Deposit Methods
Deposit methods of Azoth SDK for depositing tokens into the system.
deposit()
deposit()
Deposits tokens into AzothPay.
async deposit(amount: bigint | number, isPermit2: boolean = false): Promise<ethers.TransactionResponse>
Parameters:
amount
: The amount of tokens to deposit, should be formatted usingformatInput()
isPermit2
(optional): Whether to use Permit2 for the deposit (default: false)
Returns:
An ethers.js
TransactionResponse
object
Example:
// Format the amount correctly (10 USDT with 6 decimals)
const amount = formatInput('10', 6);
// Deposit
const tx = await azoth.deposit(amount);
await tx.wait();
console.log('Deposit successful');
depositBySig()
depositBySig()
Creates a deposit transaction that can be signed off-chain and executed by anyone.
async depositBySig(amount: bigint | number, deadline: number): Promise<ethers.TransactionResponse>
Parameters:
amount
: The amount of tokens to deposit, should be formatted usingformatInput()
deadline
: Timestamp after which the transaction cannot be executed
Returns:
An ethers.js
TransactionResponse
object
Example:
// Format the amount correctly (10 USDT with 6 decimals)
const amount = formatInput('10', 6);
// Set deadline to 1 hour from now
const deadline = Math.floor(Date.now() / 1000) + 3600;
// Create the depositBySig transaction
const tx = await azoth.depositBySig(amount, deadline);
await tx.wait();
depositFor()
depositFor()
Deposits tokens into another account.
async depositFor(amount: bigint | number, to: string, isPermit2: boolean = false): Promise<ethers.TransactionResponse>
Parameters:
amount
: The amount of tokens to deposit, should be formatted usingformatInput()
to
: The recipient addressisPermit2
(optional): Whether to use Permit2 for the deposit (default: false)
Returns:
An ethers.js
TransactionResponse
object
Example:
// Format the amount correctly (50 USDT with 6 decimals)
const amount = formatInput('50', 6);
const recipientAddress = '0x...';
// Deposit to the recipient
const tx = await azoth.depositFor(amount, recipientAddress);
await tx.wait();
Last updated