diff --git a/.contracts.json b/.contracts.json index a975d12ea..2f1a3fe7a 100644 --- a/.contracts.json +++ b/.contracts.json @@ -10,7 +10,7 @@ "TokenVesting": "0x26A20D2585fbFb8D33c766a0E19555A666D42128" }, "rinkeby": { - "DecentralizedAutonomousTrust": "0xa700BdAba48A3D96219247111B0b708Dc0b51033", + "DecentralizedAutonomousTrust": "0x417A288152A5a13b843135Db5Dc72Ea007a9EB8d", "Multicall": "0xcCe9F2159F5bf387cc70D0cFcc05031558960674", "TokenVesting": "0x0000000000000000000000000000000000000000" } diff --git a/.env.development.example b/.env.development.example index b7d2a2641..67cfc0e9e 100644 --- a/.env.development.example +++ b/.env.development.example @@ -7,6 +7,10 @@ REACT_APP_ETH_NETWORKS=development,mainnet,kovan REACT_APP_KEY_MNEMONIC="" REACT_APP_KEY_INFURA_API_KEY="" +# Deployment variables +# DAT_CONTROLLER="0x..." +# NETWORK=rinkeby + # This variables are used for development, they are filled with the locally deployed contracts. # REACT_APP_MULTICALL_ADDRESS="0x..." # REACT_APP_DAT_ADDRESS="0x..." diff --git a/README.md b/README.md index 3f8afeafe..a393102c7 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,8 @@ To make the build of the dapp use the command `yarn run build`. It will create p ## Contracts Deployment -Before doing the build make sure to have the `REACT_APP_KEY_INFURA_API_KEY` in the `.env` file with balance in the index 0 account. -To deploy the contracts for production on live networks we suggest using the script `yarn run deploy-contracts`. -An example of the script to run for mainnet: `yarn run deploy-contracts --provider https://mainnet.infura.io/v3/xxxxxxxxxxxxxxxxxxxxxxxxx` -An example of the script to run for kovan: `yarn run deploy-contracts --network kovan --provider https://kovan.infura.io/v3/xxxxxxxxxxxxxxxxxxxxxxxxx` -The script will deploy everything with the configuration proposed in https://daotalk.org/t/configuration-template-for-fundraising-decentralized-application/1250 and approved in https://alchemy.daostack.io/dao/0x519b70055af55a007110b4ff99b0ea33071c720a/proposal/0xeb9cf2b3d76664dc1e983137f33b2400ad11966b1d79399d7ca55c25ad6283fa. +Before doing the build make sure to have the `REACT_APP_KEY_INFURA_API_KEY` in the `.env` file with balance in the index 0 account. You also have to set `DAT_CONTROLLER` and `NETWORK` values. +To deploy the contracts for production on live networks we suggest using the script `yarn deploy-contracts`. ## Governance diff --git a/package.json b/package.json index a651653e5..1b3ed365f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "start-dapp": "dotenv -e .env.production ./scripts/start.sh", "dev-dapp": "dotenv -e .env.development ./scripts/dev.sh", "build-dapp": "dotenv -e .env.production ./scripts/build.sh", - "deploy-contracts": "node scripts/deployContracts.js", + "deploy-contracts": "dotenv -e .env.development node scripts/deployContracts.js", "test-contracts": "./scripts/test-contracts.sh" }, "engines": { diff --git a/scripts/deployContracts.js b/scripts/deployContracts.js index 36af691a6..3f7b99d42 100644 --- a/scripts/deployContracts.js +++ b/scripts/deployContracts.js @@ -6,22 +6,17 @@ const fs = require('fs'); const args = process.argv; require('dotenv').config(); -// Get network to use from arguments -let network = 'mainnet', mnemonic, provider,controllerAccount, web3; -for (var i = 0; i < args.length; i++) { - if (args[i] == '--network') - network = args[i+1]; - if (args[i] == '--provider') - provider = args[i+1]; - if (args[i] == '--controller') - controllerAccount = args[i+1]; +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); } -if (!provider) throw('Not provider selected, --provider parameter missing'); -mnemonic = process.env.REACT_APP_KEY_MNEMONIC; +const network = process.env.NETWORK; +const controllerAccount = process.env.DAT_CONTROLLER; +const mnemonic = process.env.REACT_APP_KEY_MNEMONIC; +const httpProviderUrl = `https://${network}.infura.io/v3/${process.env.REACT_APP_KEY_INFURA_API_KEY}` -console.log('Running deploy on network', network, 'using http provider', provider) -const web3Provider = new HDWalletProvider(mnemonic, new Web3.providers.HttpProvider(provider), 0, 10); +console.log('Running deploy on network', network, 'using http provider', httpProviderUrl) +const web3Provider = new HDWalletProvider(mnemonic, new Web3.providers.HttpProvider(httpProviderUrl), 0, 10); web3 = new Web3(web3Provider) ZWeb3.initialize(web3.currentProvider); @@ -85,9 +80,7 @@ async function main() { console.log(`Using account: ${deployer}`, ' \n'); console.log(`Deploy DAT with config: ${JSON.stringify(deployOptions, null, 2)}`, ' \n'); - contracts.proxyAdmin = await ProxyAdmin.new({ - from: deployer - }); + contracts.proxyAdmin = await ProxyAdmin.new({ from: deployer }); console.log(`ProxyAdmin deployed ${contracts.proxyAdmin.address}`); contracts.datImplementation = await DATContract.new({ from: deployer, gas: 9000000 }) @@ -100,6 +93,7 @@ async function main() { [], // data { from: deployer } ); + await sleep(30000); contracts.dat = await DATContract.at(contracts.datProxy.address); console.log(`DAT proxy deployed ${contracts.datProxy.address}`); @@ -117,9 +111,7 @@ async function main() { // Deploy token vesting if (deployOptions.initReserve > 0) { - contracts.tokenVesting = await TokenVesting.new({ - from: deployer - }); + contracts.tokenVesting = await TokenVesting.new({ from: deployer }); await contracts.tokenVesting.methods.initialize( deployOptions.control, new moment().unix(), deployOptions.vestingCliff, deployOptions.vestingDuration, false, deployOptions.control diff --git a/src/config/contracts/rinkeby.json b/src/config/contracts/rinkeby.json index d290a9fb6..250706596 100644 --- a/src/config/contracts/rinkeby.json +++ b/src/config/contracts/rinkeby.json @@ -1,6 +1,6 @@ { "multicall": "0xcCe9F2159F5bf387cc70D0cFcc05031558960674", - "DAT": "0xa700BdAba48A3D96219247111B0b708Dc0b51033", + "DAT": "0x417A288152A5a13b843135Db5Dc72Ea007a9EB8d", "DATinfo": { "fromBlock": 8164325, "collateralType": "ETH", @@ -16,4 +16,4 @@ "revenueCommitmentBasisPoints": "1000", "minInvestment": "1000000000000000" } -} \ No newline at end of file +}