Skip to content

Commit

Permalink
restructured deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
aalavandhan committed Nov 2, 2021
1 parent 60f50f3 commit 4aa8b6e
Show file tree
Hide file tree
Showing 29 changed files with 790 additions and 624 deletions.
83 changes: 52 additions & 31 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require('@nomiclabs/hardhat-etherscan');
require('./tasks/deploy/ampleforth');
require('./tasks/deploy/chain_bridge');
require('./tasks/deploy/matic');
require('./tasks/deploy/arbitrum');
require('./tasks/deploy/rebase_reporter');

require('./tasks/ops/rebase');
Expand All @@ -26,94 +27,114 @@ module.exports = {
solidity: {
compilers: [
{
version: '0.4.24'
version: '0.4.24',
},
{
version: '0.7.6'
version: '0.5.12',
},
{
version: '0.6.4'
version: '0.6.4',
},
{
version: '0.6.8'
version: '0.6.8',
},
{
version: '0.5.12'
version: '0.6.11',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
{
version: '0.7.3',
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
}
]
runs: 200,
},
},
},
{
version: '0.7.6',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
mocha: {
timeout: 1000000
timeout: 1000000,
},
gasReporter: {
currency: 'USD',
enabled: !!process.env.REPORT_GAS,
excludeContracts: ['_mocks', '_external', 'uFragments'],
coinmarketcap: process.env.COINMARKETCAP_API_KEY
coinmarketcap: process.env.COINMARKETCAP_API_KEY,
},

etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY
apiKey: process.env.ETHERSCAN_API_KEY,
},

bscscan: {
apiKey: process.env.BSCSCAN_API_KEY
apiKey: process.env.BSCSCAN_API_KEY,
},

networks: {
localGethBaseChain: {
url: 'http://localhost:7545'
url: 'http://localhost:7545',
},
localGethSatChain1: {
url: 'http://localhost:7550'
url: 'http://localhost:7550',
},
localGethSatChain2: {
url: 'http://localhost:7555'
url: 'http://localhost:7555',
},

// meter-passport
dev1RopstenBaseChain: {
url: 'https://eth-ropsten.alchemyapi.io/v2/' + process.env.ALCHEMY_SECRET
url: 'https://eth-ropsten.alchemyapi.io/v2/' + process.env.ALCHEMY_SECRET,
},
dev1BscTestnetSatChain: {
url: 'https://data-seed-prebsc-1-s1.binance.org:8545'
url: 'https://data-seed-prebsc-1-s1.binance.org:8545',
},
dev1MeterTestnetSatChain: {
url: 'https://rpctest.meter.io'
url: 'https://rpctest.meter.io',
},

// matic
dev2GoerliBaseChain: {
url: 'https://eth-goerli.alchemyapi.io/v2/' + process.env.ALCHEMY_SECRET
url: 'https://eth-goerli.alchemyapi.io/v2/' + process.env.ALCHEMY_SECRET,
},
dev2MumbaiSatChain: {
url: 'https://polygon-mumbai.infura.io/v3/' + process.env.INFURA_SECRET
url: 'https://polygon-mumbai.infura.io/v3/' + process.env.INFURA_SECRET,
},

// arbitrum
dev3RinkebyBaseChain: {
url: 'https://eth-rinkeby.alchemyapi.io/v2/' + process.env.ALCHEMY_SECRET,
},
dev3RinkebyArbitrumSatChain: {
url: 'https://rinkeby.arbitrum.io/rpc',
},

// prod
prodEthereumBaseChain: {
url: 'https://mainnet.infura.io/v3/' + process.env.INFURA_SECRET
url: 'https://mainnet.infura.io/v3/' + process.env.INFURA_SECRET,
},
prodBscSatChain: {
url: 'https://bsc-dataseed.binance.org'
},
prodAvaxSatChain: {
url: 'https://api.avax.network/ext/bc/C/rpc'
url: 'https://bsc-dataseed.binance.org',
},
prodMeterSatChain: {
url: 'https://rpc.meter.io'
url: 'https://rpc.meter.io',
},
prodMaticSatChain: {
url: 'https://polygon-mainnet.infura.io/v3/' + process.env.INFURA_SECRET
}
}
url: 'https://polygon-mainnet.infura.io/v3/' + process.env.INFURA_SECRET,
},
},
};
18 changes: 12 additions & 6 deletions helpers/contracts.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const ContractABIPaths = {
UFragmentsPolicy: 'uFragments/contracts',
Orchestrator: 'uFragments/contracts',
MedianOracle: 'market-oracle/contracts',
UFragmentsTestnet: 'contracts/_test',

// Chainbridge
Bridge: 'chainbridge-solidity/contracts',
Expand Down Expand Up @@ -58,8 +59,9 @@ const deployContract = async (ethers, contractName, signer, args, txParams) => {
// console.log('Deploying', contractName);
const Factory = await getCompiledContractFactory(ethers, contractName);
const contract = await Factory.connect(signer).deploy(...args, txParams);
await contract.deployTransaction.wait();
// console.log('Deployed');
if (waitBlocks > 0) {
await contract.deployTransaction.wait(waitBlocks);
}
return contract;
};

Expand Down Expand Up @@ -88,8 +90,9 @@ const deployProxyContract = async (
initializerDef,
txParams,
);
await contract.deployTransaction.wait();
// console.log('Deployed');
if (waitBlocks > 0) {
await contract.deployTransaction.wait(waitBlocks);
}

const defaultProxyAdmin = ProxyAdminFactory.connect(signer).attach(
await getAdminAddress(signer.provider, contract.address),
Expand All @@ -99,7 +102,10 @@ const deployProxyContract = async (
newProxyAdmin.address,
txParams,
);
await refChangeTx.wait();

if (waitBlocks > 0) {
await refChangeTx.wait(waitBlocks);
}

return contract;
};
Expand Down Expand Up @@ -141,7 +147,7 @@ const upgradeProxyContract = async (
proxy.address,
Factory.connect(signer),
);
await sleep(180);
await sleep(30);
} else {
console.log(`CAUTION: Skpping storage layout verification!`);
const newImpl = await deployContract(
Expand Down
Loading

0 comments on commit 4aa8b6e

Please sign in to comment.