exchange.IO("abi", ...)
In the FMZ Quant Trading Platform, various blockchain-related functions are mainly implemented through the exchange.IO() function. The following documentation will describe the different functions of the exchange.IO() function separately. The exchange.IO("abi", ...) function call is used to register ABI.
-
Supports Ethereum (eth)
-
Supports TRON (tron)
exchange.IO(k, address, abiContent)Examples
javascript
function main() {
// register Uniswap SwapRouter02 abi
var routerAddress = "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"
var abi = `[{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"internalType":"struct IV3SwapRouter.ExactOutputParams","name":"params","type":"tuple"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"payable","type":"function"}]`
// abi only uses partial exactOutput method content, complete abi can be searched online
exchange.IO("abi", routerAddress, abi)
}Arguments
| Name | Type | Required | Description |
k | string | Yes | The |
address | string | Yes | The |
abiContent | string | Yes | The |
Remarks
If the called smart contract method is a standard ERC20 method, registration is not required.
To obtain the contract's ABI content, you can use the following URL, just take the result field, for example:
url
https://api.etherscan.io/api?module=contract&action=getabi&address=0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45