add gnosis chain with sushiswap, curve, and swapr strategies#187
add gnosis chain with sushiswap, curve, and swapr strategies#187amatureApe wants to merge 15 commits intomasterfrom
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.
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.
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.
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.
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.
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.
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.
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.
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.