node icon indicating copy to clipboard operation
node copied to clipboard

Add ability to handle on ZetaChain assets issued from connected chain calls

Open lumtis opened this issue 1 year ago • 0 comments

This feature idea is an extension of https://github.com/zeta-chain/node/issues/2736 would reuse lot of the components and therefore would depend on it.

Is your feature request related to a problem? Please describe.

https://github.com/zeta-chain/node/issues/2736 adds the ability to react to the result of a smart contract call which is the returned data of the smart contract.

Many dapp, DeFi applications have side effects outside of returned values, where assets are issued for example.

This idea is about giving the ability to handle assets issued from arbitrary smart contract calls, and fully enable the vision of chain abstraction.

Example: You perform a Uniswap swap, the receive tokens will be issued on an address on Ethereum. In the current model, these tokens will remains on Ethereum, even with a CCTX supported to abstract chain usage, interactions from Ethrereum will still be necessary to use the tokens.

This feature allows to tells the CCTX to claim back the exchanged tokens into ZetaChain and process those here.

Example of what it can enable: the user can initiate from Polygon a swap on Ethereum Uniswap and receive PEPE, the PEPE are withdrawn back to Polygon (let's say with support multichain ZRC20s here)

Describe the solution you'd like

Extend mainly the interface introduced in https://github.com/zeta-chain/node/issues/2736

One idea is to extend the ResultOptions to tells which asset to watch for for issued asset

ResultOptions{
    address resultReceiver; // will receive the asset back on ZetaChain
    bool callOnResult; // eventually we just want to receive the asset and not perform any calls
    address[] assetsToWatch; // in this example will describe a list of ERC20 to wathc for issued assets
}

The Gateway contracts check the different of ERC20 balance in the smart contract call, emit in the event the asset that have been issued to its address, and send the asset to the ERC20 custody contract (if whitelisted)

In the onResult hook, a Result object contains the list of asset with amount issued.

lumtis avatar Aug 20 '24 10:08 lumtis