Skip to content

Commit

Permalink
better tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricedesaxe committed Mar 9, 2022
1 parent edada1b commit 2342eda
Show file tree
Hide file tree
Showing 5 changed files with 357 additions and 23 deletions.
11 changes: 3 additions & 8 deletions contracts/OffsetHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ contract OffsetHelper is OffsetHelperStorage {
// Here is a link to the specific error from inside the safeTransferETH() method
// https://github.com/sushiswap/sushiswap/blob/canary/contracts/uniswapv2/libraries/TransferHelper.sol#L27

// TODO also, the swap method will send unused MATIC to OffsetHelper instead of to the user, need to adapt for that

// check eligibility of token to swap for
require(isRedeemable(_toToken), "Can't swap for this token");

Expand All @@ -169,12 +167,9 @@ contract OffsetHelper is OffsetHelperStorage {
path[2] = _toToken;

// swap MATIC for tokens
routerSushi.swapETHForExactTokens{value: msg.value}(
_amount,
path,
address(this),
block.timestamp
);
uint256[] memory amounts = routerSushi.swapETHForExactTokens{
value: msg.value
}(_amount, path, address(this), block.timestamp);

// update balances
balances[msg.sender][path[2]] += _amount;
Expand Down
139 changes: 131 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@openzeppelin/contracts": "^4.5.0",
"@openzeppelin/contracts-upgradeable": "^4.5.1",
"i": "^0.3.7",
"solc": "^0.8.12"
"solc": "^0.8.12",
"urql": "^2.2.0"
}
}
Loading

0 comments on commit 2342eda

Please sign in to comment.