An example vault to demonstrate Vaultenator
git clone https://github.com/margined-protocol/example-vault.git
cd example-vault
rustup show
cargo wasm # compile contract
cargo test # run tests
This example vault showcases Vaultenator and offers a minimal implementation of the CosmWasm Vault Standard with a TokenFactory token used to represent a share of the vault. This example vault takes a deposit, issues a share token and holds the deposit on the contract.
Vaultenator is based on traits and this minimal vault implements some of these traits and uses the defaults for others. Implementers are free to add their own implementations of any of these traits should functionality differ.
Trait | Default? | Implementation |
---|---|---|
Administer |
Yes | |
Configure |
No | src/config.rs |
Describe |
No | src/describe.rs |
Handle |
No | src/handle.rs |
ManageState |
No | src/state.rs |
Own |
Yes | |
Query |
Yes | |
ReplyHandler |
Yes | |
Vaultenator |
Yes |
First add vaultenator to your existing cargo project
cargo add vaultenator
To create a vault using Vaultenator you will likely want to implement the following traits as a minimum. See this example vault as a guide.
Configure
- define a config struct and its managementState
- define a state struct and its managementHandle
- implementhandle_deposit
,handle_redeem
and any other handlers you want to implement.Describe
- this is metadata used by the CosmWasm Vault Standard.
Any test framework will work with Vaultenator but test-tube is recommended.
An example test suite is given in the ./tests
folder of this repo including
some useful helpers.