-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write a int token Minting contract where the transfer function is restricted to council members(Multisig aggregator contract ) and the burn function is restricted to the burning contract #17
Comments
|
pragma solidity ^0.8.16;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract INT is ERC20 {
address public weuFoundation;
mapping(address => bool) public weuFoundationMember;
address public BurningAddress;
address public Owner;
constructor() ERC20("INT Token", "INPUT") {
Owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == Owner, "Only WEU Foundation can perform this action");
_;
}
modifier onlyBurning(){
require(msg.sender == BurningAddress,"Only burning address can perform this action");
_;
}
function addCouncilMember(address councilMember) external onlyOwner {
require(councilMember != address(0), "Council member address should not be equal to the zero address");
weuFoundationMember[councilMember] = true;
}
function mint(address account, uint256 amount) external {
require(msg.sender == weuFoundation,"the caller needs to be from WeuFoundation");
require(account != address(0),"The account address should not be equal to zero address");
_mint(account, amount);
}
function ChangeWeuFoundationaddress(address _weuFoundation)external onlyOwner{
require(_weuFoundation != address(0),"The Weu foundation address should not be equal to zero address");
weuFoundation = _weuFoundation;
}
function changeBurningAddress(address _burningAddress)external onlyOwner{
require(_burningAddress != address(0),"The Burning address should not be equal to zero address");
BurningAddress = _burningAddress;
}
function burn(uint256 amount) external onlyBurning {
_burn(msg.sender, amount);
}
function transfer(address to,uint256 value)public override virtual returns(bool)
{
require(weuFoundationMember[to], "Transfer is restricted to council members");
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
function transferFrom(address _from,address _to,uint256 value)public override virtual returns(bool)
{
require(msg.sender == weuFoundation || msg.sender == BurningAddress,"the caller needs to be from WeuFoundation or the burning Contract");
address spender = _msgSender();
_spendAllowance(_from, spender, value);
_transfer(_from, _to, value);
return true;
}
function approve(address spender,uint256 value)public override virtual returns(bool)
{
require(msg.sender == weuFoundation || spender == BurningAddress,"the caller needs to be from WeuFoundation or the to address needs to be the burning address");
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
}
I have added two functions Add council Member function addCouncilMember(address councilMember) external onlyOwner {
require(councilMember != address(0), "Council member address should not be equal to the zero address");
weuFoundationMember[councilMember] = true;
} Did some modification my adding mapping in transfer function function transfer(address to,uint256 value)public override virtual returns(bool)
{
require(weuFoundationMember[to], "Transfer is restricted to council members");
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
``` |
// SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract INT is ERC20, AccessControl {
} |
pragma solidity ^0.8.16; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract INT is ERC20 {
} |
// SPDX-License-Identifier: MIT import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract INT is ERC20 {
} |
@YashPandey59 @shivasai780 @vinaykumar0103 @sscodez @123456788940
The text was updated successfully, but these errors were encountered: