From e7bcd7156639ced6b7bcd3b84627eab203d6cff6 Mon Sep 17 00:00:00 2001 From: Michael Kim Date: Tue, 26 Mar 2024 23:13:16 +0900 Subject: [PATCH] Add the ability to test with two local chains --- packages/validator/.gitignore | 3 + packages/validator/env/.env.sample | 12 + packages/validator/hardhat-change-network.ts | 9 + packages/validator/hardhat.config.ts | 150 +++++++ packages/validator/package.json | 1 + packages/validator/scripts/exchange.ts | 49 --- packages/validator/scripts/sync.ts | 12 - .../validator/src/scheduler/EventCollector.ts | 46 +- packages/validator/src/scheduler/Executor.ts | 15 +- packages/validator/src/utils/ContractUtils.ts | 93 ++-- .../test-local/chain1/config/config.toml | 12 + .../test-local/chain1/config/genesis.json | 404 ++++++++++++++++++ .../chain1/config/private/password.txt | 1 + ...--f85b2dba83a08dee6e24e4461e0334e7384896f9 | 1 + .../test-local/chain1/docker-compose.yml | 30 ++ .../test-local/chain2/config/config.toml | 12 + .../test-local/chain2/config/genesis.json | 404 ++++++++++++++++++ .../chain2/config/private/password.txt | 1 + ...--f85b2dba83a08dee6e24e4461e0334e7384896f9 | 1 + .../test-local/chain2/docker-compose.yml | 22 + packages/validator/test-local/cmd.sh | 59 +++ .../test-local/helper/Deployments.ts | 186 ++++++++ .../validator/test-local/helper/Utility.ts | 69 +++ packages/validator/test-local/localtest.ts | 219 ++++++++++ packages/validator/test-local/start-chain.sh | 24 ++ packages/validator/test-local/start-test.sh | 9 + packages/validator/test-local/stop-chain.sh | 6 + packages/validator/test/01-Collector.test.ts | 101 +++-- packages/validator/test/02-Bridge.test.ts | 109 +++-- packages/validator/test/helper/Deployments.ts | 90 +--- packages/validator/tsconfig.json | 2 +- 31 files changed, 1852 insertions(+), 300 deletions(-) delete mode 100644 packages/validator/scripts/exchange.ts delete mode 100644 packages/validator/scripts/sync.ts create mode 100644 packages/validator/test-local/chain1/config/config.toml create mode 100644 packages/validator/test-local/chain1/config/genesis.json create mode 100644 packages/validator/test-local/chain1/config/private/password.txt create mode 100644 packages/validator/test-local/chain1/config/template/node/keystore/UTC--2023-04-20T00-12-19.384030000Z--f85b2dba83a08dee6e24e4461e0334e7384896f9 create mode 100644 packages/validator/test-local/chain1/docker-compose.yml create mode 100644 packages/validator/test-local/chain2/config/config.toml create mode 100644 packages/validator/test-local/chain2/config/genesis.json create mode 100644 packages/validator/test-local/chain2/config/private/password.txt create mode 100644 packages/validator/test-local/chain2/config/template/node/keystore/UTC--2023-04-20T00-12-19.384030000Z--f85b2dba83a08dee6e24e4461e0334e7384896f9 create mode 100644 packages/validator/test-local/chain2/docker-compose.yml create mode 100755 packages/validator/test-local/cmd.sh create mode 100644 packages/validator/test-local/helper/Deployments.ts create mode 100644 packages/validator/test-local/helper/Utility.ts create mode 100644 packages/validator/test-local/localtest.ts create mode 100755 packages/validator/test-local/start-chain.sh create mode 100755 packages/validator/test-local/start-test.sh create mode 100755 packages/validator/test-local/stop-chain.sh diff --git a/packages/validator/.gitignore b/packages/validator/.gitignore index 046e575..8f64a5b 100644 --- a/packages/validator/.gitignore +++ b/packages/validator/.gitignore @@ -140,3 +140,6 @@ typechain-types cache artifacts +/**/*/chain1/node/* +/**/*/chain2/node/* +.openzeppelin/ diff --git a/packages/validator/env/.env.sample b/packages/validator/env/.env.sample index 1874d92..7992d18 100644 --- a/packages/validator/env/.env.sample +++ b/packages/validator/env/.env.sample @@ -18,5 +18,17 @@ DATABASE_PORT=5432 # 0x6F8CF905906dDe9E440F0DF5B26146cf1f195F12 DEPLOYER=0x0d451ab5bd459f59fda0cf8018cfbfa4df5c454c5c25a844b70a5afcaf246c98 +# 0x6629E54deC62B88b34d6fF7439B290cC0f1bfaEC +FEE=0xcfefe53d3c74cda9aa7b0af55d0b615cdcf7d4ed3b8653fb87fb2259f083f007 +# 0xF99D11fa9E430005b2cEE0f671d4dA79868D9570 +BRIDGE_VALIDATOR1=0xba07977ad7f97189551f9f119a9f92413cec54d456921f249c71ec39a0c04925 +# 0x6F8CF905906dDe9E440F0DF5B26146cf1f195F12 +BRIDGE_VALIDATOR2=0x0d451ab5bd459f59fda0cf8018cfbfa4df5c454c5c25a844b70a5afcaf246c98 +# 0x414E20AfA67289f119d3Edf05F27a7832cEc738b +BRIDGE_VALIDATOR3=0x643600c786cff4ba0c5e0d8d251d2c83062b043d324b0241bcff3bddacf92399 +# 0x98F74031045b809a9078f43A51601c51Acf7B042 +BRIDGE_VALIDATOR4=0x0ff87ad864e2ad510f1a09fdef0b087f67e0b19e1b4ef66f81acdafde0dcbd2c +# 0xe3231Cda6B5be01f7C52B39cF05637A9c5Aee98A +BRIDGE_VALIDATOR5=0x6b56aac382c8b18d57e3451f11077e260cf0d242c4d44251a3b01bfc65fc08f9 REPORT_GAS=true diff --git a/packages/validator/hardhat-change-network.ts b/packages/validator/hardhat-change-network.ts index f2dba31..e1516b7 100644 --- a/packages/validator/hardhat-change-network.ts +++ b/packages/validator/hardhat-change-network.ts @@ -7,10 +7,12 @@ import { EthereumProvider } from "hardhat/types/provider"; // This import is needed to let the TypeScript compiler know that it should include your type // extensions in your npm package's types file. import "hardhat/types/runtime"; +import { EthersProviderWrapper } from "@nomiclabs/hardhat-ethers/internal/ethers-provider-wrapper"; declare module "hardhat/types/runtime" { interface HardhatRuntimeEnvironment { changeNetwork(newNetwork: string): Promise; getProvider(newNetwork: string): Promise; + getChainId(newNetwork: string): number; } } @@ -19,6 +21,7 @@ extendEnvironment((hre) => { // We use lazyObject to avoid initializing things until they are actually // needed. const providers: { [name: string]: EthereumProvider } = {}; + const chainIds: { [name: string]: number } = {}; hre.getProvider = async function getProvider(name: string): Promise { if (!providers[name]) { @@ -44,6 +47,7 @@ extendEnvironment((hre) => { if (newNetwork === "hardhat") { const { EthersProviderWrapper } = require("@nomiclabs/hardhat-ethers/internal/ethers-provider-wrapper"); (this as any).ethers.provider = new EthersProviderWrapper(this.network.provider); + chainIds[newNetwork] = (await (this as any).ethers.provider.getNetwork()).chainId; } else { const httpNetConfig = this.config.networks[newNetwork] as HttpNetworkConfig; const chainId = httpNetConfig.chainId || 0; @@ -51,7 +55,12 @@ extendEnvironment((hre) => { name: newNetwork, chainId, }) as JsonRpcProvider; + chainIds[newNetwork] = chainId; } } }; + + hre.getChainId = function getChainId(name: string): number { + return chainIds[name]; + }; }); diff --git a/packages/validator/hardhat.config.ts b/packages/validator/hardhat.config.ts index 822fc39..03c4e02 100644 --- a/packages/validator/hardhat.config.ts +++ b/packages/validator/hardhat.config.ts @@ -90,6 +90,146 @@ function getAccounts() { accounts.push(process.env.BRIDGE_VALIDATOR5); } + if (process.env.KEY01 !== undefined && process.env.KEY01.trim() !== "" && reg_bytes64.test(process.env.KEY01)) { + accounts.push(process.env.KEY01); + } else { + process.env.KEY01 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY01); + } + + if (process.env.KEY02 !== undefined && process.env.KEY02.trim() !== "" && reg_bytes64.test(process.env.KEY02)) { + accounts.push(process.env.KEY02); + } else { + process.env.KEY02 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY02); + } + + if (process.env.KEY03 !== undefined && process.env.KEY03.trim() !== "" && reg_bytes64.test(process.env.KEY03)) { + accounts.push(process.env.KEY03); + } else { + process.env.KEY03 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY03); + } + + if (process.env.KEY04 !== undefined && process.env.KEY04.trim() !== "" && reg_bytes64.test(process.env.KEY04)) { + accounts.push(process.env.KEY04); + } else { + process.env.KEY04 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY04); + } + + if (process.env.KEY05 !== undefined && process.env.KEY05.trim() !== "" && reg_bytes64.test(process.env.KEY05)) { + accounts.push(process.env.KEY05); + } else { + process.env.KEY05 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY05); + } + + if (process.env.KEY06 !== undefined && process.env.KEY06.trim() !== "" && reg_bytes64.test(process.env.KEY06)) { + accounts.push(process.env.KEY06); + } else { + process.env.KEY06 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY06); + } + + if (process.env.KEY07 !== undefined && process.env.KEY07.trim() !== "" && reg_bytes64.test(process.env.KEY07)) { + accounts.push(process.env.KEY07); + } else { + process.env.KEY07 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY07); + } + + if (process.env.KEY08 !== undefined && process.env.KEY08.trim() !== "" && reg_bytes64.test(process.env.KEY08)) { + accounts.push(process.env.KEY08); + } else { + process.env.KEY08 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY08); + } + + if (process.env.KEY09 !== undefined && process.env.KEY09.trim() !== "" && reg_bytes64.test(process.env.KEY09)) { + accounts.push(process.env.KEY09); + } else { + process.env.KEY09 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY09); + } + + if (process.env.KEY10 !== undefined && process.env.KEY10.trim() !== "" && reg_bytes64.test(process.env.KEY10)) { + accounts.push(process.env.KEY10); + } else { + process.env.KEY10 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY10); + } + + if (process.env.KEY11 !== undefined && process.env.KEY11.trim() !== "" && reg_bytes64.test(process.env.KEY11)) { + accounts.push(process.env.KEY11); + } else { + process.env.KEY11 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY11); + } + + if (process.env.KEY12 !== undefined && process.env.KEY12.trim() !== "" && reg_bytes64.test(process.env.KEY12)) { + accounts.push(process.env.KEY12); + } else { + process.env.KEY12 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY12); + } + + if (process.env.KEY13 !== undefined && process.env.KEY13.trim() !== "" && reg_bytes64.test(process.env.KEY13)) { + accounts.push(process.env.KEY13); + } else { + process.env.KEY13 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY13); + } + + if (process.env.KEY14 !== undefined && process.env.KEY14.trim() !== "" && reg_bytes64.test(process.env.KEY14)) { + accounts.push(process.env.KEY14); + } else { + process.env.KEY14 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY14); + } + + if (process.env.KEY15 !== undefined && process.env.KEY15.trim() !== "" && reg_bytes64.test(process.env.KEY15)) { + accounts.push(process.env.KEY15); + } else { + process.env.KEY15 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY15); + } + + if (process.env.KEY16 !== undefined && process.env.KEY16.trim() !== "" && reg_bytes64.test(process.env.KEY16)) { + accounts.push(process.env.KEY16); + } else { + process.env.KEY16 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY16); + } + + if (process.env.KEY17 !== undefined && process.env.KEY17.trim() !== "" && reg_bytes64.test(process.env.KEY17)) { + accounts.push(process.env.KEY17); + } else { + process.env.KEY17 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY17); + } + + if (process.env.KEY18 !== undefined && process.env.KEY18.trim() !== "" && reg_bytes64.test(process.env.KEY18)) { + accounts.push(process.env.KEY18); + } else { + process.env.KEY18 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY18); + } + + if (process.env.KEY19 !== undefined && process.env.KEY19.trim() !== "" && reg_bytes64.test(process.env.KEY19)) { + accounts.push(process.env.KEY19); + } else { + process.env.KEY19 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY19); + } + + if (process.env.KEY20 !== undefined && process.env.KEY20.trim() !== "" && reg_bytes64.test(process.env.KEY20)) { + accounts.push(process.env.KEY20); + } else { + process.env.KEY20 = Wallet.createRandom().privateKey; + accounts.push(process.env.KEY20); + } + while (accounts.length < 100) { accounts.push(Wallet.createRandom().privateKey); } @@ -154,6 +294,16 @@ const config = { chainId: 24680, accounts: getAccounts(), }, + chain1: { + url: "http://localhost:8541", + chainId: 215191, + accounts: getAccounts(), + }, + chain2: { + url: "http://localhost:8542", + chainId: 215192, + accounts: getAccounts(), + }, }, gasReporter: { enabled: process.env.REPORT_GAS !== undefined, diff --git a/packages/validator/package.json b/packages/validator/package.json index dc620e3..e7dcda1 100644 --- a/packages/validator/package.json +++ b/packages/validator/package.json @@ -18,6 +18,7 @@ "start": "TESTING=false NODE_ENV=production hardhat run src/main.ts --network production_net", "formatting:check": "prettier '**/*.{json,sol,ts,js,yaml}' -c", "formatting:write": "prettier '**/*.{json,sol,ts,js,yaml}' --write", + "test:local": "test-local/start-test.sh", "test:01-Collector": "TESTING=true hardhat test test/01-Collector.test.ts", "test:02-Bridge": "TESTING=true hardhat test test/02-Bridge.test.ts" }, diff --git a/packages/validator/scripts/exchange.ts b/packages/validator/scripts/exchange.ts deleted file mode 100644 index 94b94b9..0000000 --- a/packages/validator/scripts/exchange.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { HTTPClient } from "../src/utils/HTTPClient"; - -import { parseFromString } from "dom-parser"; - -async function main() { - const url = "https://www.kita.net/cmmrcInfo/ehgtGnrlzInfo/rltmEhgt.do"; - const client = new HTTPClient(); - const res = await client.get(url); - const rates = []; - if (res.status === 200) { - try { - const text: string = res.data; - const pos0 = text.indexOf(''); - if (pos0 < 0) return []; - const text0 = text.substring(pos0); - const pos1 = text0.indexOf("
"); - if (pos1 < 0) return []; - const text1 = text0.substring(0, pos1 + 8); - const dom = parseFromString(text1); - if (text1 === undefined) return []; - const tbody = dom.getElementsByTagName("tbody"); - if (tbody === undefined || tbody.length === 0) return []; - - const nodes = tbody[0].getElementsByTagName("tr"); - if (nodes === undefined || nodes.length === 0) return []; - - for (const tr of nodes) { - const th = tr.getElementsByTagName("th"); - if (th[0].childNodes[0].childNodes[0].text !== null) { - const symbol = th[0].childNodes[0].childNodes[0].text.toLowerCase(); - const td = tr.getElementsByTagName("td"); - if (td !== undefined && td.length > 0 && td[0].childNodes[0].text !== null) { - const rate = Math.floor(Number(td[0].childNodes[0].text.replace(/[,_]/gi, "")) * 1000000000); - rates.push({ symbol, rate }); - } - } - } - console.log(rates); - return rates; - } catch (error) { - return []; - } - } else return []; -} - -main().catch((error) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/packages/validator/scripts/sync.ts b/packages/validator/scripts/sync.ts deleted file mode 100644 index 0e977e3..0000000 --- a/packages/validator/scripts/sync.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Client } from "ntp-time"; - -async function main() { - const client = new Client("kr.pool.ntp.org", 123, { timeout: 5000 }); - const res = await client.syncTime(); - console.log(res); -} - -main().catch((error) => { - console.error(error); - process.exitCode = 1; -}); diff --git a/packages/validator/src/scheduler/EventCollector.ts b/packages/validator/src/scheduler/EventCollector.ts index e660b19..30964e3 100644 --- a/packages/validator/src/scheduler/EventCollector.ts +++ b/packages/validator/src/scheduler/EventCollector.ts @@ -1,10 +1,13 @@ import { IBridge__factory } from "../../typechain-types"; +import { IBridgeInterface } from "../../typechain-types/dms-bridge-contracts/contracts/interfaces/IBridge"; import { ValidatorStorage } from "../storage/ValidatorStorage"; import { BigNumber, Wallet } from "ethers"; import * as hre from "hardhat"; import { logger } from "../common/Logger"; -import { ValidatorType } from "../types"; +import { ValidatorType, WithdrawStatus } from "../types"; + +import { Provider } from "@ethersproject/providers"; export class EventCollector { private wallet: Wallet; @@ -12,8 +15,9 @@ export class EventCollector { private readonly network: string; private readonly contractAddress: string; private readonly startNumber: bigint; - private contract: any; private storage: ValidatorStorage; + private provider: Provider | undefined; + private interfaceOfBridge: IBridgeInterface | undefined; constructor( storage: ValidatorStorage, @@ -31,15 +35,18 @@ export class EventCollector { this.wallet = wallet; } - private async getLatestBlockNumber(): Promise { - const block = await hre.ethers.provider.getBlock("latest"); - return BigInt(block.number); - } - public async work() { - await hre.changeNetwork(this.network); + if (this.provider === undefined) { + await hre.changeNetwork(this.network); + this.provider = hre.ethers.provider; + } - const latestBlockNumber = await this.getLatestBlockNumber(); + if (this.interfaceOfBridge === undefined) { + this.interfaceOfBridge = IBridge__factory.createInterface(); + } + + const block = await this.provider.getBlock("latest"); + const latestBlockNumber = BigInt(block.number); let from: BigInt; const latestCollectedNumber = await this.storage.getLatestNumber(this.wallet.address, this.type, this.network); @@ -50,21 +57,28 @@ export class EventCollector { if (from > latestBlockNumber) from = this.startNumber; } - this.contract = new hre.web3.eth.Contract(IBridge__factory.abi as any, this.contractAddress); - const events = await this.contract.getPastEvents("BridgeDeposited", { + const filters = [this.interfaceOfBridge.getEventTopic("BridgeDeposited")]; + + const logs = await this.provider.getLogs({ fromBlock: Number(from), toBlock: Number(latestBlockNumber), + address: this.contractAddress, + topics: filters, }); - const depositEvents = events.map((m: any) => { + const iface = this.interfaceOfBridge; + const depositEvents = logs.map((m: any) => { + const event = iface.parseLog(m); return { network: this.network, - tokenId: m.returnValues.tokenId, - depositId: m.returnValues.depositId, - account: m.returnValues.account, - amount: BigNumber.from(m.returnValues.amount), + tokenId: event.args.tokenId, + depositId: event.args.depositId, + account: event.args.account, + amount: BigNumber.from(event.args.amount), blockNumber: BigInt(m.blockNumber), transactionHash: m.transactionHash, + withdrawStatus: WithdrawStatus.None, + withdrawTimestamp: 0n, }; }); diff --git a/packages/validator/src/scheduler/Executor.ts b/packages/validator/src/scheduler/Executor.ts index ab07c64..79f1430 100644 --- a/packages/validator/src/scheduler/Executor.ts +++ b/packages/validator/src/scheduler/Executor.ts @@ -8,9 +8,11 @@ import { ResponseMessage } from "../utils/Errors"; import { Wallet } from "ethers"; import * as hre from "hardhat"; -import { NonceManager } from "@ethersproject/experimental"; import { ContractUtils } from "../utils/ContractUtils"; +import { NonceManager } from "@ethersproject/experimental"; +import { Provider } from "@ethersproject/providers"; + export class Executor { private storage: ValidatorStorage; private wallet: Wallet; @@ -19,6 +21,7 @@ export class Executor { private readonly sourceNetwork: string; private readonly targetNetwork: string; private readonly targetContractAddress: string; + private targetProvider: Provider | undefined; constructor( storage: ValidatorStorage, @@ -39,6 +42,11 @@ export class Executor { } public async work() { + if (this.targetProvider === undefined) { + await hre.changeNetwork(this.targetNetwork); + this.targetProvider = hre.ethers.provider; + } + const events = await this.storage.getNotExecutedEvents( this.wallet.address, this.sourceType, @@ -46,13 +54,12 @@ export class Executor { ); if (events.length === 0) return; - await hre.changeNetwork(this.targetNetwork); - const signer = new NonceManager(new GasPriceManager(this.wallet.connect(hre.ethers.provider))); + const signer = new NonceManager(new GasPriceManager(this.wallet.connect(this.targetProvider))); const contract = new hre.ethers.Contract( this.targetContractAddress, IBridge__factory.createInterface(), - hre.ethers.provider + this.targetProvider ) as IBridge; for (const event of events) { diff --git a/packages/validator/src/utils/ContractUtils.ts b/packages/validator/src/utils/ContractUtils.ts index f52fc70..812ab6c 100644 --- a/packages/validator/src/utils/ContractUtils.ts +++ b/packages/validator/src/utils/ContractUtils.ts @@ -194,20 +194,17 @@ export class ContractUtils { hash: string, address: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "address", "uint256", "uint256"], - [hash, address, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [hash, address, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } - public static getRemoveMessage(address: string, nonce: BigNumberish, chainId?: BigNumberish): Uint8Array { - const encodedResult = defaultAbiCoder.encode( - ["address", "uint256", "uint256"], - [address, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] - ); + public static getRemoveMessage(address: string, nonce: BigNumberish, chainId: BigNumberish): Uint8Array { + const encodedResult = defaultAbiCoder.encode(["address", "uint256", "uint256"], [address, chainId, nonce]); return arrayify(keccak256(encodedResult)); } @@ -227,11 +224,11 @@ export class ContractUtils { shopId: BytesLike, account: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "address", "uint256", "uint256"], - [shopId, account, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [shopId, account, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -242,11 +239,11 @@ export class ContractUtils { currency: string, account: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "string", "string", "address", "uint256", "uint256"], - [shopId, name, currency, account, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [shopId, name, currency, account, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -256,11 +253,11 @@ export class ContractUtils { status: BigNumberish, account: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "uint256", "address", "uint256", "uint256"], - [shopId, status, account, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [shopId, status, account, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -270,11 +267,11 @@ export class ContractUtils { delegator: string, account: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "address", "address", "uint256", "uint256"], - [shopId, delegator, account, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [shopId, delegator, account, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -284,11 +281,11 @@ export class ContractUtils { amount: BigNumberish, account: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "uint256", "address", "uint256", "uint256"], - [shopId, amount, account, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [shopId, amount, account, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -300,11 +297,11 @@ export class ContractUtils { phone: BytesLike, address: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "address", "uint256", "uint256"], - [phone, address, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [phone, address, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -313,7 +310,7 @@ export class ContractUtils { signer: Signer, phone: BytesLike, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Promise { const message = ContractUtils.getChangePayablePointMessage(phone, await signer.getAddress(), nonce, chainId); return signer.signMessage(message); @@ -324,7 +321,7 @@ export class ContractUtils { account: string, nonce: BigNumberish, signature: BytesLike, - chainId?: BigNumberish + chainId: BigNumberish ): boolean { const message = ContractUtils.getChangePayablePointMessage(phone, account, nonce, chainId); let res: string; @@ -336,15 +333,12 @@ export class ContractUtils { return res.toLowerCase() === account.toLowerCase(); } - public static getLoyaltyTypeMessage(address: string, nonce: BigNumberish, chainId?: BigNumberish): Uint8Array { - const encodedResult = defaultAbiCoder.encode( - ["address", "uint256", "uint256"], - [address, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] - ); + public static getLoyaltyTypeMessage(address: string, nonce: BigNumberish, chainId: BigNumberish): Uint8Array { + const encodedResult = defaultAbiCoder.encode(["address", "uint256", "uint256"], [address, chainId, nonce]); return arrayify(keccak256(encodedResult)); } - public static async signLoyaltyType(signer: Signer, nonce: BigNumberish, chainId?: BigNumberish): Promise { + public static async signLoyaltyType(signer: Signer, nonce: BigNumberish, chainId: BigNumberish): Promise { const message = ContractUtils.getLoyaltyTypeMessage(await signer.getAddress(), nonce, chainId); return signer.signMessage(message); } @@ -353,7 +347,7 @@ export class ContractUtils { account: string, nonce: BigNumberish, signature: string, - chainId?: BigNumberish + chainId: BigNumberish ): boolean { const message = ContractUtils.getLoyaltyTypeMessage(account, nonce, chainId); let res: string; @@ -375,20 +369,11 @@ export class ContractUtils { currency: string, shopId: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "string", "uint256", "string", "bytes32", "address", "uint256", "uint256"], - [ - paymentId, - purchaseId, - amount, - currency, - shopId, - address, - chainId ? chainId : hre.ethers.provider.network.chainId, - nonce, - ] + [paymentId, purchaseId, amount, currency, shopId, address, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -401,7 +386,7 @@ export class ContractUtils { currency: string, shopId: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Promise { const message = ContractUtils.getLoyaltyNewPaymentMessage( await signer.getAddress(), @@ -425,7 +410,7 @@ export class ContractUtils { nonce: BigNumberish, account: string, signature: BytesLike, - chainId?: BigNumberish + chainId: BigNumberish ): boolean { const message = ContractUtils.getLoyaltyNewPaymentMessage( account, @@ -452,11 +437,11 @@ export class ContractUtils { purchaseId: string, confirm: boolean, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "string", "bool", "address", "uint256", "uint256"], - [paymentId, purchaseId, confirm, address, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [paymentId, purchaseId, confirm, address, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -467,7 +452,7 @@ export class ContractUtils { purchaseId: string, confirm: boolean, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Promise { const message = ContractUtils.getLoyaltyClosePaymentMessage( await signer.getAddress(), @@ -485,11 +470,11 @@ export class ContractUtils { paymentId: string, purchaseId: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["bytes32", "string", "address", "uint256", "uint256"], - [paymentId, purchaseId, address, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [paymentId, purchaseId, address, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } @@ -499,7 +484,7 @@ export class ContractUtils { paymentId: string, purchaseId: string, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Promise { const message = ContractUtils.getLoyaltyCancelPaymentMessage( await signer.getAddress(), @@ -517,7 +502,7 @@ export class ContractUtils { nonce: BigNumberish, account: string, signature: BytesLike, - chainId?: BigNumberish + chainId: BigNumberish ): boolean { const message = ContractUtils.getLoyaltyCancelPaymentMessage(account, paymentId, purchaseId, nonce, chainId); let res: string; @@ -583,7 +568,7 @@ export class ContractUtils { phone: BytesLike; sender: string; }[], - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const messages: BytesLike[] = []; for (const elem of purchases) { @@ -598,7 +583,7 @@ export class ContractUtils { elem.account, elem.phone, elem.sender, - chainId ? chainId : hre.ethers.provider.network.chainId, + chainId, ] ); messages.push(keccak256(encodedData)); @@ -613,13 +598,13 @@ export class ContractUtils { public static getCurrencyMessage( height: BigNumberish, rates: { symbol: string; rate: BigNumberish }[], - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const messages: BytesLike[] = []; for (const elem of rates) { const encodedData = defaultAbiCoder.encode( ["string", "uint256", "uint256"], - [elem.symbol, elem.rate, chainId ? chainId : hre.ethers.provider.network.chainId] + [elem.symbol, elem.rate, chainId] ); messages.push(keccak256(encodedData)); } @@ -635,11 +620,11 @@ export class ContractUtils { to: string, amount: BigNumberish, nonce: BigNumberish, - chainId?: BigNumberish + chainId: BigNumberish ): Uint8Array { const encodedResult = defaultAbiCoder.encode( ["address", "address", "uint256", "uint256", "uint256"], - [from, to, amount, chainId ? chainId : hre.ethers.provider.network.chainId, nonce] + [from, to, amount, chainId, nonce] ); return arrayify(keccak256(encodedResult)); } diff --git a/packages/validator/test-local/chain1/config/config.toml b/packages/validator/test-local/chain1/config/config.toml new file mode 100644 index 0000000..0a881de --- /dev/null +++ b/packages/validator/test-local/chain1/config/config.toml @@ -0,0 +1,12 @@ +[Eth] +NetworkId = 215191 + +[Node] +HTTPHost = "0.0.0.0" +HTTPPort = 8541 +HTTPVirtualHosts = ["*"] +HTTPModules = ["eth", "net", "web3", "txpool"] + +[Node.P2P] +BootstrapNodes = [] +StaticNodes = [] diff --git a/packages/validator/test-local/chain1/config/genesis.json b/packages/validator/test-local/chain1/config/genesis.json new file mode 100644 index 0000000..83ccafe --- /dev/null +++ b/packages/validator/test-local/chain1/config/genesis.json @@ -0,0 +1,404 @@ +{ + "config": { + "chainId": 215191, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "londonBlock": 0, + "arrowglacierBlock": 0, + "grayGlacierBlock": 0, + "clique": { + "period": 0, + "epoch": 30000 + } + }, + "difficulty": "1", + "gasLimit": "8000000", + "extradata": "0x0000000000000000000000000000000000000000000000000000000000000000f85b2dba83a08dee6e24e4461e0334e7384896f90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "alloc": { + "8B595d325485a0Ca9d41908cAbF265E23C172847": { "balance": "20000000000000000000000000000" }, + "Dc245797409fb79446523Fa1A4ca97294eef22EE": { "balance": "20000000000000000000000000000" }, + "6629E54deC62B88b34d6fF7439B290cC0f1bfaEC": { "balance": "20000000000000000000000000000" }, + "9E8549cc1B5b9036AC410Ed11966BB3c6B94A77d": { "balance": "20000000000000000000000000000" }, + "103CB97f47801563C875942510Ff0585E31F55b5": { "balance": "20000000000000000000000000000" }, + "F49e8729c774f31eB1b7724E898BC9230a13E54c": { "balance": "20000000000000000000000000000" }, + "A6Ee9Ddfa9B82DF810b8E4AFaa5ff04A267d4930": { "balance": "20000000000000000000000000000" }, + "898Bf21a9e1fF51d3F1248E0A253f6A58C3a736a": { "balance": "20000000000000000000000000000" }, + "c573eF6FDcaf1461FF2BB75a70B7685ad395AA2d": { "balance": "20000000000000000000000000000" }, + "26b9D69FAa8f7950095193d50EFd14E3B80EAb5B": { "balance": "20000000000000000000000000000" }, + "8CA2D0080a42DB61cbe59611551412D294FC5911": { "balance": "20000000000000000000000000000" }, + "4501F7aF010Cef3DcEaAfbc7Bfb2B39dE57df54d": { "balance": "20000000000000000000000000000" }, + "c86c00147049695C3Cad5eA4ebb75B6bd4f09126": { "balance": "20000000000000000000000000000" }, + "1424bd767541666DF9658550FCf156FDaCd52934": { "balance": "20000000000000000000000000000" }, + "4376b9f7F6E6fa2d543910dCec2CDcC290A97722": { "balance": "20000000000000000000000000000" }, + "39E63ba90b86Bd1FF77290d37328B87dADdebf59": { "balance": "20000000000000000000000000000" }, + "454cd944C9Eac1e84064c0D105931aDCEbC86c89": { "balance": "20000000000000000000000000000" }, + "9f97e74e211D53B16491f33a1fF3A6E774B6Af26": { "balance": "20000000000000000000000000000" }, + "1cfF2132B4196AD49076A15868dCe92445c4c128": { "balance": "20000000000000000000000000000" }, + "70eB26f311Ad5c94Be746394f91AA51b72109A14": { "balance": "20000000000000000000000000000" }, + "EaeB90D77f7756fBf177D6E0E1BB794639e6097f": { "balance": "20000000000000000000000000000" }, + "3E6B6C403a1736C497b0B2e71f0993D6Dd0a8737": { "balance": "20000000000000000000000000000" }, + "5E5a72aEDAD4985B222713342bD368acD8d106E1": { "balance": "20000000000000000000000000000" }, + "F474C433D594f2E8Df047f1463Ae2edA311f27B3": { "balance": "20000000000000000000000000000" }, + "4b7FD1DB9c488Cd5cd6506d5f0E6bD1739489332": { "balance": "20000000000000000000000000000" }, + "C0Bb4e59b07a25e1007C0A85d89d93dEDeD1ef20": { "balance": "20000000000000000000000000000" }, + "1Ea9d36d45A42C95A8752541Fa06047DEc482F89": { "balance": "20000000000000000000000000000" }, + "6440665c7480451f28aE57A3d552DF3bA04383b1": { "balance": "20000000000000000000000000000" }, + "02a40B3637B0EbCF87a459DF2B00a34CA3332BDb": { "balance": "20000000000000000000000000000" }, + "b9De33A8be2F913F6AFA3a64849c86F18410fF05": { "balance": "20000000000000000000000000000" }, + "EA7d7197CAD3343661f77bEEb3966BB6F6D8343a": { "balance": "20000000000000000000000000000" }, + "1D969d5A42cf6A4D8227eFaf7146FA0a5985ccb9": { "balance": "20000000000000000000000000000" }, + "Cf6737dCf3ea51865C2204089b8E0dbe89D2f603": { "balance": "20000000000000000000000000000" }, + "f9E4C5Bd26c734417b52937a88137B20117f5dA1": { "balance": "20000000000000000000000000000" }, + "ae4451532FE3De802f776228e626d5A262dB89fD": { "balance": "20000000000000000000000000000" }, + "7aE4ef7e83ef3BE54560a12D9DE6d8F7284C4cF1": { "balance": "20000000000000000000000000000" }, + "17eEdA54B7db14E1C1B84a2e569B5EB1Dce25747": { "balance": "20000000000000000000000000000" }, + "FF25Cf201B64f0d70188AD7D141A775D209cBCeA": { "balance": "20000000000000000000000000000" }, + "bADFD86408e56AbB3C32CF0a8ca0B5d09A6e55f1": { "balance": "20000000000000000000000000000" }, + "759e97ec374B00d5c93c982275D3d4F34c6E05fc": { "balance": "20000000000000000000000000000" }, + "1D02184923Aa505153DbD0397f382d608042CBB2": { "balance": "20000000000000000000000000000" }, + "9a92B3d0760bC4e7a3cCdfe37E1fbfAAA39eC050": { "balance": "20000000000000000000000000000" }, + "02eaFC1091533F984dB53483a7215c7a982a3Ac1": { "balance": "20000000000000000000000000000" }, + "2312c098Cef41C0F55350bC3Ad8F4AFf983d9432": { "balance": "20000000000000000000000000000" }, + "5AD84fF1bD71cDEa7C3083706F2D1232a453C604": { "balance": "20000000000000000000000000000" }, + "9630fF452211Cc95BBFa32c0C4cF68eB498b8549": { "balance": "20000000000000000000000000000" }, + "F99D11fa9E430005b2cEE0f671d4dA79868D9570": { "balance": "20000000000000000000000000000" }, + "6F8CF905906dDe9E440F0DF5B26146cf1f195F12": { "balance": "20000000000000000000000000000" }, + "414E20AfA67289f119d3Edf05F27a7832cEc738b": { "balance": "20000000000000000000000000000" }, + "98F74031045b809a9078f43A51601c51Acf7B042": { "balance": "20000000000000000000000000000" }, + "e3231Cda6B5be01f7C52B39cF05637A9c5Aee98A": { "balance": "20000000000000000000000000000" }, + "3633B7eBd5562316BD3740FAe1d5A4aD46DbD8f0": { "balance": "20000000000000000000000000000" }, + "D4178A988Aa107F06fe53838B9F839A6A4511381": { "balance": "20000000000000000000000000000" }, + "A990E52FB413DCAed7ebFF2E9173C1c5E6452773": { "balance": "20000000000000000000000000000" }, + "31f2B0cA552625402046545ca155f8B2F21E09a0": { "balance": "20000000000000000000000000000" }, + "db1D45dF6F6bfeEe139096D5684B3160b8ada4C1": { "balance": "20000000000000000000000000000" }, + "EbeadEB009e7b19F16845F5c2bfd6269473fA9A2": { "balance": "20000000000000000000000000000" }, + "e967c305F00655a1b35AB250f805EB7d2678fab1": { "balance": "20000000000000000000000000000" }, + "acEEA5fF318D5BDd83045DAA63ca216505f4d9d5": { "balance": "20000000000000000000000000000" }, + "36587Bdb33C5Ae5655Dc1eEd5e2E8A1e7f0Fe618": { "balance": "20000000000000000000000000000" }, + "1421A3EbFe70795a4B1701F9A6bf6A498d823E14": { "balance": "20000000000000000000000000000" }, + "30c5C62D804ACD5EaefCD2d8D83eEA8366EBA527": { "balance": "20000000000000000000000000000" }, + "7Af3567044de23fb5f4779b1AF5c507016B52C3b": { "balance": "20000000000000000000000000000" }, + "FAb8A60CAC79c2Ab37EA742B9cd556B373Deda54": { "balance": "20000000000000000000000000000" }, + "6148d9Ea716ac12C4cCB2b6b6A68E790182Bf78A": { "balance": "20000000000000000000000000000" }, + "1e35855BAF526866CF353227268861B6c20A49B0": { "balance": "20000000000000000000000000000" }, + "20C6AE51Df6460549FD4A1F9fde35E3cb936FA64": { "balance": "20000000000000000000000000000" }, + "EB91E882489f5e3A680BfC0bdeF4aBD0227961AA": { "balance": "20000000000000000000000000000" }, + "41D7992Fe8EA6c959754eBc6387299663D40B488": { "balance": "20000000000000000000000000000" }, + "21b990C48dCC77eA7E3e353ab9ca7A09df92EEf6": { "balance": "20000000000000000000000000000" }, + "1bdBb643A47a89afBea77275a12b8689D727206F": { "balance": "20000000000000000000000000000" }, + "870E33B0774621b8e216bf74ea6C86edEcf94d93": { "balance": "20000000000000000000000000000" }, + "AE15B0C9D62C9989EA8E06da459a002c52f06ec4": { "balance": "20000000000000000000000000000" }, + "22AFBF3cc4165c973eC45d246Ec46AE21985A900": { "balance": "20000000000000000000000000000" }, + "03b73c934B2D2411d90ac092764E3736e7d631ab": { "balance": "20000000000000000000000000000" }, + "4b51C06Cd821BB5ae3615c25d20fC7b6f794B1A3": { "balance": "20000000000000000000000000000" }, + "15248ce6a1c9B8d4f16Bc37e901983B49cBB9976": { "balance": "20000000000000000000000000000" }, + "02f551e68F82D7dA8Aa109e272d7a83930D4bAAF": { "balance": "20000000000000000000000000000" }, + "C6BD8df7e6be560aD2637cF4FaF5C4a3FBb97Bf8": { "balance": "20000000000000000000000000000" }, + "0FF6c5984f4E34F2c1d98743E9F4e5BDecbE09B7": { "balance": "20000000000000000000000000000" }, + "549Dff5e390a72AF61d866Fee932e0c8BCbF71EB": { "balance": "20000000000000000000000000000" }, + "b84593b3Cabb6BF0622fDd16C4e0C33bDf24EF8f": { "balance": "20000000000000000000000000000" }, + "61A530B18673d9C92B494E172Bc4b20336C43B67": { "balance": "20000000000000000000000000000" }, + "AfB7cb6f6b5729880Ad820464FaD11B7c87bDf7d": { "balance": "20000000000000000000000000000" }, + "523026e94Dc647D4Df90AdcF3b4F74A66B1b26ed": { "balance": "20000000000000000000000000000" }, + "E1260b72974Fb4489dfcf2cA61cb7F2346B3CDc5": { "balance": "20000000000000000000000000000" }, + "E122B9e9D8A854180A176A183Ad3e4516669D045": { "balance": "20000000000000000000000000000" }, + "0FD1AB3B47312569eB7f4945C787Ea5fA84bc4e1": { "balance": "20000000000000000000000000000" }, + "29BB7CD2A2b16DD74fA3A9D970D6b26126F9074A": { "balance": "20000000000000000000000000000" }, + "B80b76158738a60907B21649edDC614FA1275fa0": { "balance": "20000000000000000000000000000" }, + "0d043fEE2E620215219939fC5115bC5436055386": { "balance": "20000000000000000000000000000" }, + "e6e949046A13B2597aeabfA9a91B1f1280D9dC75": { "balance": "20000000000000000000000000000" }, + "735a9c998653DCed19f2fE611d57B9A9cdA4f9DB": { "balance": "20000000000000000000000000000" }, + "28c0679b95381b13155EEC6a19118c5C319d5648": { "balance": "20000000000000000000000000000" }, + "23f15d8A8f08B6524c2ED0c01FE844333F98dFF9": { "balance": "20000000000000000000000000000" }, + "9e4cf1Bcd1f55cB3C266810CA166A3fd8eBFc314": { "balance": "20000000000000000000000000000" }, + "1ca8b6DC993Caf79feA86cb946979F530E3d515c": { "balance": "20000000000000000000000000000" }, + "9b76F5c7fbF126E5b4fD914e8fd641E7b8CcdF19": { "balance": "20000000000000000000000000000" }, + "e1CA4d63d0FeAaeF622605d339b150FEA6639d73": { "balance": "20000000000000000000000000000" }, + "12Cc6B68c30b00c11974Ae95E88551927D163ABD": { "balance": "20000000000000000000000000000" }, + "7Fc757946d38Cff921d16792B37A3c3204CA74d7": { "balance": "20000000000000000000000000000" }, + "BcA2fDbdE5Cf2b6Fa3168d9D1108a480e1C2E613": { "balance": "20000000000000000000000000000" }, + "81B4Adb44f3609cb55EfE446305146ca3EA9b0D7": { "balance": "20000000000000000000000000000" }, + "2f5aFef2bC0236197Dbab9eb1F12aF9e593354b2": { "balance": "20000000000000000000000000000" }, + "aaBC2728DB3E78bDfEefF882602e05b8855ee0B3": { "balance": "20000000000000000000000000000" }, + "FC548215375712963839De1597D77f73aB08921d": { "balance": "20000000000000000000000000000" }, + "aA6D744cD5Ff5f835910E9484BC48F4f58426AE1": { "balance": "20000000000000000000000000000" }, + "709FA7e66d97C112D0af2DAa6Dd5F8a31F63cC30": { "balance": "20000000000000000000000000000" }, + "3a5c045a8BDCEAbb503D9d764d8fD8865C7e41de": { "balance": "20000000000000000000000000000" }, + "E138406711736FF2a09CE67D9A33a52Aeba7D28d": { "balance": "20000000000000000000000000000" }, + "F46cc3675Ad804982aAff96C58C37d4F6F505A97": { "balance": "20000000000000000000000000000" }, + "a8d887eE878bA7c86d21052C84dA06067153311C": { "balance": "20000000000000000000000000000" }, + "17Be446A6880E2E4e76dDCc3f9c9169B2479F30F": { "balance": "20000000000000000000000000000" }, + "f2C1a95cceE7F3B24644A22cAEE6d7bc755B587b": { "balance": "20000000000000000000000000000" }, + "4d02d21e1A8D4784aB198D898E272F06dCbE302d": { "balance": "20000000000000000000000000000" }, + "4a13cc961A174d7FE41A872c1DeC448c965F868F": { "balance": "20000000000000000000000000000" }, + "e6137331596f9853A58FCfA9DFa324D272276C5b": { "balance": "20000000000000000000000000000" }, + "B82653EA7ae02D1456CF4D7d4e37F048B21F9392": { "balance": "20000000000000000000000000000" }, + "4c6faa457996789feCa24d18a55be9E0d4e279fD": { "balance": "20000000000000000000000000000" }, + "9FeEF6dc8Fd5EaeE889486526CA137520d92fe0B": { "balance": "20000000000000000000000000000" }, + "52eb9313c3E77164572bdCda3458C19e871a07f4": { "balance": "20000000000000000000000000000" }, + "75584f1113bdFf465B9c7FE92BA1D20B8A4737ED": { "balance": "20000000000000000000000000000" }, + "e1d965e82D6Dd7f602D073024657cffBAFBD6b04": { "balance": "20000000000000000000000000000" }, + "eb11e8c40aDf9FCD55D41C8661C31F3d7cd3Ded4": { "balance": "20000000000000000000000000000" }, + "6BFd392A1ea4c60CFd3eb99b08944471BE27ad08": { "balance": "20000000000000000000000000000" }, + "0686Ea59F8E9563FA898935cD56D028318909Be5": { "balance": "20000000000000000000000000000" }, + "23cBF9f8C7C7894fe0C4fB66FFDf7b97C35F4B5f": { "balance": "20000000000000000000000000000" }, + "8044C8192c4105d6a03748FCfA1cB52EE814D951": { "balance": "20000000000000000000000000000" }, + "56D8CEF7dC5EA80126cd0F9394580Ac70313ae9c": { "balance": "20000000000000000000000000000" }, + "9c88fdB279153a18639a8942bC0e2D4deF968D78": { "balance": "20000000000000000000000000000" }, + "389777a2Cd07ec12c4F8014e23434BF935617a81": { "balance": "20000000000000000000000000000" }, + "0dE3eE03c1031203Af20C811B9125DF0c244aD99": { "balance": "20000000000000000000000000000" }, + "31F3EdC1e8BD1a2595FAeAF20727Af487D395a0A": { "balance": "20000000000000000000000000000" }, + "9884d4608E25C20E28EC5Bce1Ba270ADdB87a43F": { "balance": "20000000000000000000000000000" }, + "f55a9B58dD615Bf60B0315564cD7a1551E3D95C9": { "balance": "20000000000000000000000000000" }, + "f1253268417c9e49Ad515Fd9db4381870309D78f": { "balance": "20000000000000000000000000000" }, + "e9D4c4ff2Db39D94398eA640ACb9B8d4Eefad45c": { "balance": "20000000000000000000000000000" }, + "4594b82543EDaD783e569291A60932514D19Ac12": { "balance": "20000000000000000000000000000" }, + "8bBb09844472C35DAD83e318b18d9ED001Ac9DD4": { "balance": "20000000000000000000000000000" }, + "b929f1211FE61c9fbf25c7bd2cB526364c6ceaD3": { "balance": "20000000000000000000000000000" }, + "Ea7343BF51352212872b51B53172EfB94bF1c83d": { "balance": "20000000000000000000000000000" }, + "30064fe03EC3Ce283DF7f739bBB7bFDEA87970C2": { "balance": "20000000000000000000000000000" }, + "5C90CadA77147564eaF626b0d0a7FFB40259c689": { "balance": "20000000000000000000000000000" }, + "9Ec17b27792615B878B9646FbAa0Ce1755297C54": { "balance": "20000000000000000000000000000" }, + "3181182d134669109c84bD54ee3ab515b8187cB6": { "balance": "20000000000000000000000000000" }, + "7F7ef7199A50B9cF39AE18F457681007d45BF607": { "balance": "20000000000000000000000000000" }, + "F7844DD9A20f11aCa96F1Feff3Ab92bC4555d848": { "balance": "20000000000000000000000000000" }, + "89fE210c9Cf65F240Ecf8d801D4C52C49957C231": { "balance": "20000000000000000000000000000" }, + "e2E01273a6C0C4cB05A7E52A8E3c618fbB16FCC1": { "balance": "20000000000000000000000000000" }, + "1F8fb5FE8611e4b7f4e6672c1E5cD0Bbd0f81b5a": { "balance": "20000000000000000000000000000" }, + "93899f73E2e06586394b18f5b69e252dB2F843cb": { "balance": "20000000000000000000000000000" }, + "E39df657481Eb91985B68BD3586dF5533AAd1BB5": { "balance": "20000000000000000000000000000" }, + "7E08957676859B9a14510884746df72c933BA256": { "balance": "20000000000000000000000000000" }, + "24568bc6ba56FB614Ddff3096aAEfb20EEa0ef1E": { "balance": "20000000000000000000000000000" }, + "6f1F537bb43e108bD53EE641b31CE5C67dB8346b": { "balance": "20000000000000000000000000000" }, + "cD2CD186f0CDD61ec5cdBE8c7695887E34Edb591": { "balance": "20000000000000000000000000000" }, + "73c56D93F90Fa5E1F0A55030DF9Cce043355892C": { "balance": "20000000000000000000000000000" }, + "A95bD48acF39F2Cd75d4876004DB6dFfEb42bf3C": { "balance": "20000000000000000000000000000" }, + "d70638F112Cc30a5CfFed110C9c2159A4256B402": { "balance": "20000000000000000000000000000" }, + "0e9C7B9Cd0F28c1727cE143c88F6e417DeB88A07": { "balance": "20000000000000000000000000000" }, + "603e61bDCea40004c578D1C63fEc4f2B59ea2F88": { "balance": "20000000000000000000000000000" }, + "F4dD12b4EFA0d2db9F9b1202E720371F28030AC7": { "balance": "20000000000000000000000000000" }, + "92c397740a4eD9429B1CbAad98A32155CfDaFd56": { "balance": "20000000000000000000000000000" }, + "67525dBD7D67f93B1439Ecc76Da4b7c56F18ed64": { "balance": "20000000000000000000000000000" }, + "136b92f575f06e9072c9e01D33cc49B4eCE40809": { "balance": "20000000000000000000000000000" }, + "07ffE21C4C5008bf022b02c9b617366b4785e97f": { "balance": "20000000000000000000000000000" }, + "4f907Da410b6CBED352D8E39320B9C57280e9447": { "balance": "20000000000000000000000000000" }, + "8F4091B7EB2bf1fa095bCc7d9cb30B962B2c9ab7": { "balance": "20000000000000000000000000000" }, + "A25bF2aea03ba2271dBf1974aC56841bd482B0d8": { "balance": "20000000000000000000000000000" }, + "b0C2c2c82De37807521c22CDa018920d82Bfd09f": { "balance": "20000000000000000000000000000" }, + "0A2CeE1D632Dff27b24444848d88c6aB77f76eE3": { "balance": "20000000000000000000000000000" }, + "E445Ab844Da94c71296EdF7B04bE7C14faAE316f": { "balance": "20000000000000000000000000000" }, + "538eeece071210494c1a892d5C13E864c181a976": { "balance": "20000000000000000000000000000" }, + "B64470AE461609dCd745D88e33Bf79Cd24FEEDbF": { "balance": "20000000000000000000000000000" }, + "653c0a13e952c80CB63ec9bb0645aB5E66eC8c43": { "balance": "20000000000000000000000000000" }, + "791ebE3A302E9243A955b20CfB0Ec019bA5cC801": { "balance": "20000000000000000000000000000" }, + "3E2F45A8c714124d4bE83A3830085c8C19543FF5": { "balance": "20000000000000000000000000000" }, + "37d0315C35EAcEc33afB5E27dae8596a3fAa942c": { "balance": "20000000000000000000000000000" }, + "E52d91AEd57Cacb1b88c663Ef012ebF5f67F82E6": { "balance": "20000000000000000000000000000" }, + "63308305fdd078D7D7F33170A98C50d96c06D7C4": { "balance": "20000000000000000000000000000" }, + "C8CbCbB0532223D884622911F8fc6500403328c1": { "balance": "20000000000000000000000000000" }, + "64131c43f51Fb2Be8E8591629AFcf796740EF553": { "balance": "20000000000000000000000000000" }, + "9ff8f6a06F1F7d6570b88dF7d205F9905a082769": { "balance": "20000000000000000000000000000" }, + "A424369b4c2eA88458257497aCA06a8518Bb9f53": { "balance": "20000000000000000000000000000" }, + "3c8D0c7ECec7748f1614BC0Da95d9db3b1E1e400": { "balance": "20000000000000000000000000000" }, + "84470950445A32AD74c38Fb7741fA08a15ECb4A1": { "balance": "20000000000000000000000000000" }, + "E28f9CE6CaF517174FC32B119AfFC7129c1541C8": { "balance": "20000000000000000000000000000" }, + "cF29abc57Bdf7e729CfD5C59a8e7A00C97371710": { "balance": "20000000000000000000000000000" }, + "6472D0A319351697AD372aA40bC71F3aCE885F20": { "balance": "20000000000000000000000000000" }, + "a6CA3188a757Ccb8e9F15bFdE3CD47d1a608290D": { "balance": "20000000000000000000000000000" }, + "359a898ffE899d6914546331F450b0Fa28bDA38A": { "balance": "20000000000000000000000000000" }, + "aC9a52dA87B3c106ad967d42655d22E1F6E0951D": { "balance": "20000000000000000000000000000" }, + "546d36619D4d1a98AC190497278551D70798F960": { "balance": "20000000000000000000000000000" }, + "7eE169D8decD59f933af92C5937f72c274A3ECa9": { "balance": "20000000000000000000000000000" }, + "Ec457286cEb8075305c38F36Cd1BE6aBf3060343": { "balance": "20000000000000000000000000000" }, + "F85d821994473B96d3d7796045a8112dfD9ffC80": { "balance": "20000000000000000000000000000" }, + "e41aAfA506c48C7f8aade94E7fcfa431725f9a7A": { "balance": "20000000000000000000000000000" }, + "5dd78008f0B42a0E0e49435f7Bad9b264b96c7BD": { "balance": "20000000000000000000000000000" }, + "0Be9F5eB80590D0FF801742c5EFd77D3f5902761": { "balance": "20000000000000000000000000000" }, + "60959343b2034Cec4228B611a2e926E6D4dD31df": { "balance": "20000000000000000000000000000" }, + "928e73e399CC0a56ED3B843D25a6930C8dFF36A6": { "balance": "20000000000000000000000000000" }, + "7aC873564D790D9e4002b64379560399365126D9": { "balance": "20000000000000000000000000000" }, + "6F815bdAA9842f814F11292bA0C1dD3aa2Dc565b": { "balance": "20000000000000000000000000000" }, + "5d3E7A006dCC154a7beF0422144E872A7B70b852": { "balance": "20000000000000000000000000000" }, + "0651126EaF5D1BBba5f0715027dBd3BE39463Af7": { "balance": "20000000000000000000000000000" }, + "ab2Ba50aC8a173c81CdD5Be4fbbDAa1Db61C5ebb": { "balance": "20000000000000000000000000000" }, + "12C955E675a827355b9bD1fbF62c37CC42F0D303": { "balance": "20000000000000000000000000000" }, + "DA9Db77DB21aa922cFf9190C0590464Bd65eD72d": { "balance": "20000000000000000000000000000" }, + "F1EF107feB4A79B794CDac0afBDE28333E68A414": { "balance": "20000000000000000000000000000" }, + "5f76F3a1FE6c328e2126f81691396e2802C76194": { "balance": "20000000000000000000000000000" }, + "44b13dbFC6651a53A1c952Dfec47bf0d981F9F8e": { "balance": "20000000000000000000000000000" }, + "a92DB2bad90e9884E33cC71edC9B33c5b8C0caf6": { "balance": "20000000000000000000000000000" }, + "4B5BA08659994110a5bA03D5231EDCD1BA8b9Aa8": { "balance": "20000000000000000000000000000" }, + "e36e36e60b8e8314D4eDcEA79Dc55bf4CCe10479": { "balance": "20000000000000000000000000000" }, + "cE68A481F891bB9E727BE2E6c4AFF55eEa103837": { "balance": "20000000000000000000000000000" }, + "595B64D78433d61ac8F69053efb6b4D7e2209973": { "balance": "20000000000000000000000000000" }, + "8Fd6bE06782665c8dd04a19509A983B51288e852": { "balance": "20000000000000000000000000000" }, + "129BA0004d5A0065F0a63Ff09EC6E456Dc209A86": { "balance": "20000000000000000000000000000" }, + "d7ab214172E9e312053C67Bb2C58Fb2f4944F7F5": { "balance": "20000000000000000000000000000" }, + "1c8434648eC3B6e039782393Eb1D66761CE99dD3": { "balance": "20000000000000000000000000000" }, + "F2974e3D9f40eC89D3dc2c56a8460644443a42a9": { "balance": "20000000000000000000000000000" }, + "19C4D0f773E4481971b377AD68101669aB7d760d": { "balance": "20000000000000000000000000000" }, + "598aebA1b7FA390fF0a3aDDb11F1cBeBDcD57eFC": { "balance": "20000000000000000000000000000" }, + "5711C058bf55AbC92737F5E6882C306F923777d3": { "balance": "20000000000000000000000000000" }, + "80895C22F170e428E76016C078009693E9D87253": { "balance": "20000000000000000000000000000" }, + "409722601138Ea73985F4A6Cc6Fe452A7505879B": { "balance": "20000000000000000000000000000" }, + "fF64a631f44A7705348D122b340Da64F2CDA3aa3": { "balance": "20000000000000000000000000000" }, + "66bBEf9149481e606eCA70052cD5b11CB6e7A341": { "balance": "20000000000000000000000000000" }, + "B92Fb7A35fe8eaC18D429628427dc89DB140E42e": { "balance": "20000000000000000000000000000" }, + "b3826043e7fE244d1A3B9E0270c3866B2ae8C0b1": { "balance": "20000000000000000000000000000" }, + "f74baafB34d5B5341164d23D2152771089116966": { "balance": "20000000000000000000000000000" }, + "6057F3A1E0EC1Df21d09673c9640006593240412": { "balance": "20000000000000000000000000000" }, + "FdE5FF01796AE21ed3a3107A5035596dFbC95BC9": { "balance": "20000000000000000000000000000" }, + "800974694B942ca3eb2C71295ECd8aE44CADbF6D": { "balance": "20000000000000000000000000000" }, + "764c771C5bfE73219A4a49b9B3aD6BF9e7373a4d": { "balance": "20000000000000000000000000000" }, + "E7DA161BD0523e054986a4fdb2B656d10D9F90F2": { "balance": "20000000000000000000000000000" }, + "298AC7a0381b9964a998110b1eC664Cd1329EF20": { "balance": "20000000000000000000000000000" }, + "f37846BB1a6689C44B31d8400bF4589637380273": { "balance": "20000000000000000000000000000" }, + "2Eb9c1c641e185575414F4e9A85Be62f20fA5097": { "balance": "20000000000000000000000000000" }, + "a4Eb53ed77203894b68bFB27B50B0676A8Dec185": { "balance": "20000000000000000000000000000" }, + "0229Dd332125fF89914Da64Be60ea99259A86B19": { "balance": "20000000000000000000000000000" }, + "28d150a939e7348597BF35cA3588261456c6Ab74": { "balance": "20000000000000000000000000000" }, + "F01BA1A09487e4F2C8dbD2122A8C1cbdA36aF631": { "balance": "20000000000000000000000000000" }, + "afFe745418Ad24c272175e5B58610A8a35e2EcDa": { "balance": "20000000000000000000000000000" }, + "D10ADf251463A260242c216c8c7D3e736eBdB398": { "balance": "20000000000000000000000000000" }, + "D12e250C8F5C3720297CeBF5A50655A8e2348847": { "balance": "20000000000000000000000000000" }, + "57D5E271FF8A4d49AE793B8b6Cf005E33FA4FA48": { "balance": "20000000000000000000000000000" }, + "14De3f38D8deB7fFc5c15859bA05e4B088F8F631": { "balance": "20000000000000000000000000000" }, + "A9c5559da87A7511D28e87C751dAfE65374Ce59f": { "balance": "20000000000000000000000000000" }, + "AAa610aE6711B810921ca06629c42a3E127851cd": { "balance": "20000000000000000000000000000" }, + "4BbfEd63b19954A357C1Dfc3Ba8820d2eE31Bbcf": { "balance": "20000000000000000000000000000" }, + "e3812c628b1E0245Eed4A548914e32C9eeFda019": { "balance": "20000000000000000000000000000" }, + "fD8072e4809BFADd90ad6D60aF31C8dCd7a46990": { "balance": "20000000000000000000000000000" }, + "C6B4C8B6077212315A758D1EF77783d3526a3E2c": { "balance": "20000000000000000000000000000" }, + "566B6EeC3aE1A57a8aC4cBd2CAe5C0bf2337924C": { "balance": "20000000000000000000000000000" }, + "1f795E24Dbe2b81767dFB0b815D13Bd0584F7e14": { "balance": "20000000000000000000000000000" }, + "7Fc0D5160079DE5Ad3De11956A8123b62Cdb4C06": { "balance": "20000000000000000000000000000" }, + "552fbB4aE609D641BFA06612A1A72e5b9173846a": { "balance": "20000000000000000000000000000" }, + "64D111eA9763c93a003cef491941A011B8df5a49": { "balance": "20000000000000000000000000000" }, + "3FE8D00143bd0eAd2397D48ba0E31E5E1268dBfb": { "balance": "20000000000000000000000000000" }, + "Cf44157e9df307c90FC7762933Ac1e2921e8b39E": { "balance": "20000000000000000000000000000" }, + "f26f7844f5B4770c47f34ea35a03B2b3534d08FE": { "balance": "20000000000000000000000000000" }, + "7Bac9e662E2C1Cf9f6f97F8CaF9c7aDE8F146bd1": { "balance": "20000000000000000000000000000" }, + "852DB1c83e17BE9fba782c97436F47cE4ad2Af83": { "balance": "20000000000000000000000000000" }, + "5857f28FDFE295bde60967c749199cAfB89C720F": { "balance": "20000000000000000000000000000" }, + "98b0fdb6C23C7C80B4728579e76F4aD95fe7014A": { "balance": "20000000000000000000000000000" }, + "F51A41cD49ff9B280Acea3768f8624003C69F3ea": { "balance": "20000000000000000000000000000" }, + "8340Bb9Cd5C3827c213beB23b05E1815c4bE9AFA": { "balance": "20000000000000000000000000000" }, + "f3802b4c177aE5ca5ED022Ced2643dAE79E3b824": { "balance": "20000000000000000000000000000" }, + "35004290E2890782DE456A8C0787f0747E93089B": { "balance": "20000000000000000000000000000" }, + "B0ddD72EEB6b692505b99C912c30a5509f4D9062": { "balance": "20000000000000000000000000000" }, + "Ac09cdb210e7F5528e3b045F6726A145d08E25be": { "balance": "20000000000000000000000000000" }, + "dD30Ef7eefC7ec283d9B573D86e11a77E9b3F722": { "balance": "20000000000000000000000000000" }, + "A579D3De3fb6613017A03C5C66d4f1Cf3d37b427": { "balance": "20000000000000000000000000000" }, + "49760921d14C3343f04Bf46371aD782C1478F5BC": { "balance": "20000000000000000000000000000" }, + "7B7B7Fb2613Dd7286DcAe541bF2391c9754eA3cd": { "balance": "20000000000000000000000000000" }, + "B4008dDce19b0061317726c5fC3413d8C8C828Eb": { "balance": "20000000000000000000000000000" }, + "d1D879664617032Da2Da21CF3DA9e58a487673A9": { "balance": "20000000000000000000000000000" }, + "71770F1Ed060051ebb6f3f2350418ea339268505": { "balance": "20000000000000000000000000000" }, + "903063cE4dBF5C61bB2f4d697C082Ac3F26c9e03": { "balance": "20000000000000000000000000000" }, + "74B936f54fDbDa9324a871226835944D6468CdBb": { "balance": "20000000000000000000000000000" }, + "A6543b00acde8F61475B089474EDdE92223103A5": { "balance": "20000000000000000000000000000" }, + "a8201943223834BaB8e4C877971568e8daf4963F": { "balance": "20000000000000000000000000000" }, + "BE43a4598aB331D60054726037F942a432E2b0FA": { "balance": "20000000000000000000000000000" }, + "096710E3B5ccAb0a35501226f7D00B57b41901F3": { "balance": "20000000000000000000000000000" }, + "06796CE510010e90F519e9cBE28E5075c7e80Ba8": { "balance": "20000000000000000000000000000" }, + "4aCB655Ec9cb9b7bA53059D2754Da628F97E5520": { "balance": "20000000000000000000000000000" }, + "58cd45F5461DFa1c03e44459f700Aa530488Fe7f": { "balance": "20000000000000000000000000000" }, + "cD2803008856100264F17140d4d977768C36B546": { "balance": "20000000000000000000000000000" }, + "8f05bddf379d89c827bAEFE43a5eca3aBE2CAf49": { "balance": "20000000000000000000000000000" }, + "7c86E333501Ac8BfA7b5a4A9a166922d1872FeBa": { "balance": "20000000000000000000000000000" }, + "809d7F5B2AC27Fc3aBc8441EC31386a80EdA1592": { "balance": "20000000000000000000000000000" }, + "7642b1EC5175CC389a62632E0AF253Cf78bb07b9": { "balance": "20000000000000000000000000000" }, + "2Fe00A97b2e578bF7381CFA0379d3756372fF644": { "balance": "20000000000000000000000000000" }, + "265A22e880fD793e277625ea8e4f7D58D40C419F": { "balance": "20000000000000000000000000000" }, + "89e3b2D91ecaf08016eEDb966c1fecA1e326714e": { "balance": "20000000000000000000000000000" }, + "2c620BdACb2ef5f7AE80Ca323f81158845A1605e": { "balance": "20000000000000000000000000000" }, + "7CDaDf72FDbE02641027ACD0Aa517D3cA76996eF": { "balance": "20000000000000000000000000000" }, + "b92E3679F3DA94003063FCf72E525bC7Df99bA3C": { "balance": "20000000000000000000000000000" }, + "8cD7f4FD8ADd776B28D6A6A61625a89b1738c8d1": { "balance": "20000000000000000000000000000" }, + "dCdb0368728F93c3a7aAef38980B5f0933cCcF31": { "balance": "20000000000000000000000000000" }, + "58F2660975Ac5a747e2D3944AA4649EE460fB26D": { "balance": "20000000000000000000000000000" }, + "A432821b87110a36f4163E1c5f66185efCB69117": { "balance": "20000000000000000000000000000" }, + "2122bf35f2D64E64483A4289cD0Bcd613b1bcAFa": { "balance": "20000000000000000000000000000" }, + "D303166E007f601cfAB726C8d078BE75e7fE809a": { "balance": "20000000000000000000000000000" }, + "94c0Cd28e2988f58388E709eB2010c721e5c32E2": { "balance": "20000000000000000000000000000" }, + "DF32A6dD8993528135C2e13B18dDAD3f78c581cF": { "balance": "20000000000000000000000000000" }, + "FF94F0D95F4130A7212C5D91850373D5Fe9eeAF7": { "balance": "20000000000000000000000000000" }, + "90Ab97F65F1A5d02320e887fd07066c3e78c5846": { "balance": "20000000000000000000000000000" }, + "14C17C2286324Db12A47bab0477D100dabB92b82": { "balance": "20000000000000000000000000000" }, + "B2E1578C22c1d918706EC6314a15678ccD9D918C": { "balance": "20000000000000000000000000000" }, + "c3b44fA9c5eF71c8e4D2C7d71E46aa5306a24f18": { "balance": "20000000000000000000000000000" }, + "BADDa09A6543EF1c9dAcaF1B9f556683aA07Df17": { "balance": "20000000000000000000000000000" }, + "bAC552C9638a004642C539af7c730DF3cA78835d": { "balance": "20000000000000000000000000000" }, + "821438f750867b0c4cB0F4C96f95c21b263238DE": { "balance": "20000000000000000000000000000" }, + "3fD2AF3AC475B764F2d94F52fA48135b2E71E3b6": { "balance": "20000000000000000000000000000" }, + "65738d6AfD0eac08B0375A628bFc96BF4e6F5E4B": { "balance": "20000000000000000000000000000" }, + "366Ec0bA6e9A28ef6CBE4Ddb900028336F67b32f": { "balance": "20000000000000000000000000000" }, + "967614054b6906B39d449f53C0d8A7A3F4e50584": { "balance": "20000000000000000000000000000" }, + "B09353ABE11E1F5e6Bff8cD7743322d30D9dE44E": { "balance": "20000000000000000000000000000" }, + "19594858cE5cC77bF1ff71B61214D41e0d5a1aE8": { "balance": "20000000000000000000000000000" }, + "faBC045A3d34A070dc0a4e34d916CBf1Febed8e5": { "balance": "20000000000000000000000000000" }, + "7De5c9cE240bdeb4B35E742BEec3f81b9657c724": { "balance": "20000000000000000000000000000" }, + "AfCA35269d937662Bf2b27a2299aeEB0FB42Ea17": { "balance": "20000000000000000000000000000" }, + "35aCaF5bD718349620545ec339B168B23d1A3dcd": { "balance": "20000000000000000000000000000" }, + "4324Fb178B841a436c18F3191BFa75026d4112B2": { "balance": "20000000000000000000000000000" }, + "C9c29fD8fF7204965bdE443cd4ca4c35B451B19e": { "balance": "20000000000000000000000000000" }, + "42c7E54a2CB757F121180Be68bc1b5fd9Db1c8f5": { "balance": "20000000000000000000000000000" }, + "AC7Fe12CeDA522Bf1cb0D3A30272C3A3E7FE177f": { "balance": "20000000000000000000000000000" }, + "a1E4b09110181051585B990d7024397FE6370346": { "balance": "20000000000000000000000000000" }, + "cB41a82601703A3EDe0fc30d994ad43888F7c511": { "balance": "20000000000000000000000000000" }, + "8e88b88C3BbA79E9E5897bC8D6d8bEf1CAc64f56": { "balance": "20000000000000000000000000000" }, + "010e3d8c7fec02ce7fA7288D11f1f6C1400FE07A": { "balance": "20000000000000000000000000000" }, + "b2b5868f995F88293011D10e87ae0e9E979b1F16": { "balance": "20000000000000000000000000000" }, + "D391edCddbc48410cC66D022932FDd517f38172B": { "balance": "20000000000000000000000000000" }, + "6a03061a10C3E39B59082c01d06ca48fc5257B36": { "balance": "20000000000000000000000000000" }, + "Ee27eEb9D8b7De85CCF13C953a94f59bd9bbaA92": { "balance": "20000000000000000000000000000" }, + "db757A91b920Cc3AC04F04fc7905F13c4352908d": { "balance": "20000000000000000000000000000" }, + "c41Ae4077732ca2F35745674A8ea60CC3Daca6cB": { "balance": "20000000000000000000000000000" }, + "8d6433eE1105a14cB357739474da40a263bb1b6b": { "balance": "20000000000000000000000000000" }, + "f062aa80Dec9c82f7116B1da4438966AC1C746C2": { "balance": "20000000000000000000000000000" }, + "7fda36C554872bE7Fe2b94F07125496Cb755dA6A": { "balance": "20000000000000000000000000000" }, + "c47949A63Ed9E163dcBb84443c3FE6702D12a1Ed": { "balance": "20000000000000000000000000000" }, + "3BF101CcA175ebD8a2f475784b59A1f197c4EB87": { "balance": "20000000000000000000000000000" }, + "62B811293e809BFc5D1177CCdf0DD8D18C871caA": { "balance": "20000000000000000000000000000" }, + "6F7C263aBe2b734ec520166Ecae6C34DD0B7AeEF": { "balance": "20000000000000000000000000000" }, + "5BD8556a379438B7761dAEe893d33afDA63DdE66": { "balance": "20000000000000000000000000000" }, + "eF70Cbb5Bcdb4D8597c1958572875075FaC935aa": { "balance": "20000000000000000000000000000" }, + "3Cc670905d684A19D7318CE02b36183b680aC9Ba": { "balance": "20000000000000000000000000000" }, + "4f84af3DAe0dff52851Bc51D05579Ce31CB4aA41": { "balance": "20000000000000000000000000000" }, + "1A976a73C2E1d578d12C1d5490EA39Da032DED09": { "balance": "20000000000000000000000000000" }, + "274b22DA330f2888CA272b325E4B806BEE1020dD": { "balance": "20000000000000000000000000000" }, + "C6E444e95F5c0e1D08bD6BF696e7b7be78C52F0A": { "balance": "20000000000000000000000000000" }, + "Bf71BE43744dE11ab907Cd437a3544988Bcd64E9": { "balance": "20000000000000000000000000000" }, + "8FF6E213BF89DBad2ff139E3C9D07D66438c8cC0": { "balance": "20000000000000000000000000000" }, + "9CB046D582f5aF26e649e4657953523de0b5177A": { "balance": "20000000000000000000000000000" }, + "24dd2E8A8571090fDA4D92a9d94995E651B65640": { "balance": "20000000000000000000000000000" }, + "20eB9941Df5b95b1b1AfAc1193c6a075B6191563": { "balance": "20000000000000000000000000000" }, + "5650Cd3E6e8963B43d21fAe60ee7a03bCefCe766": { "balance": "20000000000000000000000000000" }, + "B0FBfeceA23f95C2E34507EF1749aA979834BfAB": { "balance": "20000000000000000000000000000" }, + "f5eFcEd6dEaF09afb1fbe1E66ac86d370Bab0bf5": { "balance": "20000000000000000000000000000" }, + "79ef881A6D74Adf584fBa246B3fdd5Fc8Ef2Faa6": { "balance": "20000000000000000000000000000" }, + "e06B52067c7bD475d98774e89Ff2a49dD0481677": { "balance": "20000000000000000000000000000" }, + "38e8B3b89658863bc020F7a42FDaDF01E764d1b9": { "balance": "20000000000000000000000000000" }, + "10796DCc8D50AB69b2621f14Cc78E71ED2c160b7": { "balance": "20000000000000000000000000000" }, + "30393722F985c1Ed304f05a1c66c6dfbac7bc03d": { "balance": "20000000000000000000000000000" }, + "e05cedAAC8c23038c09798F06014A8888e9560Cf": { "balance": "20000000000000000000000000000" }, + "AA7Fce32fb237183dF6d5cd33330d30757196dE9": { "balance": "20000000000000000000000000000" }, + "1a760E632c2C40e0e7e12b0A23E965372da6Af11": { "balance": "20000000000000000000000000000" }, + "8439192178CA79A7295Fb000b40Ec65f17046D30": { "balance": "20000000000000000000000000000" }, + "74586E5B9BB8AA2c243acD2fBcA5481b266D7ACf": { "balance": "20000000000000000000000000000" }, + "62631968D8739b60eB13f959484811C3c1b12AA4": { "balance": "20000000000000000000000000000" }, + "e2A15140F8638f87c2b62Dac8b6b961bcF32e32B": { "balance": "20000000000000000000000000000" }, + "D1E5F25cccCf818C231639afae0d44BE456ddCb6": { "balance": "20000000000000000000000000000" }, + "C16ba417886D4d4dB07BBd7a3EC6dD98379A8EE6": { "balance": "20000000000000000000000000000" }, + "3353580f7d0da80B9Afe199990b6D9F63B194b1e": { "balance": "20000000000000000000000000000" }, + "22705d65bd7aa931440056ecff203305d2b27B0A": { "balance": "20000000000000000000000000000" }, + "D8E45777F05E10aA7Fc4187f9dd45E6ff59d0d73": { "balance": "20000000000000000000000000000" } + } +} diff --git a/packages/validator/test-local/chain1/config/private/password.txt b/packages/validator/test-local/chain1/config/private/password.txt new file mode 100644 index 0000000..f6800b9 --- /dev/null +++ b/packages/validator/test-local/chain1/config/private/password.txt @@ -0,0 +1 @@ +boa2022!@ diff --git a/packages/validator/test-local/chain1/config/template/node/keystore/UTC--2023-04-20T00-12-19.384030000Z--f85b2dba83a08dee6e24e4461e0334e7384896f9 b/packages/validator/test-local/chain1/config/template/node/keystore/UTC--2023-04-20T00-12-19.384030000Z--f85b2dba83a08dee6e24e4461e0334e7384896f9 new file mode 100644 index 0000000..aaa976c --- /dev/null +++ b/packages/validator/test-local/chain1/config/template/node/keystore/UTC--2023-04-20T00-12-19.384030000Z--f85b2dba83a08dee6e24e4461e0334e7384896f9 @@ -0,0 +1 @@ +{"address":"f85b2dba83a08dee6e24e4461e0334e7384896f9","crypto":{"cipher":"aes-128-ctr","ciphertext":"22036d22e9dcecaf3eed9e8e5419a642f26bb804f379af6c7799a5e17558525f","cipherparams":{"iv":"5e90b256ce5df8f3a0e8a86612431350"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"37ee8d72401c8f829748841dbd7cfcedb37b10a1a72f69c3db8967ede649b88b"},"mac":"21e96a2748834f8e0fe6bff1779166faee23debedd347a2064cf541e4036a4a0"},"id":"98c2b8bc-5a66-4803-9866-cf3eaa1cda3a","version":3} \ No newline at end of file diff --git a/packages/validator/test-local/chain1/docker-compose.yml b/packages/validator/test-local/chain1/docker-compose.yml new file mode 100644 index 0000000..3ce0e20 --- /dev/null +++ b/packages/validator/test-local/chain1/docker-compose.yml @@ -0,0 +1,30 @@ +version: "3.7" +services: + agora-el-node1: + container_name: agora-el-node1 + image: bosagora/agora-el-node:v2.0.1 + ports: + - "8541:8541" + restart: always + volumes: + - ../chain1/node:/data + - ../chain1/config:/config + command: + --config=/config/config.toml + --datadir=/data + --syncmode=full + --gcmode=archive + --allow-insecure-unlock=true + --unlock=0xF85B2dbA83A08DEe6E24E4461E0334e7384896F9 + --password=/config/private/password.txt + --mine=true + --miner.etherbase=0xF85B2dbA83A08DEe6E24E4461E0334e7384896F9 + --http.corsdomain="*" + networks: + - bosagora_network + +networks: + bosagora_network: + driver: bridge + external: true + internal: true diff --git a/packages/validator/test-local/chain2/config/config.toml b/packages/validator/test-local/chain2/config/config.toml new file mode 100644 index 0000000..1a6b0f8 --- /dev/null +++ b/packages/validator/test-local/chain2/config/config.toml @@ -0,0 +1,12 @@ +[Eth] +NetworkId = 215192 + +[Node] +HTTPHost = "0.0.0.0" +HTTPPort = 8542 +HTTPVirtualHosts = ["*"] +HTTPModules = ["eth", "net", "web3", "txpool"] + +[Node.P2P] +BootstrapNodes = [] +StaticNodes = [] diff --git a/packages/validator/test-local/chain2/config/genesis.json b/packages/validator/test-local/chain2/config/genesis.json new file mode 100644 index 0000000..f93b65d --- /dev/null +++ b/packages/validator/test-local/chain2/config/genesis.json @@ -0,0 +1,404 @@ +{ + "config": { + "chainId": 215192, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "berlinBlock": 0, + "londonBlock": 0, + "arrowglacierBlock": 0, + "grayGlacierBlock": 0, + "clique": { + "period": 0, + "epoch": 30000 + } + }, + "difficulty": "1", + "gasLimit": "8000000", + "extradata": "0x0000000000000000000000000000000000000000000000000000000000000000f85b2dba83a08dee6e24e4461e0334e7384896f90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "alloc": { + "8B595d325485a0Ca9d41908cAbF265E23C172847": { "balance": "20000000000000000000000000000" }, + "Dc245797409fb79446523Fa1A4ca97294eef22EE": { "balance": "20000000000000000000000000000" }, + "6629E54deC62B88b34d6fF7439B290cC0f1bfaEC": { "balance": "20000000000000000000000000000" }, + "9E8549cc1B5b9036AC410Ed11966BB3c6B94A77d": { "balance": "20000000000000000000000000000" }, + "103CB97f47801563C875942510Ff0585E31F55b5": { "balance": "20000000000000000000000000000" }, + "F49e8729c774f31eB1b7724E898BC9230a13E54c": { "balance": "20000000000000000000000000000" }, + "A6Ee9Ddfa9B82DF810b8E4AFaa5ff04A267d4930": { "balance": "20000000000000000000000000000" }, + "898Bf21a9e1fF51d3F1248E0A253f6A58C3a736a": { "balance": "20000000000000000000000000000" }, + "c573eF6FDcaf1461FF2BB75a70B7685ad395AA2d": { "balance": "20000000000000000000000000000" }, + "26b9D69FAa8f7950095193d50EFd14E3B80EAb5B": { "balance": "20000000000000000000000000000" }, + "8CA2D0080a42DB61cbe59611551412D294FC5911": { "balance": "20000000000000000000000000000" }, + "4501F7aF010Cef3DcEaAfbc7Bfb2B39dE57df54d": { "balance": "20000000000000000000000000000" }, + "c86c00147049695C3Cad5eA4ebb75B6bd4f09126": { "balance": "20000000000000000000000000000" }, + "1424bd767541666DF9658550FCf156FDaCd52934": { "balance": "20000000000000000000000000000" }, + "4376b9f7F6E6fa2d543910dCec2CDcC290A97722": { "balance": "20000000000000000000000000000" }, + "39E63ba90b86Bd1FF77290d37328B87dADdebf59": { "balance": "20000000000000000000000000000" }, + "454cd944C9Eac1e84064c0D105931aDCEbC86c89": { "balance": "20000000000000000000000000000" }, + "9f97e74e211D53B16491f33a1fF3A6E774B6Af26": { "balance": "20000000000000000000000000000" }, + "1cfF2132B4196AD49076A15868dCe92445c4c128": { "balance": "20000000000000000000000000000" }, + "70eB26f311Ad5c94Be746394f91AA51b72109A14": { "balance": "20000000000000000000000000000" }, + "EaeB90D77f7756fBf177D6E0E1BB794639e6097f": { "balance": "20000000000000000000000000000" }, + "3E6B6C403a1736C497b0B2e71f0993D6Dd0a8737": { "balance": "20000000000000000000000000000" }, + "5E5a72aEDAD4985B222713342bD368acD8d106E1": { "balance": "20000000000000000000000000000" }, + "F474C433D594f2E8Df047f1463Ae2edA311f27B3": { "balance": "20000000000000000000000000000" }, + "4b7FD1DB9c488Cd5cd6506d5f0E6bD1739489332": { "balance": "20000000000000000000000000000" }, + "C0Bb4e59b07a25e1007C0A85d89d93dEDeD1ef20": { "balance": "20000000000000000000000000000" }, + "1Ea9d36d45A42C95A8752541Fa06047DEc482F89": { "balance": "20000000000000000000000000000" }, + "6440665c7480451f28aE57A3d552DF3bA04383b1": { "balance": "20000000000000000000000000000" }, + "02a40B3637B0EbCF87a459DF2B00a34CA3332BDb": { "balance": "20000000000000000000000000000" }, + "b9De33A8be2F913F6AFA3a64849c86F18410fF05": { "balance": "20000000000000000000000000000" }, + "EA7d7197CAD3343661f77bEEb3966BB6F6D8343a": { "balance": "20000000000000000000000000000" }, + "1D969d5A42cf6A4D8227eFaf7146FA0a5985ccb9": { "balance": "20000000000000000000000000000" }, + "Cf6737dCf3ea51865C2204089b8E0dbe89D2f603": { "balance": "20000000000000000000000000000" }, + "f9E4C5Bd26c734417b52937a88137B20117f5dA1": { "balance": "20000000000000000000000000000" }, + "ae4451532FE3De802f776228e626d5A262dB89fD": { "balance": "20000000000000000000000000000" }, + "7aE4ef7e83ef3BE54560a12D9DE6d8F7284C4cF1": { "balance": "20000000000000000000000000000" }, + "17eEdA54B7db14E1C1B84a2e569B5EB1Dce25747": { "balance": "20000000000000000000000000000" }, + "FF25Cf201B64f0d70188AD7D141A775D209cBCeA": { "balance": "20000000000000000000000000000" }, + "bADFD86408e56AbB3C32CF0a8ca0B5d09A6e55f1": { "balance": "20000000000000000000000000000" }, + "759e97ec374B00d5c93c982275D3d4F34c6E05fc": { "balance": "20000000000000000000000000000" }, + "1D02184923Aa505153DbD0397f382d608042CBB2": { "balance": "20000000000000000000000000000" }, + "9a92B3d0760bC4e7a3cCdfe37E1fbfAAA39eC050": { "balance": "20000000000000000000000000000" }, + "02eaFC1091533F984dB53483a7215c7a982a3Ac1": { "balance": "20000000000000000000000000000" }, + "2312c098Cef41C0F55350bC3Ad8F4AFf983d9432": { "balance": "20000000000000000000000000000" }, + "5AD84fF1bD71cDEa7C3083706F2D1232a453C604": { "balance": "20000000000000000000000000000" }, + "9630fF452211Cc95BBFa32c0C4cF68eB498b8549": { "balance": "20000000000000000000000000000" }, + "F99D11fa9E430005b2cEE0f671d4dA79868D9570": { "balance": "20000000000000000000000000000" }, + "6F8CF905906dDe9E440F0DF5B26146cf1f195F12": { "balance": "20000000000000000000000000000" }, + "414E20AfA67289f119d3Edf05F27a7832cEc738b": { "balance": "20000000000000000000000000000" }, + "98F74031045b809a9078f43A51601c51Acf7B042": { "balance": "20000000000000000000000000000" }, + "e3231Cda6B5be01f7C52B39cF05637A9c5Aee98A": { "balance": "20000000000000000000000000000" }, + "3633B7eBd5562316BD3740FAe1d5A4aD46DbD8f0": { "balance": "20000000000000000000000000000" }, + "D4178A988Aa107F06fe53838B9F839A6A4511381": { "balance": "20000000000000000000000000000" }, + "A990E52FB413DCAed7ebFF2E9173C1c5E6452773": { "balance": "20000000000000000000000000000" }, + "31f2B0cA552625402046545ca155f8B2F21E09a0": { "balance": "20000000000000000000000000000" }, + "db1D45dF6F6bfeEe139096D5684B3160b8ada4C1": { "balance": "20000000000000000000000000000" }, + "EbeadEB009e7b19F16845F5c2bfd6269473fA9A2": { "balance": "20000000000000000000000000000" }, + "e967c305F00655a1b35AB250f805EB7d2678fab1": { "balance": "20000000000000000000000000000" }, + "acEEA5fF318D5BDd83045DAA63ca216505f4d9d5": { "balance": "20000000000000000000000000000" }, + "36587Bdb33C5Ae5655Dc1eEd5e2E8A1e7f0Fe618": { "balance": "20000000000000000000000000000" }, + "1421A3EbFe70795a4B1701F9A6bf6A498d823E14": { "balance": "20000000000000000000000000000" }, + "30c5C62D804ACD5EaefCD2d8D83eEA8366EBA527": { "balance": "20000000000000000000000000000" }, + "7Af3567044de23fb5f4779b1AF5c507016B52C3b": { "balance": "20000000000000000000000000000" }, + "FAb8A60CAC79c2Ab37EA742B9cd556B373Deda54": { "balance": "20000000000000000000000000000" }, + "6148d9Ea716ac12C4cCB2b6b6A68E790182Bf78A": { "balance": "20000000000000000000000000000" }, + "1e35855BAF526866CF353227268861B6c20A49B0": { "balance": "20000000000000000000000000000" }, + "20C6AE51Df6460549FD4A1F9fde35E3cb936FA64": { "balance": "20000000000000000000000000000" }, + "EB91E882489f5e3A680BfC0bdeF4aBD0227961AA": { "balance": "20000000000000000000000000000" }, + "41D7992Fe8EA6c959754eBc6387299663D40B488": { "balance": "20000000000000000000000000000" }, + "21b990C48dCC77eA7E3e353ab9ca7A09df92EEf6": { "balance": "20000000000000000000000000000" }, + "1bdBb643A47a89afBea77275a12b8689D727206F": { "balance": "20000000000000000000000000000" }, + "870E33B0774621b8e216bf74ea6C86edEcf94d93": { "balance": "20000000000000000000000000000" }, + "AE15B0C9D62C9989EA8E06da459a002c52f06ec4": { "balance": "20000000000000000000000000000" }, + "22AFBF3cc4165c973eC45d246Ec46AE21985A900": { "balance": "20000000000000000000000000000" }, + "03b73c934B2D2411d90ac092764E3736e7d631ab": { "balance": "20000000000000000000000000000" }, + "4b51C06Cd821BB5ae3615c25d20fC7b6f794B1A3": { "balance": "20000000000000000000000000000" }, + "15248ce6a1c9B8d4f16Bc37e901983B49cBB9976": { "balance": "20000000000000000000000000000" }, + "02f551e68F82D7dA8Aa109e272d7a83930D4bAAF": { "balance": "20000000000000000000000000000" }, + "C6BD8df7e6be560aD2637cF4FaF5C4a3FBb97Bf8": { "balance": "20000000000000000000000000000" }, + "0FF6c5984f4E34F2c1d98743E9F4e5BDecbE09B7": { "balance": "20000000000000000000000000000" }, + "549Dff5e390a72AF61d866Fee932e0c8BCbF71EB": { "balance": "20000000000000000000000000000" }, + "b84593b3Cabb6BF0622fDd16C4e0C33bDf24EF8f": { "balance": "20000000000000000000000000000" }, + "61A530B18673d9C92B494E172Bc4b20336C43B67": { "balance": "20000000000000000000000000000" }, + "AfB7cb6f6b5729880Ad820464FaD11B7c87bDf7d": { "balance": "20000000000000000000000000000" }, + "523026e94Dc647D4Df90AdcF3b4F74A66B1b26ed": { "balance": "20000000000000000000000000000" }, + "E1260b72974Fb4489dfcf2cA61cb7F2346B3CDc5": { "balance": "20000000000000000000000000000" }, + "E122B9e9D8A854180A176A183Ad3e4516669D045": { "balance": "20000000000000000000000000000" }, + "0FD1AB3B47312569eB7f4945C787Ea5fA84bc4e1": { "balance": "20000000000000000000000000000" }, + "29BB7CD2A2b16DD74fA3A9D970D6b26126F9074A": { "balance": "20000000000000000000000000000" }, + "B80b76158738a60907B21649edDC614FA1275fa0": { "balance": "20000000000000000000000000000" }, + "0d043fEE2E620215219939fC5115bC5436055386": { "balance": "20000000000000000000000000000" }, + "e6e949046A13B2597aeabfA9a91B1f1280D9dC75": { "balance": "20000000000000000000000000000" }, + "735a9c998653DCed19f2fE611d57B9A9cdA4f9DB": { "balance": "20000000000000000000000000000" }, + "28c0679b95381b13155EEC6a19118c5C319d5648": { "balance": "20000000000000000000000000000" }, + "23f15d8A8f08B6524c2ED0c01FE844333F98dFF9": { "balance": "20000000000000000000000000000" }, + "9e4cf1Bcd1f55cB3C266810CA166A3fd8eBFc314": { "balance": "20000000000000000000000000000" }, + "1ca8b6DC993Caf79feA86cb946979F530E3d515c": { "balance": "20000000000000000000000000000" }, + "9b76F5c7fbF126E5b4fD914e8fd641E7b8CcdF19": { "balance": "20000000000000000000000000000" }, + "e1CA4d63d0FeAaeF622605d339b150FEA6639d73": { "balance": "20000000000000000000000000000" }, + "12Cc6B68c30b00c11974Ae95E88551927D163ABD": { "balance": "20000000000000000000000000000" }, + "7Fc757946d38Cff921d16792B37A3c3204CA74d7": { "balance": "20000000000000000000000000000" }, + "BcA2fDbdE5Cf2b6Fa3168d9D1108a480e1C2E613": { "balance": "20000000000000000000000000000" }, + "81B4Adb44f3609cb55EfE446305146ca3EA9b0D7": { "balance": "20000000000000000000000000000" }, + "2f5aFef2bC0236197Dbab9eb1F12aF9e593354b2": { "balance": "20000000000000000000000000000" }, + "aaBC2728DB3E78bDfEefF882602e05b8855ee0B3": { "balance": "20000000000000000000000000000" }, + "FC548215375712963839De1597D77f73aB08921d": { "balance": "20000000000000000000000000000" }, + "aA6D744cD5Ff5f835910E9484BC48F4f58426AE1": { "balance": "20000000000000000000000000000" }, + "709FA7e66d97C112D0af2DAa6Dd5F8a31F63cC30": { "balance": "20000000000000000000000000000" }, + "3a5c045a8BDCEAbb503D9d764d8fD8865C7e41de": { "balance": "20000000000000000000000000000" }, + "E138406711736FF2a09CE67D9A33a52Aeba7D28d": { "balance": "20000000000000000000000000000" }, + "F46cc3675Ad804982aAff96C58C37d4F6F505A97": { "balance": "20000000000000000000000000000" }, + "a8d887eE878bA7c86d21052C84dA06067153311C": { "balance": "20000000000000000000000000000" }, + "17Be446A6880E2E4e76dDCc3f9c9169B2479F30F": { "balance": "20000000000000000000000000000" }, + "f2C1a95cceE7F3B24644A22cAEE6d7bc755B587b": { "balance": "20000000000000000000000000000" }, + "4d02d21e1A8D4784aB198D898E272F06dCbE302d": { "balance": "20000000000000000000000000000" }, + "4a13cc961A174d7FE41A872c1DeC448c965F868F": { "balance": "20000000000000000000000000000" }, + "e6137331596f9853A58FCfA9DFa324D272276C5b": { "balance": "20000000000000000000000000000" }, + "B82653EA7ae02D1456CF4D7d4e37F048B21F9392": { "balance": "20000000000000000000000000000" }, + "4c6faa457996789feCa24d18a55be9E0d4e279fD": { "balance": "20000000000000000000000000000" }, + "9FeEF6dc8Fd5EaeE889486526CA137520d92fe0B": { "balance": "20000000000000000000000000000" }, + "52eb9313c3E77164572bdCda3458C19e871a07f4": { "balance": "20000000000000000000000000000" }, + "75584f1113bdFf465B9c7FE92BA1D20B8A4737ED": { "balance": "20000000000000000000000000000" }, + "e1d965e82D6Dd7f602D073024657cffBAFBD6b04": { "balance": "20000000000000000000000000000" }, + "eb11e8c40aDf9FCD55D41C8661C31F3d7cd3Ded4": { "balance": "20000000000000000000000000000" }, + "6BFd392A1ea4c60CFd3eb99b08944471BE27ad08": { "balance": "20000000000000000000000000000" }, + "0686Ea59F8E9563FA898935cD56D028318909Be5": { "balance": "20000000000000000000000000000" }, + "23cBF9f8C7C7894fe0C4fB66FFDf7b97C35F4B5f": { "balance": "20000000000000000000000000000" }, + "8044C8192c4105d6a03748FCfA1cB52EE814D951": { "balance": "20000000000000000000000000000" }, + "56D8CEF7dC5EA80126cd0F9394580Ac70313ae9c": { "balance": "20000000000000000000000000000" }, + "9c88fdB279153a18639a8942bC0e2D4deF968D78": { "balance": "20000000000000000000000000000" }, + "389777a2Cd07ec12c4F8014e23434BF935617a81": { "balance": "20000000000000000000000000000" }, + "0dE3eE03c1031203Af20C811B9125DF0c244aD99": { "balance": "20000000000000000000000000000" }, + "31F3EdC1e8BD1a2595FAeAF20727Af487D395a0A": { "balance": "20000000000000000000000000000" }, + "9884d4608E25C20E28EC5Bce1Ba270ADdB87a43F": { "balance": "20000000000000000000000000000" }, + "f55a9B58dD615Bf60B0315564cD7a1551E3D95C9": { "balance": "20000000000000000000000000000" }, + "f1253268417c9e49Ad515Fd9db4381870309D78f": { "balance": "20000000000000000000000000000" }, + "e9D4c4ff2Db39D94398eA640ACb9B8d4Eefad45c": { "balance": "20000000000000000000000000000" }, + "4594b82543EDaD783e569291A60932514D19Ac12": { "balance": "20000000000000000000000000000" }, + "8bBb09844472C35DAD83e318b18d9ED001Ac9DD4": { "balance": "20000000000000000000000000000" }, + "b929f1211FE61c9fbf25c7bd2cB526364c6ceaD3": { "balance": "20000000000000000000000000000" }, + "Ea7343BF51352212872b51B53172EfB94bF1c83d": { "balance": "20000000000000000000000000000" }, + "30064fe03EC3Ce283DF7f739bBB7bFDEA87970C2": { "balance": "20000000000000000000000000000" }, + "5C90CadA77147564eaF626b0d0a7FFB40259c689": { "balance": "20000000000000000000000000000" }, + "9Ec17b27792615B878B9646FbAa0Ce1755297C54": { "balance": "20000000000000000000000000000" }, + "3181182d134669109c84bD54ee3ab515b8187cB6": { "balance": "20000000000000000000000000000" }, + "7F7ef7199A50B9cF39AE18F457681007d45BF607": { "balance": "20000000000000000000000000000" }, + "F7844DD9A20f11aCa96F1Feff3Ab92bC4555d848": { "balance": "20000000000000000000000000000" }, + "89fE210c9Cf65F240Ecf8d801D4C52C49957C231": { "balance": "20000000000000000000000000000" }, + "e2E01273a6C0C4cB05A7E52A8E3c618fbB16FCC1": { "balance": "20000000000000000000000000000" }, + "1F8fb5FE8611e4b7f4e6672c1E5cD0Bbd0f81b5a": { "balance": "20000000000000000000000000000" }, + "93899f73E2e06586394b18f5b69e252dB2F843cb": { "balance": "20000000000000000000000000000" }, + "E39df657481Eb91985B68BD3586dF5533AAd1BB5": { "balance": "20000000000000000000000000000" }, + "7E08957676859B9a14510884746df72c933BA256": { "balance": "20000000000000000000000000000" }, + "24568bc6ba56FB614Ddff3096aAEfb20EEa0ef1E": { "balance": "20000000000000000000000000000" }, + "6f1F537bb43e108bD53EE641b31CE5C67dB8346b": { "balance": "20000000000000000000000000000" }, + "cD2CD186f0CDD61ec5cdBE8c7695887E34Edb591": { "balance": "20000000000000000000000000000" }, + "73c56D93F90Fa5E1F0A55030DF9Cce043355892C": { "balance": "20000000000000000000000000000" }, + "A95bD48acF39F2Cd75d4876004DB6dFfEb42bf3C": { "balance": "20000000000000000000000000000" }, + "d70638F112Cc30a5CfFed110C9c2159A4256B402": { "balance": "20000000000000000000000000000" }, + "0e9C7B9Cd0F28c1727cE143c88F6e417DeB88A07": { "balance": "20000000000000000000000000000" }, + "603e61bDCea40004c578D1C63fEc4f2B59ea2F88": { "balance": "20000000000000000000000000000" }, + "F4dD12b4EFA0d2db9F9b1202E720371F28030AC7": { "balance": "20000000000000000000000000000" }, + "92c397740a4eD9429B1CbAad98A32155CfDaFd56": { "balance": "20000000000000000000000000000" }, + "67525dBD7D67f93B1439Ecc76Da4b7c56F18ed64": { "balance": "20000000000000000000000000000" }, + "136b92f575f06e9072c9e01D33cc49B4eCE40809": { "balance": "20000000000000000000000000000" }, + "07ffE21C4C5008bf022b02c9b617366b4785e97f": { "balance": "20000000000000000000000000000" }, + "4f907Da410b6CBED352D8E39320B9C57280e9447": { "balance": "20000000000000000000000000000" }, + "8F4091B7EB2bf1fa095bCc7d9cb30B962B2c9ab7": { "balance": "20000000000000000000000000000" }, + "A25bF2aea03ba2271dBf1974aC56841bd482B0d8": { "balance": "20000000000000000000000000000" }, + "b0C2c2c82De37807521c22CDa018920d82Bfd09f": { "balance": "20000000000000000000000000000" }, + "0A2CeE1D632Dff27b24444848d88c6aB77f76eE3": { "balance": "20000000000000000000000000000" }, + "E445Ab844Da94c71296EdF7B04bE7C14faAE316f": { "balance": "20000000000000000000000000000" }, + "538eeece071210494c1a892d5C13E864c181a976": { "balance": "20000000000000000000000000000" }, + "B64470AE461609dCd745D88e33Bf79Cd24FEEDbF": { "balance": "20000000000000000000000000000" }, + "653c0a13e952c80CB63ec9bb0645aB5E66eC8c43": { "balance": "20000000000000000000000000000" }, + "791ebE3A302E9243A955b20CfB0Ec019bA5cC801": { "balance": "20000000000000000000000000000" }, + "3E2F45A8c714124d4bE83A3830085c8C19543FF5": { "balance": "20000000000000000000000000000" }, + "37d0315C35EAcEc33afB5E27dae8596a3fAa942c": { "balance": "20000000000000000000000000000" }, + "E52d91AEd57Cacb1b88c663Ef012ebF5f67F82E6": { "balance": "20000000000000000000000000000" }, + "63308305fdd078D7D7F33170A98C50d96c06D7C4": { "balance": "20000000000000000000000000000" }, + "C8CbCbB0532223D884622911F8fc6500403328c1": { "balance": "20000000000000000000000000000" }, + "64131c43f51Fb2Be8E8591629AFcf796740EF553": { "balance": "20000000000000000000000000000" }, + "9ff8f6a06F1F7d6570b88dF7d205F9905a082769": { "balance": "20000000000000000000000000000" }, + "A424369b4c2eA88458257497aCA06a8518Bb9f53": { "balance": "20000000000000000000000000000" }, + "3c8D0c7ECec7748f1614BC0Da95d9db3b1E1e400": { "balance": "20000000000000000000000000000" }, + "84470950445A32AD74c38Fb7741fA08a15ECb4A1": { "balance": "20000000000000000000000000000" }, + "E28f9CE6CaF517174FC32B119AfFC7129c1541C8": { "balance": "20000000000000000000000000000" }, + "cF29abc57Bdf7e729CfD5C59a8e7A00C97371710": { "balance": "20000000000000000000000000000" }, + "6472D0A319351697AD372aA40bC71F3aCE885F20": { "balance": "20000000000000000000000000000" }, + "a6CA3188a757Ccb8e9F15bFdE3CD47d1a608290D": { "balance": "20000000000000000000000000000" }, + "359a898ffE899d6914546331F450b0Fa28bDA38A": { "balance": "20000000000000000000000000000" }, + "aC9a52dA87B3c106ad967d42655d22E1F6E0951D": { "balance": "20000000000000000000000000000" }, + "546d36619D4d1a98AC190497278551D70798F960": { "balance": "20000000000000000000000000000" }, + "7eE169D8decD59f933af92C5937f72c274A3ECa9": { "balance": "20000000000000000000000000000" }, + "Ec457286cEb8075305c38F36Cd1BE6aBf3060343": { "balance": "20000000000000000000000000000" }, + "F85d821994473B96d3d7796045a8112dfD9ffC80": { "balance": "20000000000000000000000000000" }, + "e41aAfA506c48C7f8aade94E7fcfa431725f9a7A": { "balance": "20000000000000000000000000000" }, + "5dd78008f0B42a0E0e49435f7Bad9b264b96c7BD": { "balance": "20000000000000000000000000000" }, + "0Be9F5eB80590D0FF801742c5EFd77D3f5902761": { "balance": "20000000000000000000000000000" }, + "60959343b2034Cec4228B611a2e926E6D4dD31df": { "balance": "20000000000000000000000000000" }, + "928e73e399CC0a56ED3B843D25a6930C8dFF36A6": { "balance": "20000000000000000000000000000" }, + "7aC873564D790D9e4002b64379560399365126D9": { "balance": "20000000000000000000000000000" }, + "6F815bdAA9842f814F11292bA0C1dD3aa2Dc565b": { "balance": "20000000000000000000000000000" }, + "5d3E7A006dCC154a7beF0422144E872A7B70b852": { "balance": "20000000000000000000000000000" }, + "0651126EaF5D1BBba5f0715027dBd3BE39463Af7": { "balance": "20000000000000000000000000000" }, + "ab2Ba50aC8a173c81CdD5Be4fbbDAa1Db61C5ebb": { "balance": "20000000000000000000000000000" }, + "12C955E675a827355b9bD1fbF62c37CC42F0D303": { "balance": "20000000000000000000000000000" }, + "DA9Db77DB21aa922cFf9190C0590464Bd65eD72d": { "balance": "20000000000000000000000000000" }, + "F1EF107feB4A79B794CDac0afBDE28333E68A414": { "balance": "20000000000000000000000000000" }, + "5f76F3a1FE6c328e2126f81691396e2802C76194": { "balance": "20000000000000000000000000000" }, + "44b13dbFC6651a53A1c952Dfec47bf0d981F9F8e": { "balance": "20000000000000000000000000000" }, + "a92DB2bad90e9884E33cC71edC9B33c5b8C0caf6": { "balance": "20000000000000000000000000000" }, + "4B5BA08659994110a5bA03D5231EDCD1BA8b9Aa8": { "balance": "20000000000000000000000000000" }, + "e36e36e60b8e8314D4eDcEA79Dc55bf4CCe10479": { "balance": "20000000000000000000000000000" }, + "cE68A481F891bB9E727BE2E6c4AFF55eEa103837": { "balance": "20000000000000000000000000000" }, + "595B64D78433d61ac8F69053efb6b4D7e2209973": { "balance": "20000000000000000000000000000" }, + "8Fd6bE06782665c8dd04a19509A983B51288e852": { "balance": "20000000000000000000000000000" }, + "129BA0004d5A0065F0a63Ff09EC6E456Dc209A86": { "balance": "20000000000000000000000000000" }, + "d7ab214172E9e312053C67Bb2C58Fb2f4944F7F5": { "balance": "20000000000000000000000000000" }, + "1c8434648eC3B6e039782393Eb1D66761CE99dD3": { "balance": "20000000000000000000000000000" }, + "F2974e3D9f40eC89D3dc2c56a8460644443a42a9": { "balance": "20000000000000000000000000000" }, + "19C4D0f773E4481971b377AD68101669aB7d760d": { "balance": "20000000000000000000000000000" }, + "598aebA1b7FA390fF0a3aDDb11F1cBeBDcD57eFC": { "balance": "20000000000000000000000000000" }, + "5711C058bf55AbC92737F5E6882C306F923777d3": { "balance": "20000000000000000000000000000" }, + "80895C22F170e428E76016C078009693E9D87253": { "balance": "20000000000000000000000000000" }, + "409722601138Ea73985F4A6Cc6Fe452A7505879B": { "balance": "20000000000000000000000000000" }, + "fF64a631f44A7705348D122b340Da64F2CDA3aa3": { "balance": "20000000000000000000000000000" }, + "66bBEf9149481e606eCA70052cD5b11CB6e7A341": { "balance": "20000000000000000000000000000" }, + "B92Fb7A35fe8eaC18D429628427dc89DB140E42e": { "balance": "20000000000000000000000000000" }, + "b3826043e7fE244d1A3B9E0270c3866B2ae8C0b1": { "balance": "20000000000000000000000000000" }, + "f74baafB34d5B5341164d23D2152771089116966": { "balance": "20000000000000000000000000000" }, + "6057F3A1E0EC1Df21d09673c9640006593240412": { "balance": "20000000000000000000000000000" }, + "FdE5FF01796AE21ed3a3107A5035596dFbC95BC9": { "balance": "20000000000000000000000000000" }, + "800974694B942ca3eb2C71295ECd8aE44CADbF6D": { "balance": "20000000000000000000000000000" }, + "764c771C5bfE73219A4a49b9B3aD6BF9e7373a4d": { "balance": "20000000000000000000000000000" }, + "E7DA161BD0523e054986a4fdb2B656d10D9F90F2": { "balance": "20000000000000000000000000000" }, + "298AC7a0381b9964a998110b1eC664Cd1329EF20": { "balance": "20000000000000000000000000000" }, + "f37846BB1a6689C44B31d8400bF4589637380273": { "balance": "20000000000000000000000000000" }, + "2Eb9c1c641e185575414F4e9A85Be62f20fA5097": { "balance": "20000000000000000000000000000" }, + "a4Eb53ed77203894b68bFB27B50B0676A8Dec185": { "balance": "20000000000000000000000000000" }, + "0229Dd332125fF89914Da64Be60ea99259A86B19": { "balance": "20000000000000000000000000000" }, + "28d150a939e7348597BF35cA3588261456c6Ab74": { "balance": "20000000000000000000000000000" }, + "F01BA1A09487e4F2C8dbD2122A8C1cbdA36aF631": { "balance": "20000000000000000000000000000" }, + "afFe745418Ad24c272175e5B58610A8a35e2EcDa": { "balance": "20000000000000000000000000000" }, + "D10ADf251463A260242c216c8c7D3e736eBdB398": { "balance": "20000000000000000000000000000" }, + "D12e250C8F5C3720297CeBF5A50655A8e2348847": { "balance": "20000000000000000000000000000" }, + "57D5E271FF8A4d49AE793B8b6Cf005E33FA4FA48": { "balance": "20000000000000000000000000000" }, + "14De3f38D8deB7fFc5c15859bA05e4B088F8F631": { "balance": "20000000000000000000000000000" }, + "A9c5559da87A7511D28e87C751dAfE65374Ce59f": { "balance": "20000000000000000000000000000" }, + "AAa610aE6711B810921ca06629c42a3E127851cd": { "balance": "20000000000000000000000000000" }, + "4BbfEd63b19954A357C1Dfc3Ba8820d2eE31Bbcf": { "balance": "20000000000000000000000000000" }, + "e3812c628b1E0245Eed4A548914e32C9eeFda019": { "balance": "20000000000000000000000000000" }, + "fD8072e4809BFADd90ad6D60aF31C8dCd7a46990": { "balance": "20000000000000000000000000000" }, + "C6B4C8B6077212315A758D1EF77783d3526a3E2c": { "balance": "20000000000000000000000000000" }, + "566B6EeC3aE1A57a8aC4cBd2CAe5C0bf2337924C": { "balance": "20000000000000000000000000000" }, + "1f795E24Dbe2b81767dFB0b815D13Bd0584F7e14": { "balance": "20000000000000000000000000000" }, + "7Fc0D5160079DE5Ad3De11956A8123b62Cdb4C06": { "balance": "20000000000000000000000000000" }, + "552fbB4aE609D641BFA06612A1A72e5b9173846a": { "balance": "20000000000000000000000000000" }, + "64D111eA9763c93a003cef491941A011B8df5a49": { "balance": "20000000000000000000000000000" }, + "3FE8D00143bd0eAd2397D48ba0E31E5E1268dBfb": { "balance": "20000000000000000000000000000" }, + "Cf44157e9df307c90FC7762933Ac1e2921e8b39E": { "balance": "20000000000000000000000000000" }, + "f26f7844f5B4770c47f34ea35a03B2b3534d08FE": { "balance": "20000000000000000000000000000" }, + "7Bac9e662E2C1Cf9f6f97F8CaF9c7aDE8F146bd1": { "balance": "20000000000000000000000000000" }, + "852DB1c83e17BE9fba782c97436F47cE4ad2Af83": { "balance": "20000000000000000000000000000" }, + "5857f28FDFE295bde60967c749199cAfB89C720F": { "balance": "20000000000000000000000000000" }, + "98b0fdb6C23C7C80B4728579e76F4aD95fe7014A": { "balance": "20000000000000000000000000000" }, + "F51A41cD49ff9B280Acea3768f8624003C69F3ea": { "balance": "20000000000000000000000000000" }, + "8340Bb9Cd5C3827c213beB23b05E1815c4bE9AFA": { "balance": "20000000000000000000000000000" }, + "f3802b4c177aE5ca5ED022Ced2643dAE79E3b824": { "balance": "20000000000000000000000000000" }, + "35004290E2890782DE456A8C0787f0747E93089B": { "balance": "20000000000000000000000000000" }, + "B0ddD72EEB6b692505b99C912c30a5509f4D9062": { "balance": "20000000000000000000000000000" }, + "Ac09cdb210e7F5528e3b045F6726A145d08E25be": { "balance": "20000000000000000000000000000" }, + "dD30Ef7eefC7ec283d9B573D86e11a77E9b3F722": { "balance": "20000000000000000000000000000" }, + "A579D3De3fb6613017A03C5C66d4f1Cf3d37b427": { "balance": "20000000000000000000000000000" }, + "49760921d14C3343f04Bf46371aD782C1478F5BC": { "balance": "20000000000000000000000000000" }, + "7B7B7Fb2613Dd7286DcAe541bF2391c9754eA3cd": { "balance": "20000000000000000000000000000" }, + "B4008dDce19b0061317726c5fC3413d8C8C828Eb": { "balance": "20000000000000000000000000000" }, + "d1D879664617032Da2Da21CF3DA9e58a487673A9": { "balance": "20000000000000000000000000000" }, + "71770F1Ed060051ebb6f3f2350418ea339268505": { "balance": "20000000000000000000000000000" }, + "903063cE4dBF5C61bB2f4d697C082Ac3F26c9e03": { "balance": "20000000000000000000000000000" }, + "74B936f54fDbDa9324a871226835944D6468CdBb": { "balance": "20000000000000000000000000000" }, + "A6543b00acde8F61475B089474EDdE92223103A5": { "balance": "20000000000000000000000000000" }, + "a8201943223834BaB8e4C877971568e8daf4963F": { "balance": "20000000000000000000000000000" }, + "BE43a4598aB331D60054726037F942a432E2b0FA": { "balance": "20000000000000000000000000000" }, + "096710E3B5ccAb0a35501226f7D00B57b41901F3": { "balance": "20000000000000000000000000000" }, + "06796CE510010e90F519e9cBE28E5075c7e80Ba8": { "balance": "20000000000000000000000000000" }, + "4aCB655Ec9cb9b7bA53059D2754Da628F97E5520": { "balance": "20000000000000000000000000000" }, + "58cd45F5461DFa1c03e44459f700Aa530488Fe7f": { "balance": "20000000000000000000000000000" }, + "cD2803008856100264F17140d4d977768C36B546": { "balance": "20000000000000000000000000000" }, + "8f05bddf379d89c827bAEFE43a5eca3aBE2CAf49": { "balance": "20000000000000000000000000000" }, + "7c86E333501Ac8BfA7b5a4A9a166922d1872FeBa": { "balance": "20000000000000000000000000000" }, + "809d7F5B2AC27Fc3aBc8441EC31386a80EdA1592": { "balance": "20000000000000000000000000000" }, + "7642b1EC5175CC389a62632E0AF253Cf78bb07b9": { "balance": "20000000000000000000000000000" }, + "2Fe00A97b2e578bF7381CFA0379d3756372fF644": { "balance": "20000000000000000000000000000" }, + "265A22e880fD793e277625ea8e4f7D58D40C419F": { "balance": "20000000000000000000000000000" }, + "89e3b2D91ecaf08016eEDb966c1fecA1e326714e": { "balance": "20000000000000000000000000000" }, + "2c620BdACb2ef5f7AE80Ca323f81158845A1605e": { "balance": "20000000000000000000000000000" }, + "7CDaDf72FDbE02641027ACD0Aa517D3cA76996eF": { "balance": "20000000000000000000000000000" }, + "b92E3679F3DA94003063FCf72E525bC7Df99bA3C": { "balance": "20000000000000000000000000000" }, + "8cD7f4FD8ADd776B28D6A6A61625a89b1738c8d1": { "balance": "20000000000000000000000000000" }, + "dCdb0368728F93c3a7aAef38980B5f0933cCcF31": { "balance": "20000000000000000000000000000" }, + "58F2660975Ac5a747e2D3944AA4649EE460fB26D": { "balance": "20000000000000000000000000000" }, + "A432821b87110a36f4163E1c5f66185efCB69117": { "balance": "20000000000000000000000000000" }, + "2122bf35f2D64E64483A4289cD0Bcd613b1bcAFa": { "balance": "20000000000000000000000000000" }, + "D303166E007f601cfAB726C8d078BE75e7fE809a": { "balance": "20000000000000000000000000000" }, + "94c0Cd28e2988f58388E709eB2010c721e5c32E2": { "balance": "20000000000000000000000000000" }, + "DF32A6dD8993528135C2e13B18dDAD3f78c581cF": { "balance": "20000000000000000000000000000" }, + "FF94F0D95F4130A7212C5D91850373D5Fe9eeAF7": { "balance": "20000000000000000000000000000" }, + "90Ab97F65F1A5d02320e887fd07066c3e78c5846": { "balance": "20000000000000000000000000000" }, + "14C17C2286324Db12A47bab0477D100dabB92b82": { "balance": "20000000000000000000000000000" }, + "B2E1578C22c1d918706EC6314a15678ccD9D918C": { "balance": "20000000000000000000000000000" }, + "c3b44fA9c5eF71c8e4D2C7d71E46aa5306a24f18": { "balance": "20000000000000000000000000000" }, + "BADDa09A6543EF1c9dAcaF1B9f556683aA07Df17": { "balance": "20000000000000000000000000000" }, + "bAC552C9638a004642C539af7c730DF3cA78835d": { "balance": "20000000000000000000000000000" }, + "821438f750867b0c4cB0F4C96f95c21b263238DE": { "balance": "20000000000000000000000000000" }, + "3fD2AF3AC475B764F2d94F52fA48135b2E71E3b6": { "balance": "20000000000000000000000000000" }, + "65738d6AfD0eac08B0375A628bFc96BF4e6F5E4B": { "balance": "20000000000000000000000000000" }, + "366Ec0bA6e9A28ef6CBE4Ddb900028336F67b32f": { "balance": "20000000000000000000000000000" }, + "967614054b6906B39d449f53C0d8A7A3F4e50584": { "balance": "20000000000000000000000000000" }, + "B09353ABE11E1F5e6Bff8cD7743322d30D9dE44E": { "balance": "20000000000000000000000000000" }, + "19594858cE5cC77bF1ff71B61214D41e0d5a1aE8": { "balance": "20000000000000000000000000000" }, + "faBC045A3d34A070dc0a4e34d916CBf1Febed8e5": { "balance": "20000000000000000000000000000" }, + "7De5c9cE240bdeb4B35E742BEec3f81b9657c724": { "balance": "20000000000000000000000000000" }, + "AfCA35269d937662Bf2b27a2299aeEB0FB42Ea17": { "balance": "20000000000000000000000000000" }, + "35aCaF5bD718349620545ec339B168B23d1A3dcd": { "balance": "20000000000000000000000000000" }, + "4324Fb178B841a436c18F3191BFa75026d4112B2": { "balance": "20000000000000000000000000000" }, + "C9c29fD8fF7204965bdE443cd4ca4c35B451B19e": { "balance": "20000000000000000000000000000" }, + "42c7E54a2CB757F121180Be68bc1b5fd9Db1c8f5": { "balance": "20000000000000000000000000000" }, + "AC7Fe12CeDA522Bf1cb0D3A30272C3A3E7FE177f": { "balance": "20000000000000000000000000000" }, + "a1E4b09110181051585B990d7024397FE6370346": { "balance": "20000000000000000000000000000" }, + "cB41a82601703A3EDe0fc30d994ad43888F7c511": { "balance": "20000000000000000000000000000" }, + "8e88b88C3BbA79E9E5897bC8D6d8bEf1CAc64f56": { "balance": "20000000000000000000000000000" }, + "010e3d8c7fec02ce7fA7288D11f1f6C1400FE07A": { "balance": "20000000000000000000000000000" }, + "b2b5868f995F88293011D10e87ae0e9E979b1F16": { "balance": "20000000000000000000000000000" }, + "D391edCddbc48410cC66D022932FDd517f38172B": { "balance": "20000000000000000000000000000" }, + "6a03061a10C3E39B59082c01d06ca48fc5257B36": { "balance": "20000000000000000000000000000" }, + "Ee27eEb9D8b7De85CCF13C953a94f59bd9bbaA92": { "balance": "20000000000000000000000000000" }, + "db757A91b920Cc3AC04F04fc7905F13c4352908d": { "balance": "20000000000000000000000000000" }, + "c41Ae4077732ca2F35745674A8ea60CC3Daca6cB": { "balance": "20000000000000000000000000000" }, + "8d6433eE1105a14cB357739474da40a263bb1b6b": { "balance": "20000000000000000000000000000" }, + "f062aa80Dec9c82f7116B1da4438966AC1C746C2": { "balance": "20000000000000000000000000000" }, + "7fda36C554872bE7Fe2b94F07125496Cb755dA6A": { "balance": "20000000000000000000000000000" }, + "c47949A63Ed9E163dcBb84443c3FE6702D12a1Ed": { "balance": "20000000000000000000000000000" }, + "3BF101CcA175ebD8a2f475784b59A1f197c4EB87": { "balance": "20000000000000000000000000000" }, + "62B811293e809BFc5D1177CCdf0DD8D18C871caA": { "balance": "20000000000000000000000000000" }, + "6F7C263aBe2b734ec520166Ecae6C34DD0B7AeEF": { "balance": "20000000000000000000000000000" }, + "5BD8556a379438B7761dAEe893d33afDA63DdE66": { "balance": "20000000000000000000000000000" }, + "eF70Cbb5Bcdb4D8597c1958572875075FaC935aa": { "balance": "20000000000000000000000000000" }, + "3Cc670905d684A19D7318CE02b36183b680aC9Ba": { "balance": "20000000000000000000000000000" }, + "4f84af3DAe0dff52851Bc51D05579Ce31CB4aA41": { "balance": "20000000000000000000000000000" }, + "1A976a73C2E1d578d12C1d5490EA39Da032DED09": { "balance": "20000000000000000000000000000" }, + "274b22DA330f2888CA272b325E4B806BEE1020dD": { "balance": "20000000000000000000000000000" }, + "C6E444e95F5c0e1D08bD6BF696e7b7be78C52F0A": { "balance": "20000000000000000000000000000" }, + "Bf71BE43744dE11ab907Cd437a3544988Bcd64E9": { "balance": "20000000000000000000000000000" }, + "8FF6E213BF89DBad2ff139E3C9D07D66438c8cC0": { "balance": "20000000000000000000000000000" }, + "9CB046D582f5aF26e649e4657953523de0b5177A": { "balance": "20000000000000000000000000000" }, + "24dd2E8A8571090fDA4D92a9d94995E651B65640": { "balance": "20000000000000000000000000000" }, + "20eB9941Df5b95b1b1AfAc1193c6a075B6191563": { "balance": "20000000000000000000000000000" }, + "5650Cd3E6e8963B43d21fAe60ee7a03bCefCe766": { "balance": "20000000000000000000000000000" }, + "B0FBfeceA23f95C2E34507EF1749aA979834BfAB": { "balance": "20000000000000000000000000000" }, + "f5eFcEd6dEaF09afb1fbe1E66ac86d370Bab0bf5": { "balance": "20000000000000000000000000000" }, + "79ef881A6D74Adf584fBa246B3fdd5Fc8Ef2Faa6": { "balance": "20000000000000000000000000000" }, + "e06B52067c7bD475d98774e89Ff2a49dD0481677": { "balance": "20000000000000000000000000000" }, + "38e8B3b89658863bc020F7a42FDaDF01E764d1b9": { "balance": "20000000000000000000000000000" }, + "10796DCc8D50AB69b2621f14Cc78E71ED2c160b7": { "balance": "20000000000000000000000000000" }, + "30393722F985c1Ed304f05a1c66c6dfbac7bc03d": { "balance": "20000000000000000000000000000" }, + "e05cedAAC8c23038c09798F06014A8888e9560Cf": { "balance": "20000000000000000000000000000" }, + "AA7Fce32fb237183dF6d5cd33330d30757196dE9": { "balance": "20000000000000000000000000000" }, + "1a760E632c2C40e0e7e12b0A23E965372da6Af11": { "balance": "20000000000000000000000000000" }, + "8439192178CA79A7295Fb000b40Ec65f17046D30": { "balance": "20000000000000000000000000000" }, + "74586E5B9BB8AA2c243acD2fBcA5481b266D7ACf": { "balance": "20000000000000000000000000000" }, + "62631968D8739b60eB13f959484811C3c1b12AA4": { "balance": "20000000000000000000000000000" }, + "e2A15140F8638f87c2b62Dac8b6b961bcF32e32B": { "balance": "20000000000000000000000000000" }, + "D1E5F25cccCf818C231639afae0d44BE456ddCb6": { "balance": "20000000000000000000000000000" }, + "C16ba417886D4d4dB07BBd7a3EC6dD98379A8EE6": { "balance": "20000000000000000000000000000" }, + "3353580f7d0da80B9Afe199990b6D9F63B194b1e": { "balance": "20000000000000000000000000000" }, + "22705d65bd7aa931440056ecff203305d2b27B0A": { "balance": "20000000000000000000000000000" }, + "D8E45777F05E10aA7Fc4187f9dd45E6ff59d0d73": { "balance": "20000000000000000000000000000" } + } +} diff --git a/packages/validator/test-local/chain2/config/private/password.txt b/packages/validator/test-local/chain2/config/private/password.txt new file mode 100644 index 0000000..f6800b9 --- /dev/null +++ b/packages/validator/test-local/chain2/config/private/password.txt @@ -0,0 +1 @@ +boa2022!@ diff --git a/packages/validator/test-local/chain2/config/template/node/keystore/UTC--2023-04-20T00-12-19.384030000Z--f85b2dba83a08dee6e24e4461e0334e7384896f9 b/packages/validator/test-local/chain2/config/template/node/keystore/UTC--2023-04-20T00-12-19.384030000Z--f85b2dba83a08dee6e24e4461e0334e7384896f9 new file mode 100644 index 0000000..aaa976c --- /dev/null +++ b/packages/validator/test-local/chain2/config/template/node/keystore/UTC--2023-04-20T00-12-19.384030000Z--f85b2dba83a08dee6e24e4461e0334e7384896f9 @@ -0,0 +1 @@ +{"address":"f85b2dba83a08dee6e24e4461e0334e7384896f9","crypto":{"cipher":"aes-128-ctr","ciphertext":"22036d22e9dcecaf3eed9e8e5419a642f26bb804f379af6c7799a5e17558525f","cipherparams":{"iv":"5e90b256ce5df8f3a0e8a86612431350"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"37ee8d72401c8f829748841dbd7cfcedb37b10a1a72f69c3db8967ede649b88b"},"mac":"21e96a2748834f8e0fe6bff1779166faee23debedd347a2064cf541e4036a4a0"},"id":"98c2b8bc-5a66-4803-9866-cf3eaa1cda3a","version":3} \ No newline at end of file diff --git a/packages/validator/test-local/chain2/docker-compose.yml b/packages/validator/test-local/chain2/docker-compose.yml new file mode 100644 index 0000000..03f697f --- /dev/null +++ b/packages/validator/test-local/chain2/docker-compose.yml @@ -0,0 +1,22 @@ +version: "3.7" +services: + agora-el-node2: + container_name: agora-el-node2 + image: bosagora/agora-el-node:v2.0.1 + ports: + - "8542:8542" + restart: always + volumes: + - ../chain2/node:/data + - ../chain2/config:/config + command: + --config=/config/config.toml + --datadir=/data + --syncmode=full + --gcmode=archive + --allow-insecure-unlock=true + --unlock=0xF85B2dbA83A08DEe6E24E4461E0334e7384896F9 + --password=/config/private/password.txt + --mine=true + --miner.etherbase=0xF85B2dbA83A08DEe6E24E4461E0334e7384896F9 + --http.corsdomain="*" diff --git a/packages/validator/test-local/cmd.sh b/packages/validator/test-local/cmd.sh new file mode 100755 index 0000000..2e209c2 --- /dev/null +++ b/packages/validator/test-local/cmd.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +set -eu + +system="" +case "$OSTYPE" in + darwin*) system="darwin" ;; + linux*) system="linux" ;; + msys*) system="windows" ;; + cygwin*) system="windows" ;; + *) exit 1 ;; +esac +readonly system + + +if [ "$1" = "init1" ]; then + + if [ "$system" == "linux" ]; then + sudo rm -rf ./test-local/chain1/node + else + rm -rf ./test-local/chain1/node + fi + + mkdir -p ./test-local/chain1/node + + cp -rf ./test-local/chain1/config/template/node/* ./test-local/chain1/node + + docker run -it -v ./test-local/chain1/node:/data -v ./test-local/chain1/config:/config --name el-node --rm bosagora/agora-el-node:v2.0.1 --datadir=/data init /config/genesis.json + +elif [ "$1" = "init2" ]; then + + if [ "$system" == "linux" ]; then + sudo rm -rf ./test-local/chain2/node + else + rm -rf ./test-local/chain2/node + fi + + mkdir -p ./test-local/chain2/node + + cp -rf ./test-local/chain2/config/template/node/* ./test-local/chain2/node + + docker run -it -v ./test-local/chain2/node:/data -v ./test-local/chain2/config:/config --name el-node --rm bosagora/agora-el-node:v2.0.1 --datadir=/data init /config/genesis.json + +elif [ "$1" = "start1" ]; then + + docker compose -f ./test-local/chain1/docker-compose.yml up -d + +elif [ "$1" = "stop1" ]; then + + docker compose -f ./test-local/chain1/docker-compose.yml down + +elif [ "$1" = "start2" ]; then + + docker compose -f ./test-local/chain2/docker-compose.yml up -d + +elif [ "$1" = "stop2" ]; then + + docker compose -f ./test-local/chain2/docker-compose.yml down +fi \ No newline at end of file diff --git a/packages/validator/test-local/helper/Deployments.ts b/packages/validator/test-local/helper/Deployments.ts new file mode 100644 index 0000000..b4a59a7 --- /dev/null +++ b/packages/validator/test-local/helper/Deployments.ts @@ -0,0 +1,186 @@ +import "@nomiclabs/hardhat-ethers"; +import "@nomiclabs/hardhat-waffle"; +import "@openzeppelin/hardhat-upgrades"; +import { ethers, upgrades } from "hardhat"; + +import { BaseContract, Wallet } from "ethers"; + +import { Amount, BOACoin } from "../../src/common/Amount"; +import { HardhatAccount } from "../../src/HardhatAccount"; +import { Bridge, BridgeValidator, TestKIOS } from "../../typechain-types"; +import { Config } from "../../src/common/Config"; + +import * as hre from "hardhat"; + +interface IDeployedContract { + name: string; + address: string; + contract: BaseContract; +} + +export interface IAccount { + deployer: Wallet; + fee: Wallet; + bridgeValidators: Wallet[]; + users: Wallet[]; +} + +type FnDeployer = (accounts: IAccount, deployment: Deployments) => void; + +export class Deployments { + public deployments: Map; + public accounts: IAccount; + public config: Config; + public network: string; + + constructor(config: Config, network: string) { + this.config = config; + this.network = network; + this.deployments = new Map(); + + const raws = HardhatAccount.keys.map((m) => new Wallet(m, hre.ethers.provider)); + const [ + deployer, + fee, + bridgeValidator1, + bridgeValidator2, + bridgeValidator3, + bridgeValidator4, + bridgeValidator5, + user01, + user02, + user03, + user04, + user05, + user06, + user07, + user08, + user09, + user10, + ] = raws; + + this.accounts = { + deployer, + fee, + bridgeValidators: [ + bridgeValidator1, + bridgeValidator2, + bridgeValidator3, + bridgeValidator4, + bridgeValidator5, + ], + users: [user01, user02, user03, user04, user05, user06, user07, user08, user09, user10], + }; + } + + public addContract(name: string, address: string, contract: BaseContract) { + this.deployments.set(name, { + name, + address, + contract, + }); + } + + public getContract(name: string): BaseContract | undefined { + const info = this.deployments.get(name); + if (info !== undefined) { + return info.contract; + } else { + return undefined; + } + } + + public getContractAddress(name: string): string | undefined { + const info = this.deployments.get(name); + if (info !== undefined) { + return info.address; + } else { + return undefined; + } + } + + public async doDeployAll() { + await hre.changeNetwork(this.network); + const deployers: FnDeployer[] = [deployToken, deployBridgeValidator, deployBridge]; + for (const elem of deployers) { + try { + await elem(this.accounts, this); + } catch (error) { + console.log(error); + } + } + } +} + +async function deployToken(accounts: IAccount, deployment: Deployments) { + const contractName = "TestKIOS"; + console.log(`Deploy ${contractName}...`); + + await hre.changeNetwork(deployment.network); + const factory = await ethers.getContractFactory("TestKIOS"); + const contract = (await factory.connect(accounts.deployer).deploy(accounts.deployer.address)) as TestKIOS; + await contract.deployed(); + await contract.deployTransaction.wait(); + + const balance = await contract.balanceOf(accounts.deployer.address); + console.log(`TestKIOS token's owner: ${accounts.deployer.address}`); + console.log(`TestKIOS token's balance of owner: ${new BOACoin(balance).toDisplayString(true, 2)}`); + + deployment.addContract(contractName, contract.address, contract); + console.log(`Deployed ${contractName} to ${contract.address}`); + + { + const userAmount = Amount.make(200_000, 18); + const tx2 = await contract.connect(accounts.deployer).multiTransfer( + accounts.users.map((m) => m.address), + userAmount.value + ); + console.log(`Transfer token to users (tx: ${tx2.hash})...`); + await tx2.wait(); + } +} + +async function deployBridgeValidator(accounts: IAccount, deployment: Deployments) { + const contractName = "BridgeValidator"; + console.log(`Deploy ${contractName}...`); + + await hre.changeNetwork(deployment.network); + const factory = await ethers.getContractFactory("BridgeValidator"); + const contract = (await upgrades.deployProxy( + factory.connect(accounts.deployer), + [accounts.bridgeValidators.map((m) => m.address), 3], + { + initializer: "initialize", + kind: "uups", + } + )) as BridgeValidator; + await contract.deployed(); + await contract.deployTransaction.wait(); + deployment.addContract(contractName, contract.address, contract); + console.log(`Deployed ${contractName} to ${contract.address}`); +} + +async function deployBridge(accounts: IAccount, deployment: Deployments) { + const contractName = "Bridge"; + console.log(`Deploy ${contractName}...`); + + if (deployment.getContract("BridgeValidator") === undefined || deployment.getContract("TestKIOS") === undefined) { + console.error("Contract is not deployed!"); + return; + } + + await hre.changeNetwork(deployment.network); + const factory = await ethers.getContractFactory("Bridge"); + const contract = (await upgrades.deployProxy( + factory.connect(accounts.deployer), + [await deployment.getContractAddress("BridgeValidator"), accounts.fee.address], + { + initializer: "initialize", + kind: "uups", + } + )) as Bridge; + await contract.deployed(); + await contract.deployTransaction.wait(); + deployment.addContract(contractName, contract.address, contract); + console.log(`Deployed ${contractName} to ${contract.address}`); +} diff --git a/packages/validator/test-local/helper/Utility.ts b/packages/validator/test-local/helper/Utility.ts new file mode 100644 index 0000000..d01e5f1 --- /dev/null +++ b/packages/validator/test-local/helper/Utility.ts @@ -0,0 +1,69 @@ +import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios"; +import { DefaultServer } from "../../src/DefaultServer"; +import { handleNetworkError } from "../../src/network/ErrorTypes"; + +export class TestServer extends DefaultServer {} + +/** + * This is a client for testing. + * Test codes can easily access error messages received from the server. + */ +export class TestClient { + private client: AxiosInstance; + + constructor() { + this.client = axios.create(); + } + + public get(url: string, config?: AxiosRequestConfig): Promise { + return new Promise((resolve, reject) => { + this.client + .get(url, config) + .then((response: AxiosResponse) => { + resolve(response); + }) + .catch((reason: any) => { + reject(handleNetworkError(reason)); + }); + }); + } + + public delete(url: string, config?: AxiosRequestConfig): Promise { + return new Promise((resolve, reject) => { + this.client + .delete(url, config) + .then((response: AxiosResponse) => { + resolve(response); + }) + .catch((reason: any) => { + reject(handleNetworkError(reason)); + }); + }); + } + + public post(url: string, data?: any, config?: AxiosRequestConfig): Promise { + return new Promise((resolve, reject) => { + this.client + .post(url, data, config) + .then((response: AxiosResponse) => { + resolve(response); + }) + .catch((reason: any) => { + reject(handleNetworkError(reason)); + }); + }); + } + + public put(url: string, data?: any, config?: AxiosRequestConfig): Promise { + return new Promise((resolve, reject) => { + this.client + .put(url, data, config) + .then((response: AxiosResponse) => { + resolve(response); + }) + .catch((reason: any) => { + reject(handleNetworkError(reason)); + }); + }); + } +} diff --git a/packages/validator/test-local/localtest.ts b/packages/validator/test-local/localtest.ts new file mode 100644 index 0000000..434452d --- /dev/null +++ b/packages/validator/test-local/localtest.ts @@ -0,0 +1,219 @@ +import "@nomiclabs/hardhat-ethers"; +import "@nomiclabs/hardhat-waffle"; +import "@nomiclabs/hardhat-web3"; +import "@openzeppelin/hardhat-upgrades"; + +import { Amount } from "../src/common/Amount"; +import { Config } from "../src/common/Config"; +import { Scheduler } from "../src/scheduler/Scheduler"; +import { ValidatorStorage } from "../src/storage/ValidatorStorage"; +import { ContractUtils } from "../src/utils/ContractUtils"; +import { BIP20DelegatedTransfer, Bridge } from "../typechain-types"; +import { Deployments } from "./helper/Deployments"; +import { TestServer } from "./helper/Utility"; + +// tslint:disable-next-line:no-implicit-dependencies +import { arrayify } from "@ethersproject/bytes"; +import { AddressZero, HashZero } from "@ethersproject/constants"; + +import * as hre from "hardhat"; +import path from "path"; + +import { URL } from "url"; +import { BridgeScheduler } from "../src/scheduler/BridgeScheduler"; + +import chai, { expect } from "chai"; + +describe("Test for Bridge", function () { + this.timeout(1000 * 60 * 5); + + const config = new Config(); + config.readFromFile(path.resolve(process.cwd(), "config", "config_test.yaml")); + config.bridge.networkAName = "chain1"; + config.bridge.networkBName = "chain2"; + let deploymentsA: Deployments; + let deploymentsB: Deployments; + + let tokenAContract: BIP20DelegatedTransfer; + let tokenBContract: BIP20DelegatedTransfer; + let bridgeAContract: Bridge; + let bridgeBContract: Bridge; + let storage: ValidatorStorage; + let server: TestServer; + let serverURL: URL; + + const amount = Amount.make(100_000, 18).value; + + let tokenId0: string; + let tokenId1: string; + let depositId: string; + + it("Attach", async () => { + await hre.changeNetwork(config.bridge.networkAName); + deploymentsA = new Deployments(config, config.bridge.networkAName); + await deploymentsA.doDeployAll(); + tokenAContract = deploymentsA.getContract("TestKIOS") as BIP20DelegatedTransfer; + bridgeAContract = deploymentsA.getContract("Bridge") as Bridge; + config.bridge.networkAContractAddress = bridgeAContract.address; + + await hre.changeNetwork(config.bridge.networkBName); + deploymentsB = new Deployments(config, config.bridge.networkBName); + await deploymentsB.doDeployAll(); + tokenBContract = deploymentsB.getContract("TestKIOS") as BIP20DelegatedTransfer; + bridgeBContract = deploymentsB.getContract("Bridge") as Bridge; + config.bridge.networkBContractAddress = bridgeBContract.address; + }); + + it("Create TestServer", async () => { + serverURL = new URL(`http://127.0.0.1:${config.server.port}`); + storage = await ValidatorStorage.make(config.database); + await storage.clearTestDB(); + + const schedulers: Scheduler[] = []; + schedulers.push(new BridgeScheduler("*/1 * * * * *")); + server = new TestServer(config, storage, schedulers); + }); + + it("Register token", async () => { + await hre.changeNetwork(config.bridge.networkAName); + // Native Token + tokenId0 = HashZero; + await bridgeAContract.connect(deploymentsA.accounts.deployer).registerToken(HashZero, AddressZero); + // BIP20 Token + tokenId1 = ContractUtils.getTokenId(await tokenAContract.name(), await tokenAContract.symbol()); + await bridgeAContract.connect(deploymentsA.accounts.deployer).registerToken(tokenId1, tokenAContract.address); + + await hre.changeNetwork(config.bridge.networkBName); + // Native Token + await bridgeBContract.connect(deploymentsB.accounts.deployer).registerToken(HashZero, AddressZero); + // BIP20 Token + tokenId1 = ContractUtils.getTokenId(await tokenBContract.name(), await tokenBContract.symbol()); + await bridgeBContract.connect(deploymentsB.accounts.deployer).registerToken(tokenId1, tokenBContract.address); + }); + + it("Deposit Native Liquidity at Bridge A", async () => { + await hre.changeNetwork(config.bridge.networkAName); + const liquidityAmount = Amount.make(1_000_000_000, 18).value; + const signature = await ContractUtils.signMessage(deploymentsA.accounts.deployer, arrayify(HashZero)); + const tx1 = await bridgeAContract + .connect(deploymentsA.accounts.deployer) + .depositLiquidity(tokenId0, liquidityAmount, signature, { value: liquidityAmount }); + await tx1.wait(); + }); + + it("Deposit Native Liquidity at Bridge B", async () => { + await hre.changeNetwork(config.bridge.networkBName); + const liquidityAmount = Amount.make(1_000_000_000, 18).value; + const signature = await ContractUtils.signMessage(deploymentsB.accounts.deployer, arrayify(HashZero)); + const tx1 = await bridgeBContract + .connect(deploymentsB.accounts.deployer) + .depositLiquidity(tokenId0, liquidityAmount, signature, { value: liquidityAmount }); + await tx1.wait(); + }); + + it("Deposit BIP20 Liquidity at Bridge A", async () => { + await hre.changeNetwork(config.bridge.networkAName); + const liquidityAmount = Amount.make(1_000_000_000, 18).value; + const nonce = await tokenAContract.nonceOf(deploymentsA.accounts.deployer.address); + const message = ContractUtils.getTransferMessage( + deploymentsA.accounts.deployer.address, + bridgeAContract.address, + liquidityAmount, + nonce, + hre.getChainId(config.bridge.networkAName) + ); + const signature = await ContractUtils.signMessage(deploymentsA.accounts.deployer, message); + const tx1 = await bridgeAContract + .connect(deploymentsA.accounts.deployer) + .depositLiquidity(tokenId1, liquidityAmount, signature); + await tx1.wait(); + }); + + it("Deposit BIP20 Liquidity at Bridge B", async () => { + await hre.changeNetwork(config.bridge.networkBName); + const liquidityAmount = Amount.make(1_000_000_000, 18).value; + const nonce = await tokenBContract.nonceOf(deploymentsB.accounts.deployer.address); + const message = ContractUtils.getTransferMessage( + deploymentsB.accounts.deployer.address, + bridgeBContract.address, + liquidityAmount, + nonce, + hre.getChainId(config.bridge.networkBName) + ); + const signature = await ContractUtils.signMessage(deploymentsB.accounts.deployer, message); + const tx1 = await bridgeBContract + .connect(deploymentsB.accounts.deployer) + .depositLiquidity(tokenId1, liquidityAmount, signature); + await tx1.wait(); + }); + + it("Start TestServer", async () => { + await server.start(); + }); + + it("Deposit native token to Main Bridge", async () => { + await hre.changeNetwork(config.bridge.networkAName); + const oldLiquidity = await hre.ethers.provider.getBalance(bridgeAContract.address); + depositId = ContractUtils.getRandomId(deploymentsA.accounts.users[0].address); + const signature = await ContractUtils.signMessage(deploymentsA.accounts.users[0], arrayify(HashZero)); + const tx = await bridgeAContract + .connect(deploymentsA.accounts.users[0]) + .depositToBridge(tokenId0, depositId, AddressZero, 0, signature, { + value: amount, + }); + await tx.wait(); + expect(await hre.ethers.provider.getBalance(bridgeAContract.address)).to.deep.equal(oldLiquidity.add(amount)); + }); + + it("Waiting", async () => { + await hre.changeNetwork(config.bridge.networkBName); + const t1 = ContractUtils.getTimeStamp(); + while (true) { + const info = await bridgeBContract.getWithdrawInfo(depositId); + if (info.executed) break; + else if (ContractUtils.getTimeStamp() - t1 > 60) break; + await ContractUtils.delay(1000); + } + }); + + it("Deposit BIB20 token to Main Bridge", async () => { + await hre.changeNetwork(config.bridge.networkBName); + const oldLiquidity = await tokenBContract.balanceOf(bridgeBContract.address); + const oldTokenBalance = await tokenBContract.balanceOf(deploymentsB.accounts.users[0].address); + const nonce = await tokenBContract.nonceOf(deploymentsB.accounts.users[0].address); + const message = ContractUtils.getTransferMessage( + deploymentsB.accounts.users[0].address, + bridgeBContract.address, + amount, + nonce, + hre.getChainId(config.bridge.networkBName) + ); + depositId = ContractUtils.getRandomId(deploymentsB.accounts.users[0].address); + const signature = await ContractUtils.signMessage(deploymentsB.accounts.users[0], message); + const tx = await bridgeBContract + .connect(deploymentsB.accounts.deployer) + .depositToBridge(tokenId1, depositId, deploymentsB.accounts.users[0].address, amount, signature); + await tx.wait(); + + expect(await tokenBContract.balanceOf(deploymentsB.accounts.users[0].address)).to.deep.equal( + oldTokenBalance.sub(amount) + ); + expect(await tokenBContract.balanceOf(bridgeBContract.address)).to.deep.equal(oldLiquidity.add(amount)); + }); + + it("Waiting", async () => { + await hre.changeNetwork(config.bridge.networkAName); + const t1 = ContractUtils.getTimeStamp(); + while (true) { + const info = await bridgeAContract.getWithdrawInfo(depositId); + if (info.executed) break; + else if (ContractUtils.getTimeStamp() - t1 > 60) break; + await ContractUtils.delay(1000); + } + }); + + after("Stop TestServer", async () => { + await server.stop(); + await storage.dropTestDB(); + }); +}); diff --git a/packages/validator/test-local/start-chain.sh b/packages/validator/test-local/start-chain.sh new file mode 100755 index 0000000..a8412d2 --- /dev/null +++ b/packages/validator/test-local/start-chain.sh @@ -0,0 +1,24 @@ +#!/bin/bash + + +if docker-compose ls | grep -q 'chain1' +then + ./test-local/cmd.sh stop1 + sleep 2 +fi + +if docker-compose ls | grep -q 'chain2' +then + ./test-local/cmd.sh stop2 + sleep 2 +fi + + +./test-local/cmd.sh init1 +sleep 2 +./test-local/cmd.sh init2 +sleep 2 +./test-local/cmd.sh start1 +sleep 2 +./test-local/cmd.sh start2 +sleep 2 diff --git a/packages/validator/test-local/start-test.sh b/packages/validator/test-local/start-test.sh new file mode 100755 index 0000000..e9a6a40 --- /dev/null +++ b/packages/validator/test-local/start-test.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +./test-local/start-chain.sh + +rm -rf .openzeppelin +npx hardhat test ./test-local/localtest.ts + +./test-local/stop-chain.sh + diff --git a/packages/validator/test-local/stop-chain.sh b/packages/validator/test-local/stop-chain.sh new file mode 100755 index 0000000..c5d7351 --- /dev/null +++ b/packages/validator/test-local/stop-chain.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +./test-local/cmd.sh stop1 +sleep 2 +./test-local/cmd.sh stop2 +sleep 2 diff --git a/packages/validator/test/01-Collector.test.ts b/packages/validator/test/01-Collector.test.ts index cd4b66e..e44111d 100644 --- a/packages/validator/test/01-Collector.test.ts +++ b/packages/validator/test/01-Collector.test.ts @@ -36,10 +36,13 @@ interface IShopData { } describe("Test for EventCollector", () => { - const deployments = new Deployments(); + const config = new Config(); + config.readFromFile(path.resolve(process.cwd(), "config", "config_test.yaml")); + config.bridge.networkAName = "hardhat"; + config.bridge.networkBName = "hardhat"; + const deploymentsA = new Deployments(config, config.bridge.networkAName); let tokenContract: BIP20DelegatedTransfer; let bridgeContract: Bridge; - let config: Config; let storage: ValidatorStorage; const amount = Amount.make(100_000, 18).value; @@ -49,14 +52,12 @@ describe("Test for EventCollector", () => { let validatorWallet: Wallet; const deployAllContract = async (shopData: IShopData[]) => { - await deployments.doDeployAll(); - tokenContract = deployments.getContract("TestKIOS") as BIP20DelegatedTransfer; - bridgeContract = deployments.getContract("Bridge") as Bridge; + await deploymentsA.doDeployAll(); + tokenContract = deploymentsA.getContract("TestKIOS") as BIP20DelegatedTransfer; + bridgeContract = deploymentsA.getContract("Bridge") as Bridge; }; before("Create Config", async () => { - config = new Config(); - config.readFromFile(path.resolve(process.cwd(), "config", "config_test.yaml")); validatorWallet = new Wallet(config.bridge.validators[0]); storage = await ValidatorStorage.make(config.database); await storage.clearTestDB(); @@ -77,7 +78,7 @@ describe("Test for EventCollector", () => { collector = new EventCollector( storage, ValidatorType.A, - "hardhat", + config.bridge.networkAName, bridgeContract.address, 1n, validatorWallet @@ -86,53 +87,63 @@ describe("Test for EventCollector", () => { it("EventCollector.work()", async () => { await collector.work(); - const events = await storage.getEvents(validatorWallet.address, ValidatorType.A, "hardhat", 0n); + const events = await storage.getEvents( + validatorWallet.address, + ValidatorType.A, + config.bridge.networkAName, + 0n + ); assert.deepStrictEqual(events.length, 0); }); it("Register token", async () => { + await hre.changeNetwork(config.bridge.networkAName); // Native Token tokenId0 = HashZero; - await bridgeContract.connect(deployments.accounts.deployer).registerToken(HashZero, AddressZero); + await bridgeContract.connect(deploymentsA.accounts.deployer).registerToken(HashZero, AddressZero); // BIP20 Token tokenId1 = ContractUtils.getTokenId(await tokenContract.name(), await tokenContract.symbol()); - await bridgeContract.connect(deployments.accounts.deployer).registerToken(tokenId1, tokenContract.address); + await bridgeContract.connect(deploymentsA.accounts.deployer).registerToken(tokenId1, tokenContract.address); }); it("Deposit Native Liquidity", async () => { + await hre.changeNetwork(config.bridge.networkAName); const liquidityAmount = Amount.make(1_000_000_000, 18).value; - const signature = await ContractUtils.signMessage(deployments.accounts.deployer, arrayify(HashZero)); + const signature = await ContractUtils.signMessage(deploymentsA.accounts.deployer, arrayify(HashZero)); const tx1 = await bridgeContract - .connect(deployments.accounts.deployer) + .connect(deploymentsA.accounts.deployer) .depositLiquidity(tokenId0, liquidityAmount, signature, { value: liquidityAmount }); await tx1.wait(); }); it("Deposit BIP20 Liquidity", async () => { + await hre.changeNetwork(config.bridge.networkAName); const liquidityAmount = Amount.make(1_000_000_000, 18).value; - const nonce = await (deployments.getContract("TestKIOS") as BIP20DelegatedTransfer).nonceOf( - deployments.accounts.deployer.address + const nonce = await (deploymentsA.getContract("TestKIOS") as BIP20DelegatedTransfer).nonceOf( + deploymentsA.accounts.deployer.address ); const message = ContractUtils.getTransferMessage( - deployments.accounts.deployer.address, + deploymentsA.accounts.deployer.address, bridgeContract.address, liquidityAmount, - nonce + nonce, + hre.getChainId(config.bridge.networkAName) ); - const signature = await ContractUtils.signMessage(deployments.accounts.deployer, message); + const signature = await ContractUtils.signMessage(deploymentsA.accounts.deployer, message); const tx1 = await bridgeContract - .connect(deployments.accounts.deployer) + .connect(deploymentsA.accounts.deployer) .depositLiquidity(tokenId1, liquidityAmount, signature); await tx1.wait(); }); it("Deposit native token to Main Bridge", async () => { + await hre.changeNetwork(config.bridge.networkAName); const oldLiquidity = await hre.ethers.provider.getBalance(bridgeContract.address); - depositId = ContractUtils.getRandomId(deployments.accounts.users[0].address); - const signature = await ContractUtils.signMessage(deployments.accounts.users[0], arrayify(HashZero)); + depositId = ContractUtils.getRandomId(deploymentsA.accounts.users[0].address); + const signature = await ContractUtils.signMessage(deploymentsA.accounts.users[0], arrayify(HashZero)); await expect( bridgeContract - .connect(deployments.accounts.users[0]) + .connect(deploymentsA.accounts.users[0]) .depositToBridge(tokenId0, depositId, AddressZero, 0, signature, { value: amount, }) @@ -141,7 +152,7 @@ describe("Test for EventCollector", () => { .withNamedArgs({ tokenId: tokenId0, depositId, - account: deployments.accounts.users[0].address, + account: deploymentsA.accounts.users[0].address, amount, }); expect(await hre.ethers.provider.getBalance(bridgeContract.address)).to.deep.equal(oldLiquidity.add(amount)); @@ -149,39 +160,46 @@ describe("Test for EventCollector", () => { it("EventCollector.work()", async () => { await collector.work(); - const events = await storage.getEvents(validatorWallet.address, ValidatorType.A, "hardhat", 0n); + const events = await storage.getEvents( + validatorWallet.address, + ValidatorType.A, + config.bridge.networkAName, + 0n + ); assert.deepStrictEqual(events.length, 1); - assert.deepStrictEqual(events[0].network, "hardhat"); + assert.deepStrictEqual(events[0].network, config.bridge.networkAName); assert.deepStrictEqual(events[0].tokenId, tokenId0); assert.deepStrictEqual(events[0].depositId, depositId); - assert.deepStrictEqual(events[0].account, deployments.accounts.users[0].address); + assert.deepStrictEqual(events[0].account, deploymentsA.accounts.users[0].address); assert.deepStrictEqual(events[0].amount, amount); }); it("Deposit BIB20 token to Main Bridge", async () => { + await hre.changeNetwork(config.bridge.networkAName); const oldLiquidity = await tokenContract.balanceOf(bridgeContract.address); - const oldTokenBalance = await tokenContract.balanceOf(deployments.accounts.users[0].address); - const nonce = await tokenContract.nonceOf(deployments.accounts.users[0].address); + const oldTokenBalance = await tokenContract.balanceOf(deploymentsA.accounts.users[0].address); + const nonce = await tokenContract.nonceOf(deploymentsA.accounts.users[0].address); const message = ContractUtils.getTransferMessage( - deployments.accounts.users[0].address, + deploymentsA.accounts.users[0].address, bridgeContract.address, amount, - nonce + nonce, + hre.getChainId(config.bridge.networkAName) ); - depositId = ContractUtils.getRandomId(deployments.accounts.users[0].address); - const signature = await ContractUtils.signMessage(deployments.accounts.users[0], message); + depositId = ContractUtils.getRandomId(deploymentsA.accounts.users[0].address); + const signature = await ContractUtils.signMessage(deploymentsA.accounts.users[0], message); await expect( bridgeContract - .connect(deployments.accounts.deployer) - .depositToBridge(tokenId1, depositId, deployments.accounts.users[0].address, amount, signature) + .connect(deploymentsA.accounts.deployer) + .depositToBridge(tokenId1, depositId, deploymentsA.accounts.users[0].address, amount, signature) ) .to.emit(bridgeContract, "BridgeDeposited") .withNamedArgs({ depositId, - account: deployments.accounts.users[0].address, + account: deploymentsA.accounts.users[0].address, amount, }); - expect(await tokenContract.balanceOf(deployments.accounts.users[0].address)).to.deep.equal( + expect(await tokenContract.balanceOf(deploymentsA.accounts.users[0].address)).to.deep.equal( oldTokenBalance.sub(amount) ); expect(await tokenContract.balanceOf(bridgeContract.address)).to.deep.equal(oldLiquidity.add(amount)); @@ -189,12 +207,17 @@ describe("Test for EventCollector", () => { it("EventCollector.work()", async () => { await collector.work(); - const events = await storage.getEvents(validatorWallet.address, ValidatorType.A, "hardhat", 0n); + const events = await storage.getEvents( + validatorWallet.address, + ValidatorType.A, + config.bridge.networkAName, + 0n + ); assert.deepStrictEqual(events.length, 2); - assert.deepStrictEqual(events[1].network, "hardhat"); + assert.deepStrictEqual(events[1].network, config.bridge.networkAName); assert.deepStrictEqual(events[1].tokenId, tokenId1); assert.deepStrictEqual(events[1].depositId, depositId); - assert.deepStrictEqual(events[1].account, deployments.accounts.users[0].address); + assert.deepStrictEqual(events[1].account, deploymentsA.accounts.users[0].address); assert.deepStrictEqual(events[1].amount, amount); }); }); diff --git a/packages/validator/test/02-Bridge.test.ts b/packages/validator/test/02-Bridge.test.ts index 44514f9..a682284 100644 --- a/packages/validator/test/02-Bridge.test.ts +++ b/packages/validator/test/02-Bridge.test.ts @@ -19,7 +19,6 @@ import { solidity } from "ethereum-waffle"; import { arrayify } from "@ethersproject/bytes"; import { AddressZero, HashZero } from "@ethersproject/constants"; -import * as assert from "assert"; import { Wallet } from "ethers"; import * as hre from "hardhat"; import path from "path"; @@ -37,11 +36,17 @@ interface IShopData { } describe("Test for Bridge", () => { - const deployments = new Deployments(); - let tokenContract: BIP20DelegatedTransfer; + const config = new Config(); + config.readFromFile(path.resolve(process.cwd(), "config", "config_test.yaml")); + config.bridge.networkAName = "hardhat"; + config.bridge.networkBName = "hardhat"; + const deploymentsA = new Deployments(config, config.bridge.networkAName); + const deploymentsB = new Deployments(config, config.bridge.networkBName); + + let tokenAContract: BIP20DelegatedTransfer; + let tokenBContract: BIP20DelegatedTransfer; let bridgeAContract: Bridge; let bridgeBContract: Bridge; - let config: Config; let storage: ValidatorStorage; let server: TestServer; let serverURL: URL; @@ -53,15 +58,15 @@ describe("Test for Bridge", () => { let depositId: string; before("Deploy", async () => { - await deployments.doDeployAll(); - tokenContract = deployments.getContract("TestKIOS") as BIP20DelegatedTransfer; - bridgeAContract = deployments.getContract("BridgeA") as Bridge; - bridgeBContract = deployments.getContract("BridgeB") as Bridge; + await deploymentsA.doDeployAll(); + await deploymentsB.doDeployAll(); + tokenAContract = deploymentsA.getContract("TestKIOS") as BIP20DelegatedTransfer; + tokenBContract = deploymentsB.getContract("TestKIOS") as BIP20DelegatedTransfer; + bridgeAContract = deploymentsA.getContract("Bridge") as Bridge; + bridgeBContract = deploymentsB.getContract("Bridge") as Bridge; }); before("Create Config", async () => { - config = new Config(); - config.readFromFile(path.resolve(process.cwd(), "config", "config_test.yaml")); config.bridge.networkAContractAddress = bridgeAContract.address; config.bridge.networkBContractAddress = bridgeBContract.address; }); @@ -79,64 +84,71 @@ describe("Test for Bridge", () => { before("Register token", async () => { // Native Token tokenId0 = HashZero; - await bridgeAContract.connect(deployments.accounts.deployer).registerToken(HashZero, AddressZero); - await bridgeBContract.connect(deployments.accounts.deployer).registerToken(HashZero, AddressZero); + await bridgeAContract.connect(deploymentsA.accounts.deployer).registerToken(HashZero, AddressZero); + await bridgeBContract.connect(deploymentsB.accounts.deployer).registerToken(HashZero, AddressZero); + // BIP20 Token - tokenId1 = ContractUtils.getTokenId(await tokenContract.name(), await tokenContract.symbol()); - await bridgeAContract.connect(deployments.accounts.deployer).registerToken(tokenId1, tokenContract.address); - await bridgeBContract.connect(deployments.accounts.deployer).registerToken(tokenId1, tokenContract.address); + tokenId1 = ContractUtils.getTokenId(await tokenAContract.name(), await tokenAContract.symbol()); + await bridgeAContract.connect(deploymentsA.accounts.deployer).registerToken(tokenId1, tokenAContract.address); + await bridgeBContract.connect(deploymentsB.accounts.deployer).registerToken(tokenId1, tokenBContract.address); }); before("Deposit Native Liquidity at Bridge A", async () => { + await hre.changeNetwork(config.bridge.networkAName); const liquidityAmount = Amount.make(1_000_000_000, 18).value; - const signature = await ContractUtils.signMessage(deployments.accounts.deployer, arrayify(HashZero)); + const signature = await ContractUtils.signMessage(deploymentsA.accounts.deployer, arrayify(HashZero)); const tx1 = await bridgeAContract - .connect(deployments.accounts.deployer) + .connect(deploymentsA.accounts.deployer) .depositLiquidity(tokenId0, liquidityAmount, signature, { value: liquidityAmount }); await tx1.wait(); }); before("Deposit Native Liquidity at Bridge B", async () => { + await hre.changeNetwork(config.bridge.networkBName); const liquidityAmount = Amount.make(1_000_000_000, 18).value; - const signature = await ContractUtils.signMessage(deployments.accounts.deployer, arrayify(HashZero)); + const signature = await ContractUtils.signMessage(deploymentsB.accounts.deployer, arrayify(HashZero)); const tx1 = await bridgeBContract - .connect(deployments.accounts.deployer) + .connect(deploymentsB.accounts.deployer) .depositLiquidity(tokenId0, liquidityAmount, signature, { value: liquidityAmount }); await tx1.wait(); }); before("Deposit BIP20 Liquidity at Bridge A", async () => { + await hre.changeNetwork(config.bridge.networkAName); const liquidityAmount = Amount.make(1_000_000_000, 18).value; - const nonce = await (deployments.getContract("TestKIOS") as BIP20DelegatedTransfer).nonceOf( - deployments.accounts.deployer.address + const nonce = await (deploymentsA.getContract("TestKIOS") as BIP20DelegatedTransfer).nonceOf( + deploymentsA.accounts.deployer.address ); const message = ContractUtils.getTransferMessage( - deployments.accounts.deployer.address, + deploymentsA.accounts.deployer.address, bridgeAContract.address, liquidityAmount, - nonce + nonce, + hre.getChainId(config.bridge.networkAName) ); - const signature = await ContractUtils.signMessage(deployments.accounts.deployer, message); + const signature = await ContractUtils.signMessage(deploymentsA.accounts.deployer, message); const tx1 = await bridgeAContract - .connect(deployments.accounts.deployer) + .connect(deploymentsA.accounts.deployer) .depositLiquidity(tokenId1, liquidityAmount, signature); await tx1.wait(); }); before("Deposit BIP20 Liquidity at Bridge B", async () => { + await hre.changeNetwork(config.bridge.networkBName); const liquidityAmount = Amount.make(1_000_000_000, 18).value; - const nonce = await (deployments.getContract("TestKIOS") as BIP20DelegatedTransfer).nonceOf( - deployments.accounts.deployer.address + const nonce = await (deploymentsB.getContract("TestKIOS") as BIP20DelegatedTransfer).nonceOf( + deploymentsB.accounts.deployer.address ); const message = ContractUtils.getTransferMessage( - deployments.accounts.deployer.address, + deploymentsB.accounts.deployer.address, bridgeBContract.address, liquidityAmount, - nonce + nonce, + hre.getChainId(config.bridge.networkBName) ); - const signature = await ContractUtils.signMessage(deployments.accounts.deployer, message); + const signature = await ContractUtils.signMessage(deploymentsB.accounts.deployer, message); const tx1 = await bridgeBContract - .connect(deployments.accounts.deployer) + .connect(deploymentsB.accounts.deployer) .depositLiquidity(tokenId1, liquidityAmount, signature); await tx1.wait(); }); @@ -151,12 +163,13 @@ describe("Test for Bridge", () => { }); it("Deposit native token to Main Bridge", async () => { + await hre.changeNetwork(config.bridge.networkAName); const oldLiquidity = await hre.ethers.provider.getBalance(bridgeAContract.address); - depositId = ContractUtils.getRandomId(deployments.accounts.users[0].address); - const signature = await ContractUtils.signMessage(deployments.accounts.users[0], arrayify(HashZero)); + depositId = ContractUtils.getRandomId(deploymentsA.accounts.users[0].address); + const signature = await ContractUtils.signMessage(deploymentsA.accounts.users[0], arrayify(HashZero)); await expect( bridgeAContract - .connect(deployments.accounts.users[0]) + .connect(deploymentsA.accounts.users[0]) .depositToBridge(tokenId0, depositId, AddressZero, 0, signature, { value: amount, }) @@ -165,7 +178,7 @@ describe("Test for Bridge", () => { .withNamedArgs({ tokenId: tokenId0, depositId, - account: deployments.accounts.users[0].address, + account: deploymentsA.accounts.users[0].address, amount, }); expect(await hre.ethers.provider.getBalance(bridgeAContract.address)).to.deep.equal(oldLiquidity.add(amount)); @@ -182,32 +195,34 @@ describe("Test for Bridge", () => { }); it("Deposit BIB20 token to Main Bridge", async () => { - const oldLiquidity = await tokenContract.balanceOf(bridgeBContract.address); - const oldTokenBalance = await tokenContract.balanceOf(deployments.accounts.users[0].address); - const nonce = await tokenContract.nonceOf(deployments.accounts.users[0].address); + await hre.changeNetwork(config.bridge.networkBName); + const oldLiquidity = await tokenBContract.balanceOf(bridgeBContract.address); + const oldTokenBalance = await tokenBContract.balanceOf(deploymentsB.accounts.users[0].address); + const nonce = await tokenBContract.nonceOf(deploymentsB.accounts.users[0].address); const message = ContractUtils.getTransferMessage( - deployments.accounts.users[0].address, + deploymentsB.accounts.users[0].address, bridgeBContract.address, amount, - nonce + nonce, + hre.getChainId(config.bridge.networkBName) ); - depositId = ContractUtils.getRandomId(deployments.accounts.users[0].address); - const signature = await ContractUtils.signMessage(deployments.accounts.users[0], message); + depositId = ContractUtils.getRandomId(deploymentsB.accounts.users[0].address); + const signature = await ContractUtils.signMessage(deploymentsB.accounts.users[0], message); await expect( bridgeBContract - .connect(deployments.accounts.deployer) - .depositToBridge(tokenId1, depositId, deployments.accounts.users[0].address, amount, signature) + .connect(deploymentsB.accounts.deployer) + .depositToBridge(tokenId1, depositId, deploymentsB.accounts.users[0].address, amount, signature) ) .to.emit(bridgeBContract, "BridgeDeposited") .withNamedArgs({ depositId, - account: deployments.accounts.users[0].address, + account: deploymentsB.accounts.users[0].address, amount, }); - expect(await tokenContract.balanceOf(deployments.accounts.users[0].address)).to.deep.equal( + expect(await tokenBContract.balanceOf(deploymentsB.accounts.users[0].address)).to.deep.equal( oldTokenBalance.sub(amount) ); - expect(await tokenContract.balanceOf(bridgeBContract.address)).to.deep.equal(oldLiquidity.add(amount)); + expect(await tokenBContract.balanceOf(bridgeBContract.address)).to.deep.equal(oldLiquidity.add(amount)); }); it("Waiting", async () => { diff --git a/packages/validator/test/helper/Deployments.ts b/packages/validator/test/helper/Deployments.ts index 6e6f987..67e752a 100644 --- a/packages/validator/test/helper/Deployments.ts +++ b/packages/validator/test/helper/Deployments.ts @@ -8,13 +8,9 @@ import { BaseContract, Wallet } from "ethers"; import { Amount, BOACoin } from "../../src/common/Amount"; import { HardhatAccount } from "../../src/HardhatAccount"; import { Bridge, BridgeValidator, TestKIOS } from "../../typechain-types"; +import { Config } from "../../src/common/Config"; -interface IShopData { - shopId: string; - name: string; - currency: string; - wallet: Wallet; -} +import * as hre from "hardhat"; interface IDeployedContract { name: string; @@ -27,7 +23,6 @@ export interface IAccount { fee: Wallet; bridgeValidators: Wallet[]; users: Wallet[]; - shops: Wallet[]; } type FnDeployer = (accounts: IAccount, deployment: Deployments) => void; @@ -35,8 +30,12 @@ type FnDeployer = (accounts: IAccount, deployment: Deployments) => void; export class Deployments { public deployments: Map; public accounts: IAccount; + public config: Config; + public network: string; - constructor() { + constructor(config: Config, network: string) { + this.config = config; + this.network = network; this.deployments = new Map(); const raws = HardhatAccount.keys.map((m) => new Wallet(m, ethers.provider)); @@ -58,16 +57,6 @@ export class Deployments { user08, user09, user10, - shop01, - shop02, - shop03, - shop04, - shop05, - shop06, - shop07, - shop08, - shop09, - shop10, ] = raws; this.accounts = { @@ -81,7 +70,6 @@ export class Deployments { bridgeValidator5, ], users: [user01, user02, user03, user04, user05, user06, user07, user08, user09, user10], - shops: [shop01, shop02, shop03, shop04, shop05, shop06, shop07, shop08, shop09, shop10], }; } @@ -112,13 +100,8 @@ export class Deployments { } public async doDeployAll() { - const deployers: FnDeployer[] = [ - deployToken, - deployBridgeValidator, - deployBridge, - deployBridgeA, - deployBridgeB, - ]; + await hre.changeNetwork(this.network); + const deployers: FnDeployer[] = [deployToken, deployBridgeValidator, deployBridge]; for (const elem of deployers) { try { await elem(this.accounts, this); @@ -133,6 +116,7 @@ async function deployToken(accounts: IAccount, deployment: Deployments) { const contractName = "TestKIOS"; console.log(`Deploy ${contractName}...`); + await hre.changeNetwork(deployment.network); const factory = await ethers.getContractFactory("TestKIOS"); const contract = (await factory.connect(accounts.deployer).deploy(accounts.deployer.address)) as TestKIOS; await contract.deployed(); @@ -153,13 +137,6 @@ async function deployToken(accounts: IAccount, deployment: Deployments) { ); console.log(`Transfer token to users (tx: ${tx2.hash})...`); await tx2.wait(); - - const tx3 = await contract.connect(accounts.deployer).multiTransfer( - accounts.shops.map((m) => m.address), - userAmount.value - ); - console.log(`Transfer token to shops (tx: ${tx3.hash})...`); - await tx3.wait(); } } @@ -167,6 +144,7 @@ async function deployBridgeValidator(accounts: IAccount, deployment: Deployments const contractName = "BridgeValidator"; console.log(`Deploy ${contractName}...`); + await hre.changeNetwork(deployment.network); const factory = await ethers.getContractFactory("BridgeValidator"); const contract = (await upgrades.deployProxy( factory.connect(accounts.deployer), @@ -190,52 +168,8 @@ async function deployBridge(accounts: IAccount, deployment: Deployments) { console.error("Contract is not deployed!"); return; } - const factory = await ethers.getContractFactory("Bridge"); - const contract = (await upgrades.deployProxy( - factory.connect(accounts.deployer), - [await deployment.getContractAddress("BridgeValidator"), accounts.fee.address], - { - initializer: "initialize", - kind: "uups", - } - )) as Bridge; - await contract.deployed(); - await contract.deployTransaction.wait(); - deployment.addContract(contractName, contract.address, contract); - console.log(`Deployed ${contractName} to ${contract.address}`); -} - -async function deployBridgeA(accounts: IAccount, deployment: Deployments) { - const contractName = "BridgeA"; - console.log(`Deploy ${contractName}...`); - - if (deployment.getContract("BridgeValidator") === undefined || deployment.getContract("TestKIOS") === undefined) { - console.error("Contract is not deployed!"); - return; - } - const factory = await ethers.getContractFactory("Bridge"); - const contract = (await upgrades.deployProxy( - factory.connect(accounts.deployer), - [await deployment.getContractAddress("BridgeValidator"), accounts.fee.address], - { - initializer: "initialize", - kind: "uups", - } - )) as Bridge; - await contract.deployed(); - await contract.deployTransaction.wait(); - deployment.addContract(contractName, contract.address, contract); - console.log(`Deployed ${contractName} to ${contract.address}`); -} -async function deployBridgeB(accounts: IAccount, deployment: Deployments) { - const contractName = "BridgeB"; - console.log(`Deploy ${contractName}...`); - - if (deployment.getContract("BridgeValidator") === undefined || deployment.getContract("TestKIOS") === undefined) { - console.error("Contract is not deployed!"); - return; - } + await hre.changeNetwork(deployment.network); const factory = await ethers.getContractFactory("Bridge"); const contract = (await upgrades.deployProxy( factory.connect(accounts.deployer), diff --git a/packages/validator/tsconfig.json b/packages/validator/tsconfig.json index 5ae8ce3..a616501 100644 --- a/packages/validator/tsconfig.json +++ b/packages/validator/tsconfig.json @@ -8,6 +8,6 @@ "declaration": true, "resolveJsonModule": true }, - "include": ["./scripts", "./src", "./test", "./typechain-types"], + "include": ["./scripts", "./src", "./test", "./test-local", "./typechain-types"], "files": ["./hardhat.config.ts"] }