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.
- Solo
- Solo (Schema)
- Rust (Schema)
- Go (Schema)
// deposits N base tokens from wallet into chain
err := chain.DepositBaseTokensToL2(N, wallet)
require.NoError(t, err)
// deposits N base tokens from wallet into chain
d := coreaccounts.ScFuncs.Deposit(ctx.Sign(wallet))
d.Func.TransferBaseTokes(N).Post()
require.NoError(t, ctx.Err)
// deposits N iotas from wallet into chain
let d = coreaccounts::ScFuncs::deposit(ctx.sign(wallet));
d.func.transfer_base_tokens(N).post();
// deposits N iotas from wallet into chain
d := coreaccounts.ScFuncs.Deposit(ctx.Sign(wallet))
d.Func.TransferBaseTokens(N).Post()