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: vaults v2 #557

Merged
merged 106 commits into from
Mar 19, 2024
Merged

feat: vaults v2 #557

merged 106 commits into from
Mar 19, 2024

Conversation

nieldeckx
Copy link
Contributor

No description provided.

@nieldeckx nieldeckx changed the base branch from master to nd/cleanup-1 September 6, 2023 15:28
Copy link
Contributor

@philiphacks philiphacks left a comment

Choose a reason for hiding this comment

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

Reviewed this up to sorted vaults contract, will do a second round, perhaps some comments will be invalid once I see all the code

)

;; Get collateral amount info to use in liquidation
(define-public (get-collateral-for-liquidation (oracle <oracle-trait>) (token principal) (collateral uint) (debt uint))
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: I guess we cannot define this as read-only?

Copy link
Contributor

Choose a reason for hiding this comment

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

Q: do we need to check the oracle input param?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A: Overall there are still a lot of hardcoded contracts in the code. The goal is to replace them all by traits. I think once we replace .arkadiko-vaults-tokens-v1-1 by a trait, the function can not be read-only anymore?

;; Need hints to know where to insert vault in sorted list
(define-public (open-vault
(oracle <oracle-trait>)
(token <ft-trait>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: how is the token verified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A: See: (collateral-info (unwrap! (contract-call? .arkadiko-vaults-tokens-v1-1 get-token (contract-of token)) (err ERR_UNKNOWN_TOKEN)))

;; ---------------------------------------------------------

;; Deposit tokens to pool
(define-public (deposit (token <ft-trait>) (sender principal) (amount uint))
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Should we allow deposits & withdrawals on any token?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A: these methods are used by contracts only, which should check the token. (ex: open-vault on vaults-operations)

Copy link
Contributor

@philiphacks philiphacks left a comment

Choose a reason for hiding this comment

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

Did a second round, I need to dive deeper into the sorted logic, but costs may be a concern

--global and others added 14 commits February 2, 2024 15:26
* feat: implement vault v2 UI

* wip

* wip

* deploy contracts v2 script

* deps

* deploy migration contract

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* finish step 1

* wip

* wip

* fix PC

* fix vault overview

* overview

* vault positions

* feat: merge "Your positions" and "Start borrowing" sections (#561)

* feat: merge positions and start borrowing sections

* chore: cleanup

* misc: make vaults index page dynamic

* wip

* wip

* wip

* wip

* wip

* fix vault creation

* feat: vaults-v2 manage vault UI (#562)

* feat: vaults-v2 manage vault UI

* wip

---------

Co-authored-by: --global <--global>

* wip

* cleanup

* fix design

* fix: sort collateral types

* fix: numbers

* wip

* wip: stSTX colors

* wip

* fix: status indicators

* fix labels

* fix labels

* fix

* fix: price

* fix: collateral type xbtc

* do not launch with atALEXv2

* some colors

* misc: show convert to stSTX vault

* target _blank

* remove redemption fee

* fix css class

* fix css

* fix: dynamic token

* fix: todos

* fix: add stSTX prices

* add stSTX balance to UI

* wip

* fixes

* dynamic logo

* wip: vault mint

* cleanup

* wip: vault actions

* wip: vault actions

* wip: vault actions

* wip

* fix margin

* fix data

* wip: liquidation pool

* wip

* add liquidate vault script

* fix: wizard

* wip

* wip

* fix claims

* chore: update new testnet addy

* wip

* fix: make sure price is not 0

* chore: add mint fee

* chore: add script to set collateral token

* fix: loading screen for collateral

* fix: error handling with min 500 USDA

* fix: do not allow borrows when liquidity is not available

* fix: remove atALEX from unstake/stake fn

* fix: stSTX vault creation

* fix: tokenNameToTicker

* fix: take max debt into account when minting USDA

* fix: rounding

* fix: decimals for stSTX in UI

* wip: migrate stx vault

* chore: cleanup

* chore: cleanup

* fix: do not show authorized sections

* fix: vault mint usda 98%

* fix: use oracle v2-3

* fix: mint for protocol on xBTC

* guardian v3-1

* fix: set new testnet addy

* chore: set oracle prices

* fix: governance v4-2

* wip: mint from faucet

* fixes

* feat: add testnet prices

* fix: merge conflict

* fixes

* fix

* add testnet query param

* add testnet query param

* fixes

* fix: fetch real-time oracle prices for testnet

* fix: make minting max USDA more conservative

* cleanup

* fix: debt burn

* fix: more conservative collateral withdraw

* fix: warning shield

* feat: calculate min stability fee

* cleanup

* fixes

* fix: int for minting fee

* CSS fixes

* fix: use 6 blocks as minimum stability fee

* fixes

* feat: add stacker-payer-v3-9

* feat: add gov vote for upgrade

* use gov 4-2

* fix: set correct FE addresses

* fix: mainnet addresses on vaults-migration contract

* fix: remove unused migrate method

* add migration notice

* add migration notice (usda stake pool)

* fix: spacing

* Revert "fix: spacing"

This reverts commit 4feafe7.

* fix: spacing

---------

Co-authored-by: --global <--global>
Co-authored-by: Maxime Laforet <me@macx.im>
Co-authored-by: Niel Deckx <hello@nieldeckx.be>
@philiphacks philiphacks marked this pull request as ready for review March 18, 2024 21:20
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