Hi,
Here is my simple contract:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Test1 {
string public name = "test1";
string public symbol = "TEST1";
uint256 public totalSupply = 1000 * 10**18; // 1000 tokens with 18 decimal places
uint8 public decimals = 18;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
address public deadWallet = 0x000000000000000000000000000000000000dEaD;
event Transfer(address indexed from, address indexed to, uint256 value);
constructor() {
balanceOf[msg.sender] = totalSupply;
}
function transfer(address _to, uint256 _value) external returns (bool success) {
require(_to != address(0), "Invalid address");
require(_value <= balanceOf[msg.sender], "Insufficient balance");
uint256 burnAmount = (_value * 5) / 100; // 5% burn for buys
uint256 transferAmount = _value - burnAmount;
balanceOf[msg.sender] -= _value;
balanceOf[_to] += transferAmount;
balanceOf[deadWallet] += burnAmount;
emit Transfer(msg.sender, _to, transferAmount);
emit Transfer(msg.sender, deadWallet, burnAmount);
return true;
}
function approve(address _spender, uint256 _value) external returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success) {
require(_from != address(0), "Invalid address");
require(_to != address(0), "Invalid address");
require(_value <= balanceOf[_from], "Insufficient balance");
require(_value <= allowance[_from][msg.sender], "Allowance exceeded");
uint256 burnAmount = (_value * 5) / 100; // 5% burn for sells
uint256 transferAmount = _value - burnAmount;
balanceOf[_from] -= _value;
balanceOf[_to] += transferAmount;
balanceOf[deadWallet] += burnAmount;
allowance[_from][msg.sender] -= _value;
emit Transfer(_from, _to, transferAmount);
emit Transfer(_from, deadWallet, burnAmount);
return true;
}
}
Whenever I deploy and test it out, the dex completely ignores the burn/sending 5% to deadwallet and just transfers the whole lot. Im assuming at this point I need to import some openzepplin and change something? Please help me!