diff --git a/config/default.js b/config/default.js index 9bf256188..f52e147b2 100644 --- a/config/default.js +++ b/config/default.js @@ -271,28 +271,96 @@ module.exports = { bootChallenger: process.env.BOOT_CHALLENGER_ADDRESS || '0xfCb059A4dB5B961d3e48706fAC91a55Bad0035C9', }, - tokens: [ - { - name: 'MockERC20', - address: '0xB5Acbe9a0F1F8B98F3fC04471F7fE5d2c222cB44', - amount: 200, - }, - { - name: 'Test-Eth', - address: '0x3f152B63Ec5CA5831061B2DccFb29a874C317502', - amount: '10000000000000000000000', - }, - { - name: 'MATIC', - address: '0x499d11E0b6eAC7c0593d8Fb292DCBbF815Fb29Ae', - amount: '10000000000000000000000', - }, - { - name: 'USDC', - address: '0x07865c6e87b9f70255377e024ace6630c1eaa37f', - amount: '1000000000000', - }, - ], + tokens: { + blockchain1: [ + { + name: 'MockERC20', + address: '0xB5Acbe9a0F1F8B98F3fC04471F7fE5d2c222cB44', + amount: 200, + }, + { + name: 'Test-Eth', + address: '0x3f152B63Ec5CA5831061B2DccFb29a874C317502', + amount: '10000000000000000000000', + }, + { + name: 'MATIC', + address: '0x499d11E0b6eAC7c0593d8Fb292DCBbF815Fb29Ae', + amount: '10000000000000000000000', + }, + { + name: 'USDC', + address: '0x07865c6e87b9f70255377e024ace6630c1eaa37f', + amount: '1000000000000', + }, + ], + development: [ + { + name: 'MockERC20', + address: '0xB5Acbe9a0F1F8B98F3fC04471F7fE5d2c222cB44', + amount: 200, + }, + { + name: 'Test-Eth', + address: '0x3f152B63Ec5CA5831061B2DccFb29a874C317502', + amount: '10000000000000000000000', + }, + { + name: 'MATIC', + address: '0x499d11E0b6eAC7c0593d8Fb292DCBbF815Fb29Ae', + amount: '10000000000000000000000', + }, + { + name: 'USDC', + address: '0x07865c6e87b9f70255377e024ace6630c1eaa37f', + amount: '1000000000000', + }, + ], + mainnet: [ + { + name: 'WETH', + address: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', + amount: process.env.WETH_MAINNET_RESTRICT || '1000000000000000000', + }, + { + name: 'MATIC', + address: '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', + amount: process.env.MATIC_MAINNET_RESTRICT || '1000000000000000000000', + }, + { + name: 'USDC', + address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', + amount: process.env.USDC_MAINNET_RESTRICT || '1000000000', + }, + { + name: 'USDT', + address: '0xdAC17F958D2ee523a2206206994597C13D831ec7', + amount: process.env.USDT_MAINNET_RESTRICT || '1000000000', + }, + { + name: 'DAI', + address: '0x6B175474E89094C44Da98b954EedeAC495271d0F', + amount: process.env.DAI_MAINNET_RESTRICT || '1000000000000000000000', + }, + ], + goerli: [ + { + name: 'WETH', + address: '0x3f152B63Ec5CA5831061B2DccFb29a874C317502', + amount: process.env.WETH_GOERLI_RESTRICT || '1000000000000000000', + }, + { + name: 'MATIC', + address: '0x499d11E0b6eAC7c0593d8Fb292DCBbF815Fb29Ae', + amount: process.env.MATIC_GOERLI_RESTRICT || '1000000000000000000000', + }, + { + name: 'USDC', + address: '0x07865c6E87B9F70255377e024ace6630C1Eaa37F', + amount: process.env.USDC_GOERLI_RESTRICT || '1000000000', + }, + ], + }, }, // for Browser use diff --git a/nightfall-deployer/migrations/2_deploy_upgradeable.js b/nightfall-deployer/migrations/2_deploy_upgradeable.js index 0a58ee7df..4a5fe56cc 100644 --- a/nightfall-deployer/migrations/2_deploy_upgradeable.js +++ b/nightfall-deployer/migrations/2_deploy_upgradeable.js @@ -14,7 +14,8 @@ const State = artifacts.require('State.sol'); const config = require('config'); -const { addresses } = config.RESTRICTIONS; +const { RESTRICTIONS } = config; +const { addresses } = RESTRICTIONS; module.exports = async function (deployer) { await deployer.deploy(Verifier); @@ -43,4 +44,11 @@ module.exports = async function (deployer) { const { bootProposer, bootChallenger } = addresses; await proposers.setBootProposer(bootProposer); await challengers.setBootChallenger(bootChallenger); + const restrictions = await Shield.deployed(); + // restrict transfer amounts + console.log('**TEST**', process.env.ETH_NETWORK, RESTRICTIONS.tokens, RESTRICTIONS); + for (let token of RESTRICTIONS.tokens[process.env.ETH_NETWORK]) { + console.log(`Max deposit restriction for ${token.name}: ${token.amount}`); + await restrictions.setRestriction(token.address, token.amount); + } }; diff --git a/nightfall-deployer/migrations/3_test_tokens_migration.js b/nightfall-deployer/migrations/3_test_tokens_migration.js index 2b196963b..af9d8b501 100644 --- a/nightfall-deployer/migrations/3_test_tokens_migration.js +++ b/nightfall-deployer/migrations/3_test_tokens_migration.js @@ -21,13 +21,9 @@ const nERC721 = 35; module.exports = function (deployer, _, accounts) { deployer.then(async () => { const restrictions = await Shield.deployed(); - - for (let token of RESTRICTIONS.tokens) { - console.log(`Max deposit restriction for ${token.name}: ${token.amount}`); - await restrictions.setRestriction(token.address, token.amount); - } if (DEPLOY_MOCK_TOKENS === 'false') return; + await deployer.deploy(ERC20Mock, 1001010000000000); // initialSupply const ERC20deployed = await ERC20Mock.deployed(); diff --git a/test/e2e/tokens/erc20.test.mjs b/test/e2e/tokens/erc20.test.mjs index 5cb064db8..7f9b46924 100644 --- a/test/e2e/tokens/erc20.test.mjs +++ b/test/e2e/tokens/erc20.test.mjs @@ -27,7 +27,9 @@ const { } = config.TEST_OPTIONS; const { - RESTRICTIONS: { tokens: defaultRestrictions }, + RESTRICTIONS: { + tokens: { blockchain1: defaultRestrictions }, + }, } = config; const nf3Users = [new Nf3(signingKeys.user1, environment), new Nf3(signingKeys.user2, environment)];