Nexera-Fi SDKUsage ExamplesSupported Adapters

Nexera DEX Adapter Showcase

In this demonstration, we'll highlight the application of the Nexera DEX 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 USDT tokens into the DEX.

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

const chainId: ChainId = 42161; // Arbitrum One
 
// Target Assets
// Note: Assets at play should be already whitelisted in the `Orchestrator` 
const USDT = "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"; // Token in balance
 
// Target Adapter (i.e. NxraDEXAdapter)
const NxraDEXAdapter = nexeraFiSdk.getAdapters(chainId).NxraDEXAdapter;
 
// Connect to your Orchestrator instance
// Note: `NxraDEXAdapter` 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 USDT to Orchestrator
// (Adapters can only manage assets that are allocated to the Orchestrator)
await UsdtContract.connect(wallet_signer).transfer(
    Orchestrator.address,
    ethers.utils.parseUnits("200", 6), // 200 USDT
    {nonce: nonce_}
);
 
/* ---------------------------- Construct `out` token compositions ------------------------ */
// Tokens to send (i.e. 200 USDT)
const out = [
    { 
        token: USDT,
        amount: ethers.utils.parseUnits("200", 6)
    },
];
 
nonce_ = await wallet_signer.getTransactionCount(); // Get nonce for Tx
 
// Execute Deposit action
await Orchestrator.execute(
    [{
        adapter: NxraDEXAdapter.address,
        op: Operation.DEPOSIT,   // `Operation` enum is exported by the NexeraFi-SDK package
        send: out,
        minReceive: [],
        extraData: "0x"
    }],
    {nonce: nonce_}
);