deposit(contract, sender, amount, transfer_limit, start_time, end_time, duration, currency)
Feature
Generate deposit operation to deposit currency to a payment model with transfer setting. amount > 0 && end_time > start_time && duration <= (end_time - start_time) Note: Any accounts can execute the operation.
Parameters
string
contract address,
string
sender,
string
| number
amount, //The amount to deposit.
string
| number
transfer_limit, // The maximum amount that can be sent.
string
| number
start_time, //The start time when a transfer becomes possible. (timestamp)
string
| number
end_time, //The end time after which a transfer is no longer allowed. (timestamp)
string
| number
duration, // The cooldown period (in seconds) after the last transfer, during which further transfers are blocked.
string
currency ID
Return Value
object
deposit operation
example
const contract = "0x675b7c22dd188Af248985C64278081cC64Dc9bD2fca";
const sender = "0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca";
const currencyID = "MCC";
const amount = 10000;
const transfer_limit = 2000;
const startTime = 3000;
const endTime = 1738825040;
const duration = 1000;
const op = mitum.payment.deposit(contract, sender, amount, transfer_limit, startTime, endTime, duration, currencyID);
console.log(op);
// output
Operation {
id: 'mitum',
fact: DepositFact {
hint: Hint { s: 'mitum-payment-deposit-operation-fact' },
token: Token { s: '2025-02-06 06:40:40.934 +0000 UTC' },
_hash: <Buffer 75 c6 33 08 71 72 28 33 61 b4 8a 54 bb 1b 91 90 c1 bf e2 fc 97 07 72 76 a2 0e 4a aa 9c ec 45 48>,
sender: Address {
s: '0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca',
type: 'mitum'
},
contract: Address {
s: '0x675b7c22dd188Af248985C64278081cC64Dc9bD2fca',
type: 'mitum'
},
currency: CurrencyID { s: 'MCC' },
amount: Big { big: 10000n },
transfer_limit: Big { big: 2000n },
start_time: Big { big: 3000n },
end_time: Big { big: 1738825040n },
duration: Big { big: 1000n }
},
hint: Hint { s: 'mitum-payment-deposit-operation' },
_factSigns: [],
_hash: <Buffer >
}
Last updated