Nexera-Fi SDKUsage ExamplesSupported Adapters

Aura Adapter Showcase

In this demonstration, we'll highlight the application of the Aura Adapter within the Nexera-Fi SDK for executing a token deposit operation, assuming that the strategy Orchestrator instance is already deployed and configured.
(see Deployment & Configuration Guide, Initializing Adapters)

Specifically, we will deposit 50WETH-50AURA BPT in the associated Aura pool.

Make sure you've appropriately initialized the NexeraFiSDK, covering configurations essential for further interactions.

const chainId: ChainId = 1; // Ethereum Mainnet
 
// Target Assets
// Note: Assets at play should be already whitelisted in the `Orchestrator` 
const BPT = "0xCfCA23cA9CA720B6E98E3Eb9B6aa0fFC4a5C08B9"; // Token in balance
 
// Pool Address
const POOL = "0x1204f5060bE8b716F5A62b4Df4cE32acD01a69f5"; // Aura Pool
 
// Target Adapter (i.e. AuraAdapter)
const AuraAdapter = nexeraFiSdk.getAdapters(chainId).AuraAdapter;
 
// Connect to your Orchestrator instance
// Note: `AuraAdapter` should be already whitelisted and properly initialized in the `Orchestrator`  
const orchestratorAddress = "..." // // Replace with the address of the instance you own
const Orchestrator = nexeraFiSdk.getOrchestrator(orchestratorAddress, wallet_signer);
 
// Get nonce for Tx
let nonce_ = await wallet_signer.getTransactionCount();
 
// Send BPT to Orchestrator
// (Adapters can only manage assets that are allocated to the Orchestrator)
await BptContract.connect(wallet_signer).transfer(
    Orchestrator.address,
    ethers.utils.parseEther("20"), // 20 BPT
    {nonce: nonce_}
);
 
/* ----------------------- Construct `out` token compositions and `extraData` ----------------------- */
// Tokens to send (i.e. 20 BPT)
const out = [
    { 
        token: BPT,
        amount: ethers.utils.parseEther("20")
    },
];
 
// Extra data contains extra arguments used by the function (i.e. Pool Address)
const extraData = ethers.utils.defaultAbiCoder.encode(["address"], [POOL]);
 
// Use `callStatic` to simulate the Tx and acquire what is received (asset-wise) by the Orchestrator
const totalReceived = await Orchestrator.callStatic.execute(
    [{
        adapter: AuraAdapter.address,
        op: Operation.DEPOSIT,  // `Operation` enum is exported by the NexeraFi-SDK package
        send: out,
        minReceive: [],
        extraData: extraData
    }]
);
 
nonce_ = await wallet_signer.getTransactionCount(); // Get nonce for Tx
 
// Execute Deposit action
await Orchestrator.execute(
    [{
        adapter: AuraAdapter.address,
        op: Operation.DEPOSIT,
        send: out,
        minReceive: [],
        extraData: extraData
    }],
    {nonce: nonce_}
);