0

I am learning Solidity . Currrently I am learning about ERC token standards . I want to write a smart contract in which it is possible for "msg.sender" who is calling the mint() function to be able to burn those tokens which he is minting for "to" . Is there any ERC standard to achieve this functionality ?

Suppose Bob is the owner of contract , Henry is calling the mint function and minting the tokens to address of Alice . I want Henry to be able to burn those tokens that he minted to the address of Alice .

Also , by default who except the token owner has authority to burn his tokens ? In the above example , who except Alice ( owner of tokens ) can burn the tokens ( without being the owner of the token ) ?

3 Answers 3

0

I don't think this can be a standard, since it disrupts the core feature of blockchain, ie, the removal of a central authority. If you give that right to anyone other than the token owner, it will be a centralized system like a bank that controls your money.

ALthough, you can write your own code and change the standard approach.

0

Usually burning tokens are done by sending them to null address, 0x00000...

have an additional hash map(address -> tokenIndex) on top of ERC standard and check if the address can burn a particular token.

0

The standard of burning Tokens is just transferring the tokens to the 0x00 address

Assuming that you are using Openzeppelin contracts:

There isn't anyone who can burn tokens but the owner unless the owner has added an extra EOA or Contract as operator of your tokens;

Ie. When you sell your nfts in Opensea, before listing you set Opensea's Seaport Marketplace contract as operator of your tokens; then if someone buys your nft, Seaport can transfer the token from your wallet to someone else's wallet after the buyer pays.

being said this:

There are 2 ways where Wallet A (Henry) can burn the tokens of Wallet B (Alice)

  1. Alice calls approveForAll() and adds the operator flag to Henry, then Henry can call the burn() function

  2. You modify the contract to allow henry burn alice's tokens:

    2.1.- on smartcontract level, remove the ownership requirement to burn tokens

    2.2.- add some security steps to control who can burn or not

Note regarding number 2.- (Its unsafe and risky and I don't recommend it)

If you where to do it this way, you need to take security measures and protect your burn function; You might want to implement Ownable.sol and add a modifier to your function "only owner" so no-one but the deployer of the contract can call the burn function; you can also implement Access control contract to control who can burn

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.