zeta-chain / protocol-contracts

Protocol contracts implementing the core logic of the protocol, deployed on ZetaChain and on connected chains
MIT License
70 stars 58 forks source link

Add `address asset` and `uint256 amount` in the `MessageContext` on connected chain #426

Open lumtis opened 2 weeks ago

lumtis commented 2 weeks ago

The onCall hook on connected chains has the following object:

struct MessageContext {
    address sender;
}

Amount passed of Ether can be obtained with msg.value but for ERC20 there is no such information, unless it is added manually in the message, but this is an overhead for the developers that shouldn't be necessary We should add information such as amount and asset to the context:

struct MessageContext {
    address sender;
    address asset;
    uint256 amount;
}
fadeev commented 5 days ago

This is very important! It's possible to add amount to the message, but I don't know if it possible to add the asset address, I don't think there is a mapping on ZetaChain where you can get underlying asset address from ZRC-20.