Skip to content

Commit

Permalink
SwapperCalleePsm: Add note regarding dust accumulation (#72)
Browse files Browse the repository at this point in the history
* SwapperCalleePsm: Prevent swap amts not multiple of to18ConversionFactor

* Remove requirement on SwapperCalleePsm amt

---------

Co-authored-by: telome <>
  • Loading branch information
telome authored Nov 21, 2023
1 parent 7d8403d commit 9318d51
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/funnels/callees/SwapperCalleePsm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ 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 PsmLike(psm).buyGemNoFee (to, amt / to18ConversionFactor);
Expand Down

0 comments on commit 9318d51

Please sign in to comment.