Closed brewmaster012 closed 9 months ago
I thought about the design yesterday and few questions:
@brewmaster012
If behavior in first question as I phrased it, then just need to set state correctly for Inbound CCTX when received status from target external chain and add zetaclient logic for processing PendingRevert for TSS address and ERC20Custody so that it sends amounts correctly from CCTX.Inbound.Amount and also subtract gas fees depending on how we handle that.
- We already have PendingRevert state for CCTX and can track if Outbound part of this CCTX to external chain failed, so basically when fail was caught by ZetaClient, it's just needed to set CCTX as PendingRevert, right? Can you also pls point out to lines of code where this received Abort from external chain happens so I can correctly update handling? @aldapp7 x/crosschain/keeper/evm_deposit.go:35 This is where it's currently handled. Only non-failured case is handled; In case of failure, I believe the CCTX status will be transitioned to "Abort", but i'm not sure.
2. What about gas fees that we waste on refunds and user wasted on failed transaction? How we handle that? Also we need to basically handle it for outbound chain, ZetaChain and inbound chain.
@aldapp7 In terms of gas handling, i think for now let's let the FUNGIBLE module address pay for the revert outbound gas, out of its own ZRC20 gas balance. Later we can make the user accountable for such gas fees (if user sends in native gas, we deduct gas from the amount it sent in and return; if user sends ERC20, we do a swap ZRC20->gas ZRC20).
Closing as it seems no longer relevant with the current state of the project. Feel free to reopen it.
Currently if an external transaction triggers omnichain smart contract which fails, that's the end of story and the sender of the external transaction will lose whatever was sent to TSS address/ERC20Custody contract. The inbound CCTX is directly put into
Aborted
state.We should put the inbound CCTX into
PendingRevert
state and add logic to zetaclient to implement this revert command that refunds user's fungible tokens on external chains.