Git Product home page Git Product logo

example-vault's Introduction

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.

example-vault's People

Contributors

shapeshed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.