Skip to content

Commit

Permalink
Hardcode DAI address in the fee collection functions
Browse files Browse the repository at this point in the history
  • Loading branch information
peculiarity committed Nov 15, 2021
1 parent 158788c commit f3ef0fb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions contracts/multiply/Exchange.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ contract Exchange {
return balance;
}

function _collectFeeTokenToDai(address asset, uint256 fromAmount) internal returns (uint256) {
function _collectFeeTokenToDai(uint256 fromAmount) internal returns (uint256) {
uint256 feeToTransfer = (fromAmount.mul(fee)).div(feeBase);
IERC20(asset).safeTransfer(feeBeneficiaryAddress, feeToTransfer);
IERC20(DAI_ADDRESS).safeTransfer(feeBeneficiaryAddress, feeToTransfer);
emit FeePaid(feeBeneficiaryAddress, feeToTransfer);
return fromAmount.sub(feeToTransfer);
}

function _collectFeeDaiToToken(address asset, uint256 fromAmount) internal returns (uint256) {
function _collectFeeDaiToToken(uint256 fromAmount) internal returns (uint256) {
uint256 feeToTransfer = fromAmount.sub((fromAmount.mul(feeBase)).div(feeBase.add(fee)));
IERC20(asset).safeTransfer(feeBeneficiaryAddress, feeToTransfer);
IERC20(DAI_ADDRESS).safeTransfer(feeBeneficiaryAddress, feeToTransfer);
emit FeePaid(feeBeneficiaryAddress, feeToTransfer);
return fromAmount.sub(feeToTransfer);
}
Expand All @@ -123,7 +123,7 @@ contract Exchange {
) public {
_transferIn(msg.sender, DAI_ADDRESS, amount);

uint256 _amount = _collectFeeDaiToToken(DAI_ADDRESS, amount);
uint256 _amount = _collectFeeDaiToToken(amount);
uint256 balance = _swap(DAI_ADDRESS, asset, _amount, receiveAtLeast, callee, withData);

uint256 daiBalance = IERC20(DAI_ADDRESS).balanceOf(address(this));
Expand All @@ -145,7 +145,7 @@ contract Exchange {
_transferIn(msg.sender, asset, amount);

uint256 balance = _swap(asset, DAI_ADDRESS, amount, receiveAtLeast, callee, withData);
uint256 _balance = _collectFeeTokenToDai(DAI_ADDRESS, balance);
uint256 _balance = _collectFeeTokenToDai(balance);

uint256 assetBalance = IERC20(asset).balanceOf(address(this));

Expand Down

0 comments on commit f3ef0fb

Please sign in to comment.