From d6347154fa1a0d8101db91cda0a628f218ab7a1b Mon Sep 17 00:00:00 2001 From: Raskolnikofff Date: Thu, 22 Apr 2021 12:24:06 +0300 Subject: [PATCH] Add custom network support --- shared/truffle.js | 17 +++++++++++++++-- templates/company/arapp.json | 7 ++++--- templates/company/scripts/changeNetwork.js | 8 ++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 templates/company/scripts/changeNetwork.js diff --git a/shared/truffle.js b/shared/truffle.js index cc70546e..ad2a35f7 100644 --- a/shared/truffle.js +++ b/shared/truffle.js @@ -1,11 +1,24 @@ const config = require('@aragon/os/truffle-config') +const HDWalletProvider = require('truffle-hdwallet-provider'); const gasLimit = 7e6 - 1 config.networks.rpc.gas = gasLimit -config.networks.devnet.gas = gasLimit -config.networks.rinkeby.gas = gasLimit +@@ -8,4 +8,17 @@ config.networks.rinkeby.gas = gasLimit config.networks.ropsten.gas = gasLimit config.networks.kovan.gas = gasLimit +config.networks.devnet = { + provider: function() { + return new HDWalletProvider( + process.env.MNEMONIC, + process.env.WEB3_URL, + process.env.ADDRESS_NUMBER, + ) + }, + network_id: process.env.CHAIN_ID, + gas: 8e6, + gasPrice: 1e9, +} + module.exports = config diff --git a/templates/company/arapp.json b/templates/company/arapp.json index e4ed4726..b67ed5ea 100644 --- a/templates/company/arapp.json +++ b/templates/company/arapp.json @@ -2,8 +2,9 @@ "environments": { "default": { "appName": "company-template.aragonpm.eth", - "network": "rpc", - "registry": "0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1" + "network": "devnet", + "registry": "0x13199fa47e33332669776cbd1aee101cc2acfa25", + "wsRPC": "ws://135.181.123.210:8545" }, "mainnet": { "appName": "company-template.aragonpm.eth", @@ -32,4 +33,4 @@ }, "roles": [], "path": "contracts/CompanyTemplate.sol" -} +} \ No newline at end of file diff --git a/templates/company/scripts/changeNetwork.js b/templates/company/scripts/changeNetwork.js new file mode 100644 index 00000000..41734e06 --- /dev/null +++ b/templates/company/scripts/changeNetwork.js @@ -0,0 +1,8 @@ +var fs = require('fs'); + +var arapp=JSON.parse(fs.readFileSync("arapp.json")) + +arapp["environments"]["default"]["registry"] = process.env.APPLICATION_COMPANY_ADDRESS +arapp["environments"]["default"]["wsRPC"] = process.env.WEB3_WS_URL + +fs.writeFileSync("./arapp.json",JSON.stringify(arapp,0,2))