-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add proxies as named accounts, check if they exist before deploying t…
…hem in migrations, refactor associated files (having added Prettier config for JS files)
- Loading branch information
Marccio Silva
committed
Aug 26, 2021
1 parent
0e895d9
commit 62a0a94
Showing
7 changed files
with
492 additions
and
388 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"overrides": [ | ||
{ | ||
"files": "*.sol", | ||
"options": { | ||
"printWidth": 80, | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"singleQuote": false, | ||
"bracketSpacing": false, | ||
"explicitTypes": "always" | ||
} | ||
}, | ||
{ | ||
"files": "*.js", | ||
"options": { | ||
"parser": "json5", | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false | ||
} | ||
} | ||
] | ||
} |
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,43 +1,40 @@ | ||
module.exports = async function ({getNamedAccounts, deployments, network}) { // HardhatRuntimeEnvironment | ||
const {deployer, multiSig, proxyAdmin} = await getNamedAccounts() | ||
const {deploy, log} = deployments | ||
module.exports = async function({ getNamedAccounts, deployments, network }) { // HardhatRuntimeEnvironment | ||
const { deployer, multiSig, proxyAdmin, bridgeProxy } = await getNamedAccounts(); | ||
const { deploy, log } = deployments; | ||
|
||
let symbol = 'e'; | ||
if(network.name == 'rskregtest' || network.name == 'rsktestnet' || network.name == 'rskmainnet') | ||
symbol = 'r' | ||
if (!bridgeProxy) { | ||
let symbol = "e"; | ||
if (network.name === "rskregtest" || network.name === "rsktestnet" || network.name === "rskmainnet") { | ||
symbol = "r"; | ||
} | ||
|
||
const MultiSigWallet = await deployments.get('MultiSigWallet'); | ||
const ProxyAdmin = await deployments.get('ProxyAdmin'); | ||
const Federation_old = await deployments.get('Federation_old'); | ||
const AllowTokens_old = await deployments.get('AllowTokens_old'); | ||
const SideTokenFactory_old = await deployments.get('SideTokenFactory_old'); | ||
const MultiSigWallet = await deployments.get("MultiSigWallet"); | ||
const ProxyAdmin = await deployments.get("ProxyAdmin"); | ||
const Federation_old = await deployments.get("Federation_old"); | ||
const AllowTokens_old = await deployments.get("AllowTokens_old"); | ||
const SideTokenFactory_old = await deployments.get("SideTokenFactory_old"); | ||
|
||
const Bridge_old = await deployments.get('Bridge_old'); | ||
const Bridge_old = await deployments.get("Bridge_old"); | ||
const bridge = new web3.eth.Contract(Bridge_old.abi, Bridge_old.address); | ||
const methodCall = bridge.methods.initialize( | ||
multiSig ?? MultiSigWallet.address, | ||
Federation_old.address, | ||
AllowTokens_old.address, | ||
SideTokenFactory_old.address, | ||
symbol | ||
multiSig ?? MultiSigWallet.address, | ||
Federation_old.address, | ||
AllowTokens_old.address, | ||
SideTokenFactory_old.address, | ||
symbol | ||
); | ||
await methodCall.call({ from: deployer }) | ||
await methodCall.call({ from: deployer }); | ||
|
||
const deployProxyResult = await deploy('BridgeProxy', { | ||
from: deployer, | ||
args: [ | ||
Bridge_old.address, | ||
proxyAdmin ?? ProxyAdmin.address, | ||
methodCall.encodeABI() | ||
], | ||
log: true, | ||
const deployProxyResult = await deploy("BridgeProxy", { | ||
from: deployer, | ||
args: [Bridge_old.address, proxyAdmin ?? ProxyAdmin.address, methodCall.encodeABI()], | ||
log: true | ||
}); | ||
if (deployProxyResult.newlyDeployed) { | ||
log( | ||
`Contract BridgeProxy deployed at ${deployProxyResult.address} using ${deployProxyResult.receipt.gasUsed.toString()} gas` | ||
); | ||
log(`Contract BridgeProxy deployed at ${deployProxyResult.address} using ${deployProxyResult.receipt.gasUsed.toString()} gas`); | ||
} | ||
} | ||
}; | ||
module.exports.id = 'deploy_bridgeProxy'; // id required to prevent reexecution | ||
module.exports.tags = ['BridgeProxy', 'old']; | ||
module.exports.dependencies = ['Bridge_old', 'MultiSigWallet', 'ProxyAdmin','Federation_old', 'AllowTokens_old', 'SideTokenFactory_old']; | ||
module.exports.id = "deploy_bridgeProxy"; // id required to prevent reexecution | ||
module.exports.tags = ["BridgeProxy", "old"]; | ||
module.exports.dependencies = ["Bridge_old", "MultiSigWallet", "ProxyAdmin", "Federation_old", "AllowTokens_old", "SideTokenFactory_old"]; |
Oops, something went wrong.