Comment on page
Making a deposit
For compatibility across tokens with various decimals, 2PI allows unifying all currency amounts to use the decimal representation. For example, a value of 10 in the amount field will utilize ten currency tokens.
twoPi.deposit({vaultIdentifier, amount, unit})
This method deposits the specified amount of stablecoins to 2Pi.
Parameter | Type | Optionality | Description |
---|---|---|---|
vaultIdentifier | String | required | A string that represents the network/currency pair |
amount | String | required | Amount to deposit |
unit | String | optional | Flag to force the way values get represented. options: wei | native
Native: means it will handle amount values using decimal representation. wei (default): the smallest denomination of a token. Based on the token decimals. |
JavaScript
const deposit = await twoPi.deposit({
vaultIdentifier: 'mumbai_dai',
amount: '12',
unit: 'native',
});
The status of the operation plus a detailed list of the transactions that took part in the deposit action.
{
status: 1,
transactionsReceipt: [
{
to: '0x001B3B4d0F3714Ca98ba10F6042DaEbF0B1B7b6F',
from: '0x596B25b30898Ea5EAD475a5f4D672be9F5C5E143',
contractAddress: null,
transactionIndex: 5,
gasUsed: BigNumber { _hex: '0xb45b', _isBigNumber: true },
logsBloom: '...',
blockHash: '0xb3428efda29f4a394bdb2330f65ec1aff67fdb42625c9ae3409a612009d6fc9d',
transactionHash: '0xf130583f0cf01c1c9f534c0d2d622738cbad4020413b68b2d1ed5dcfe66dafe8',
logs: [ [Object], [Object] ],
blockNumber: 22617355,
confirmations: 1,
cumulativeGasUsed: BigNumber { _hex: '0x0329b4', _isBigNumber: true },
effectiveGasPrice: BigNumber { _hex: '0x07aef40a00', _isBigNumber: true },
status: 1,
type: 0,
byzantium: true
},
{
to: '0x3B353b1CBDDA3A3D648af9825Ee34d9CA816FD38',
from: '0x596B25b30898Ea5EAD475a5f4D672be9F5C5E143',
contractAddress: null,
transactionIndex: 2,
gasUsed: BigNumber { _hex: '0x116e79', _isBigNumber: true },
logsBloom: '...',
blockHash: '0xeded66533c50c0ac3cb6b4e39e330387abbb0c832ab4b7a1f6621c764e5d9081',
transactionHash: '0x9a277d8111794b942572df2b0b736937e9ce6f674a091a3252e20b53910582f4',
logs: [
[Object], [Object], [Object],
],
blockNumber: 22617364,
confirmations: 1,
cumulativeGasUsed: BigNumber { _hex: '0x1353df', _isBigNumber: true },
effectiveGasPrice: BigNumber { _hex: '0x07aef40a00', _isBigNumber: true },
status: 1,
type: 0,
byzantium: true
}
],
}
Last modified 1yr ago