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.

Method Parameters

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.

Example

JavaScript
1
const deposit = await twoPi.deposit({
2
vaultIdentifier: 'mumbai_dai',
3
amount: '12',
4
unit: 'native',
5
});
Copied!

Returns

The status of the operation plus a detailed list of the transactions that took part in the deposit action.
1
{
2
status: 1,
3
transactionsReceipt: [
4
{
5
to: '0x001B3B4d0F3714Ca98ba10F6042DaEbF0B1B7b6F',
6
from: '0x596B25b30898Ea5EAD475a5f4D672be9F5C5E143',
7
contractAddress: null,
8
transactionIndex: 5,
9
gasUsed: BigNumber { _hex: '0xb45b', _isBigNumber: true },
10
logsBloom: '...',
11
blockHash: '0xb3428efda29f4a394bdb2330f65ec1aff67fdb42625c9ae3409a612009d6fc9d',
12
transactionHash: '0xf130583f0cf01c1c9f534c0d2d622738cbad4020413b68b2d1ed5dcfe66dafe8',
13
logs: [ [Object], [Object] ],
14
blockNumber: 22617355,
15
confirmations: 1,
16
cumulativeGasUsed: BigNumber { _hex: '0x0329b4', _isBigNumber: true },
17
effectiveGasPrice: BigNumber { _hex: '0x07aef40a00', _isBigNumber: true },
18
status: 1,
19
type: 0,
20
byzantium: true
21
},
22
{
23
to: '0x3B353b1CBDDA3A3D648af9825Ee34d9CA816FD38',
24
from: '0x596B25b30898Ea5EAD475a5f4D672be9F5C5E143',
25
contractAddress: null,
26
transactionIndex: 2,
27
gasUsed: BigNumber { _hex: '0x116e79', _isBigNumber: true },
28
logsBloom: '...',
29
blockHash: '0xeded66533c50c0ac3cb6b4e39e330387abbb0c832ab4b7a1f6621c764e5d9081',
30
transactionHash: '0x9a277d8111794b942572df2b0b736937e9ce6f674a091a3252e20b53910582f4',
31
logs: [
32
[Object], [Object], [Object],
33
],
34
blockNumber: 22617364,
35
confirmations: 1,
36
cumulativeGasUsed: BigNumber { _hex: '0x1353df', _isBigNumber: true },
37
effectiveGasPrice: BigNumber { _hex: '0x07aef40a00', _isBigNumber: true },
38
status: 1,
39
type: 0,
40
byzantium: true
41
}
42
],
43
}
Copied!