Deposits
Approve the vault
await walletClient.writeContract({
address: underlyingToken,
abi: erc20Abi,
functionName: 'approve',
args: [vault, amount],
})Deposit
const vaultAbi = [{
type: 'function', stateMutability: 'nonpayable', name: 'deposit',
inputs: [
{name: 'assets', type: 'uint256'},
{name: 'receiver', type: 'address'},
],
outputs: [{name: 'shares', type: 'uint256'}],
}] as const
const hash = await walletClient.writeContract({
address: vault,
abi: vaultAbi,
functionName: 'deposit',
args: [amount, receiver], // receiver is usually the same wallet
})Using mint instead of deposit
mint instead of depositUsing permit (one transaction)
New shares start earning immediately
Last updated
Was this helpful?
