A burn address should be added to the smart contract, and the contract should be updated to allow for burning tokens.
Code Example
The following code snippet shows how to add a burn address to a smart contract using OpenZeppelin's Burnable contract:
import "@openzeppelin/contracts/token/ERC20/extensions/Burnable.sol";
contract MyContract is ERC20, Burnable {
address public burnAddress = address(0);
function burn(uint256 amount) public override {
require(_msgSender() != burnAddress, "Burn address cannot burn tokens");
super.burn(amount);
}
}
In this code example, the Burnable contract is imported and then inherited by the MyContract contract. The burnAddress variable is set to a hardcoded address that will act as the burn address. The burn function is overridden to disallow the burn address from burning tokens.
π― Acceptance Criteria
A burn address should be added to the smart contract using OpenZeppelin's Burnable contract.
The contract should be updated to allow for burning tokens.
The burn function should disallow the burn address from burning tokens.
π Additional Notes
The burn address should be set to an address that is not controlled by any entity.
π Issue Description
Add a burn address to a smart contract deployed on the Polygon Network, using OpenZeppelin's Burnable contract.
OpenZeppelin Libraries
The following OpenZeppelin library should be used:
Burnable: @openzeppelin/contracts/token/ERC20/extensions/Burnable.sol
Burn Address
A burn address should be added to the smart contract, and the contract should be updated to allow for burning tokens.
Code Example
The following code snippet shows how to add a burn address to a smart contract using OpenZeppelin's Burnable contract:
In this code example, the Burnable contract is imported and then inherited by the MyContract contract. The burnAddress variable is set to a hardcoded address that will act as the burn address. The burn function is overridden to disallow the burn address from burning tokens.
π― Acceptance Criteria
A burn address should be added to the smart contract using OpenZeppelin's Burnable contract. The contract should be updated to allow for burning tokens. The burn function should disallow the burn address from burning tokens.
π Additional Notes
The burn address should be set to an address that is not controlled by any entity.