I need to use the Multiplex Feature of 0x in order to perform a specific trade that perform a UniswapV3 call followed by a _FillOTCorder
using the SelfBalance
feature of the the Multiplex Feature.
As this is a complex set of code, the best way to do it is to reuse the existing solidity code.
As the order need to be signed, I can’t call multiplexMultiHopSellEthForToken
on the proxy contract directly : I need to encode almost the whole call off‑chain in a Solidity vm, then sign it.
It’s often said that structs are just tuples, but before ABIencoderV2
you could pass tuples but not structs to functions and indeed, the following code below doesn’t works :
calls = abi.encode( abi.encode(subcall.id,subcall.data) ,abi.encode(subcall2.id,subcall2.data)); bytes memory ret = abi.encodeWithSelector(IMultiplexFeature.multiplexMultiHopSellEthForToken.selector, abi.encode(IERC20Token(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2),IERC20Token(0xdAC17F958D2ee523a2206206994597C13D831ec7),IERC20Token(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE)), ret2, 0);`
In details, it correctly generate the 0x5161b966
selector but the initial argument decoding fails and the transaction reverts.
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
💰 Install these recommended apps:
💲 SocialGood - 100% Crypto Back on Everyday Shopping
💲 xPortal - The DeFi For The Next Billion
💲 CryptoTab Browser - Lightweight, fast, and ready to mine!
💰 Register on these recommended exchanges:
🟡 Binance🟡 Bitfinex🟡 Bitmart🟡 Bittrex🟡 Bitget
🟡 CoinEx🟡 Crypto.com🟡 Gate.io🟡 Huobi🟡 Kucoin.
Comments