Skip to main content

Your Contract Is The Trader

  • The swap contract sees your contract as the trader, not the wallet that called it.
  • Every identity check — trader authorization, destination approvals, fee lookup, self-delivery — resolves against the calling contract's address.

Three consequences follow.

Your contract must be the authorized trader​

Authorizing the wallet that deployed it does nothing. The address we authorize has to be the contract's.

Your contract holds the input tokens and grants the allowance​

The pool pulls the input token from whoever called it. In a contract-to-contract swap that is your contract, so the tokens have to be sitting in the contract before you swap — not in your signing wallet, and not at the destination. The allowance to the pool is the contract's to grant, too.

Your contract must grant its own destination approval​

This is the one that fails silently. Approvals are keyed on the caller, so an approval granted from your owner wallet writes a record the swap never reads — the call looks correct and the swap is still refused.

See Destination override approval.

None of this removes the need for a wallet — a contract cannot start a transaction on its own. See Triggering it from outside.