Register scheme to new DAO
You can deploy your new custom scheme contract and register it to the New DAO as part of initial scheme set using @daostack/migration
tool
Create DAO-spec¶
Add data/YourDaoSpec.json
file that describes the specifics of the DAO such as Name of Organization, Token name and symbol, initial set of scheme registered and founder members etc. You can refer to Deploy a DAO section for base dao-spec file
Add CustomSchemes
section with the details of your scheme as follows. Refer Example DAO spec
- name: Name of the contract file
- schemeName: Name of the scheme
- isUniversal: true or false, depending on which scheme you are registering
-
params: array of parameters to be passed to scheme contract's
initialize
(in-case of non-universal) orsetParameters
(in-case of universal) method. Please keep the order of parameters expected by the method in consideration- Include
{ "voteParams": X }
for voting machine parameters, where X is the index of param fromVotingMachinesParams
, that will be used to vote on proposals submitted to this scheme. "GenesisProtocolAddress"
will be converted to actual GenesisProtocol address. Include this if scheme uses Genesis Protocol as the voting machine and expects its Address as one of the parameter- Since each non-universal scheme is deployed per DAO and it is advisable to have the DAO address initialized the scheme, the migration tool expects first param to
initialize
method is DAO avatar address.
- Include
-
permissions: Include a 4 byte hex describing the permissions required by your new scheme
- 2nd bit: Scheme can register other schemes
- 3rd bit: Scheme can add/remove global constraints
- 4th bit: Scheme can upgrade the controller
- 5th bit: Scheme can call genericCall on behalf of
-
address (optional): If you have already deployed your scheme contract, then include its address here, else migration script will deploy this scheme
- alias (optional): include alias for what you will want your scheme to be referred as in subgraph
Example DAO spec file¶
Following is CommunityDaoSpec.json
using custom scheme designed in previous step for new Community DAO where people can buy reputation by donating money
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
Create DAO-deploy file¶
-
Create migration file to deploy your DAO. You will need
- node >= 10.16.0
- dotenv >=8.1.0
- @daostack/migration latest
-
Update
.env
file with following environment variables- CUSTOM_ABI_LOCATION: location of all your compiled contracts, eg.
contracts/build
- DAO_SPEC: path to
yourDaoSpec.json
file - DEFAULT_GAS: gas price for tx, eg. 3.0
- OUTPUT_FILE: full path of file where to store migration output, eg.
data/migration.json
- PRIVATE_KEY: key of the account you are using to deploy the DAO
- PROVIDER: url of the ethprovider, this could be infura or ganache
Example
1 2 3 4 5 6
CUSTOM_ABI_LOCATION='build/contracts' DAO_SPEC='../data/testDaoSpec.json' DEFAULT_GAS=3.0 OUTPUT_FILE='data/migration.json' PRIVATE_KEY='0x4f3edf983ac636a65a842ce7c78d9aa706d3b113bce9c46f30d7d21715b23b1d' PROVIDER='http://localhost:8545'
- CUSTOM_ABI_LOCATION: location of all your compiled contracts, eg.
-
Add/Update the
ops/deployDAO.js
, Refer Example deploy script
Example deploy script¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|