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

Create a RevertContext to pass to `onRevert` #310

Closed lumtis closed 3 months ago

lumtis commented 3 months ago

After some experimentation, we would need a revertContext object to correctly handle a revert.

The following format should address any use case

revertContext:
  address asset -> address of the asset (empty is gas token)
  uint64 amount
  bytes revertMessage -> an arbitrary message that can be set during the initiation of a CCTX, this allow the contract to handle custom revert logic with context from the initial inbound (like for example setting the address of the user that should be refunded for a smart contract to handle onRevert)

Other change to consider: