Skip to content

margined-protocol/example-vault

Example vault

GitHub Actions CI Workflow Status GitHub Actions Build Workflow Status

An example vault to demonstrate Vaultenator

Installation

git clone https://github.com/margined-protocol/example-vault.git
cd example-vault
rustup show
cargo wasm # compile contract
cargo test # run tests

Overview

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

Using Vaultenator

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 management
  • State - define a state struct and its management
  • Handle - implement handle_deposit, handle_redeem and any other handlers you want to implement.
  • Describe - this is metadata used by the CosmWasm Vault Standard.

Testing

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.

About

An example vault to demonstrate Vaultenator, a crate for creating CosmWasm Standard Vaults

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Languages