Payments

Handles the encoding of calldata for payment operations.

GitHub File: payments.ts

Properties

Public

PropertyTypeModifierDescription

INTERFACE

static

The Application Binary Interface for the related Elastic contracts.

Constructor

Private constructor that cannot be constructed.

Methods

encodeFeeBips() - private static

Encodes the fees and returns the fee value as a hexed string.

Parameters

ParamsTypeDescription

fee

The fees charged for the payment

Returns

TypeDescription

string

An encoded string that represents the hex value of the fee.


encodeUnwrapETH() - public static

Handles the encoding of unwrapping WETH with the option to charge fees for the unwrapping operation.

Parameters

ParamsTypeDescription

amountMinimum

The minimum balance of the contract from which WETH is being unwrapped. Prevents malicious contracts from stealing WETH9 from users.

recipient

string

The recipient of the unwrapped ETH.

feeOptions

An object that contains fee data for the unwrap transaction: fee:Percent = The % of the transfer output that will be taken as a fee. recipient: string = The recipient address for the fee.

Returns

TypeDescription

string

The hex encoded calldata to perform the WETH unwrapping.


encodeSweepToken() - public static

Handles the encoding of transferring all of a contract's token balance with an optional fee.

Parameters

ParamsTypeDescription

token

The token to be transferred/swept.

amountMinimum

The minimum balance of the contract. Prevents malicious contracts from stealing WETH9 from users.

recipient

string

The recipient of the unwrapped ETH.

feeOptions

An object that contains fee data for the unwrap transaction: fee:Percent = The % of the transfer output that will be taken as a fee. recipient: string = The recipient address for the fee.

Returns

TypeDescription

string

The hex encoded calldata to perform the token sweep operation.


encodeRefundETH() - public static

Handles the encoding of transferring all of a contract's ETH balance to the message sender.

Returns

TypeDescription

string

The hex encoded calldata to perform the ETH refund operation.

Last updated