1

I'm trying to make a PoC (using frontier template) where I should update the balance of an EVM ERC-20. I guess that the steps should be as follows:

  1. Calculate the storage slot like this tool does: https://github.com/danforbes/substrate-evm/blob/master/utils/README.md#commands
  2. Write the EVM state
  3. Commit the State

So, knowing this, I don't know where to start for updating the EVM storage from the Substrate Runtime... and I don't find any resource talking about that.

Thanks in advance

1 Answer 1

0

If I understand correctly what you want is to update the amount of supply of your ERC20 token.

The ERC20 token: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol has two functions for that purpose:

  • mint: Creates amount tokens and assigns them to account, increasing the total supply.
  • burn: Destroys amount tokens from account, reducing the total supply.

You can call this functions via an Extrinsic in your EVM pallet. To check how to interact with an ERC20 token via extrinsics I'd suggest to take a look into the Substrate tutorial: Access EVM accounts

Your Answer

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

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