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
## Deploying the Solidity Smart Contracts via Truffle
2
2
3
-
`/migrations/2_deploy_contracts.js` contains the parameters needed to deploy the contracts. Please edit these params as you see fit.
3
+
### Running
4
+
5
+
A script in `/migrations/2_deploy_contracts.js` deploys the contracts to the specified network.
6
+
7
+
The script can be run with `npm run deploy`.
8
+
9
+
### Networks
10
+
11
+
By default, `npm run deploy` will deploy the contracts to the development network. To deploy to a different network run `npm run deploy -- --network {networkName}`, for example `npm run deploy -- --network ropsten`.
12
+
13
+
-`{networkName}` must exist as valid network in the `truffle.js` config file.
14
+
15
+
### Configuration
16
+
17
+
A configuration file in the `/migrations/deploy.config.js` contains the parameters needed to deploy the contracts. Please edit these params as you see fit.
4
18
5
19
```
6
-
const initialSupply = 1000000, // total supply of Graph Tokens at time of deployment
7
-
minimumCurationStakingAmount = 100, // minimum amount allowed to be staked by Market Curators
8
-
defaultReserveRatio = 500000, // reserve ratio (percent as PPM)
9
-
minimumIndexingStakingAmount = 100, // minimum amount allowed to be staked by Indexing Nodes
10
-
maximumIndexers = 10, // maximum number of Indexing Nodes staked higher than stake to consider
11
-
slashingPercentage = 10, // percent of stake to slash in successful dispute
12
-
thawingPeriod = 60 * 60 * 24 * 7, // amount of seconds to wait until indexer can finish stake logout
13
-
multiSigRequiredVote = 0, // votes required (setting a required amount here will override a formula used later)
14
-
multiSigOwners = [] // add addresses of the owners of the multisig contract here
15
-
```
20
+
const TOKEN_UNIT = new BN('10').pow(new BN('18'))
16
21
17
-
The `MultiSigWallet` contract is deployed first in order to retain its address for use in deploying the remaining contracts.
22
+
{
23
+
curation: {
24
+
reserveRatio: 500000,
25
+
minimumCurationStake: new BN('100').mul(TOKEN_UNIT),
26
+
withdrawalFeePercentage: 50000,
27
+
},
28
+
dispute: {
29
+
minimumDeposit: new BN('100').mul(TOKEN_UNIT),
30
+
fishermanRewardPercentage: 1000, // in basis points
31
+
slashingPercentage: 1000, // in basis points
32
+
},
33
+
epochs: {
34
+
lengthInBlocks: (24 * 60 * 60) / 15, // One day in blocks
35
+
},
36
+
staking: {
37
+
channelDisputeEpochs: 1,
38
+
maxAllocationEpochs: 5,
39
+
thawingPeriod: 20, // in blocks
40
+
},
41
+
token: {
42
+
initialSupply: new BN('10000000').mul(TOKEN_UNIT),
43
+
},
44
+
}
45
+
```
18
46
19
-
The `Staking` contract requires both the address of the `MultiSigWallet` and the `GraphToken`.
47
+
### Order of deployment
20
48
21
-
The order of deployment is as follows:
49
+
Due to some of the contracts require the address of other contracts, they are deployed in the following order:
22
50
23
-
1. Deploy MultiSigWallet contract
24
-
2. Deploy GraphToken Contract
25
-
3. Deploy all remaining contracts with the address of the MultiSigWallet, and in the case of the `Staking` contract, use the `GraphToken` address retained previously.
_[See ./contracts/README.md for full list of contracts](./contracts/)_
132
-
133
-
## Requirement and Implementation Annotations
134
-
135
-
Each contract includes docstring-like comments with requirements listed at the top of the file.
136
-
137
-
Example: `@req c01 Any User can stake Graph Tokens to be included as a Curator for a given subgraphId.`
138
-
139
-
Explanation: The `c01` denotes a section and number for the requirement. `c` in this case stands for `curation` and later in the contract we see `@req s01` used for a `staking` requirement.
140
-
141
-
Farther down in the code you should see annotations for the implementation of each requirement written as `@imp c01` (and so on). This is meant to be a simple way of defining and matching requirements and their implementations.
0 commit comments