use fuel_types::ContractId;
pub struct Revert {
pub contract_id: ContractId,
pub error_val: u64,
}
Revert
receipt is produced when a Sway smart contract function call fails. error_val
field records these values, enabling your indexer to identify the specific cause of the reversion. Reason | Value |
---|---|
FailedRequire | 0 |
FailedTransferToAddress | 1 |
FailedSendMessage | 2 |
FailedAssertEq | 3 |
FailedAssert | 4 |
You can handle functions that could produce a Revert
receipt by adding a parameter with the type Revert
.
fn handle_revert(revert: Revert) {
// handle the emitted Revert receipt
}