Hello, any one here? I saw 0x v2 added an forwarder contract address, but it can only support ETH to token, why didn’t you consider of supporting token to ETH trade?
When you submit an Ethereum transaction, you can specify an amount of ETH to go with the transaction. That means in a single transaction you can send ETH along with the trade you want to execute, the contract can convert your ETH into WETH, and execute any trades you’ve provided it in a single transaction.
You can’t do the same thing with tokens. You have to set allowances to be able to trade tokens; within Ethereum there’s no way around this. So if you’re trading tokens, you have to have one transaction to set allowances for your tokens and another transaction to execute the trade. You could potentially have a contract that trades tokens based on your allowances then converts WETH back to ETH before it sends it to you, but you’d still have to have at least two transactions to set allowances before executing the trade.
Thank you for your reply!
According to this, we wanna to design a proxy wrapper contract, the flow like this:
PW(Our proxy wrapper contract)
0xEX(0x exchange contract)
0xPC(0x proxy contract)
0xET(0x etherToken contract)
User set TokenA allowance to PW
PW set TokenA allowance to 0xPC
User place a order
makerToken is TokenA
takerToken is WETH
taker send a fillOrder tx to PW
PW transfer User’s TokenA to PW
PW generate a new order, almost same data with original order, only salt, signature, maker, taker(taker address specified as “taker”) is different
PW send a fillOrder tx to 0xEX
0xEX notify that 0xPC to transfer PW’s TokenA to taker
0xEX notify that 0xPC to transfer taker’s WETH to PW
PW send a withdraw tx to 0x 0xET, and get ETH back
PW send a internal tx, transfer ETH to User
And the step 2-9, is within one transaction, Dose it could be be possible?