0

I want to burn the token from a different contract, I know I would have to use an external burn function but can someone help me with some piece of code.

1
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
    – Community Bot
    Feb 7 at 14:16

1 Answer 1

0

You first create an interface of the ERC-20 contract and create an instance of it with the address of the token contract. You can then call the burn function on it.

interface IERC721{
    function burn(uint256);
}

contract BurnStuff {
    
    address _token;

    constructor(address token){
        _token = token;
    }
        
    function burnToken(uint256 _tokenId) public {
        IERC721(_token).burn(_tokenId)
    }
}
2
  • Bro I wanted to know about ERC721 Feb 7 at 5:54
  • 1
    Sorry, by bad. But if you had taken a look at ERC721 contract, you'll know what to do here. You just need to change _amount to _tokenId.
    – pbsh
    Feb 7 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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