fix: a zero-minimum balance check never sets the output side (closes #649)
A BALANCE_CHECK_ERC20 of the sender with a zero minimum guarantees nothing, and neither does one the router lets fail. Such a check set Token Out and the minimum whenever the output side held no minimum. After an UNWRAP_WETH that drops the minimum, a zero check of USDC named USDC as Token Out. Such a check now sets neither line. A check with a positive minimum is unchanged. Model: opus-5-5
This commit is contained in:
@@ -1629,13 +1629,13 @@ function decode(data, toAddress, chainId, sources, fromAddress) {
|
||||
} else {
|
||||
// The router passes this check whenever the owner
|
||||
// holds at least minBalance, so a zero one guarantees
|
||||
// nothing and does not replace a minimum an earlier
|
||||
// step stated. A check the router lets fail guarantees
|
||||
// nothing either, so it is read as a zero one. Any
|
||||
// nothing. A check the router lets fail guarantees
|
||||
// nothing either, so it is read as a zero one. A zero
|
||||
// check sets neither Token Out nor the minimum. Any
|
||||
// other minBalance sets the output side as a swap
|
||||
// does. It pays nobody.
|
||||
// does. The check pays nobody.
|
||||
const minBalance = allowedToFail ? 0n : b.minBalance;
|
||||
if (!(minBalance === 0n && present(minOutput))) {
|
||||
if (minBalance !== 0n) {
|
||||
setOutput(i, b.token, minBalance, []);
|
||||
}
|
||||
keepsRouterWeth = true;
|
||||
|
||||
Reference in New Issue
Block a user