You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 18, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+5-70
Original file line number
Diff line number
Diff line change
@@ -13,83 +13,18 @@ PLEASE NOTE that these contracts have not been extensively audited yet and are n
13
13
14
14
## Install and run the unit tests
15
15
16
-
1. Run npm install
16
+
1. Run yarn install
17
17
```
18
-
npm install
18
+
yarn install
19
19
```
20
20
21
21
2. Install [truffle](http://truffleframework.com/) and [test-rpc](https://github.com/ethereumjs/testrpc) globally
22
22
```
23
-
npm i -g ethereumjs-testrpc
24
-
npm install -g truffle
23
+
yarn global add ethereumjs-testrpc
24
+
yarn global add truffle
25
25
```
26
26
27
27
3. Run unit tests
28
28
```
29
-
truffle compile
30
-
truffle test
29
+
yarn run test
31
30
```
32
-
33
-
34
-
35
-
## Smart Contract
36
-
The {Set} contract has three functions, which are the constructor, issue, and redeem.
37
-
38
-
### Underwriting (constructor)
39
-
Underwriting is the process of creating a new {Set} contract. Anybody can create an Index Token by deploying a new {Set} contract that follows the {Set} specification to an Ethereum network. The constructor function is only called once during deployment. The required constructor parameters are below:
40
-
41
-
**Token Creation Parameters**
42
-
43
-
Parameter | Type | Description
44
-
------------ | ------------- | -------------
45
-
tokens | address[] | A list of ERC20 token addresses
46
-
units | uint[] | A list of quantities for each token
47
-
48
-
There are no restrictions to how many different ERC20 tokens can be included, aside from the transaction gas limit and data input limits. Since {Set}s are ERC20 tokens, {Set}s could be composed of other {Set}s. Deploying a {Set} creates a clean-slate contract with 0 tokens.
49
-
50
-
51
-
### Token Issuance (issue)
52
-
Token issuance is the process of generating new tokens from a {Set} Contract. Given the {Set} contract has been deployed, anybody can call the contract's `issue` function to convert a specified mix of ERC20 tokens into a token that represents its underlying parts. There only exists as many {Set} tokens as there are tokens issued less redemptions. The issue function parameters are:
1. Issuer decides the quantity of {Set} tokens to issue
68
-
2. Issuer calls Token A's `approve` function for the specified unit of Token A required multiplied by the quantity desired to issue
69
-
3. Issuer calls Token B's `approve` function for the specified unit of Token B required multiplied by the quantity desired to issue
70
-
4. Issue continues to call `approve` for the correct amount to all remaining tokens
71
-
5. Issuer calls the {Set} Contract's `issue` function with the desired quantity of Index Tokens to issue
72
-
6. The contract transfers the required quantities of tokens to the contracts. If any transfer is unsuccessful, the whole transaction is reverted.
73
-
7. If the previous step was sucessful, the contract increments the corresponding quantity of tokens to the issuer
74
-
75
-
76
-
### Token Redemption (redeem)
77
-
Token Redemption is the process of converting an Index Token into its underlying component tokens. Redeeming tokens reduces the token supply of {Set} tokens in the contract. The issue function parameters are:
78
-
79
-
**Redeem Function Parameters**
80
-
81
-
Parameter | Type | Description
82
-
------------ | ------------- | -------------
83
-
quantity | uint | The quantity of {Set}s to redeem
0 commit comments