Skip to content

API ReferenceErrorsEnumeration

RevertErrorType

Known revert errors that can occur in the system, and which should be handled gracefully. A number of contract revert errors that can occur when writing to a contract will not be represented here, as they are either in the class of errors that should be preventable by the dapp, and thus indicate a dapp coding error, or they have no graceful solve.

Remarks

Each member mirrors a Solidity custom error declared by the LetterOfCredit, CollateralVault, or PythPriceOracle contract (or OpenZeppelin’s SafeERC20). When a write or simulation reverts, the SDK decodes the revert data against those ABIs and sets TransactionRevertError.type to the matching member; a decoded error name with no member here, or a revert carrying no decodable data, becomes RevertErrorType.Unknown.

Enumeration Members

Enumeration MemberValueDescription
AddressUnauthorizedForLOC"AddressUnauthorizedForLOC"The sender is not the LOC’s creator, and the operation (extendLOC, modifyLOCCollateral) is creator-only. Beneficiary-side authorization failures surface as RevertErrorType.InvalidSignature instead; read OutstandingLetterOfCredit.creator before offering the action.
AssetPairUnauthorized"AssetPairUnauthorized"No collateral factor is configured for this (collateral token, credited token) pair, so a dynamic LOC cannot be created or have collateral released in it. Check getCollateralFactor for the pair, or list valid collateral for a credited token with getCollateralTokensForCreditedToken.
CastOverflow"CastOverflow"An amount exceeded int256.max during a signed-integer cast in the pricing math. Unreachable with realistic token amounts; indicates a corrupted or wildly out-of-range input.
ClaimableAmountZero"ClaimableAmountZero"The collateral being reserved is so small that, after the vault’s withdrawal fee (getVaultWithdrawalFeeBasisPoints) is deducted, nothing would remain claimable. Increase the collateral amount.
CollateralAmountInCreditedTokenZero"CollateralAmountInCreditedTokenZero"The LOC’s claimable collateral has zero credited-token value at the oracle price used for liquidation. Conversion cannot produce any credited tokens; refresh the price and LOC state before retrying.
ContractNotApprovedByProtocol"ContractNotApprovedByProtocol"The vault was asked to act for a “collateralizable” contract that protocol governance has not approved — the LetterOfCredit address the SDK is configured with when creating or topping up a LOC, or the target of a depositAndApprove. Almost always a stale or wrong contract address for the connected chain; verify with getContractAddress.
ConversionFundsReceivedMismatch"ConversionFundsReceivedMismatch"An external liquidator returned a credited-token amount different from the exact amount the LOC conversion required. Select another liquidator or route, or correct the liquidator parameters before retrying.
ERC20InsufficientAllowance"ERC20InsufficientAllowance"A direct ERC-20 transferFrom moved more than the spender’s approved allowance. Unlike RevertErrorType.SafeERC20FailedOperation (the protocol’s own wrapped call), this fires on a wallet-initiated token operation — approving ANVL for a third party, for example. Check the current allowance with getERC20Allowance and approve a sufficient amount before retrying.
ERC20InsufficientBalance"ERC20InsufficientBalance"A direct ERC-20 transfer or transferFrom moved more than the sender’s balance — the commonest failure on any token. Unlike RevertErrorType.SafeERC20FailedOperation (the protocol’s own wrapped call), this fires on a wallet-initiated token operation, such as transferring ANVL directly. Check the current balance with getAccountTokenBalance before retrying.
ERC20InvalidReceiver"ERC20InvalidReceiver"A direct ERC-20 transfer or transferFrom named the zero address as its receiver. Supply a real destination address.
GlobalCreditedTokenMaxInUseExceeded"GlobalCreditedTokenMaxInUseExceeded"Creating this dynamic LOC would push the total credited amount outstanding across all dynamic LOCs in this credited token above the protocol-wide cap. Compare CreditedToken.globalAmountInDynamicUse plus the requested amount against CreditedToken.globalMaxInDynamicUse via getCreditedToken; the only remedy is a smaller amount or waiting for usage to fall.
InsufficientAllowance"InsufficientAllowance"The vault allowance the account granted the LetterOfCredit contract for this collateral token is smaller than the collateral the operation reserves. Attach a fresh signed allowance (locAllowanceSignature) or let the workflow builders request one; each reservation decreases the allowance, so it is consumed rather than merely checked.
InsufficientCollateral"InsufficientCollateral"Raised in three places: the vault account’s available (unreserved) balance is smaller than the collateral to reserve; a collateral release would remove all or more than all of a LOC’s collateral; or, for a dynamic LOC, the collateral remaining after a release would exceed the creation collateral factor at the current price. Deposit more, release less, or check getRequiredCollateralForDynamicLOC first.
InsufficientFee"InsufficientFee"The ETH sent with a Pyth price update (msg.value) is less than the fee Pyth charges for that update payload. Quote the fee with getOraclePriceUpdateFee for the same update bytes and attach it as the transaction value; excess is refunded.
InvalidLOCExtensionTimestamp"InvalidLOCExtensionTimestamp"extendLOC was given a new expiration that is not strictly later than the LOC’s current expiration. Extensions can only move expiration forward.
InvalidLOCParameters"InvalidLOCParameters"createDynamicLOC was called with the same token as both collateral and credited token. A same-token LOC is a static LOC; use the static creation path.
InvalidNonce"InvalidNonce"A nonce invalidation target is older than the account’s current nonce.
InvalidRedeemAmount"InvalidRedeemAmount"The credited amount to redeem is 0 or exceeds what remains on the LOC. Read the current OutstandingLetterOfCredit.remainingCredited (it shrinks after partial redemptions) and redeem at most that.
InvalidSignature"InvalidSignature"An EIP-712 authorization did not verify against the expected signer: a beneficiary cancel/redeem authorization that does not match the LOC’s beneficiary, or a vault allowance signature that does not match the depositing account (wrong signer, chain, or nonce, or already used). Have the correct account re-sign against the current nonce.
InvalidTargetAddress"InvalidTargetAddress"A vault withdrawal or claim named the zero address as its destination. Supply a real destination address.
InvalidZeroAddress"InvalidZeroAddress"A redemption named the zero address as its destination. Supply the address that should receive the credited tokens.
InvalidZeroAmount"InvalidZeroAmount"A vault withdraw was called with an amount of 0. Validate the amount client-side (validateTokenAmount) before sending.
LiquidationAmountTooSmall"LiquidationAmountTooSmall"Integer flooring reduced either the collateral payout or credited-token return to zero. The LOC cannot be converted at this amount and price.
LiquidatorIncentiveChanged"LiquidatorIncentiveChanged"Legacy: pre-V3 extendLOC reverted if the asset pair’s liquidator incentive had risen since the LOC was created. Since V3 collateral factors are global and this is no longer checked, so a current LetterOfCredit never emits it; retained for decoding receipts from older deployments.
LOCAlreadyConverted"LOCAlreadyConverted"The LOC’s collateral has already been converted (liquidated) into the credited token, so collateral can no longer be modified and it cannot be converted again. Redemption and cancellation still work.
LOCCreditedTokenMaxExceeded"LOCCreditedTokenMaxExceeded"The credited amount of a new dynamic LOC exceeds CreditedToken.maxPerDynamicLOC for that token. Read the bound with getCreditedToken and cap the input.
LOCCreditedTokenUnderMinimum"LOCCreditedTokenUnderMinimum"The credited amount of a new dynamic LOC is below CreditedToken.minPerDynamicLOC for that token. Read the bound with getCreditedToken.
LOCExpired"LOCExpired"The LOC’s expiration is at or before the current block timestamp, so it can no longer be redeemed, extended, converted, or have its collateral modified — only cancelled. Also raised at creation (with LOC id 0) when the requested expiration is already in the past.
LOCHealthy"LOCHealthy"convertLOC was called before the dynamic LOC reached the current pair’s liquidation threshold. V3 rejects every caller, including the creator.
LOCNotFound"LOCNotFound"No live LOC has this ID: it never existed, or it was cancelled or fully redeemed, which deletes it from contract storage. Re-query with getOutstandingLetterOfCredit and treat a miss as terminal.
MaxLOCDurationExceeded"MaxLOCDurationExceeded"The requested expiration is more than the contract’s maximum LOC duration after the current block timestamp, on creation or on extension. Read the cap with getMaxLOCDuration (seconds) or getMaxLOCDate.
MulticallCallFailed"MulticallCallFailed"Multicall3 reverted an atomic batch because at least one inner call failed. Multicall3 does not bubble the inner revert bytes, so callers must refresh the affected records and authorizations before retrying.
NoOp"NoOp"modifyLOCCollateral was called with a byAmount of 0. Guard the input; a zero change is rejected rather than silently succeeding.
PriceUpdateStale"PriceUpdateStale"The oracle price the transaction would use was published more than the deployment’s maxPriceUpdateSecondsAgo (getMaxLOCPriceUpdateSecondsAgo) before the block timestamp. Fetch a fresh Pyth update with getOraclePriceUpdate immediately before sending and pass it as the operation’s price update.
RelatedArraysLengthMismatch"RelatedArraysLengthMismatch"Two parallel arrays (token addresses vs. amounts, or token addresses vs. price-feed IDs) were passed with different lengths. A caller bug in hand-built batch calls; the SDK’s builders never produce it.
SafeERC20FailedOperation"SafeERC20FailedOperation"An ERC-20 call the protocol made on the sender’s behalf — usually the vault’s transferFrom during a deposit — returned false or reverted. In practice the wallet has not approved the CollateralVault for the deposit amount, or its token balance is short; check with getERC20Allowance before depositing.
SimultaneousUseLimitExceeded"SimultaneousUseLimitExceeded"A single call attempted to invalidate more than the contract’s bound.
TokenNotAllowed"TokenNotAllowed"The token is not enabled as vault collateral — never listed, or disabled by governance — so it cannot be deposited or reserved (existing reservations may still be released). List enabled tokens with getCollateralTokens and read CollateralToken.enabled.
Unauthorized"Unauthorized"A vault function reserved for the collateralizable contract that owns a reservation (modifyCollateralReservation, claimCollateral, depositFromAccount, …) was called by some other address. Integrators only see this when calling the CollateralVault directly instead of going through the LetterOfCredit contract; the SDK’s workflows do not produce it.
Unknown"Unknown"The transaction reverted with data the SDK could not map to a member of this enum: a protocol error that is not enumerated (for example the contract’s InvalidCollateralFactor or TagTooLong), a revert from a contract outside the Anvil ABIs, or an opaque revert with no data. Inspect TransactionRevertError’s cause for the raw error and its decoded name when present.