LayerHopDocsLaunch app (opens in a new tab)

CALLS_REVERTED

Destination calls would revert: The destination calls of a quote failed their mandatory simulation, so no quote was returned.

HTTP status Retry
400 no

Where it comes from: POST /v1/quote with calls or action (destination calls).

Causes#

  • A call reverts when run from the provider's executor with exactly dstAmount of the output token, for example it spends more than dstAmount or misses the ERC-20 approve call before it.
  • The target contract rejects calls from the executor (it checks msg.sender, is paused, or a supply cap is reached).
  • The calldata is for another chain or another contract version.

How to fix#

  • Read the message: it names the failing call index, its target and the decoded revert reason.
  • For ERC-20 outputs put approve(target, dstAmount) on the output token before the call that spends it, and spend at most dstAmount.
  • Make the target credit recipient from a parameter, never msg.sender (see Destination calls).

Example response#

JSON
{
  "error": {
    "code": "CALLS_REVERTED",
    "message": "{\n  \"error\": {\n    \"code\": \"CALLS_REVERTED\",\n    \"message\": \"Destination call 1 (to 0x794a61358d6845594f94dc1db02a252b5b4814ad) would revert: Error(ERC20: transfer amount exceeds balance)\",\n    \"requestId\": \"0d5e1f6a-…\",\n    \"docsUrl\": \"https://docs.layerhop.com/errors/CALLS_REVERTED\"\n  }\n}",
    "requestId": "0d5e1f6a-3b2c-4d1e-8f9a-7b6c5d4e3f21",
    "docsUrl": "https://docs.layerhop.com/errors/CALLS_REVERTED"
  }
}

See Error handling & retries for a retry strategy, and the error catalog for every code.

Last updated