Skip to content

andromedaprotocol/andromeda-core

Repository files navigation

 

A monorepository containing all the contracts and packages related to Andromeda Protocol. Full documentation for all the contracts can be found here.

ADO Categories

The contracts are classified based on their functionality. Currently we have 8 different contract categories.

Category Description
app Contracts used for building Andromeda apps.
data-storage Contracts used to store any type of data (uint, string, bool ect...).
ecosystem Contracts that are allow interaction with different ecosystem protocols.
finance Contracts used by fungible tokens to perform defi operations.
fungible tokens Contracts that integrate with fungible tokens (CW-20 tokens).
non-fungible-tokens Contacts that integrate with non-funible toknes (NFTs). Includes a standard CW721 contract with some custom features.
modules Andromeda modules that are attached to other ADOs to extend functionality.
defunct Andromeda contracts that are no longer supported.

ADOs

Contract Category Description Documentation
andromeda-app-contract app Contract used to create Andromeda Apps. Gitbook
andromeda-factory app Contract used to save the code Ids of all Andromeda ADOs. Gitbook
andromeda-primitive data-storage Contract that stores any type of data that can be referenced by other ADOs. Gitbook
andromeda-vault ecosystem Contract that can receive and store funds. Acts as a central bank for projects. Gitbook
andromeda-rate-limiting-withdrawals finance Contract that puts restrictions on the withdrawal of funds by users. Gitbook
andromeda-splitter finance Contract used to split any sent funds amongst defined addresses. Gitbook
andromeda-timelock finance Contract used to store funds until a condition has been satisfied before being released, similar to Escrow. Gitbook
andromeda-vesting finance Contract used to custom vest tokens for a single recipient. Gitbook
andromeda-weighted-distribution-splitter finance Contract used to split any sent funds amongst defined addresses. Similar to the splitter but uses weights instead of percentages. Gitbook
andromeda-cw20 fungible tokens Contract to create standard cw-20 tokens. Gitbook
andromeda-cw20-staking fungible tokens Contract that allows the staking of cw-20 tokens for rewards. Gitbook
andromeda-lockdrop fungible tokens Contract that allows users to deposit a netive token in exchange for the project's cw-20 token Gitbook
andromeda-merkle-airdrop fungible tokens Contract used to perform a merkle airdrop on cw20-tokens Gitbook
andromeda-auction non-fungible-tokens Contract that can receive an NFT and run an auction on it. Gitbook
andromeda-crowdfund non-fungible-tokens Contracts used to perform a crowdfund by selling NFTs. Gitbook
andromeda-cw721 non-fungible-tokens Contract used to create cw-721 standard NFTs. Has a custom message that allows selling the NFTs. Gitbook
andromeda-cw721-staking non-fungible-tokens Contract that allows custom staking of NFTs. Gitbook
andromeda-gumball non-fungible-tokens Contract that allows users to pay a price to get a random NFT. Gitbook
andromeda-nft-timelock non-fungible-tokens Contract that locks an NFT for a certain period of time. Gitbook
andromeda-wrapped-cw721 non-fungible-tokens Contract that wraps an NFT and mints an Andromeda NFT that can leverage our custom messages and modules instead. The token can be unwrapped. Gitbook

Modules

Modules are smart contracts that can be added to other ADOs on instantiation to extend their functionality. The communication between ADOs and our modules is achieved using our custom Hooks. We currently have 4 modules:

Module Description Documentation
address-list A module used to whitelist/blacklist a list of addresses to interact with the ADO. Gitbook
rates A module used to add rates (taxes/royalties) on fund transfers Gitbook
cw721-bids Module that can be attached to the cw721 ADO as another way to buy and sell NFTs. Gitbook
receipts A module that can be attached to ADOs that saves the events of messages. Gitbook

Packages

Contract Description
andromeda_protocol Package used to define message types and various utility methods used by Andromeda ADO Contracts.

ADO Base

The packages also includes the ado_base. Since all our ADOs are built using the same architecture, redundency was inevitable. So we decided to bundle up all the functions/messages/structures that are used by all ADOs into the ado_base which can be referenced by any new ADOs.

Development

Testing

All tests can be run using:

cargo test --workspace

Building

All contracts and packages can be built by running the build script:

./build_all.sh

This will build all contract .wasm files in to the artifacts directory at the project root.

To build a single contract, you need to have wasm-opt Then run:

./build.sh [contract name] or ./build.sh [catogory name]

Examples:

./build.sh andromda vault to build the vault contract. or ./build.sh finance to build all contracts under the finance category.

They can also be chained to build multiple directories at the same time:

./build.sh andromeda_app non-fungible-tokens to build the app contract and all contracts under the non-fungible-tokens category.

Formatting

Make sure you run rustfmt before creating a PR to the repo. You need to install the nightly version of rustfmt.

rustup toolchain install nightly

To run rustfmt,

cargo fmt

Linting

You should run clippy also. This is a lint tool for rust. It suggests more efficient/readable code. You can see the clippy document for more information. You need to install nightly version of clippy.

Install

rustup toolchain install nightly

Run

cargo clippy --all --all-targets -- -D warnings

Creating and Interacting with ADOs

Andromeda is deployed on many of the Cosmos chains. Usually this will require you to set up an environment for each chain. Luckily, Andromeda has built the Andromeda CLI, an all in one tool to build, interact, and manage ADOs and wallets for any of the chains. The CLI documentation can be found here.

Licensing

Terms and Conditions