-
Notifications
You must be signed in to change notification settings - Fork 15
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/gnosis vault #188
Draft
RedVeil
wants to merge
79
commits into
main
Choose a base branch
from
feat/GnosisVault
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Feat/gnosis vault #188
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feat/gnosis vault
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
Fix/gnosis audit
Integrate async redeem in router
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To faciliate the fast changing needs of DeFi we create a vault that can grow with us into any direction we require. The goal is to create a vault that has absolute flexibility of what protocols to interact with and how but still remains easy to manage and save us on developing new strategies for each protocol out there.
For users the vault abstracts away the complexity of interacting with multiple protocols and allows them to deposit and withdraw with a single interface. They wont need to chase new protocols or rebalance as all this complexity is abstracted away.
Architecture
The main contract is the
OracleVault
which uses a Gnosis-Safe
to hold and manage assets. We use aPushOracle
to keep track of the value of the assets held in theSafe
and set the price of the vault shares.The
OracleVault
follows the ERC7540 standard. Deposits are instantaneous but withdrawals are processed asynchronously.The
PushOracle
is controlled by theOracleVaultController
which has permissionedkeepers
to update the price of thePushOracle
. Price updates are expected to happen in regular intervals. If a price update is significantly larger/smaller than the previous price we will update the price but pause the vault immediately to prevent any losses. The same goes for a drawdown from the latest high water mark. This ensures that price manipulations or temporary issues wont lead to a loss of funds for the vault or user.The
Safe
is controlled bymanagers
which can either be bots, ai agents or humans. All transactions are verified by aTransactionGuard
-module and we have a seprateSafeController
-module to remove malicious or inactive managers and even liquidate theSafe
if needed. TheTransactionGuard
allows us to allow which contracts and functionsmanagers
can call. Later we will also add limits and decode and sanitize calls to increase security further.TransactionGuard
andSafeController
both use a hook pattern to allow us to update and add additional functionality later.Sequence Diagrams
Deposit Flow
Withdraw Flow
Scope
At this point we expect the manager to be a trusted permissioned actor which is why we wont include any contracts of the
SafeController
-module just yet.For
TransactionGuard
we use theScopeGuard
-module by zodiac which has been extensively tested and is battle tested. https://github.com/gnosisguild/zodiac-guard-scope/tree/mainKnown Issues / Security Considerations
A lot of the security assumptions come down to proper configuration and key management / operational security.
A malicious owner of the
OracleVaultController
orTransactionGuard
can rug the vault and the users funds. So we need to ensure the highest level of security to keep access to the keys as limited and safe as possible.Additionally a poorly set up
TransactionGuard
can lead to a rug pull of the vault. Verifiying and maybe even auditing the deployment is crucial here.Idle
managers
can also stale the withdrawal process since they will need to process and fulfill withdrawals. To incentivise fulfilling we can configure awithdrawalIncentive
which will be paid out to the manager that fulfills the withdrawal.Lastly
setLimits
on theAsyncVault
can lock user deposits if set too high. This can lead to a situation where a user cannot withdraw their funds even though they deposited successfully. E.g. If there wasnt aminAmount
initially and we set theminAmount
to a value lower than the deposit amount of certain users they wont be able to withdraw without adding more funds to the vault which might not be possible.