Closed ttl33 closed 1 day ago
The update introduces enhanced functionality and refactoring in the vault management module. New constants and structures like VaultState
denote specific vault configurations. Updated methods now manage vault shares and validate transactions more accurately. The MintShares
function facilitates minting based on deposits, while ValidateWithdrawFromVault
ensures proper withdrawal validation. Comprehensive tests support these functionalities, ensuring robustness.
Files/Paths | Change Summary |
---|---|
protocol/testutil/constants/vault.go |
Added VaultState , renamed and added vault constants, and updated deposit constants. |
protocol/x/vault/keeper/deposit.go |
Introduced MintShares function in the Keeper struct to manage vault share minting. |
protocol/x/vault/keeper/withdraw.go |
Added ValidateWithdrawFromVault function in the Keeper struct for withdrawal validation. |
protocol/x/vault/keeper/withdraw_test.go |
Added test cases and utility functions to validate the new withdrawal functionalities and scenarios. |
sequenceDiagram
participant User
participant Vault
participant Keeper
User->>Vault: Request to Deposit Quantums
Vault->>Keeper: MintShares Request with Quantums
Keeper-->>Vault: Shares Minted Confirmation
Vault-->>User: Deposit Confirmation
User->>Vault: Request Withdrawal
Vault->>Keeper: ValidateWithdrawFromVault Request
Keeper-->>Vault: Validation Result
Vault-->>User: Withdrawal Result
In the vaults where treasures gleam,
Minted shares like dreams they seem.
Alice, Bob, they stake their claim,
Through code so robust, they play the game.
A rabbit’s joy, to see it done,
Vaults well-managed, dreams begun.
🐇✨
[!TIP]
Early access features: enabled
We are currently testing the following features in early access: - **OpenAI `gpt-4o` model for code reviews and chat**: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available. Note: - You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file. - Please join our [Discord Community](https://discord.com/invite/GsXnASn26c) to provide feedback and report issues. - OSS projects are currently opted into early access features by default.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Changelist
ValidateWithdrawFromVault
does stateful validations like 1) vault exists and 2) subaccount has shares in the vault and 3) owner shares > withdraw sharesValidateBasic
does stateless validations like 1) subaccount is valid format and 2) quote quantum is positive + uint64Test Plan
unit tests
Author/Reviewer Checklist
state-breaking
label.indexer-postgres-breaking
label.PrepareProposal
orProcessProposal
, manually add the labelproposal-breaking
.feature:[feature-name]
.backport/[branch-name]
.refactor
,chore
,bug
.Summary by CodeRabbit
New Features
VaultState
struct to manage vault details includingVaultId
,Equity
, andOwnerShares
.Bug Fixes
Tests