Skip to content
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

feat: LiquityV2 #419

Open
wants to merge 36 commits into
base: improvement/upgrade-hardhat
Choose a base branch
from
Open

feat: LiquityV2 #419

wants to merge 36 commits into from

Conversation

rajko-z
Copy link
Contributor

@rajko-z rajko-z commented Oct 11, 2024

This PR includes following contracts:

  • LiquityV2Open
  • LiquityV2Supply
  • LiquityV2Withdraw
  • LiquityV2Borrow
  • LiquityV2Payback
  • LiquityV2Claim
  • LiquityV2Adjust
  • LiquityV2AdjustZombieTrove
  • LiquityV2AdjustInterestRate
  • LiquityV2SPDeposit
  • LiquityV2SPWithdraw
  • LiquityV2SPClaimColl
  • LiquityV2View
  • LiquityV2RatioTrigger - automation
  • LiquityV2RatioCheck - automation
  • ShouldClosePriceTrigger - automation
  • SendTokensAndUnwrap - helper

Also, new strategies are introduced:

  • LiquityV2RepayStrategy
  • LiquityV2FLRepayStrategy
  • LiquityV2BoostStrategy
  • LiquityV2FLBoostStrategy
  • LiquityV2FLBoostWithCollStrategy
  • LiquityV2CloseToCollStrategy
  • LiquityV2FLCloseToCollStrategy
  • LiquityV2FLCloseToDebtStrategy

Things left to do:

  • Add natspec to all contracts
  • Double check if we have all the information in view contract and add something if necessary
  • Replace addresses once LiquityV2 is deployed
  • Check if new changes are introduced on liquity side, and update contracts if necessary
  • Update regular action tests with new addresses and mainnet forking
  • Update strategy tests for boost/repay

SDK PR: defisaver/defisaver-sdk#122
AUTOMATION SDK PR: defisaver/automation-sdk#26

@rajko-z rajko-z changed the title feat: add LiquityV2 actions feat: LiquityV2 Oct 11, 2024
@rajko-z rajko-z marked this pull request as ready for review October 21, 2024 06:06
@rajko-z rajko-z changed the base branch from main to improvement/upgrade-hardhat October 31, 2024 18:14
// when pulling max amount, we need to leave some WETH for gas compensation
if (isMaxPull) {
_params.collAmount = _collToken.pullTokensIfNeeded(_params.from, _params.collAmount);
if (_params.collAmount <= ETH_GAS_COMPENSATION) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this check as it's going to revert on the underflow either way, also if the amount is slightly bigger it's still going to revert because it's not going to be enough collateral for min_debt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s not necessary; it was more of a sanity check to communicate more explicitly to the caller that WETH compensation is required and that the max uint256 will account for this. It’s true that this would need to be significantly higher than just the WETH gas compensation amount to cover the debt on the Liquity side.

Copy link
Collaborator

@yippee-ki-yay yippee-ki-yay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good a few minor change requests, will take a second look when we're ready for deployment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants