bskt

所属分类:区块链开发
开发工具:JavaScript
文件大小:27KB
下载次数:0
上传日期:2018-04-30 19:31:40
上 传 者sh-1993
说明:  用于创建去中心化代币投资组合的智能合约
(A smart contract for creating decentralized token portfolios)

文件列表:
.circleci (0, 2018-04-22)
.circleci\config.yml (923, 2018-04-22)
.solcover.js (263, 2018-04-22)
.soliumignore (12, 2018-04-22)
.soliumrc.json (193, 2018-04-22)
CODEOWNERS (16, 2018-04-22)
config-examples (0, 2018-04-22)
config-examples\deploy-config.example.js (416, 2018-04-22)
config-examples\secrets.ci.json (108, 2018-04-22)
config-examples\secrets.example.json (106, 2018-04-22)
contracts (0, 2018-04-22)
contracts\BsktToken.sol (9073, 2018-04-22)
contracts\Migrations.sol (555, 2018-04-22)
contracts\MultiSigWallet.sol (11536, 2018-04-22)
contracts\TokenA.sol (403, 2018-04-22)
contracts\TokenB.sol (403, 2018-04-22)
contracts\TokenC.sol (403, 2018-04-22)
migrations (0, 2018-04-22)
migrations\1_initial_migration.js (178, 2018-04-22)
migrations\2_deploy_contracts.js (3022, 2018-04-22)
package.json (2670, 2018-04-22)
scripts (0, 2018-04-22)
scripts\compile-contract.js (3048, 2018-04-22)
scripts\ganache-cli.sh (691, 2018-04-22)
scripts\generate-arguments.js (946, 2018-04-22)
scripts\generate-bytecode.js (1477, 2018-04-22)
test (0, 2018-04-22)
test\BsktToken.test.js (20658, 2018-04-22)
test\E2E.test.js (21672, 2018-04-22)
test\TestBsktToken.sol (3631, 2018-04-22)
test\constants.js (41, 2018-04-22)
test\helpers (0, 2018-04-22)
test\helpers\assertRevert.js (201, 2018-04-22)
test\utils.js (222, 2018-04-22)
truffle.js (1348, 2018-04-22)
... ...

# Bskt Bskt is a generic smart contract that creates decentralized token portfolios. Bskt facilitates the bundling and unbundling of a collection of ERC20 tokens in exchange for a new ERC20 token. Owners of the new token have a direct claim on the underlying tokens. Unlike traditional funds, custody is held by the smart contract. These new tokens can be created by anyone who surrenders the underlying tokens and redeemed by anyone who owns issued tokens. Bskt allows investors to diversify their exposure to tokens in the Ethereum ecosystem without adding custody risk. See the [whitepaper](https://github.com/cryptofinlabs/bskt-whitepaper) for more details. ## Usage The steps for creating and redeeming Bskts are outlined here. A dapp which abstracts most of this away will be available here. ### Create - Determine how many Bskt tokens to create - Acquire the underlying tokens tokens (usually bought on exchanges) - Call the ERC20 `approve` function for each underlying token, allowing the Bskt to access the appropriate amount of each token - Call the Bskt's create function - The Bskt contract uses the ERC20 `transferFrom` function which then mints Bskt tokens for the creator ### Redeem - Call the Bskt's redeem function - The Bskt contract burns the tokens and uses the ERC20 `transfer` function to transfer underlying tokens to the redeemer ## Documentation The main functions provided in this contract are detailed below. #### `BsktToken(address[] addresses, uint256[] quantities, uint256 _creationUnit, string _name, string _symbol)` Initializes contract with a list of ERC20 token addresses and corresponding minimum number of units required for a creation unit. #### `create(uint256 baseUnits)` Creates Bskt tokens in exchange for underlying tokens. Before calling, underlying tokens must be approved to be moved by the Bskt Token contract. The number of approved tokens required depends on baseUnits. The `baseUnits` must be a multiple of the `creationUnit`. #### `redeem(uint256 baseUnits, address[] tokensToSkip)` Redeems Bskt tokens in return for underlying tokens. The `baseUnits` must be a multiple of the `creationUnit`. ## Development ### Set up - Run: ``` # git clone npm run bootstrap ``` - Create a `config/secrets.json` file. The `config-examples/secrets.example.json` file is provided for reference. ### Test npm run test:js npm run test:sol npm run test:e2e ### Deploy (beta) - Create a `config/deploy-config.js` file. The `config-examples/deploy-config.example.js` file is provided for reference. truffle migrate --network ### Contact For questions, contact us hi@cryptofin.io

近期下载者

相关文件


收藏者