Skip to content

Commit

Permalink
Add missing prettier dependency, move prettier config to package.json…
Browse files Browse the repository at this point in the history
… for bridge JS files, reformat all files related to PR, use bridge proxy in 22_deploy_federation if available instead of deploying the contract
  • Loading branch information
Marccio Silva committed Aug 27, 2021
1 parent 62a0a94 commit 2d2b55f
Show file tree
Hide file tree
Showing 8 changed files with 470 additions and 261 deletions.
26 changes: 0 additions & 26 deletions bridge/.prettierrc.json

This file was deleted.

14 changes: 7 additions & 7 deletions bridge/deploy/01_deploy_multiSigWallet.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const { deploy1820 } = require("@thinkanddev/deploy-eip-1820-web3-rsk");
const {deploy1820} = require('@thinkanddev/deploy-eip-1820-web3-rsk');

module.exports = async function({ getNamedAccounts, deployments, network }) { // HardhatRuntimeEnvironment
const { deployer, multiSig } = await getNamedAccounts();
const { deploy, log } = deployments;
module.exports = async function({getNamedAccounts, deployments, network}) { // HardhatRuntimeEnvironment
const {deployer, multiSig} = await getNamedAccounts();
const {deploy, log} = deployments;

if (!multiSig) {
const deployResult = await deploy("MultiSigWallet", {
const deployResult = await deploy('MultiSigWallet', {
from: deployer,
args: [[deployer], 1],
log: true
Expand All @@ -21,5 +21,5 @@ module.exports = async function({ getNamedAccounts, deployments, network }) { //
await deploy1820(web3);
}
};
module.exports.id = "deploy_multiSigWallet"; // id required to prevent reexecution
module.exports.tags = ["MultiSigWallet"];
module.exports.id = 'deploy_multiSigWallet'; // id required to prevent re-execution
module.exports.tags = ['MultiSigWallet'];
20 changes: 10 additions & 10 deletions bridge/deploy/02_deploy_proxyAdmin.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module.exports = async function({ getNamedAccounts, deployments }) { // HardhatRuntimeEnvironment
const { deployer, multiSig, proxyAdmin } = await getNamedAccounts();
const { deploy, log, execute } = deployments;
module.exports = async function({getNamedAccounts, deployments}) { // HardhatRuntimeEnvironment
const {deployer, multiSig, proxyAdmin} = await getNamedAccounts();
const {deploy, log, execute} = deployments;

if (!proxyAdmin) {
const deployResult = await deploy("ProxyAdmin", {
const deployResult = await deploy('ProxyAdmin', {
from: deployer,
log: true,
log: true
});

if (deployResult.newlyDeployed) {
log(
`Contract ProxyAdmin deployed at ${deployResult.address} using ${deployResult.receipt.gasUsed.toString()} gas`
);
const MultiSigWallet = await deployments.get("MultiSigWallet");
await execute("ProxyAdmin", { from: deployer }, "transferOwnership", multiSig ?? MultiSigWallet.address);
const MultiSigWallet = await deployments.get('MultiSigWallet');
await execute('ProxyAdmin', {from: deployer}, 'transferOwnership', multiSig ?? MultiSigWallet.address);
log(`Transfered Ownership to MultiSig`);
}
}
};
module.exports.id = "deploy_proxyAdmin"; // id required to prevent reexecution
module.exports.tags = ["ProxyAdmin"];
module.exports.dependencies = ["MultiSigWallet"];
module.exports.id = 'deploy_proxyAdmin'; // id required to prevent reexecution
module.exports.tags = ['ProxyAdmin'];
module.exports.dependencies = ['MultiSigWallet'];
34 changes: 17 additions & 17 deletions bridge/deploy/08_deploy_bridgeProxy.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module.exports = async function({ getNamedAccounts, deployments, network }) { // HardhatRuntimeEnvironment
const { deployer, multiSig, proxyAdmin, bridgeProxy } = 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;

if (!bridgeProxy) {
let symbol = "e";
if (network.name === "rskregtest" || network.name === "rsktestnet" || network.name === "rskmainnet") {
symbol = "r";
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,
Expand All @@ -23,9 +23,9 @@ module.exports = async function({ getNamedAccounts, deployments, network }) { //
SideTokenFactory_old.address,
symbol
);
await methodCall.call({ from: deployer });
await methodCall.call({from: deployer});

const deployProxyResult = await deploy("BridgeProxy", {
const deployProxyResult = await deploy('BridgeProxy', {
from: deployer,
args: [Bridge_old.address, proxyAdmin ?? ProxyAdmin.address, methodCall.encodeABI()],
log: true
Expand All @@ -35,6 +35,6 @@ module.exports = async function({ getNamedAccounts, deployments, network }) { //
}
}
};
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'];
Loading

0 comments on commit 2d2b55f

Please sign in to comment.