Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gas-limit committed Nov 19, 2024
1 parent d54c10d commit a6f2f3a
Show file tree
Hide file tree
Showing 7 changed files with 807 additions and 211 deletions.
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/openzeppelin-foundry-upgrades"]
path = lib/openzeppelin-foundry-upgrades
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts-upgradeable
Submodule openzeppelin-contracts-upgradeable deleted from fa5253
1 change: 0 additions & 1 deletion lib/openzeppelin-foundry-upgrades
Submodule openzeppelin-foundry-upgrades deleted from 16e0ae
9 changes: 4 additions & 5 deletions src/Standalone/StandaloneMultiRewarder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pragma solidity 0.7.6;

import { SafeMath} from "../dependencies/openzeppelin/contracts/SafeMath.sol";
import { IERC20 } from "../dependencies/openzeppelin/contracts/IERC20.sol";
import { SafeERC20 } from "../dependencies/openzeppelin/contracts/SafeERC20.sol";

contract StandaloneMultiRewarder {

Expand Down Expand Up @@ -88,7 +87,7 @@ contract StandaloneMultiRewarder {
_simulateRewardPerToken(_aToken, rewardToken, multiTotalStaked[_aToken].sub(_amount));
}

SafeERC20.safeTransferFrom(IERC20(_aToken), msg.sender, address(this), _amount);
IERC20(_aToken).transferFrom(msg.sender, address(this), _amount);

emit multiStakeRecorded(msg.sender, _aToken, _amount);
}
Expand All @@ -98,13 +97,13 @@ contract StandaloneMultiRewarder {
require(_amount > 0, "amount must be greater than 0");
require(_amount <= multiUserStaked[msg.sender][_aToken], "insufficient staked amount");

_claimMultiRewards(_aToken, msg.sender);
claimMultiRewards(_aToken);
uint256 stakedAmount = multiUserStaked[msg.sender][_aToken];
require(stakedAmount >= _amount, "insufficient staked amount");
multiUserStaked[msg.sender][_aToken] = stakedAmount.sub(_amount);
multiTotalStaked[_aToken] = multiTotalStaked[_aToken].sub(_amount);

SafeERC20.safeTransfer(IERC20(_aToken), msg.sender, _amount);
IERC20(_aToken).transfer(msg.sender, _amount);

emit multiUnstakeRecorded(msg.sender, _aToken, _amount);
}
Expand All @@ -128,7 +127,7 @@ contract StandaloneMultiRewarder {
multiUserRewardOffset[msg.sender][_aToken][
rewardToken
] = multiRewardPerToken[_aToken][rewardToken];
SafeERC20.safeTransfer(IERC20(rewardToken), msg.sender, earnedAmountActual);
IERC20(rewardToken).transfer(msg.sender, earnedAmountActual);

emit multiRewardHarvested(msg.sender, _aToken, rewardToken, earnedAmountActual);
}
Expand Down
198 changes: 0 additions & 198 deletions src/dependencies/openzeppelin/contracts/SafeERC20.sol

This file was deleted.

Loading

0 comments on commit a6f2f3a

Please sign in to comment.