Uniswap / universal-router

Uniswap's Universal Router for NFT and ERC20 swapping
GNU General Public License v3.0
393 stars 196 forks source link

allow Reverts in TX with multiple commands, aka F flag, aka 0x80 Mask: not working #338

Open bscNinja opened 7 months ago

bscNinja commented 7 months ago
execute.chain A => {
buy 10 token
}

execute.chain ( 0x0a0808 or  0x0a8888 ) => {
sell  5 token : works alone [does not work if chained with the second sell]
sell  6 token
}

desired result execute.chain B : success, fail but overall the transaction does not fail current result execute.chain B : fail, fail, complete transaction fails

I tried changing 0x0a0808 or 0x0a8888, in hopes it will trigger true in the contract but the whole transaction fails.

function successRequired(bytes1 command) internal pure returns (bool) {
    return command & Commands.FLAG_ALLOW_REVERT == 0;
}

Is this the expected result or am I just misunderstanding the Technical Reference when it comes to the 0x80 flag in conjunction with commands ?

Comands.sol

bytes1 internal constant FLAG_ALLOW_REVERT = 0x80;

Uniswap Technical Reference

F

A single bit flag, that signals whether or not the command should be allowed to revert without the whole transaction failing.

If f is 0 aka false and the command reverts, then the entire transaction will revert and none of the commands will be executed. If f is 1 aka true and the command reverts, then the transaction will continue, allowing us to achieve partial fills. If using this flag, be careful to include further commands that will remove any funds that could be left unused in the UniversalRouter contract.

bscNinja commented 7 months ago

re-deployed universal router locally, completely removing the revert part in universal-router.sol, still same results. If 1 part fails, everything fails. Has anyone ever used the F Flag feature successfully ?