-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add deployer with enhancedStepsReserve
- Loading branch information
1 parent
9928909
commit 6d3689f
Showing
6 changed files
with
98 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,5 @@ jspm_packages | |
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
.env |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ module.exports = { | |
version: "0.4.18", | ||
optimizer: { | ||
enabled: true, | ||
runs: 200 | ||
runs: 1000000 | ||
} | ||
}, | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
const KyberReserveHighRate = artifacts.require("KyberReserveHighRate.sol"); | ||
const ConversionRateEnhancedSteps = artifacts.require("ConversionRateEnhancedSteps.sol"); | ||
const WrapConversionRateEnhancedSteps = artifacts.require("WrapConversionRateEnhancedSteps.sol"); | ||
|
||
const BN = web3.utils.BN; | ||
|
||
let reserve; | ||
let reserveAddr = "0xad123f7Aa08B751e584E561F4d8f9ebf681530Ea"; | ||
let conversionRate; | ||
let conversionRateAddr = "0xEf17a9E8A12EdE9888803f53555573BFBC531A14"; | ||
let wrapper; | ||
let wrapperAddr = "0x49408B13A8D6814456d2a7ad0ce4882F2C6e2bf7"; | ||
|
||
let networkAddr = "0x920b322d4b8bab34fb6233646f5c87f87e79952b"; | ||
let admin= "0xf3D872b9E8d314820dc8E99DAfBe1A3FeEDc27D5"; | ||
let deployer; | ||
|
||
async function main() { | ||
const accounts = await web3.eth.getAccounts(); | ||
deployer = accounts[0]; | ||
console.log(`deployer address at ${deployer}`); | ||
|
||
gasPrice = new BN(75).mul(new BN(10).pow(new BN(9))) | ||
|
||
if(conversionRateAddr == undefined) { | ||
conversionRate = await ConversionRateEnhancedSteps.new(deployer, {gasPrice: gasPrice}); | ||
console.log(`deploy conversionRate at ${conversionRate.address}`); | ||
}else { | ||
conversionRate = await ConversionRateEnhancedSteps.at(conversionRateAddr); | ||
} | ||
|
||
if (reserveAddr == undefined){ | ||
reserve = await KyberReserveHighRate.new( | ||
networkAddr, | ||
conversionRate.address, | ||
deployer, | ||
{gasPrice: gasPrice} | ||
); | ||
console.log(`deploy reserve at ${reserve.address}`); | ||
reserveAddr = reserve.address; | ||
} else { | ||
reserve = await KyberReserveHighRate.at(reserveAddr); | ||
} | ||
|
||
if (wrapperAddr == undefined) { | ||
wrapper = await WrapConversionRateEnhancedSteps.new(conversionRate.address, {gasPrice:gasPrice}); | ||
console.log(`deploy wrapper at ${wrapper.address}`); | ||
wrapperAddr = wrapper.address; | ||
} else { | ||
wrapper = await WrapConversionRateEnhancedSteps.at(wrapperAddr); | ||
} | ||
|
||
if(await conversionRate.admin() != wrapperAddr) { | ||
console.log(`set conversionRate admin to wrapper contract`); | ||
await conversionRate.transferAdmin(wrapperAddr, {gasPrice: gasPrice}); | ||
await wrapper.claimWrappedContractAdmin({gasPrice: gasPrice}); | ||
} | ||
|
||
if(await reserve.admin() != admin) { | ||
console.log(`set new admin to reserve ${admin}`); | ||
await reserve.transferAdminQuickly(admin, {gasPrice: gasPrice}); | ||
} | ||
|
||
if(await wrapper.admin() != admin) { | ||
console.log(`set new admin to wrapper ${admin}`); | ||
await wrapper.transferAdminQuickly(admin, {gasPrice: gasPrice}); | ||
} | ||
} | ||
|
||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch(error => { | ||
console.error(error); | ||
process.exit(1); | ||
}); |