Contract call types

Squid supports multiple call types, which allow you to make contract calls using the exact amount of tokens received from swaps executed via Squid, or from previous calls which the integrator has made, like staking tokens and receiving an LP token.

These call types can be set using the callType parameter.

callType can have the following values:

callTypeDescription

DEFAULT

Executes the call as it is without any modifications

FULL_TOKEN_BALANCE

Gets the balance of an ERC20 token and sets it the the correct position in the encoded calldata data, payload must be provided with tokenAddress and inputPos

FULL_NATIVE_BALANCE

Uses the full balance of the contract in native tokens in the transaction.

COLLECT_TOKEN_BALANCE

For internal use only by Squid when interacting with Axelar. Integrators can ignore.

- target address of the smart contract to be called. - value amount of native coin, in most scenarios should be "0" . - callData contract call encoded data. - estimatedGas amount of gas of the call. - payload.tokenAddress address of the token to get the balance. - payload.inputPos position of the amount argument in the contract call to set the balance dynamically.

enum SquidCallType {
  DEFAULT = 0,
  FULL_TOKEN_BALANCE = 1,
  FULL_NATIVE_BALANCE = 2,
  COLLECT_TOKEN_BALANCE = 3,
}

type ContractCall = {
  callType: SquidCallType;
  target: string;
  value?: string;
  callData: string;
  payload?: {
    tokenAddress: string;
    inputPos: number;
  };
  estimatedGas: string;
}

Last updated