Build a post-hook

After the swap or bridge is executed, the resulting tokens will be left on the Squid Multicall contract. From there the postHooks calls will be executed.

// Create contract interface and encode delegate (Fantom staking) function
const stakingContractInterface = new ethers.utils.Interface(stakingContractAbi);
const delegateEncodedData = stakingContractInterface.encodeFunctionData('delegate', [amountToSwap]);

const postHooks = [
	{
		callType: 1, // SquidCallType.FULL_TOKEN_BALANCE
		target: stakingContractAddress,
		value: '0',
		callData: stakingEncodedData,
		payload: {
			tokenAddress: ethereumUsdc,
			inputPos: 0,
		},
		estimatedGas: '50000',
	},
]

Last updated