Skip to main content

How to Deposit to a Chain

Any assets attached to an on-ledger request are automatically deposited to the sender's L2 account before executing the request. So, to deposit tokens, you only need to send any on-ledger request with the tokens attached.

A commonly needed operation is to only deposit some funds and do nothing else. The deposit entry point of the accounts core contract is a no-op function that serves this purpose.

Gas Fees

All requests are charged a gas fee, so the L2 account may receive fewer tokens than the amount sent.

Storage Deposits

The IOTA L1 transaction needs a minimum amount of tokens attached for storage deposit. It will fail if the amount transferred is less than this minimum amount.

// deposits N base tokens from wallet into chain
err := chain.DepositBaseTokensToL2(N, wallet)
require.NoError(t, err)