/bucket-program

Bucket protocol provides a way to wrap functionally isomorphic assets on Solana into one canonical token standard

Primary LanguageTypeScriptGNU Affero General Public License v3.0AGPL-3.0

bucket-program

Background courtesy of Henrique Malaguti on Unsplash

Note on Switchboard Integration: The Switchboard integration is currently implemented in a separate, non-main branch because we don't have a client to enable local testing.

We decided to keep a separate the integration in a separate branch since merging would cause tests to fail on localnet. However, we did test the integration on a deployed devnet program.

Moreover, the PR to merge Switchboard to main is here.

Description

Bucket aims to be a composable stablecoin by aggregating a diversified pool of stablecoins to increase decentralization and decrease single points of failure. In a world of abundant stablecoins, bucket strives to provide value in 2 ways: protocol-to-bucket and consumer-to-bucket. For a more in depth description, please visit our website. Bucket builds on top of a variety open source programs in the Solana ecosystem: Crate Protocol, Saber's stable swap, and more.

The team started this project at mtnDAO for Solana's Riptide Hackathon. We are in active development. For the latest updates, follow our journey:

Diagram of on-chain architecture.

Respository overview

  • cli/

    • Interact with the deployed bucket program via the CLI instead of the UI. There is 1-1 mapping between on-chain instructions and CLI commands. There are also some extra utility functions to help surface data currently stored on-chain, e.g. view bucket PDA attributes, see a user's parsed ATAs, etc.
  • programs/

    • Folder containing all on-chain programs. We only deploy the bucket-program program. The pyth program is purely for localnet testing since pyth's oracle price feeds are not available locally.
  • scripts/

    • Various bash scripts to make common actions easier such as setting up a dev environment, copying IDLs, deploying a program, etc.
  • sdk/

    • The package that allows you to easily interact with a deployed bucket program. There is a 1-1 mapping between SDK functions and on-chain instructions. The SDK is beneficial because it abstracts away a lot of complexity of finding addresses, building transactions, and more.
  • tests/

    • The directory containing code and helpers to test the end-to-end functionality of the bucket program. These tests are a great way to understand how the bucket program works + how to interact with the program.

Rust Crates

Custom

These rust crates are produced by running anchor build.

Package Description Version Docs
bucket-program Core bucket protocol pending pending

Dependencies

These rust crates are imported across this repo's programs' Cargo.toml files. Disclaimer: our programs do not necessarily the latest versions, as displayed in the table below. Check the Cargo.toml or Cargo.lock for specific crate versions.

Package Description Version Docs
anchor-spl CPI clients for SPL programs Crates.io Docs.rs
anchor-lang Solana Sealevel eDSL Crates.io Docs.rs
stable-swap-anchor Anchor bindings for the StableSwap Rust client Crates.io Docs.rs
crate-token Fractional ownership of a basket of assets Crates.io Docs.rs
vipers Assorted checks and validations for writing safer Solana programs Crates.io Docs.rs
pyth-client Pyth price oracle data structures and example usage crates Docs.rs
switchboard-v2 A Rust library to interact with Switchboard V2's hosted data feeds. crates Docs.rs

JavaScript/Web3.js

To interact with a deployed bucket from your own programa, use the JavaScript SDK.

You can install this package in your repo with the following command

npm i @bucket-program/sdk

Developing

Getting Started

Solana specific

You'll need to install a couple development tools if this is your first time developing on Solana. We recommend starting with the following getting started guides:

Other

By this point, you should have

If not, it doesn't hurt to install these now. Many projects ues these tools. You will also need ts-mocha installed globally to run our tests. You can install it via NPM like so:

npm i -g ts-mocha

You might need to run the above command with sudo prepended. Verify it's installed by running ts-mocha. You should see output like this:

Error: No test files found: "test"

Installation

We provide a simple script to install dependencies, build packages. Simply run

yarn setup

Troubleshooting

The respective projects' documentation sites and discords are a great place to start when troubleshooting issues.

Tests

Make sure you previously built the SDK and installed all relevant packages. Then, you can run all the tests with:

anchor test

Licensing

AGPL 3.0.