From 5be7ba4649fa8f656ba2a6962fa188159d395f8c Mon Sep 17 00:00:00 2001 From: telome <> Date: Mon, 20 Nov 2023 17:09:53 +0000 Subject: [PATCH] Remove requirement on SwapperCalleePsm amt --- src/funnels/callees/SwapperCalleePsm.sol | 10 ++++------ test/funnels/callees/SwapperCalleePsm.t.sol | 7 ------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/funnels/callees/SwapperCalleePsm.sol b/src/funnels/callees/SwapperCalleePsm.sol index 95c05b9e..cadec1e9 100644 --- a/src/funnels/callees/SwapperCalleePsm.sol +++ b/src/funnels/callees/SwapperCalleePsm.sol @@ -64,12 +64,10 @@ contract SwapperCalleePsm { emit Deny(usr); } + // Note: To avoid accumulating dust in this contract, `amt` should be a multiple of `to18ConversionFactor` when `src != gem`. + // This constraint is intentionally not enforced in this contract. function swapCallback(address src, address /* dst */, uint256 amt, uint256 /* minOut */, address to, bytes calldata /* data */) external auth { - if (src == gem) { - PsmLike(psm).sellGemNoFee(to, amt); - } else { - require(amt % to18ConversionFactor == 0, "SwapperCalleePsm/invalid-amt"); - PsmLike(psm).buyGemNoFee(to, amt / to18ConversionFactor); - } + if (src == gem) PsmLike(psm).sellGemNoFee(to, amt); + else PsmLike(psm).buyGemNoFee (to, amt / to18ConversionFactor); } } diff --git a/test/funnels/callees/SwapperCalleePsm.t.sol b/test/funnels/callees/SwapperCalleePsm.t.sol index 35e5402b..10e68590 100644 --- a/test/funnels/callees/SwapperCalleePsm.t.sol +++ b/test/funnels/callees/SwapperCalleePsm.t.sol @@ -91,11 +91,4 @@ contract SwapperCalleePsmTest is DssTest { checkPsmSwap(callee, USDC, DAI); checkPsmSwap(calleeUSDT, DAI, USDT); } - - function testInvalidSwapAmt() public { - uint256 amt = 10_000 * 10**18 + 10**12 - 1; - GemLike(DAI).transfer(address(callee), amt); - vm.expectRevert("SwapperCalleePsm/invalid-amt"); - callee.swapCallback(DAI, USDC, amt, 0, address(this), ""); - } }