-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add gnosis chain with sushiswap, curve, and swapr strategies #187
base: master
Are you sure you want to change the base?
Conversation
address[] memory rewardTokens = ISwaprRewarder(rewarder).getRewardTokens(); | ||
for (uint256 i = 0; i > rewardTokens.length; i++) { | ||
uint256 _rewardToken = IERC20(rewardTokens[i]).balanceOf(address(this)); | ||
if (rewardRoutes[rewardTokens[i]].length > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include _rewardToken > 0
in this condition
if (swapRoutes[token1].length > 1) { | ||
_swap(swaprRouter, swapRoutes[token1], _toToken1); | ||
if (gno == token0 || gno == token1) { | ||
if (_gno > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can bump up if (_gno > 0)
to outside this if/else block to cut down on a line of code
|
||
import "../strategy-swapr-base.sol"; | ||
|
||
contract StrategySwaprCowGnoLp is StrategySwaprFarmBase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Special characters such as $
are considered "illegal" in file names. Please remove all of them
_timelock | ||
) | ||
{ | ||
swapRoutes[gno] = [swapr, xdai, gno]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work given your Swapr base contract. What happens is that this enters the first if
block where it will only swap half of the GNO for COW, leaving the SWAPR untouched during the harvest. I think what you're looking for is:
rewardRoutes[swapr] = [swapr, xdai, gno]
{ | ||
rewardRoutes[swapr] = [swapr, xdai, gno]; | ||
rewardRoutes[cow] = [cow, gno]; | ||
rewardRoutes[gno] = [gno]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this, it will likely cause the AMM to throw an error.
_timelock | ||
) | ||
{ | ||
swapRoutes[gno] = [swapr, xdai, gno]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment above about rewardRoutes[swapr] = [swapr, xdai, gno]
uint256[] memory harvestableAmounts = ISwaprRewarder(rewarder).claimableRewards(address(this)); | ||
for (uint256 i = 0; i < harvestableAmounts.length; i++) { | ||
if (harvestableAmounts[i] > 0) { | ||
shouldClaimFirst = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add a break; here to pop out of the for loop after you found a claim and save gas.
if (activeRewardsTokens[i] == reward) { | ||
activeRewardsTokens[i] = activeRewardsTokens[activeRewardsTokens.length - 1]; | ||
delete activeRewardsTokens[activeRewardsTokens.length - 1]; | ||
activeRewardsTokens.pop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should have to delete the last element of the array AND pop it. Pop implicitly calls delete, so you would be deleting the last two elements of the array. See Pop definition here: https://docs.soliditylang.org/en/v0.5.4/types.html#array-members
No description provided.