fix: After rebase fixes
- In Tycho Router - Fix integration tests - If the trade is cyclical, we can't do the balance check for the correctness of the amountOut transfers - In encoding, - if it is a wrap trade, the transfer should be just a normal Transfer (not TransferFrom nor a Permit2Transfer) - add test names to println! statements --- don't change below this line --- ENG-4315 Took 1 hour 0 minutes Took 30 seconds Took 21 seconds Took 16 seconds Took 17 seconds
This commit is contained in:
@@ -433,10 +433,14 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
|
||||
Address.sendValue(payable(receiver), amountOut);
|
||||
}
|
||||
|
||||
uint256 currentBalanceTokenOut = _balanceOf(tokenOut, receiver);
|
||||
uint256 userAmount = currentBalanceTokenOut - initialBalanceTokenOut;
|
||||
if (userAmount != amountOut) {
|
||||
revert TychoRouter__AmountOutNotFullyReceived(userAmount, amountOut);
|
||||
if (tokenIn != tokenOut) {
|
||||
uint256 currentBalanceTokenOut = _balanceOf(tokenOut, receiver);
|
||||
uint256 userAmount = currentBalanceTokenOut - initialBalanceTokenOut;
|
||||
if (userAmount != amountOut) {
|
||||
revert TychoRouter__AmountOutNotFullyReceived(
|
||||
userAmount, amountOut
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,11 +487,14 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
|
||||
Address.sendValue(payable(receiver), amountOut);
|
||||
}
|
||||
|
||||
uint256 currentBalanceTokenOut = _balanceOf(tokenOut, receiver);
|
||||
uint256 userAmount = currentBalanceTokenOut - initialBalanceTokenOut;
|
||||
|
||||
if (userAmount != amountOut) {
|
||||
revert TychoRouter__AmountOutNotFullyReceived(userAmount, amountOut);
|
||||
if (tokenIn != tokenOut) {
|
||||
uint256 currentBalanceTokenOut = _balanceOf(tokenOut, receiver);
|
||||
uint256 userAmount = currentBalanceTokenOut - initialBalanceTokenOut;
|
||||
if (userAmount != amountOut) {
|
||||
revert TychoRouter__AmountOutNotFullyReceived(
|
||||
userAmount, amountOut
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,11 +538,15 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
|
||||
_unwrapETH(amountOut);
|
||||
Address.sendValue(payable(receiver), amountOut);
|
||||
}
|
||||
uint256 currentBalanceTokenOut = _balanceOf(tokenOut, receiver);
|
||||
uint256 userAmount = currentBalanceTokenOut - initialBalanceTokenOut;
|
||||
|
||||
if (userAmount != amountOut) {
|
||||
revert TychoRouter__AmountOutNotFullyReceived(userAmount, amountOut);
|
||||
if (tokenIn != tokenOut) {
|
||||
uint256 currentBalanceTokenOut = _balanceOf(tokenOut, receiver);
|
||||
uint256 userAmount = currentBalanceTokenOut - initialBalanceTokenOut;
|
||||
if (userAmount != amountOut) {
|
||||
revert TychoRouter__AmountOutNotFullyReceived(
|
||||
userAmount, amountOut
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ contract CurveExecutor is IExecutor, TokenTransfer {
|
||||
payable
|
||||
returns (uint256)
|
||||
{
|
||||
if (data.length != 65) revert CurveExecutor__InvalidDataLength();
|
||||
if (data.length != 85) revert CurveExecutor__InvalidDataLength();
|
||||
|
||||
(
|
||||
address tokenIn,
|
||||
@@ -134,6 +134,7 @@ contract CurveExecutor is IExecutor, TokenTransfer {
|
||||
int128 i,
|
||||
int128 j,
|
||||
bool tokenApprovalNeeded,
|
||||
TransferType transferType,
|
||||
address receiver
|
||||
)
|
||||
{
|
||||
|
||||
@@ -120,7 +120,8 @@ contract UniswapV4Executor is IExecutor, V4Router, ICallback, TokenTransfer {
|
||||
})
|
||||
);
|
||||
params[1] = abi.encode(currencyIn, amountIn);
|
||||
params[2] = abi.encode(Currency.wrap(tokenOut), receiver, uint256(0));
|
||||
params[2] =
|
||||
abi.encode(Currency.wrap(tokenOut), receiver, uint256(0));
|
||||
swapData = abi.encode(actions, params);
|
||||
}
|
||||
uint256 tokenOutBalanceBefore;
|
||||
|
||||
Reference in New Issue
Block a user