const fromAddress = "0xd8da6bf26964af9d7eed9e03e53415d37aa96045";
const USDC_ADDRESS = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const AUSDC_ADDRESS = "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c";
const WETH_ADDRESS = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
const AWETH_ADDRESS = "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8";
const AAVE_V3 = "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2";
const aUsdcAmountIn = parseUnits("3000", 6).toString();
const chainId = 1;
const bundle = await client.getBundleData(
{
chainId,
fromAddress,
routingStrategy: "delegate",
},
// Switch collateral within Aave from USDC to WETH
[
{
protocol: "aave-v3",
action: "redeem",
args: {
tokenIn: AUSDC_ADDRESS,
tokenOut: USDC_ADDRESS,
amountIn: aUsdcAmountIn,
primaryAddress: AAVE_V3,
},
},
{
protocol: "enso",
action: "route",
args: {
tokenIn: USDC_ADDRESS,
tokenOut: WETH_ADDRESS,
amountIn: aUsdcAmountIn,
},
},
{
protocol: "aave-v3",
action: "deposit",
args: {
tokenIn: WETH_ADDRESS,
tokenOut: AWETH_ADDRESS,
amountIn: {useOutputOfCallAt: 1},
primaryAddress: AAVE_V3,
},
},
]
);
console.log(JSON.stringify(bundle.bundle, null, 2));
await sendSmartWallet(bundle.tx, bundle.tx);