Type/to search
Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Exchanges
Capability Matrix
Centralized Exchanges
Decentralized Exchanges (DEX)
Prediction Markets
Securities and Futures
On-chain & Custom

Performs encodePacked encoding operations.

exchange.IO(k, dataFormat, ...args)

Examples

When using Uniswap V3, parameters such as trading path need to be passed in, which requires the use of encodePacked encoding operations.

javascript
function main() { var fee = exchange.IO("encodePacked", "uint24", 3000) var tokenInAddress = "0x111111111117dC0aa78b770fA6A738034120C302" var tokenOutAddress = "0x6b175474e89094c44da98b954eedeac495271d0f" var path = tokenInAddress.slice(2).toLowerCase() path += fee + tokenOutAddress.slice(2).toLowerCase() Log("path:", path) }

Returns

TypeDescription

string

Data string that has been processed with encodePacked encoding.

Arguments

NameTypeRequiredDescription

k

string

Yes

Functional mode of the exchange.IO() function. When set to encodePacked, it indicates that the function performs data encodePacked encoding operations.

dataFormat

string

Yes

Data type format and arrangement order for encodePacked encoding.

arg

string / number / array / any

Yes

Specific data values that match the format of the dataFormat parameter.

There can be multiple arg parameters, and their type and quantity are determined by the settings of the dataFormat parameter. A tuple is passed as an array.

See Also