diff --git a/bridge/deploy/01_deploy_multiSigWallet.js b/bridge/deploy/01_deploy_multiSigWallet.js index 99f2b3fc8..025ec1f0f 100644 --- a/bridge/deploy/01_deploy_multiSigWallet.js +++ b/bridge/deploy/01_deploy_multiSigWallet.js @@ -1,17 +1,14 @@ -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', { from: deployer, - args: [ - [deployer], - 1 - ], - log: true, + args: [[deployer], 1], + log: true }); if (deployResult.newlyDeployed) { @@ -23,6 +20,6 @@ module.exports = async function ({getNamedAccounts, deployments, network}) { // if (!network.live) { await deploy1820(web3); } -} -module.exports.id = 'deploy_multiSigWallet'; // id required to prevent reexecution +}; +module.exports.id = 'deploy_multiSigWallet'; // id required to prevent re-execution module.exports.tags = ['MultiSigWallet']; diff --git a/bridge/deploy/02_deploy_proxyAdmin.js b/bridge/deploy/02_deploy_proxyAdmin.js index c7496c692..0d43546dc 100644 --- a/bridge/deploy/02_deploy_proxyAdmin.js +++ b/bridge/deploy/02_deploy_proxyAdmin.js @@ -1,11 +1,11 @@ -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', { from: deployer, - log: true, + log: true }); if (deployResult.newlyDeployed) { @@ -14,9 +14,7 @@ module.exports = async function ({getNamedAccounts, deployments}) { // HardhatRu ); const MultiSigWallet = await deployments.get('MultiSigWallet'); await execute('ProxyAdmin', {from: deployer}, 'transferOwnership', multiSig ?? MultiSigWallet.address); - log( - `Transfered Ownership to MultiSig` - ); + log(`Transfered Ownership to MultiSig`); } } }; diff --git a/bridge/deploy/08_deploy_bridgeProxy.js b/bridge/deploy/08_deploy_bridgeProxy.js index 29d4d9b64..9276156af 100644 --- a/bridge/deploy/08_deploy_bridgeProxy.js +++ b/bridge/deploy/08_deploy_bridgeProxy.js @@ -1,10 +1,12 @@ -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; + if (!bridgeProxy) { let symbol = 'e'; - if(network.name == 'rskregtest' || network.name == 'rsktestnet' || network.name == 'rskmainnet') - symbol = 'r' + if (network.name === 'rskregtest' || network.name === 'rsktestnet' || network.name === 'rskmainnet') { + symbol = 'r'; + } const MultiSigWallet = await deployments.get('MultiSigWallet'); const ProxyAdmin = await deployments.get('ProxyAdmin'); @@ -15,29 +17,24 @@ module.exports = async function ({getNamedAccounts, deployments, network}) { // 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, + 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.dependencies = ['Bridge_old', 'MultiSigWallet', 'ProxyAdmin', 'Federation_old', 'AllowTokens_old', 'SideTokenFactory_old']; diff --git a/bridge/deploy/21_deploy_allowTokens.js b/bridge/deploy/21_deploy_allowTokens.js index 328afa8ea..90eed40e2 100644 --- a/bridge/deploy/21_deploy_allowTokens.js +++ b/bridge/deploy/21_deploy_allowTokens.js @@ -1,268 +1,298 @@ -//We are actually gona use the latest Bridge but truffle only knows the address of the proxy +// We are actually gonna use the latest Bridge but truffle only knows the address of the proxy const toWei = web3.utils.toWei; -const deployHelper = require("../deployed/deployHelper"); +const deployHelper = require('../deployed/deployHelper'); -module.exports = async function ({getNamedAccounts, deployments}) { // HardhatRuntimeEnvironment - const {deployer, multiSig, proxyAdmin} = await getNamedAccounts() - const {deploy, log} = deployments +module.exports = async function({getNamedAccounts, deployments}) { // HardhatRuntimeEnvironment + const {deployer, multiSig, proxyAdmin, allowTokensProxy} = await getNamedAccounts(); + const {deploy, log} = deployments; - const deployResult = await deploy('AllowTokens', { - from: deployer, - log: true, - }); + const deployResult = await deploy('AllowTokens', { + from: deployer, + log: true + }); - if (deployResult.newlyDeployed) { - log( - `Contract AllowTokens deployed at ${deployResult.address} using ${deployResult.receipt.gasUsed.toString()} gas` - ); - } + if (deployResult.newlyDeployed) { + log( + `Contract AllowTokens deployed at ${deployResult.address} using ${deployResult.receipt.gasUsed.toString()} gas` + ); + } - const AllowTokens = await deployments.get('AllowTokens'); - const ProxyAdmin = await deployments.get('ProxyAdmin'); - const BridgeProxy = await deployments.get('BridgeProxy'); + const AllowTokens = await deployments.get('AllowTokens'); + const ProxyAdmin = await deployments.get('ProxyAdmin'); + const BridgeProxy = await deployments.get('BridgeProxy'); - const deployedJson = deployHelper.getDeployed(network.name); - deployedJson.smallAmountConfirmations = deployedJson.smallAmountConfirmations || '0'; - deployedJson.mediumAmountConfirmations = deployedJson.mediumAmountConfirmations || '0'; - deployedJson.largeAmountConfirmations = deployedJson.largeAmountConfirmations || '0'; + const deployedJson = deployHelper.getDeployed(network.name); + deployedJson.smallAmountConfirmations = deployedJson.smallAmountConfirmations || '0'; + deployedJson.mediumAmountConfirmations = deployedJson.mediumAmountConfirmations || '0'; + deployedJson.largeAmountConfirmations = deployedJson.largeAmountConfirmations || '0'; - const typesInfo = network.name == 'rskmainnet' || network.name == 'ethmainnet' + const typesInfo = network.name === 'rskmainnet' || network.name === 'ethmainnet' ? tokensTypesMainnet() : tokensTypesTestnet(); - const allowTokensLogic = new web3.eth.Contract(AllowTokens.abi, AllowTokens.address) - const methodCall = allowTokensLogic.methods.initialize( - deployer, - BridgeProxy.address, - deployedJson.smallAmountConfirmations, - deployedJson.mediumAmountConfirmations, - deployedJson.largeAmountConfirmations, - typesInfo - ); - methodCall.call({ from: deployer }); + const allowTokensLogic = new web3.eth.Contract(AllowTokens.abi, AllowTokens.address); + const methodCall = allowTokensLogic.methods.initialize( + deployer, + BridgeProxy.address, + deployedJson.smallAmountConfirmations, + deployedJson.mediumAmountConfirmations, + deployedJson.largeAmountConfirmations, + typesInfo + ); + methodCall.call({from: deployer}); + if (!allowTokensProxy) { const deployResultProxy = await deploy('AllowTokensProxy', { - from: deployer, - args: [ - AllowTokens.address, - proxyAdmin ?? ProxyAdmin.address, - methodCall.encodeABI() - ], - log: true, - }); + from: deployer, + args: [ + AllowTokens.address, + proxyAdmin ?? ProxyAdmin.address, + methodCall.encodeABI() + ], + log: true + }); if (deployResultProxy.newlyDeployed) { log( `Contract AllowTokensProxy deployed at ${deployResultProxy.address} using ${deployResultProxy.receipt.gasUsed.toString()} gas` ); } + } - const AllowTokensProxy = await deployments.get('AllowTokensProxy'); - const allowTokens = new web3.eth.Contract(AllowTokens.abi, AllowTokensProxy.address) + const AllowTokensProxy = await deployments.get('AllowTokensProxy'); + const allowTokens = new web3.eth.Contract(AllowTokens.abi, AllowTokensProxy.address); - if (network.name == 'rsktestnet') { - await setTokensRskTestnet(allowTokens, deployer); - } - if (network.name == 'kovan') { - await setTokensKovan(allowTokens, deployer); - } - if (network.name == 'rskmainnet') { - await setTokensRskMainnet(allowTokens, deployer); - } - if (network.name == 'ethmainnet') { - await setTokensEthereum(allowTokens, deployer); - } - log(`AllowTokens Setted Tokens`); + if (network.name === 'rsktestnet') { + await setTokensRskTestnet(allowTokens, deployer); + } + if (network.name === 'kovan') { + await setTokensKovan(allowTokens, deployer); + } + if (network.name === 'rskmainnet') { + await setTokensRskMainnet(allowTokens, deployer); + } + if (network.name === 'ethmainnet') { + await setTokensEthereum(allowTokens, deployer); + } + log(`AllowTokens Setted Tokens`); - const MultiSigWallet = await deployments.get('MultiSigWallet'); - //Set multisig as the owner - await allowTokens.methods.transferOwnership(multiSig ?? MultiSigWallet.address).send({ from: deployer }); - log( - `AllowTokens Transfered Ownership to MultiSigWallet` - ); + const MultiSigWallet = await deployments.get('MultiSigWallet'); + //Set multisig as the owner + await allowTokens.methods.transferOwnership(multiSig ?? MultiSigWallet.address).send({from: deployer}); + log( + `AllowTokens Transfered Ownership to MultiSigWallet` + ); }; module.exports.id = 'deploy_allowTokens'; // id required to prevent reexecution module.exports.tags = ['AllowTokens', 'new']; module.exports.dependencies = ['MultiSigWallet', 'ProxyAdmin', 'BridgeProxy']; function tokensTypesMainnet() { - return [ - { description: 'BTC', limits: { - min:toWei('0.0001'), - max:toWei('25'), - daily:toWei('100'), - mediumAmount:toWei('0.1'), - largeAmount:toWei('1') } - }, - { description: 'ETH', limits: { - min:toWei('0.005'), - max:toWei('750'), - daily:toWei('3000'), - mediumAmount:toWei('3'), - largeAmount:toWei('30') } - }, - { description: '<1000usd', limits: { - min:toWei('0.01'), - max:toWei('2500'), - daily:toWei('5000'), - mediumAmount:toWei('10'), - largeAmount:toWei('100') } - }, - { description: '<100usd', limits: { - min:toWei('0.1'), - max:toWei('25000'), - daily:toWei('50000'), - mediumAmount:toWei('100'), - largeAmount:toWei('1000') } - }, - { description: '=1usd', limits: { - min:toWei('10'), - max:toWei('2500000'), - daily:toWei('5000000'), - mediumAmount:toWei('10000'), - largeAmount:toWei('100000') } - }, - { description: '<1usd', limits: { - min:toWei('1000'), - max:toWei('250000000'), - daily:toWei('500000000'), - mediumAmount:toWei('1000000'), - largeAmount:toWei('10000000') } - }, - { description: '<1cent', limits: { - min:toWei('100000'), - max:toWei('25000000000'), - daily:toWei('50000000000'), - mediumAmount:toWei('100000000'), - largeAmount:toWei('1000000000') } - }, - ] + return [ + { + description: 'BTC', limits: { + min: toWei('0.0001'), + max: toWei('25'), + daily: toWei('100'), + mediumAmount: toWei('0.1'), + largeAmount: toWei('1') + } + }, + { + description: 'ETH', limits: { + min: toWei('0.005'), + max: toWei('750'), + daily: toWei('3000'), + mediumAmount: toWei('3'), + largeAmount: toWei('30') + } + }, + { + description: '<1000usd', limits: { + min: toWei('0.01'), + max: toWei('2500'), + daily: toWei('5000'), + mediumAmount: toWei('10'), + largeAmount: toWei('100') + } + }, + { + description: '<100usd', limits: { + min: toWei('0.1'), + max: toWei('25000'), + daily: toWei('50000'), + mediumAmount: toWei('100'), + largeAmount: toWei('1000') + } + }, + { + description: '=1usd', limits: { + min: toWei('10'), + max: toWei('2500000'), + daily: toWei('5000000'), + mediumAmount: toWei('10000'), + largeAmount: toWei('100000') + } + }, + { + description: '<1usd', limits: { + min: toWei('1000'), + max: toWei('250000000'), + daily: toWei('500000000'), + mediumAmount: toWei('1000000'), + largeAmount: toWei('10000000') + } + }, + { + description: '<1cent', limits: { + min: toWei('100000'), + max: toWei('25000000000'), + daily: toWei('50000000000'), + mediumAmount: toWei('100000000'), + largeAmount: toWei('1000000000') + } + } + ]; } function tokensTypesTestnet() { - return [ - { description: 'BTC', limits: { - min:toWei('0.0001'), - max:toWei('25'), - daily:toWei('100'), - mediumAmount:toWei('0.01'), - largeAmount:toWei('0.1') } - }, - { description: 'ETH', limits: { - min:toWei('0.0005'), - max:toWei('750'), - daily:toWei('3000'), - mediumAmount:toWei('0.03'), - largeAmount:toWei('0.3') } - }, - { description: '<1000usd', limits: { - min:toWei('0.001'), - max:toWei('2500'), - daily:toWei('5000'), - mediumAmount:toWei('0.01'), - largeAmount:toWei('0.1') } - }, - { description: '<100usd', limits: { - min:toWei('0.1'), - max:toWei('25000'), - daily:toWei('50000'), - mediumAmount:toWei('1'), - largeAmount:toWei('10') } - }, - { description: '=1usd', limits: { - min:toWei('1'), - max:toWei('2500000'), - daily:toWei('5000000'), - mediumAmount:toWei('10'), - largeAmount:toWei('100') } - }, - { description: '<1usd', limits: { - min:toWei('10'), - max:toWei('250000000'), - daily:toWei('500000000'), - mediumAmount:toWei('100'), - largeAmount:toWei('1000') } - }, - { description: '<1cent', limits: { - min:toWei('10'), - max:toWei('25000000000'), - daily:toWei('50000000000'), - mediumAmount:toWei('100'), - largeAmount:toWei('1000') } - }, - ] + return [ + { + description: 'BTC', limits: { + min: toWei('0.0001'), + max: toWei('25'), + daily: toWei('100'), + mediumAmount: toWei('0.01'), + largeAmount: toWei('0.1') + } + }, + { + description: 'ETH', limits: { + min: toWei('0.0005'), + max: toWei('750'), + daily: toWei('3000'), + mediumAmount: toWei('0.03'), + largeAmount: toWei('0.3') + } + }, + { + description: '<1000usd', limits: { + min: toWei('0.001'), + max: toWei('2500'), + daily: toWei('5000'), + mediumAmount: toWei('0.01'), + largeAmount: toWei('0.1') + } + }, + { + description: '<100usd', limits: { + min: toWei('0.1'), + max: toWei('25000'), + daily: toWei('50000'), + mediumAmount: toWei('1'), + largeAmount: toWei('10') + } + }, + { + description: '=1usd', limits: { + min: toWei('1'), + max: toWei('2500000'), + daily: toWei('5000000'), + mediumAmount: toWei('10'), + largeAmount: toWei('100') + } + }, + { + description: '<1usd', limits: { + min: toWei('10'), + max: toWei('250000000'), + daily: toWei('500000000'), + mediumAmount: toWei('100'), + largeAmount: toWei('1000') + } + }, + { + description: '<1cent', limits: { + min: toWei('10'), + max: toWei('25000000000'), + daily: toWei('50000000000'), + mediumAmount: toWei('100'), + largeAmount: toWei('1000') + } + } + ]; } async function setTokensRskTestnet(allowTokens, deployer) { - // await allowTokens.setToken('0x09b6ca5e4496238a1f176aea6bb607db96c2286e', '0'); //WRBTC - await allowTokens.methods.setMultipleTokens([ - { token: '0x19f64674d8a5b4e652319f5e239efd3bc969a1fe', typeId: '5' }, //RIF - { token: '0xcb46c0ddc60d18efeb0e586c17af6ea36452dae0', typeId: '4' }, //DOC - { token: '0x4da7997a819bb46b6758b9102234c289dd2ad3bf', typeId: '0' }, //BPro - // SideToken - { token: '0xd15cdd74dff1a6a81ca639b038839b126bc01ff9', typeId: '1' }, //rKovWETH - { token: '0x0d86fca9be034a363cf12c9834af08d54a10451c', typeId: '4' }, //rKovSAI - { token: '0x7b846216a194c69bb1ea52ea8faa92d314866451', typeId: '4' }, //rKovDAI - { token: '0x0a8d098e31a60da2b9c874d97de6e6b385c28e9d', typeId: '4' }, //rKovTUSD - { token: '0xed3334adb07a3a5947d268e5a8c67b84f5464963', typeId: '4' }, //rKovUSDC - { token: '0x4cfE225cE54c6609a525768b13F7d87432358C57', typeId: '4' }, //rKovUSDT - { token: '0x8bbbd80981fe76d44854d8df305e8985c19f0e78', typeId: '3' }, //rKovLINK - { token: '0xe95afdfec031f7b9cd942eb7e60f053fb605dfcd', typeId: '3' }, //rKovsBUND - ]).send({ from: deployer }); + // await allowTokens.setToken('0x09b6ca5e4496238a1f176aea6bb607db96c2286e', '0'); //WRBTC + await allowTokens.methods.setMultipleTokens([ + {token: '0x19f64674d8a5b4e652319f5e239efd3bc969a1fe', typeId: '5'}, //RIF + {token: '0xcb46c0ddc60d18efeb0e586c17af6ea36452dae0', typeId: '4'}, //DOC + {token: '0x4da7997a819bb46b6758b9102234c289dd2ad3bf', typeId: '0'}, //BPro + // SideToken + {token: '0xd15cdd74dff1a6a81ca639b038839b126bc01ff9', typeId: '1'}, //rKovWETH + {token: '0x0d86fca9be034a363cf12c9834af08d54a10451c', typeId: '4'}, //rKovSAI + {token: '0x7b846216a194c69bb1ea52ea8faa92d314866451', typeId: '4'}, //rKovDAI + {token: '0x0a8d098e31a60da2b9c874d97de6e6b385c28e9d', typeId: '4'}, //rKovTUSD + {token: '0xed3334adb07a3a5947d268e5a8c67b84f5464963', typeId: '4'}, //rKovUSDC + {token: '0x4cfE225cE54c6609a525768b13F7d87432358C57', typeId: '4'}, //rKovUSDT + {token: '0x8bbbd80981fe76d44854d8df305e8985c19f0e78', typeId: '3'}, //rKovLINK + {token: '0xe95afdfec031f7b9cd942eb7e60f053fb605dfcd', typeId: '3'} //rKovsBUND + ]).send({from: deployer}); } async function setTokensKovan(allowTokens, deployer) { - await allowTokens.methods.setMultipleTokens([ - { token: '0xd1b98b6607330172f1d991521145a22bce793277', typeId: '0' }, //WBTC - { token: '0x0a9add98c076448cbcfacf5e457da12ddbef4a8f', typeId: '0' }, //renBTC - { token: '0xd0A1E359811322d97991E03f863a0C30C2cF029C', typeId: '1' }, //WETH - { token: '0xc7cc3413f169a027dccfeffe5208ca4f38ef0c40', typeId: '4' }, //SAI - { token: '0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa', typeId: '4' }, //DAI - { token: '0x0000000000085d4780B73119b644AE5ecd22b376', typeId: '4' }, //TUSD - { token: '0xe22da380ee6B445bb8273C81944ADEB6E8450422', typeId: '4' }, //USDC - { token: '0x13512979ade267ab5100878e2e0f485b568328a4', typeId: '4' }, //USDT - { token: '0xa36085F69e2889c224210F603D836748e7dC0088', typeId: '3' }, //LINK - { token: '0x8d3e855f3f55109d473735ab76f753218400fe96', typeId: '3' }, //BUND + await allowTokens.methods.setMultipleTokens([ + {token: '0xd1b98b6607330172f1d991521145a22bce793277', typeId: '0'}, //WBTC + {token: '0x0a9add98c076448cbcfacf5e457da12ddbef4a8f', typeId: '0'}, //renBTC + {token: '0xd0A1E359811322d97991E03f863a0C30C2cF029C', typeId: '1'}, //WETH + {token: '0xc7cc3413f169a027dccfeffe5208ca4f38ef0c40', typeId: '4'}, //SAI + {token: '0x4F96Fe3b7A6Cf9725f59d353F723c1bDb64CA6Aa', typeId: '4'}, //DAI + {token: '0x0000000000085d4780B73119b644AE5ecd22b376', typeId: '4'}, //TUSD + {token: '0xe22da380ee6B445bb8273C81944ADEB6E8450422', typeId: '4'}, //USDC + {token: '0x13512979ade267ab5100878e2e0f485b568328a4', typeId: '4'}, //USDT + {token: '0xa36085F69e2889c224210F603D836748e7dC0088', typeId: '3'}, //LINK + {token: '0x8d3e855f3f55109d473735ab76f753218400fe96', typeId: '3'}, //BUND // SideToken - { token: '0x69f6d4d4813f8e2e618dae7572e04b6d5329e207', typeId: '5' }, //eRIF - { token: '0x09a8f2041Be23e8eC3c72790C9A92089BC70FbCa', typeId: '4' }, //eDOC - { token: '0xB3c9ec8833bfA0d382a183EcED27aBc079520928', typeId: '0' }, //eBPro - ]).send({ from: deployer }); + {token: '0x69f6d4d4813f8e2e618dae7572e04b6d5329e207', typeId: '5'}, //eRIF + {token: '0x09a8f2041Be23e8eC3c72790C9A92089BC70FbCa', typeId: '4'}, //eDOC + {token: '0xB3c9ec8833bfA0d382a183EcED27aBc079520928', typeId: '0'} //eBPro + ]).send({from: deployer}); } async function setTokensRskMainnet(allowTokens, deployer) { - await allowTokens.methods.setMultipleTokens([ - { token: '0xe700691da7b9851f2f35f8b8182c69c53ccad9db', typeId: '5' }, //DOC - { token: '0x2acc95758f8b5f583470ba265eb685a8f45fc9d5', typeId: '6' }, //RIF - // await allowTokens.setToken('0x440cd83c160de5c96ddb20246815ea44c7abbca8', '0'); //BPro - // await allowTokens.setToken('0x967f8799af07df1534d48a95a5c9febe92c53ae0', '0'); //WRBTC - // Side Tokens - { token: '0x6b1a73d547f4009a26b8485b63d7015d248ad406', typeId: '4' }, //rDAI - { token: '0x1bda44fda023f2af8280a16fd1b01d1a493ba6c4', typeId: '4' }, //rUSDC - { token: '0xef213441a85df4d7acbdae0cf78004e1e486bb96', typeId: '4' }, //rUSDT - { token: '0x14adae34bef7ca957ce2dde5add97ea050123827', typeId: '3' }, //rLINK - { token: '0x4991516df6053121121274397a8c1dad608bc95b', typeId: '3' }, //rBUND - { token: '0x73c08467E23F7DCB7dDBbc8d05041B74467A498A', typeId: '6' }, //rFLIXX - { token: '0x9c3a5f8d686fade293c0ce989a62a34408c4e307', typeId: '6' }, //rRFOX - { token: '0xff9ea341d9ea91cb7c54342354377f5104fd403f', typeId: '6' }, //rAMLT - ]).send({ from: deployer }); + await allowTokens.methods.setMultipleTokens([ + {token: '0xe700691da7b9851f2f35f8b8182c69c53ccad9db', typeId: '5'}, //DOC + {token: '0x2acc95758f8b5f583470ba265eb685a8f45fc9d5', typeId: '6'}, //RIF + // await allowTokens.setToken('0x440cd83c160de5c96ddb20246815ea44c7abbca8', '0'); //BPro + // await allowTokens.setToken('0x967f8799af07df1534d48a95a5c9febe92c53ae0', '0'); //WRBTC + // Side Tokens + {token: '0x6b1a73d547f4009a26b8485b63d7015d248ad406', typeId: '4'}, //rDAI + {token: '0x1bda44fda023f2af8280a16fd1b01d1a493ba6c4', typeId: '4'}, //rUSDC + {token: '0xef213441a85df4d7acbdae0cf78004e1e486bb96', typeId: '4'}, //rUSDT + {token: '0x14adae34bef7ca957ce2dde5add97ea050123827', typeId: '3'}, //rLINK + {token: '0x4991516df6053121121274397a8c1dad608bc95b', typeId: '3'}, //rBUND + {token: '0x73c08467E23F7DCB7dDBbc8d05041B74467A498A', typeId: '6'}, //rFLIXX + {token: '0x9c3a5f8d686fade293c0ce989a62a34408c4e307', typeId: '6'}, //rRFOX + {token: '0xff9ea341d9ea91cb7c54342354377f5104fd403f', typeId: '6'} //rAMLT + ]).send({from: deployer}); } async function setTokensEthereum(allowTokens, deployer) { - await allowTokens.methods.setMultipleTokens([ - { token: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', typeId: '0' }, //WBTC - { token: '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', typeId: '0' }, //renBTC - { token: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', typeId: '1' }, //WETH - { token: '0x6b175474e89094c44da98b954eedeac495271d0f', typeId: '4' }, //DAI - { token: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', typeId: '5' }, //USDC - { token: '0xdac17f958d2ee523a2206206994597c13d831ec7', typeId: '5' }, //USDT - { token: '0x514910771af9ca656af840dff83e8264ecf986ca', typeId: '3' }, //LINK - { token: '0x8d3e855f3f55109d473735ab76f753218400fe96', typeId: '3' }, //BUND - { token: '0xf04a8ac553fcedb5ba99a64799155826c136b0be', typeId: '6' }, //FLIXX - { token: '0xa1d6Df714F91DeBF4e0802A542E13067f31b8262', typeId: '6' }, //RFOX - { token: '0xca0e7269600d353f70b14ad118a49575455c0f2f', typeId: '6' }, //AMLT - // Side Tokens - { token: '0x2acc95758f8b5f583470ba265eb685a8f45fc9d5', typeId: '5' }, //eRIF - { token: '0xe700691da7b9851f2f35f8b8182c69c53ccad9db', typeId: '4' }, //eDOC - ]).send({ from: deployer }); + await allowTokens.methods.setMultipleTokens([ + {token: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', typeId: '0'}, //WBTC + {token: '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', typeId: '0'}, //renBTC + {token: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', typeId: '1'}, //WETH + {token: '0x6b175474e89094c44da98b954eedeac495271d0f', typeId: '4'}, //DAI + {token: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', typeId: '5'}, //USDC + {token: '0xdac17f958d2ee523a2206206994597c13d831ec7', typeId: '5'}, //USDT + {token: '0x514910771af9ca656af840dff83e8264ecf986ca', typeId: '3'}, //LINK + {token: '0x8d3e855f3f55109d473735ab76f753218400fe96', typeId: '3'}, //BUND + {token: '0xf04a8ac553fcedb5ba99a64799155826c136b0be', typeId: '6'}, //FLIXX + {token: '0xa1d6Df714F91DeBF4e0802A542E13067f31b8262', typeId: '6'}, //RFOX + {token: '0xca0e7269600d353f70b14ad118a49575455c0f2f', typeId: '6'}, //AMLT + // Side Tokens + {token: '0x2acc95758f8b5f583470ba265eb685a8f45fc9d5', typeId: '5'}, //eRIF + {token: '0xe700691da7b9851f2f35f8b8182c69c53ccad9db', typeId: '4'} //eDOC + ]).send({from: deployer}); } diff --git a/bridge/deploy/22_deploy_federation.js b/bridge/deploy/22_deploy_federation.js index e04a5310a..5e52f4c90 100644 --- a/bridge/deploy/22_deploy_federation.js +++ b/bridge/deploy/22_deploy_federation.js @@ -1,61 +1,63 @@ -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, federatorProxy} = await getNamedAccounts(); + const {deploy, log} = deployments; - const deployResult = await deploy('Federation', { - from: deployer, - log: true, - }); + const deployResult = await deploy('Federation', { + from: deployer, + log: true + }); - if (deployResult.newlyDeployed) { - log( - `Contract Federation deployed at ${deployResult.address} using ${deployResult.receipt.gasUsed.toString()} gas` - ); - } + if (deployResult.newlyDeployed) { + log( + `Contract Federation deployed at ${deployResult.address} using ${deployResult.receipt.gasUsed.toString()} gas` + ); + } - const Federation = await deployments.get('Federation'); - const ProxyAdmin = await deployments.get('ProxyAdmin'); - const BridgeProxy = await deployments.get('BridgeProxy'); - const MultiSigWallet = await deployments.get('MultiSigWallet'); + const Federation = await deployments.get('Federation'); + let proxyAdminAddress = proxyAdmin ?? (await deployments.get('ProxyAdmin')).address; + const multiSigAddress = multiSig ?? (await deployments.get('MultiSigWallet')).address; + const bridgeProxyAddress = bridgeProxy ?? (await deployments.get('BridgeProxy')).address - let federationsMembers = [deployer]; - let required = 1; - if(network.name.toLowerCase().includes('testnet') || network.name.toLowerCase().includes('kovan')) { - federationsMembers = ['0x8f397ff074ff190fc650e5cab4da039a8163e12a']; - } - if(network.name.toLowerCase().includes('mainnet')) { - federationsMembers = [ - '0x5eb6ceca6bdd82f4a38aac0b957e6a4b5b1cceba', - '0x8a9ec366c1b359fed1a7372cf8607ec52963b550', - '0xa4398c6ff62e9b93b32b28dd29bd27c6b106245f', - '0x1089a708b03821b19db9bdf179fbd7ed7ce591d7', - '0x04237d65eb6cdc9f93db42fef53f7d5aaca2f1d6', - ]; - required = 2; - } - const federationLogic = new web3.eth.Contract(Federation.abi, Federation.address) - const methodCall = federationLogic.methods.initialize( - federationsMembers, - required, - BridgeProxy.address, - multiSig ?? MultiSigWallet.address - ); - methodCall.call({ from: deployer }); + let federationsMembers = [deployer]; + let required = 1; + if (network.name.toLowerCase().includes('testnet') || network.name.toLowerCase().includes('kovan')) { + federationsMembers = ['0x8f397ff074ff190fc650e5cab4da039a8163e12a']; + } + if (network.name.toLowerCase().includes('mainnet')) { + federationsMembers = [ + '0x5eb6ceca6bdd82f4a38aac0b957e6a4b5b1cceba', + '0x8a9ec366c1b359fed1a7372cf8607ec52963b550', + '0xa4398c6ff62e9b93b32b28dd29bd27c6b106245f', + '0x1089a708b03821b19db9bdf179fbd7ed7ce591d7', + '0x04237d65eb6cdc9f93db42fef53f7d5aaca2f1d6' + ]; + required = 2; + } + const federationLogic = new web3.eth.Contract(Federation.abi, Federation.address); + const methodCall = federationLogic.methods.initialize( + federationsMembers, + required, + bridgeProxyAddress, + multiSigAddress + ); + methodCall.call({from: deployer}); + if (!federatorProxy) { const deployProxyResult = await deploy('FederationProxy', { - from: deployer, - args: [ - Federation.address, - proxyAdmin ?? ProxyAdmin.address, - methodCall.encodeABI() - ], - log: true, + from: deployer, + args: [ + Federation.address, + proxyAdminAddress, + 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_federation'; // id required to prevent reexecution module.exports.tags = ['Federation', 'new']; diff --git a/bridge/hardhat.config.js b/bridge/hardhat.config.js index 68803dd43..79af41c5f 100644 --- a/bridge/hardhat.config.js +++ b/bridge/hardhat.config.js @@ -1,71 +1,59 @@ -require("@nomiclabs/hardhat-web3"); -require("@nomiclabs/hardhat-truffle5"); +require('@nomiclabs/hardhat-web3'); +require('@nomiclabs/hardhat-truffle5'); require('solidity-coverage'); require('hardhat-gas-reporter'); require('hardhat-deploy'); require('hardhat-abi-exporter'); require('hardhat-contract-sizer'); -require("@thinkanddev/hardhat-erc1820-rsk"); +require('@thinkanddev/hardhat-erc1820-rsk'); const fs = require('fs'); -const MNEMONIC = fs.existsSync('./mnemonic.key') - ? fs.readFileSync('./mnemonic.key', { encoding: 'utf8' }) - : "";// Your metamask's recovery words -const INFURA_API_KEY = fs.existsSync('./infura.key') - ? fs.readFileSync('./infura.key',{ encoding: 'utf8' }) - : "";// Your Infura API Key after its registration +const MNEMONIC = fs.existsSync('./mnemonic.key') ? fs.readFileSync('./mnemonic.key', {encoding: 'utf8'}) : ''; // Your metamask's recovery words +const INFURA_API_KEY = fs.existsSync('./infura.key') ? fs.readFileSync('./infura.key', {encoding: 'utf8'}) : ''; // Your Infura API Key after its registration + +const ETHEREUM_MAIN_NET_CHAIN_ID = 1; +const RSK_MAIN_NET_CHAIN_ID = 30; +const RSK_TEST_NET_CHAIN_ID = 31; +const ETHEREUM_KOVAN_CHAIN_ID = 42; +const DEFAULT_DEPLOYER_ACCOUNT_INDEX = 0; /** * @type import('hardhat/config').HardhatUserConfig */ module.exports = { solidity: { - version: "0.7.6", + version: '0.7.6', settings: { evmVersion: 'istanbul', optimizer: { enabled: true, - runs: 200 - } - } + runs: 200, + }, + }, }, gasReporter: { currency: 'RBTC', - gasPrice: 0.06 + gasPrice: 0.06, }, abiExporter: { path: './abi', clear: true, flat: true, - only: [':AllowTokens', ':Bridge', ':Federation', ':IERC20$', - ':MainToken$',':ERC777$', ':MultiSigWallet$', ':ProxyAdmin$', ':SideToken', - ':TransparentUpgradeableProxy$' - ] - }, - namedAccounts: { - deployer: { - default: 0, - }, - multiSig: { - 1: '0x040007b1804ad78a97f541bebed377dcb60e4138', - 30: '0x040007b1804ad78a97f541bebed377dcb60e4138', - 31: '0x88f6b2bc66f4c31a3669b9b1359524abf79cfc4a', - 42: '0x040007b1804ad78a97f541bebed377dcb60e4138', - }, - wrappedCurrency: { - 1: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - 30: '0x967f8799af07df1534d48a95a5c9febe92c53ae0', - 31: '0x09b6ca5e4496238a1f176aea6bb607db96c2286e', - 42: '0xd0A1E359811322d97991E03f863a0C30C2cF029C', - }, - proxyAdmin: { - 1: '0xe4d351911a6d599f91a3db1843e2ecb0f851e7e6', - 30: '0x12ed69359919fc775bc2674860e8fe2d2b6a7b5d', - 31: '0x8c35e166d2dea7a8a28aaea11ad7933cdae4b0ab', - 42: '0xe4d351911a6d599f91a3db1843e2ecb0f851e7e6', - } + only: [ + ':AllowTokens', + ':Bridge', + ':Federation', + ':IERC20$', + ':MainToken$', + ':ERC777$', + ':MultiSigWallet$', + ':ProxyAdmin$', + ':SideToken', + ':TransparentUpgradeableProxy$', + ], }, + namedAccounts: getNamedAccounts(), networks: { hardhat: { live: false, @@ -92,7 +80,7 @@ module.exports = { gas: 6700000, gasPrice: 20000000000, hardfork: 'istanbul', // London hardfork is incompatible with RSK gasPrice - tags: ['integrationTest','local'], + tags: ['integrationTest', 'local'], saveDeployments: false, }, // RSK @@ -104,9 +92,9 @@ module.exports = { chainId: 31, hardfork: 'istanbul', // London hardfork is incompatible with RSK gasPrice accounts: { - mnemonic: MNEMONIC + mnemonic: MNEMONIC, }, - tags: ['staging'] + tags: ['staging'], }, rskmainnet: { live: true, @@ -116,9 +104,9 @@ module.exports = { chainId: 30, hardfork: 'istanbul', // London hardfork is incompatible with RSK gasPrice accounts: { - mnemonic: MNEMONIC + mnemonic: MNEMONIC, }, - tags: ['prod'] + tags: ['prod'], }, //Ethereum kovan: { @@ -129,9 +117,9 @@ module.exports = { gasPrice: 10000000000, websockets: true, accounts: { - mnemonic: MNEMONIC + mnemonic: MNEMONIC, }, - tags: ['staging'] + tags: ['staging'], }, ethmainnet: { live: true, @@ -141,11 +129,77 @@ module.exports = { gasPrice: 250000000000, websockets: true, accounts: { - mnemonic: MNEMONIC + mnemonic: MNEMONIC, }, - tags: ['prod'] + tags: ['prod'], }, - }, }; +function getNamedAccounts() { + return { + deployer: { + default: DEFAULT_DEPLOYER_ACCOUNT_INDEX, + }, + multiSig: getMultiSigAddressesByChainId(), + wrappedCurrency: getWrappedCurrencyAddressesByChainId(), + proxyAdmin: getProxyAdminAddressesByChainId(), + allowTokensProxy: getAllowTokensProxyAddressesByChainId(), + bridgeProxy: getBridgeProxyAddressesByChainId(), + federatorProxy: getFederatorProxyAddressesByChainId(), + }; +} + +function getMultiSigAddressesByChainId() { + let multiSigAddressesByChainId = {}; + multiSigAddressesByChainId[ETHEREUM_MAIN_NET_CHAIN_ID] = '0x040007b1804ad78a97f541bebed377dcb60e4138'; + multiSigAddressesByChainId[RSK_MAIN_NET_CHAIN_ID] = '0x040007b1804ad78a97f541bebed377dcb60e4138'; + multiSigAddressesByChainId[RSK_TEST_NET_CHAIN_ID] = '0x88f6b2bc66f4c31a3669b9b1359524abf79cfc4a'; + multiSigAddressesByChainId[ETHEREUM_KOVAN_CHAIN_ID] = '0x040007b1804ad78a97f541bebed377dcb60e4138'; + return multiSigAddressesByChainId; +} + +function getWrappedCurrencyAddressesByChainId() { + let wrappedCurrencyAddressesByChainId = {}; + wrappedCurrencyAddressesByChainId[ETHEREUM_MAIN_NET_CHAIN_ID] = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; + wrappedCurrencyAddressesByChainId[RSK_MAIN_NET_CHAIN_ID] = '0x967f8799af07df1534d48a95a5c9febe92c53ae0'; + wrappedCurrencyAddressesByChainId[RSK_TEST_NET_CHAIN_ID] = '0x09b6ca5e4496238a1f176aea6bb607db96c2286e'; + wrappedCurrencyAddressesByChainId[ETHEREUM_KOVAN_CHAIN_ID] = '0xd0A1E359811322d97991E03f863a0C30C2cF029C'; + return wrappedCurrencyAddressesByChainId; +} + +function getProxyAdminAddressesByChainId() { + let proxyAdminAddressesByChainId = {}; + proxyAdminAddressesByChainId[ETHEREUM_MAIN_NET_CHAIN_ID] = '0xe4d351911a6d599f91a3db1843e2ecb0f851e7e6'; + proxyAdminAddressesByChainId[RSK_MAIN_NET_CHAIN_ID] = '0x12ed69359919fc775bc2674860e8fe2d2b6a7b5d'; + proxyAdminAddressesByChainId[RSK_TEST_NET_CHAIN_ID] = '0x8c35e166d2dea7a8a28aaea11ad7933cdae4b0ab'; + proxyAdminAddressesByChainId[ETHEREUM_KOVAN_CHAIN_ID] = '0xe4d351911a6d599f91a3db1843e2ecb0f851e7e6'; + return proxyAdminAddressesByChainId; +} + +function getAllowTokensProxyAddressesByChainId() { + let allowTokensProxyAddressesByChainId = {}; + allowTokensProxyAddressesByChainId[ETHEREUM_MAIN_NET_CHAIN_ID] = '0xa3fc98e0a7a979677bc14d541be770b2cb0a15f3'; + allowTokensProxyAddressesByChainId[RSK_MAIN_NET_CHAIN_ID] = '0xcb789036894a83a008a2aa5b3c2dde41d0605a9a'; + allowTokensProxyAddressesByChainId[RSK_TEST_NET_CHAIN_ID] = '0xc65bf0ae75dc1a5fc9e6f4215125692a548c773a'; + allowTokensProxyAddressesByChainId[ETHEREUM_KOVAN_CHAIN_ID] = '0x92bf86334583909b60f9b798a9dd7debd899fec4'; + return allowTokensProxyAddressesByChainId; +} + +function getBridgeProxyAddressesByChainId() { + let bridgeProxyAddressesByChainId = {}; + bridgeProxyAddressesByChainId[ETHEREUM_MAIN_NET_CHAIN_ID] = '0x12ed69359919fc775bc2674860e8fe2d2b6a7b5d'; + bridgeProxyAddressesByChainId[RSK_MAIN_NET_CHAIN_ID] = '0x9d11937e2179dc5270aa86a3f8143232d6da0e69'; + bridgeProxyAddressesByChainId[RSK_TEST_NET_CHAIN_ID] = '0x684a8a976635fb7ad74a0134ace990a6a0fcce84'; + bridgeProxyAddressesByChainId[ETHEREUM_KOVAN_CHAIN_ID] = '0x12ed69359919fc775bc2674860e8fe2d2b6a7b5d'; + return bridgeProxyAddressesByChainId; +} + +function getFederatorProxyAddressesByChainId() { + let federatorProxyAddressesByChainId = {}; + federatorProxyAddressesByChainId[ETHEREUM_MAIN_NET_CHAIN_ID] = '0x5e29c223d99648c88610519f96e85e627b3abe17'; + federatorProxyAddressesByChainId[RSK_MAIN_NET_CHAIN_ID] = '0x7ecfda6072942577d36f939ad528b366b020004b'; + federatorProxyAddressesByChainId[RSK_TEST_NET_CHAIN_ID] = '0x5d663981d930e8ec108280b9d80885658148ab0f'; + federatorProxyAddressesByChainId[ETHEREUM_KOVAN_CHAIN_ID] = '0xa347438bc288f56cb6083a79133e70dd2d1f6c2d'; + return federatorProxyAddressesByChainId; +} diff --git a/bridge/package-lock.json b/bridge/package-lock.json index ffb4b67f7..d06bcd96f 100644 --- a/bridge/package-lock.json +++ b/bridge/package-lock.json @@ -34,6 +34,8 @@ "glob-parent": ">=5.1.2", "hardhat-abi-exporter": "^2.2.1", "node-fetch": ">=2.6.1", + "prettier": "^2.3.2", + "prettier-plugin-solidity": "^1.0.0-beta.17", "web3": ">=1.0.0", "y18n": ">=5.0.5" }, @@ -248,7 +250,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "optional": true, "engines": { "node": ">=0.10.0" } @@ -1269,6 +1270,18 @@ "node": ">=4" } }, + "node_modules/prettier-plugin-solidity/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@truffle/contract-schema": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/@truffle/contract-schema/-/contract-schema-3.4.3.tgz", @@ -3007,17 +3020,23 @@ "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, "node_modules/prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", - "optional": true, + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", + "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", + "dev": true, "bin": { "prettier": "bin-prettier.js" }, "engines": { - "node": ">=4" + "node": ">=10.13.0" } }, + "node_modules/solidity-comments-extractor": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz", + "integrity": "sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw==", + "dev": true + }, "node_modules/ipld-raw/node_modules/multicodec": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/multicodec/-/multicodec-2.1.3.tgz", @@ -4139,6 +4158,15 @@ "google-protobuf": "^3.13.0" } }, + "node_modules/prettier-plugin-solidity/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-finite": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.1.0.tgz", @@ -6515,6 +6543,18 @@ "uuid": "8.1.0" } }, + "node_modules/prettier-plugin-solidity/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ipld-dag-pb": { "version": "0.20.0", "resolved": "https://registry.npmjs.org/ipld-dag-pb/-/ipld-dag-pb-0.20.0.tgz", @@ -7128,6 +7168,12 @@ "node": ">=4" } }, + "node_modules/prettier-plugin-solidity/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, "node_modules/json-text-sequence": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/json-text-sequence/-/json-text-sequence-0.1.1.tgz", @@ -7184,7 +7230,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "optional": true, "dependencies": { "invert-kv": "^1.0.0" }, @@ -10893,6 +10938,20 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/prettier-plugin-solidity/node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@truffle/debugger/node_modules/bn.js": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", @@ -14755,6 +14814,12 @@ "node": ">=10" } }, + "node_modules/prettier-plugin-solidity/node_modules/string-width/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, "node_modules/ipld-raw/node_modules/uint8arrays": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-1.1.0.tgz", @@ -17285,6 +17350,15 @@ "node": ">=8.0.0" } }, + "node_modules/prettier-plugin-solidity/node_modules/@solidity-parser/parser": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.13.2.tgz", + "integrity": "sha512-RwHnpRnfrnD2MSPveYoPh8nhofEvX7fgjHk1Oq+NNvCcLx4r1js91CO9o+F/F3fBzOCyvm8kKRTriFICX/odWw==", + "dev": true, + "dependencies": { + "antlr4ts": "^0.5.0-alpha.4" + } + }, "node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -19039,7 +19113,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", - "optional": true, "dependencies": { "lcid": "^1.0.0" }, @@ -19732,6 +19805,26 @@ "tslib": "^2.0.3" } }, + "node_modules/prettier-plugin-solidity": { + "version": "1.0.0-beta.17", + "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.17.tgz", + "integrity": "sha512-YFkxV/rHi1mphi17/XKcJ9QjZlb+L/J0yY2erix21BZfzPv2BN9dfmSRGr/poDp/FBOFSW+jteP2BCMe7HndVQ==", + "dev": true, + "dependencies": { + "@solidity-parser/parser": "^0.13.2", + "emoji-regex": "^9.2.2", + "escape-string-regexp": "^4.0.0", + "semver": "^7.3.5", + "solidity-comments-extractor": "^0.0.7", + "string-width": "^4.2.2" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "prettier": "^2.3.0" + } + }, "node_modules/express": { "version": "4.17.1", "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", @@ -21082,6 +21175,18 @@ "node": ">=0.10.0" } }, + "node_modules/solhint/node_modules/prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "optional": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/delay": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", @@ -21778,6 +21883,15 @@ "node": ">=0.10.0" } }, + "node_modules/prettier-plugin-solidity/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/import-fresh": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", @@ -23826,6 +23940,21 @@ "inBundle": true, "license": "MIT" }, + "node_modules/prettier-plugin-solidity/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@truffle/provider/node_modules/web3-providers-http": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.5.0.tgz", @@ -36996,8 +37125,7 @@ "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "optional": true + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, "io-ts": { "version": "1.10.4", @@ -38059,7 +38187,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "optional": true, "requires": { "invert-kv": "^1.0.0" } @@ -40038,7 +40165,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", - "optional": true, "requires": { "lcid": "^1.0.0" } @@ -41130,10 +41256,96 @@ "optional": true }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", - "optional": true + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", + "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", + "dev": true + }, + "prettier-plugin-solidity": { + "version": "1.0.0-beta.17", + "resolved": "https://registry.npmjs.org/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-beta.17.tgz", + "integrity": "sha512-YFkxV/rHi1mphi17/XKcJ9QjZlb+L/J0yY2erix21BZfzPv2BN9dfmSRGr/poDp/FBOFSW+jteP2BCMe7HndVQ==", + "dev": true, + "requires": { + "@solidity-parser/parser": "^0.13.2", + "emoji-regex": "^9.2.2", + "escape-string-regexp": "^4.0.0", + "semver": "^7.3.5", + "solidity-comments-extractor": "^0.0.7", + "string-width": "^4.2.2" + }, + "dependencies": { + "@solidity-parser/parser": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.13.2.tgz", + "integrity": "sha512-RwHnpRnfrnD2MSPveYoPh8nhofEvX7fgjHk1Oq+NNvCcLx4r1js91CO9o+F/F3fBzOCyvm8kKRTriFICX/odWw==", + "dev": true, + "requires": { + "antlr4ts": "^0.5.0-alpha.4" + } + }, + "ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + } + } + }, + "strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.0" + } + } + } }, "printj": { "version": "1.1.2", @@ -42599,6 +42811,12 @@ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" }, + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "optional": true + }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -42609,6 +42827,12 @@ } } }, + "solidity-comments-extractor": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz", + "integrity": "sha512-wciNMLg/Irp8OKGrh3S2tfvZiZ0NEyILfcRCXCD4mp7SgK/i9gzLfhY2hY7VMCQJ3kH9UB9BzNdibIVMchzyYw==", + "dev": true + }, "solidity-coverage": { "version": "0.7.16", "resolved": "https://registry.npmjs.org/solidity-coverage/-/solidity-coverage-0.7.16.tgz", diff --git a/bridge/package.json b/bridge/package.json index ca4198d63..0d810dcaf 100644 --- a/bridge/package.json +++ b/bridge/package.json @@ -36,7 +36,7 @@ "hardhat": "^2.4.1", "hardhat-contract-sizer": "^2.0.3", "hardhat-deploy": "^0.8.11", - "@thinkanddev/deploy-eip-1820-web3-rsk": "^1.0.2", + "@thinkanddev/deploy-eip-1820-web3-rsk": "^1.0.2", "@thinkanddev/hardhat-erc1820-rsk": "^0.1.2", "hardhat-gas-reporter": "^1.0.4", "npm-force-resolutions": "0.0.3", @@ -56,6 +56,8 @@ "glob-parent": ">=5.1.2", "hardhat-abi-exporter": "^2.2.1", "node-fetch": ">=2.6.1", + "prettier": "^2.3.2", + "prettier-plugin-solidity": "^1.0.0-beta.17", "web3": ">=1.0.0", "y18n": ">=5.0.5" }, @@ -66,5 +68,14 @@ "y18n": ">=5.0.5", "node-fetch": ">=2.6.1", "axios": ">=0.21.1" + }, + "prettier": { + "parser": "json5", + "printWidth": 120, + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "bracketSpacing": false, + "semi": true } }