const result = await smartWalletClient.execute({
payment: sponsored(),
calls: [
// 1. Initialize the vault with pool parameters
{
to: vaultManager,
data: encodeFunctionData({
abi: vaultManagerAbi,
functionName: "initialize",
args: [
init0, // Initial amount for token0
init1, // Initial amount for token1
isInversed, // Pool direction
poolKey, // Pool configuration
oracle, // Oracle wrapper address
maxSlippage, // Maximum slippage tolerance
metaVault // Meta vault address
]
}),
value: 0n
},
// 2. Set the pool configuration and liquidity ranges
{
to: vaultManager,
data: encodeFunctionData({
abi: vaultManagerAbi,
functionName: "setPool",
args: [
poolKey, // Pool key configuration
liquidityRanges, // Liquidity range parameters
swapPayload, // Swap configuration
minBurn0, // Minimum burn amount for token0
minBurn1, // Minimum burn amount for token1
minDeposit0, // Minimum deposit amount for token0
minDeposit1 // Minimum deposit amount for token1
]
}),
value: 0n
},
// 3. Execute rebalance to deposit liquidity
{
to: vaultManager,
data: encodeFunctionData({
abi: vaultManagerAbi,
functionName: "rebalance",
args: [
liquidityRanges, // Liquidity range parameters
swapPayload, // Swap configuration
minBurn0, // Minimum burn amount for token0
minBurn1, // Minimum burn amount for token1
minDeposit0, // Minimum deposit amount for token0
minDeposit1 // Minimum deposit amount for token1
]
}),
value: 0n
}
]
});