0

I am using the openzeppelin library and importing the StandardBurnableToken.sol logic into MyContract.sol

here is a code

pragma solidity ^0.4.17;

import "/openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
import "/openzeppelin-solidity/contracts/token/ERC20/StandardBurnableToken.sol";

 contract MyToken is StandardToken {
  string public name = 'Membership Token';
  string public symbol = 'MTKO';
  uint8 public decimal = 18;
  uint public INITIAL_SUPPLY = 1000000;

 constructor() public {
  totalSupply_ = INITIAL_SUPPLY;
  balances[msg.sender] = INITIAL_SUPPLY;
 }
}

Do I need to add another function in MyToken.sol to be able to call the burnFrom() function? or is that once the logic is in the ABI it can send tokens to 0x0 addresses?

1 Answer 1

1

StandardBurnableToken.sol already contains references to StandardToken.sol and BurnableToken.sol, so all you need to do is:

pragma solidity ^0.4.17;

import "/openzeppelin-solidity/contracts/token/ERC20/StandardBurnableToken.sol";

contract MyToken is StandardBurnableToken {
     ...
}

By doing this, your contract will automatically obtain the burnFrom() function, as well as anything from StandardToken. You will not need to write any code for this, as it is already included.

5
  • Awesome thank you. Then once the contract is deployed how do I send an amount to a dead wallet(0x0) or actually burn a set value?
    – JBliss
    Nov 13, 2018 at 1:53
  • You need to call the burnFrom() function. Possibly through Web3.js or some other API. Nov 13, 2018 at 7:42
  • I did find that the MEW wallet has a built function to call the burn() medium.com/@hodl50/how-to-burn-tokens-with-mew-bbf279a09798 However there is nothing in the RPC docs or Web3 calls that invoke burnFrom() function
    – JBliss
    Nov 14, 2018 at 23:39
  • You need to call a custom contract method: web3js.readthedocs.io/en/1.0/web3-eth-contract.html#id12 Nov 14, 2018 at 23:44
  • This is probably not the right place to have this discussion. Calling custom contracts functions using Web3.js is a pretty well documented thing. It is basically what every website that interacts with smart contracts does. I recommend you do a bit of research, and if all else fails, open a new question. Nov 15, 2018 at 0:18

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.