The GNairaToken project consists of two main smart contracts: GNairaToken is a custom ERC20 token with additional functionalities such as minting, burning, and blacklisting. This contract also integrates a multi-signature wallet for enhanced security of minting and burning operations. The contract is designed to follow the ERC20 standard while introducing features to manage and secure the token effectively.
-
ERC20 Standard Compliance:
- The GNairaToken adheres to the ERC20 standard, ensuring compatibility with existing wallets and exchanges.
-
Capped Supply:
- The total supply of GNairaToken is capped, preventing the creation of tokens beyond a specified limit..
- Burnable Tokens:
- Tokens can be burned (destroyed), reducing the total supply.
- Blacklisting:
- Addresses can be blacklisted to prevent them from sending or receiving tokens.
- Governor Role:
- A special role called 'Governor' is defined, which has exclusive rights to perform critical actions such as minting, burning, and managing the blacklist.
6.** Block Reward:
**
- A reward is given to miners for including transactions in blocks, promoting network participation.
- Multi-Signature Wallet Integration:
- The contract integrates with a MultiSigWallet to secure the minting and burning operations, requiring multiple approvals before these actions can be executed.
- cap: The maximum number of tokens that can ever exist.
- reward: The reward given to miners for including transactions in blocks.
- owners: An array of addresses that will own the multi-signature wallet.
*** requiredConfirmations**: The number of confirmations required for a transaction in the multi-signature wallet.
-
mintWithMultiSig
- Mints new tokens. Can only be called by the governor.
- function mintWithMultiSig(address account, uint256 amount) external onlyGovernor
- Mints new tokens. Can only be called by the governor.
-
burnWithMultiSig
- Burns tokens. Can only be called by the governor.
- function burnWithMultiSig(uint256 amount) external onlyGovernor
- Burns tokens. Can only be called by the governor.
-
setGovernor
- Sets a new governor.
- function setGovernor(address _governor) external onlyGovernor
- Sets a new governor.
-
setBlockReward
- Sets a new block reward.
- function setBlockReward(uint256 reward) public onlyGovernor
-
addToBlacklist
- Adds addresses to the blacklist.
- function addToBlacklist(address[] calldata addresses) external onlyGovernor
-
removeFromBlacklist
- Removes an address from the blacklist.
- function removeFromBlacklist(address account) external onlyGovernor
- onlyGovernor
- Restricts function access to only the governor.
- modifier onlyGovernor()
- _beforeTokenTransfer
- Overrides the _beforeTokenTransfer function to include blacklisting logic and block reward distribution.
- function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual
-
Deployment:
- Deploy the contract with the necessary parameters (cap, reward, owners, requiredConfirmations) using Remix or any other deployment tool.
-
Minting Tokens:
- The governor can mint new tokens by calling mintWithMultiSig.
-
Burning Tokens:
- The governor can burn tokens by calling burnWithMultiSig.
-
Managing the Blacklist:
- The governor can add addresses to the blacklist using addToBlacklist and remove them using removeFromBlacklist.
-
Changing the Governor:
- The current governor can appoint a new governor by calling setGovernor.
-
Setting the Block Reward:
- The governor can update the block reward by calling setBlockReward.
The multi-signature wallet ensures that minting and burning operations are secure and require multiple approvals. This reduces the risk of unauthorized token minting or burning.
-
Compile the Contract:
- Use Remix or another Solidity compiler to compile the contract.
-
Deploy the Contract:
- Deploy the contract using Remix or another deployment tool. Make sure to pass the correct constructor parameters.
-
nteract with the Contract:
- Use the deployed contract instance to interact with the functions defined in the contract. Ensure that the governor is the only one performing restricted actions.
The GNairaToken smart contract provides a secure and efficient way to manage an ERC20 token with additional functionalities like minting, burning, blacklisting, and block rewards. The integration with a multi-signature wallet ensures that critical operations are secured and require multiple approvals.
This project is licensed under the MIT License. See the LICENSE file for more details.