Icon LinkRevert

use fuel_types::ContractId;
pub struct Revert {
    pub contract_id: ContractId,
    pub error_val: u64,
	}
  • A Revert receipt is produced when a Sway smart contract function call fails.
  • The table below lists possible reasons for the failure and their values.
  • The error_val field records these values, enabling your indexer to identify the specific cause of the reversion.
ReasonValue
FailedRequire0
FailedTransferToAddress1
FailedSendMessage2
FailedAssertEq3
FailedAssert4

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
}

Was this page helpful?