I need a tax function for an ERC20 token
Budget: $30 – $250 USD
Hi! I need a simple tax function to be added in the code to create a 5 percent tax that is sent to my wallet, preferably a hook added to the contract, you can see here what I'm talking about https://docs.openzeppelin.com/contracts/4.x/extending-contracts.
Here is all the code I need minus the tax function I can't make but I hope is very simple for a good programmer. I want the tax to be taken every time someone buys tokens from an exchange and when is making a payment
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract TestNet is Initializable, ERC20Upgradeable, ERC20PermitUpgradeable, ERC20VotesUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC20_init("TestNet", "TNET");
__ERC20Permit_init("TestNet");
_mint(msg.sender, 1000000 * 10 ** decimals());
}
// The following functions are overrides required by Solidity.
function _afterTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._afterTokenTransfer(from, to, amount);
}
function _mint(address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._mint(to, amount);
}
function _burn(address account, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._burn(account, amount);
}
}
I have an example if this may help you, but this is an ugly code with too many useless functions, I only want the development tax function.
https://drive.google.com/file/d/1vPRJbxmcm8JfLNFb0u5TdHpb5UGM9tFj/view
I'm not sure if I will deploy this contract but if I do it and is successful I will send you a nice reward on top of the payment from freelancer.
Here is all the code I need minus the tax function I can't make but I hope is very simple for a good programmer. I want the tax to be taken every time someone buys tokens from an exchange and when is making a payment
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20VotesUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract TestNet is Initializable, ERC20Upgradeable, ERC20PermitUpgradeable, ERC20VotesUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC20_init("TestNet", "TNET");
__ERC20Permit_init("TestNet");
_mint(msg.sender, 1000000 * 10 ** decimals());
}
// The following functions are overrides required by Solidity.
function _afterTokenTransfer(address from, address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._afterTokenTransfer(from, to, amount);
}
function _mint(address to, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._mint(to, amount);
}
function _burn(address account, uint256 amount)
internal
override(ERC20Upgradeable, ERC20VotesUpgradeable)
{
super._burn(account, amount);
}
}
I have an example if this may help you, but this is an ugly code with too many useless functions, I only want the development tax function.
https://drive.google.com/file/d/1vPRJbxmcm8JfLNFb0u5TdHpb5UGM9tFj/view
I'm not sure if I will deploy this contract but if I do it and is successful I will send you a nice reward on top of the payment from freelancer.