Creating a ContractCall object

Squid accepts an array of ContractCall objects via its API. Below are details on how to create ContractCall objects.

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;
}

callType

target

Address of the smart contract to be called.

value

Amount of native coin, in most scenarios should be "0"

callData

Contract call encoded call data

estimatedGas

Amount of gas of the call

payload.tokenAddress

Address of the ERC20 token to get the balance when using an ERC20 in a call of callType FULL_TOKEN_BALANCE

payload.inputPos

Position of the amount argument in the contract call to set the balance dynamically.

Last updated