Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add onAbort interface #450

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions contracts/Revert.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,38 @@ struct RevertContext {
bytes revertMessage;
}

/// @notice Struct containing abort context passed to onAbort.
/// @param sender Address of account that initiated smart contract call.
/// bytes is used as the crosschain transaction can be initiated from a non-EVM chain.
/// @param asset Address of asset. On a connected chain, it contains the fungible
/// token address or is empty if it's a gas token. On ZetaChain, it contains the
/// address of the ZRC20.
/// @param amount Amount specified with the transaction.
/// @param outgoing Flag to indicate if the crosschain transaction was outgoing: from ZetaChain to connected chain.
lumtis marked this conversation as resolved.
Show resolved Hide resolved
/// if false, the transaction was incoming: from connected chain to ZetaChain.
/// @param chainID Chain ID of the connected chain.
/// @param revertMessage Arbitrary data specified in the revert options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add more details about revert options?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it helps more fadc2ff but this is just the same value used for the revert workflow

struct AbortContext {
bytes sender;
address asset;
uint256 amount;
bool outgoing;
fadeev marked this conversation as resolved.
Show resolved Hide resolved
uint256 chainID;
bytes revertMessage;
}

/// @title Revertable
/// @notice Interface for contracts that support revertable calls.
interface Revertable {
/// @notice Called when a revertable call is made.
/// @param revertContext Revert context to pass to onRevert.
function onRevert(RevertContext calldata revertContext) external;
}

/// @title Abortable
/// @notice Interface for contracts that support abortable calls.
interface Abortable {
/// @notice Called when a revertable call is aborted.
/// @param abortContext Abort context to pass to onAbort.
function onAbort(AbortContext calldata abortContext) external;
}
Loading