-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[don't pull]add deployer with enhancedStepsReserve #1050
Draft
ducquangkstn
wants to merge
1
commit into
master
Choose a base branch
from
addEnhancedOpenData-deployment
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -43,3 +43,5 @@ jspm_packages | |
.DS_Store | ||
|
||
report | ||
|
||
.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
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,15 @@ | ||
|
||
# Step to deploy reserve: | ||
### Tranditional way: | ||
- config the .env variable *PRIVATE_KEY* | ||
- run command | ||
``` | ||
node web3deployment/reserveDeploy/fpr/enhancedStepsDeployer2.js --rpcUrl https://ropsten.infura.io/v3/YOUR_INFURA_ID --gas-price-gwei 5 | ||
``` | ||
|
||
### Buidler way: | ||
- config the .env varialbe *PRIVATE_KEY* and *INFURA_API_KEY* | ||
- run command | ||
``` | ||
npx buidler run --no-compile --network ropsten web3deployment/reserveDeploy/fpr/enhancedStepsDeployer.js | ||
``` |
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; | ||
let conversionRate; | ||
let conversionRateAddr; | ||
let wrapper; | ||
let wrapperAddr; | ||
|
||
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(2).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); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plan is to send funds to this address?
if so how to return back remaining funds when done?
have private key?
consider saving it locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you set the network is ropsten in the script, accounts[0] will be the address from the privatekey in .env file