The resource loading... loading...

exchange.IO("encodePacked", …)

The exchange.IO("encodePacked", ...) function is called in a way that is used for encodePacked encoding.

The exchange.IO("encodePacked", ...) function returns the encodePacked encoded data. string

exchange.IO(k, dataFormat, …args)

The k parameter is used to set the function of the exchange.IO() function, set to "encodePacked" means that the function is used for data encodePacked encoding. k true string The dataFormat parameter is used to specify the type and order of the encodePacked encoded data. dataFormat true string The arg parameter is used to specify the specific data value that matches the dataFormat parameter. There may be more than one arg parameter, and the type and number of arg parameters depends on the dataFormat parameter setting. arg true string, number, tuple, array, and all other types supported by the system

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)
}

When using Uniswap V3, you need to pass in parameters like the exchange path, you need to use the encodePacked encoding operation:

exchange.IO("encode", ...) exchange.IO("decode", ...)