-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fixed mint bug and small improvements #18
Changes from 4 commits
cd57f10
3bf3632
86315e4
c09913e
292131f
7f08fc0
19c1908
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,5 @@ artifacts | |
cache | ||
coverage* | ||
gasReporterOutput.json | ||
typechain | ||
typechain-types |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,11 @@ contract Stargate is UUPSUpgradeable, StrategyOwnablePausableBaseUpgradeable { | |
|
||
// solhint-disable-next-line const-name-snakecase | ||
string public constant name = | ||
"brokkr.stargate_strategy.stargate_strategy_v1.0.0"; | ||
"brokkr.stargate_strategy.stargate_strategy_v1.0.1"; | ||
// solhint-disable-next-line const-name-snakecase | ||
string public constant humanReadableName = "Stargate Strategy"; | ||
// solhint-disable-next-line const-name-snakecase | ||
string public constant version = "1.0.0"; | ||
string public constant version = "1.0.1"; | ||
|
||
/// @custom:oz-upgrades-unsafe-allow constructor | ||
constructor() { | ||
|
@@ -90,7 +90,7 @@ contract Stargate is UUPSUpgradeable, StrategyOwnablePausableBaseUpgradeable { | |
uint256 lpBalanceBefore = strategyStorage.lpToken.balanceOf( | ||
address(this) | ||
); | ||
strategyStorage.poolDepositToken.approve( | ||
strategyStorage.poolDepositToken.safeApprove( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is deprecated. What is point of using this one? They recommend to use safe increase/decrease allowance. Or we can set it to 0 afterward. (approve(100), deposit(100), approve(0)). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We don't need to approve(0) at the end, as deposit will set the approval back to 0 (by calling transferFrom internally)
Let's talk about this offline and find a way on how to handle approve in the future. After we found a solution, I will change it to the right one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. most ERC20 approve can never fail btw, so we might also just check those tokens and then we can use approve There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the explanation. approve(0) was safety guard but you can ignore this. |
||
address(strategyStorage.router), | ||
amount | ||
); | ||
|
@@ -105,7 +105,7 @@ contract Stargate is UUPSUpgradeable, StrategyOwnablePausableBaseUpgradeable { | |
|
||
uint256 lpBalanceIncrement = lpBalanceAfter - lpBalanceBefore; | ||
|
||
strategyStorage.lpToken.approve( | ||
strategyStorage.lpToken.safeApprove( | ||
address(strategyStorage.lpStaking), | ||
lpBalanceIncrement | ||
); | ||
|
@@ -170,7 +170,6 @@ contract Stargate is UUPSUpgradeable, StrategyOwnablePausableBaseUpgradeable { | |
|
||
address[] memory path = new address[](3); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixing this... |
||
path[0] = address(strategyStorage.stgToken); | ||
path[1] = address(InvestableLib.WAVAX); | ||
path[2] = address(depositToken); | ||
|
||
swapExactTokensForTokens( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ contract TraderJoeV2 is | |
{ | ||
using SafeERC20Upgradeable for IInvestmentToken; | ||
using SafeERC20Upgradeable for IERC20Upgradeable; | ||
using SafeERC20Upgradeable for ITraderJoePair; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line is not added to TraderJoe.sol. |
||
|
||
error InvalidTraderJoeLpToken(); | ||
|
||
|
@@ -97,11 +98,11 @@ contract TraderJoeV2 is | |
); | ||
uint256 depositTokenDesired = amount - swapAmount; | ||
|
||
strategyStorage.pairDepositToken.approve( | ||
strategyStorage.pairDepositToken.safeApprove( | ||
address(strategyStorage.router), | ||
pairDepositTokenDesired | ||
); | ||
depositToken.approve( | ||
depositToken.safeApprove( | ||
address(strategyStorage.router), | ||
depositTokenDesired | ||
); | ||
|
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.
We're not block42 anymore.
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.
true, but we are going to move away from brokkr soon as part of the rebranding
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.
We're Brokkr at the moment. When we decide to change our name to something else, then all names should be changed accordingly. Possibility of name change doesn't mean that it's okay to use wrong company name. It can confuse users as well. What is the benefit of using wrong company name?
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.
changed it, as according to Paul rebranding might take long time