import { createComposeSdk, guards, materialisers, preconditions, resources } from '@lifi/composer-sdk';
const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
// Aave v3 aEthUSDC receipt token on Ethereum mainnet
const A_ETH_USDC = '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c';
// Your execution proxy: `userProxy` on any earlier compile result for this signer.
const PROXY = '0xYourExecutionProxy';
const sdk = createComposeSdk({
baseUrl: 'https://composer.li.quest',
apiKey: process.env.LIFI_API_KEY!,
});
const builder = sdk.flow(1, {
name: 'deposit-from-proxy',
inputs: { amountIn: resources.erc20(USDC, 1) },
});
builder.lifi.zap('deposit', {
bind: { amountIn: builder.inputs.amountIn },
config: { resourceOut: resources.erc20(A_ETH_USDC, 1) },
guards: [guards.slippage({ port: 'amountOut', bps: 100 })],
});
await builder.compile({
signer: '0xYourSignerAddress',
inputs: {
// Spend whatever USDC the proxy holds when the transaction executes.
amountIn: materialisers.balanceOf({ owner: PROXY }),
},
// Simulate as if 1,000 USDC is on the proxy.
preconditions: [
preconditions.erc20Balance({ wallet: PROXY, token: USDC, balance: '1000000000' }),
],
sweepTo: builder.context.sender,
});