Skip to content

Commit

Permalink
implement immunefi improvements (#131)
Browse files Browse the repository at this point in the history
* implement immunefi improvements

* add codeowners
  • Loading branch information
andresaiello authored Nov 14, 2023
1 parent b418a4d commit 3a19731
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @andresaiello @fadeev @lucas-janon
13 changes: 11 additions & 2 deletions packages/zevm-app-contracts/contracts/disperse/Disperse.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ import "@openzeppelin/contracts/interfaces/IERC20.sol";

contract Disperse {
function disperseEther(address[] calldata recipients, uint256[] calldata values) external payable {
for (uint256 i = 0; i < recipients.length; i++) payable(recipients[i]).transfer(values[i]);
require(recipients.length == values.length, "Recipients and values length mismatch");

for (uint256 i = 0; i < recipients.length; i++) {
(bool sent, ) = payable(recipients[i]).call{value: values[i]}("");
require(sent, "Failed to send Ether");
}

uint256 balance = address(this).balance;
if (balance > 0) payable(msg.sender).transfer(balance);
if (balance > 0) {
(bool sent, ) = payable(msg.sender).call{value: balance}("");
require(sent, "Failed to refund remaining Ether");
}
}

function disperseToken(IERC20 token, address[] calldata recipients, uint256[] calldata values) external {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ contract RewardDistributor is StakingRewards {

function _addLiquidity(uint256 tokenAmountA, uint256 tokenAmountB) internal returns (uint256) {
stakingTokenA.transferFrom(msg.sender, address(this), tokenAmountA);
stakingTokenA.approve(systemContract.uniswapv2Router02Address(), 0);
stakingTokenA.approve(systemContract.uniswapv2Router02Address(), tokenAmountA);

stakingTokenB.transferFrom(msg.sender, address(this), tokenAmountB);
Expand Down

0 comments on commit 3a19731

Please sign in to comment.