KyberSwap Docs
Search
K

Payments

Handles the encoding of calldata for payment operations.
GitHub File: payments.ts

Properties

Public

Property
Type
Modifier
Description
INTERFACE
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

Params
Type
Description
fee
Percent
The fees charged for the payment

Returns

Type
Description
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

Params
Type
Description
amountMinimum
JSBI
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

Type
Description
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

Params
Type
Description
token
Token
The token to be transferred/swept.
amountMinimum
JSBI
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

Type
Description
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

Type
Description
string
The hex encoded calldata to perform the ETH refund operation.