-
Notifications
You must be signed in to change notification settings - Fork 3
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 scLUSD strategy #77
Conversation
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.
suggested a couple of changes
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.
Left a few improvement suggestions. Also, we are doing only unit tests for this strategy, adding a few simple (happy path) fork tests would be nice.
stabilityPool.provideToSP(depositAmount, address(0)); | ||
} | ||
|
||
function harvest(uint256 _lqtyAmount, bytes calldata _lqtySwapData, uint256 _ethAmount, bytes calldata _ethSwapData) |
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.
there is no slippage control for the two potential swaps this function performs, consider adding "_amountOutMin" parameter and revert execution if the amount received is below min
// float is not allowed to be greater than 25% of the total | ||
// invested since liquidation rewards can be dilluted by savy | ||
// just-in-time depositors | ||
uint256 float = asset.balanceOf(address(this)); |
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.
asset.balanceOf(address(this))
is repeated multiple times in the contract, consider refactoring this as an internal function
function depositIntoStrategy() external { | ||
_depositIntoStrategy(); | ||
} | ||
|
||
function _depositIntoStrategy() internal { |
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.
having an external function to expose internal functionality without any added functionality seems unnecessary, consider changing the internal _depositIntoStrategy
to public
Co-authored-by: Fei Yang <fyang1024@gmail.com> Co-authored-by: brkomir <91959886+brkomir@users.noreply.github.com>
function _depositIntoStrategy() internal { | ||
uint256 float = asset.balanceOf(address(this)); | ||
uint256 targetFloat = totalAssets().mulWadDown(floatPercentage); | ||
|
||
if (float <= targetFloat) return; // nothing to invest | ||
|
||
uint256 depositAmount = float - targetFloat; | ||
|
||
// needed otherwise counted as profit during harvest | ||
totalInvested += depositAmount; | ||
|
||
stabilityPool.provideToSP(depositAmount, address(0)); | ||
|
||
emit DepositedIntoStrategy(depositAmount); | ||
} |
Check notice
Code scanning / Slither
Reentrancy vulnerabilities
scLUSD: Deposit LUSD which will be deposited into the Liquity Stability Pool. Recieve scLUSD shares which appreciate over time and can be redeemed for LUSD. A keeper bot regularly reinvests profits which consists of discounted ETH on liquidations and Liquity community issuance ($LQTY). Strategy has exposure to Liquity, 0x exchange routing protocol and a combination oracle consiting of Chainlink ETH/USD and the Chainlink LUSD/USD price feeds.