exchange.IO("encodePacked", ...)
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
| Type | Description |
string | Data string that has been processed with |
Arguments
| Name | Type | Required | Description |
k | string | Yes | Functional mode of the |
dataFormat | string | Yes | Data type format and arrangement order for |
arg | string / number / array / any | Yes | Specific data values that match the format of the There can be multiple |
See Also