fix: add amountIn in error TychoRouter__AmountInDiffersFromConsumed
This commit is contained in:
@@ -59,7 +59,9 @@ error TychoRouter__AddressZero();
|
|||||||
error TychoRouter__AmountZero();
|
error TychoRouter__AmountZero();
|
||||||
error TychoRouter__EmptySwaps();
|
error TychoRouter__EmptySwaps();
|
||||||
error TychoRouter__NegativeSlippage(uint256 amount, uint256 minAmount);
|
error TychoRouter__NegativeSlippage(uint256 amount, uint256 minAmount);
|
||||||
error TychoRouter__AmountInDiffersFromConsumed(uint256 amountConsumed);
|
error TychoRouter__AmountInDiffersFromConsumed(
|
||||||
|
uint256 amountIn, uint256 amountConsumed
|
||||||
|
);
|
||||||
error TychoRouter__MessageValueMismatch(uint256 value, uint256 amount);
|
error TychoRouter__MessageValueMismatch(uint256 value, uint256 amount);
|
||||||
error TychoRouter__InvalidDataLength();
|
error TychoRouter__InvalidDataLength();
|
||||||
|
|
||||||
@@ -164,7 +166,9 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
|
|||||||
uint256 amountConsumed = initialBalance - currentBalance;
|
uint256 amountConsumed = initialBalance - currentBalance;
|
||||||
|
|
||||||
if (amountConsumed != amountIn) {
|
if (amountConsumed != amountIn) {
|
||||||
revert TychoRouter__AmountInDiffersFromConsumed(amountConsumed);
|
revert TychoRouter__AmountInDiffersFromConsumed(
|
||||||
|
amountIn, amountConsumed
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fee > 0) {
|
if (fee > 0) {
|
||||||
|
|||||||
@@ -896,6 +896,7 @@ contract TychoRouterTest is TychoRouterTestSetup {
|
|||||||
vm.expectRevert(
|
vm.expectRevert(
|
||||||
abi.encodeWithSelector(
|
abi.encodeWithSelector(
|
||||||
TychoRouter__AmountInDiffersFromConsumed.selector,
|
TychoRouter__AmountInDiffersFromConsumed.selector,
|
||||||
|
1000000000000000000,
|
||||||
600000000000000000
|
600000000000000000
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user