资源加载中... loading...

Get Started with web3 Development Easily Based on Ethereum Using FMZ

Author: FMZ~Lydia, Created: 2023-06-25 09:17:53, Updated: 2024-11-11 22:34:49

“data”].length; i++) { var calldata = “0x” + decodedInput[“args”][“data”][i] var decodedCalldata = decodeCall(calldata, ABI_Route)

                    // Log("----------------", decodedCalldata["funcName"], "----------------", "#FF0000")
                    arrLog.push("----------------" + decodedCalldata["funcName"] + "----------------" + "#FF0000")

                    for (var key in decodedCalldata["args"]) {
                        // Log(key, decodedCalldata["args"][key])
                        arrLog.push(key + ": " + JSON.stringify(decodedCalldata["args"][key]))
                    }
                }

                // Output logs
                for (var logIdx = arrLog.length - 1; logIdx >= 0; logIdx--) {
                    Log(arrLog[logIdx])
                }
            }
            
            getTransactionCounter++
        }
        recv = obj
    } else if (data == null) {
        msg = "The buffer queue is empty, time:" + _D()
    }
    
    LogStatus(_D(), ", msg:", msg, ", recv:", recv)
}

}

function onexit() { Log(“Disconnect WS connection”) ws.close() }

function onerror() { Log(“Disconnect WS connection”) ws.close()

for (var logIdx = arrLog.length - 1; logIdx >= 0; logIdx--) {        
    Log(arrLog[logIdx])
}

}


Create a live trading to test:

```run
2023-06-20 17:01:00		Info	----------------0x5288a7bd6e0f57162ca763df722de73793e542734d7d2b7af5755664e2e67910/multicall----------------
2023-06-20 17:01:00		Info	0x851b594033d57c98af753bcb3a7d0237a615de32 -> 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45
2023-06-20 17:01:00		Info	----------------exactInputSingle----------------
2023-06-20 17:01:00		Info	params: {"tokenOut":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","fee":"10000","recipient":"0x0000000000000000000000000000000000000002","amountIn":"8952087000296027130940868","amountOutMinimum":"41638694112306829","sqrtPriceLimitX96":"0","tokenIn":"0xe1283567345349942acdfad3692924a1b16cf3cc"}
2023-06-20 17:01:00		Info	----------------unwrapWETH9----------------
2023-06-20 17:01:00		Info	amountMinimum: "41638694112306829"
2023-06-20 17:01:00		Info	recipient: "0x851b594033d57c98af753bcb3a7d0237a615de32"
2023-06-20 16:59:03		Info	----------------0x55e0c4a38a17d3aa6e8f558a66c77e9defa9f8f6e347536363ac1b921de9aaf3/multicall----------------
2023-06-20 16:59:03		Info	0x27457ada2dd725c7d0f28e1737bdd0bf583c0f0b -> 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45
2023-06-20 16:59:03		Info	----------------swapExactTokensForTokens----------------
2023-06-20 16:59:03		Info	amountIn: "816769666850161"
2023-06-20 16:59:03		Info	amountOutMin: "40404501509302321"
2023-06-20 16:59:03		Info	path: ["0x7863e06bca47ded821fcb53ab788eeb371243eda","0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"]
2023-06-20 16:59:03		Info	to: "0x27457ada2dd725c7d0f28e1737bdd0bf583c0f0b"
2023-06-20 16:58:25		Info	sigHash: 0x5ae401dc

Screenshot:

img

You can see that the Transaction Hash is 0x5288a7bd6e0f57162ca763df722de73793e542734d7d2b7af5755664e2e67910 for this transaction, and the input data data contains the call to a multicall method call. This transaction is sent in the direction: 0x851b594033d57c98af753bcb3a7d0237a615de32 -> 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45. 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45 is Uniswap’s router contract address.

img

The multicall package is parsed to call the contract’s exactInputSingle and unwrapWETH9 methods and the specific parameters of these methods.

----------------exactInputSingle----------------
params: {
    "tokenOut":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
    "fee":"10000",
    "recipient":"0x0000000000000000000000000000000000000002",
    "amountIn":"8952087000296027130940868",
    "amountOutMinimum":"41638694112306829",
    "sqrtPriceLimitX96":"0",
    "tokenIn":"0xe1283567345349942acdfad3692924a1b16cf3cc"
}

----------------unwrapWETH9----------------
amountMinimum: "41638694112306829"
recipient: "0x851b594033d57c98af753bcb3a7d0237a615de32"

If you are interested, you can modify and extend the example based on it to monitor more transactions and parse these on-chain operations.


Related

More