Skip to Content

SDK Params

fillOrKillParams

The fillOrKillParams object sets two different types of slippage protection when initiating a swap.

  1. minimum accepted price This protects the swapper against price changes between a quote and the execution of a swap by setting a minimum accepted price. If the minimum price cannot be met with the available liquidity during the specified number of blocks, deposited assets will be refunded to the specified refund address.
  2. live price protection This protects the swapper from getting an execution price that significantly deviates from the global index price of the asset (as determined by an oracle) ensuring the LPs are offering competitive pricing. Similar to other slippage settings, the execution of the swap will be paused until an LP offers a price that is within the specified deviation or the swap deadline is reached - in which case the swap will be refunded. This setting is especially useful during longer DCA swaps where the price of the asset is moving in favor of the swapper. i.e the slippage tolerance will “follow” the global price of the asset. In case the price moves against the swapper, it will still execute as long as the execution price is above the minimum accepted price.
ParamDescriptionData type
slippageTolerancePercentThe percent of slippage that is acceptable for the swap. The estimatedPrice field from the quote is used to calculate the minimum price for the channel. This field must be left out when specifying a minPrice.string
minPriceMinimum accepted price for swaps triggered through the deposit channel. This field must be left out when specifying a slippageTolerancePercent.string
livePriceSlippageTolerancePercent (optional)The percentage deviation from the global index price that is acceptable for the swap to execute. If the deviation exceeds, the swap will be refunded to the specified refund address. If not set, protocol defaults will be used. (if available for the asset pair)string
refundAddressAddress on the source chain to which the refund will be sent, if the minimum price cannot be met.string
retryDurationBlocksNumber of State Chain blocks after which a deposit is refunded, if the minimum price cannot be met. One State Chain block corresponds to 6 seconds.number

Slippage tolerance is applied relative to the quoted price unlike live price slippage which is applied relative to the global index price. Prices are checked on the AMM level and do not include deposit or broadcast fees.

Live price slippage protection is only available for asset pairs that have a recommendedLivePriceSlippageTolerancePercent in the quote and this execution does NOT need to account for protocol or broker fees.

Example

const fillOrKillParams = { refundAddress: "0xa56A6be23b6Cf39D9448FF6e897C29c41c8fbDFF", // address to which assets are refunded retryDurationBlocks: 100, // 100 blocks * 6 seconds = 10 minutes before deposits are refunded slippageTolerancePercent: quote.recommendedSlippageTolerancePercent, // use recommended slippage tolerance from quote livePriceSlippageTolerancePercent: quote.recommendedLivePriceSlippageTolerancePercent, // use recommended live price slippage tolerance from quote };

ccmParams

The Cross-Chain Messaging optional ccmParams object enables to pass a Cross-Chain Message to a receiver contract/program on the destination chain.

ParamDescriptionData type
message (required)Message (bytes) that is passed to the destination address on the destination chain.string
gasBudget (required)Gas budget for the call on the destination chain. This amount is the amount of gas or compute units required by the user logic on the destination chain.number
ccmAdditionalData (optional)Additional bytes required for the CCM call on the destination chain. This is required for Solana to pass the accounts that are required for the call.string

Example

const ccmParams = { message: "0xdeadc0de", gasBudget: 250_000, };
Last updated on