Skip to main content

Use contract-interaction flows

Use contract-interaction flows when an Ethereum Virtual Machine (EVM) wallet should deposit native ETH or approve and deposit ERC-20 funds through the SDK. The supported pool assets are ETH, USDC, and USDT on Ethereum.

Requirements

Contract-interaction flows have the following requirements:

RequirementWhy
evmRpcUrl or evmPublicClientRequired for USDC and USDT allowance and balance reads, but native ETH does not require an EVM read client
Wallet adapter with sendEthTransactionThe SDK asks the wallet to broadcast approval and deposit transactions
Token base-unit amountThe SDK sends protocol amounts as integers

The SDK rejects deposits below the asset product minimum before reading ERC-20 state or asking the wallet to broadcast:

AssetMinimum deposit
ETH5_000_000_000_000_000n wei (0.005 ETH)
USDC1_000_000n base units (1 USDC)
USDT1_000_000n base units (1 USDT)

Use getMinimumDepositAmount(asset) to read the same minimum. Repayments are not subject to deposit minimums.

Supply funds

Call client.lending.supply(...) with the contract-interaction mechanism:

import { Chain } from "@liquidium/client";

const supplyFlow = await client.lending.supply({
mechanism: "contractInteraction",
profileId,
poolId,
action: "deposit",
chain: Chain.ETH,
walletAdapter,
account: evmAddress,
amount,
});

console.log("Deposit txid", supplyFlow.txid);

For native ETH, the SDK calls the payable deposit helper with amount as transaction value. For USDC and USDT, it handles the required allowance before calling the helper. Simple Loans return transfer targets instead and do not use this mechanism.