-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from pods-finance/develop
Deployment scripts
- Loading branch information
Showing
37 changed files
with
431 additions
and
393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,38 @@ | ||
const saveJSON = require('../utils/saveJSON') | ||
const verifyContract = require('../utils/verify') | ||
|
||
task('deployConfigurationManager', 'Deploy a new instance of ConfigurationManager + Emergency + Cap and link them') | ||
.addFlag('verify', 'if true, it should verify the contract after the deployment') | ||
.setAction(async ({ verify }, hre) => { | ||
hre.run('compile') | ||
console.log('----Start Deploy ConfiguratorManager + Emergency + Cap----') | ||
|
||
const [ConfigurationManager, EmergencyStop, CapProvider] = await Promise.all([ | ||
ethers.getContractFactory('ConfigurationManager'), | ||
ethers.getContractFactory('EmergencyStop'), | ||
ethers.getContractFactory('CapProvider') | ||
]) | ||
|
||
const configurationManager = await ConfigurationManager.deploy() | ||
await configurationManager.deployed() | ||
const configurationManagerAddress = configurationManager.address | ||
console.log('configurationManager Address', configurationManager.address) | ||
const configurationManagerAddress = await hre.run('deploy', { | ||
name: 'ConfigurationManager', | ||
save: true, | ||
verify | ||
}) | ||
|
||
const emergencyStop = await EmergencyStop.deploy() | ||
await emergencyStop.deployed() | ||
console.log('emergencyStop Address', emergencyStop.address) | ||
const emergencyStopAddress = await hre.run('deploy', { | ||
name: 'EmergencyStop', | ||
save: true, | ||
verify | ||
}) | ||
|
||
await hre.run('linkConfigurationManager', { | ||
address: configurationManagerAddress, | ||
setter: 'setEmergencyStop', | ||
newContract: emergencyStop.address | ||
newContract: emergencyStopAddress | ||
}) | ||
|
||
const capProvider = await CapProvider.deploy() | ||
await capProvider.deployed() | ||
console.log('capProvider Address', capProvider.address) | ||
const capProviderAddress = await hre.run('deploy', { | ||
name: 'CapProvider', | ||
save: true, | ||
verify | ||
}) | ||
|
||
await hre.run('linkConfigurationManager', { | ||
address: configurationManagerAddress, | ||
setter: 'setCapProvider', | ||
newContract: capProvider.address | ||
newContract: capProviderAddress | ||
}) | ||
|
||
const saveObj = { | ||
ConfigurationManager: configurationManager.address, | ||
EmergencyStop: emergencyStop.address, | ||
CapProvider: capProvider.address | ||
} | ||
|
||
await saveJSON(`../../deployments/${hre.network.name}.json`, saveObj) | ||
|
||
if (verify) { | ||
await verifyContract(hre, configurationManager.address) | ||
await verifyContract(hre, emergencyStop.address) | ||
await verifyContract(hre, capProvider.address) | ||
} | ||
|
||
console.log('----End Deploy ConfiguratorManager + Emergency + Cap----') | ||
return configurationManager.address | ||
return configurationManagerAddress | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
const saveJSON = require('./utils/saveJSON') | ||
const verifyContract = require('./utils/verify') | ||
const { getDeployments } = require('./utils/deployment') | ||
const validateAddress = require('./utils/validateAddress') | ||
|
||
task('deployOptionHelper', 'Deploy new option helper using provider') | ||
.addParam('configuration', 'Address of the factory to pass to initialize') | ||
.addOptionalParam('configuration', 'An address of a deployed ConfigurationManager, defaults to current `deployments` json file') | ||
.addFlag('verify', 'if true, it should verify the contract after the deployment') | ||
.setAction(async ({ configuration, verify }, hre) => { | ||
console.log('----Start Deploy OptionHelper----') | ||
const path = `../../deployments/${hre.network.name}.json` | ||
const OptionHelper = await ethers.getContractFactory('OptionHelper') | ||
const optionHelper = await OptionHelper.deploy(configuration) | ||
console.log('Option Helper Address: ', optionHelper.address) | ||
if (!configuration) { | ||
const deployment = getDeployments() | ||
configuration = deployment.ConfigurationManager | ||
} | ||
|
||
await saveJSON(path, { optionHelper: optionHelper.address }) | ||
validateAddress(configuration, 'configuration') | ||
|
||
if (verify) { | ||
await verifyContract(hre, optionHelper.address, [configuration]) | ||
} | ||
const address = await hre.run('deploy', { | ||
name: 'OptionHelper', | ||
args: [configuration], | ||
verify, | ||
save: true | ||
}) | ||
|
||
return optionHelper.address | ||
return address | ||
}) |
Oops, something went wrong.