Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

CoinAlpha/basket-protocol

Repository files navigation

Basket Protocol

Build Status Coverage Status

A new paradigm for asset management

The Basket protocol establishes a decentralized ecosystem that trustlessly fulfills the primary functions of asset management: selection, execution, and custody. A Basket is a wallet-like instrument that contains a portfolio of digital assets. Unlike a fund, the owner of the Basket has full control and agency of the digital assets that it contains.

Roles in the Basket Protocol Ecosystem

The Basket Protocol deconstructs the traditional asset management model into three functional roles, allowing for specialization, efficiency, and decentralization. Market participants can act in any or all capacities. Meanwhile, the protocol's registry capabilities facilitate the evaluation of and tracking of baskets as well as of the arrangers that created them.

  • Arranger: creates a new basket contract by specifying the composition of tokens and their weights that the basket tokens should contain
  • Supplier: accumulates ERC20 tokens for compiling into baskets and "minting" of basket tokens
  • Buyer: the ultimate holder of the basket token, who owns and controls the basket tokens and the underlying ERC20 tokens they represent

Basket Protocol Contract Suite

Basket Contract

The fundamental building block of the Basket Protocol, a Basket Contract is an extended ERC20 token contract capable of holding and transacting in other ERC20 tokens. In addition to the basic ERC20 token specifications, the basket contract adds the following functionality:

// Deposit ERC20 tokens into the basket contract and "mint" new Basket ERC20
// tokens that represent the underlying tokens
function depositAndBundle(uint _quantity) public payable returns (bool success)
// Extract the underlying ERC20 tokens and "burning" the Basket token
function debundleAndWithdraw(uint _quantity) public returns (bool success)

A holder of a basket token issued by a Basket Contract has direct control over and agency of the underlying ERC20 tokens represented by the basket token. The Basket Contract ensures that the tokens represented by a basket token are always held by the Basket Contract, readily available for any holder who wants to debundle and assume direct ownership of the underlying tokens, at any time.

Basket Factory

Contract that allows Arrangers to construct new ERC20 token portfolios by creating new Basket Contracts. When constructing new baskets, Arrangers specify tokens and weights, creating a "template" for minting new Basket tokens from that basket.

Basket Registry

A registry to keep track of baskets created, quantity of each basket minted and burned, as well as usage of a particular arranger's baskets.

Basket Escrow

Allows for users to create buy and sell orders for baskets, fill orders, and transact in Ether.

Coding Guides

Solidity Compiler

The basket protocol uses Solidity 0.4.21.

  • Introduces "emit LogEvent" syntax
  • Note on 0.4.22: compiler version has been downgraded to 0.4.21 due to potential errors related to ERC20 tokens introduced in 0.4.22 (read more)

Testing

$ truffle install -g truffe@4.1.5
Truffle v4.1.5 (core: 4.1.5)
Solidity v0.4.21 (solc-js)

Run test

$ npm test

Running test coverage (solidity-coverage)

# Requires environment variable TEST_COVERAGE=true, which is set in the npm script:
npm run coverage

Deployed Contracts: Ropsten Testnet

We have currently deployed a testnet version of the protocol on Ropsten Ethereum.

Testnet ERC20 Tokens

Basket Factory

Basket Registry

Basket Escrow

Security

The CoinAlpha team, to the extent possible, aims to follow industry best practices and keep up to date with the rapidly developing field of smart contracts and blockchain engineering. Some of the guides and best practices followed include:

Hosho Security Audit

Hosho Audited

  • In July 2018, we hired Hosho, a global leader in blockchain security.
  • Our protocol passed Hosho's comprehensive audit. The full report can be found here: Hosho Security Audit Report.

🐞 Bug Bounty Program

We are also running a bug bounty program. If you find a security issue, please email dev@coinalpha.com. For more information on the Bug Bounty program, click here: Basket Protocol Bug Bounty Program

Contributions Are Welcome!

We welcome code contributions (via pull requests) as well as bug reports and feature requests through github issues. You may also contact us by email.

Contact

The Basket Protocol was created by CoinAlpha. You can contact us at dev@coinalpha.com.

License

Code released under the Apache-2.0 License.

About

A trust-less, non-custodial asset management protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published