From 1377dc275198c86b22260f454ea5db99a2132300 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 19 Mar 2024 12:00:57 +0100 Subject: [PATCH] change accounts to use SI for localhost --- deploy/local/000_deploy_factory.ts | 7 ++++--- hardhat.config.ts | 31 +++++++++++++++++++++++++++++- test/swutils.ts | 8 ++++---- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/deploy/local/000_deploy_factory.ts b/deploy/local/000_deploy_factory.ts index 91807c2..70c588a 100755 --- a/deploy/local/000_deploy_factory.ts +++ b/deploy/local/000_deploy_factory.ts @@ -3,12 +3,13 @@ import { DeployFunction } from 'hardhat-deploy/types'; const func: DeployFunction = async function ({ deployments, getNamedAccounts, network, ethers }) { const { deploy, log } = deployments; const { deployer } = await getNamedAccounts(); - const waitBlockConfirmations = network.name != 'testnet' ? 1 : 6; + log('----------------------------------------------------'); + log('Deployer address at ', deployer); log('----------------------------------------------------'); // Check if this is run on Cluster and is already using deployed token from Storage Incentive - const deployedToken = "0x942C6684eB9874C63d4ed26Ab0623F951D253081"; + const deployedToken = '0x942C6684eB9874C63d4ed26Ab0623F951D253081'; const code = await ethers.provider.getCode(deployedToken); let tokenAddress; @@ -31,7 +32,7 @@ const func: DeployFunction = async function ({ deployments, getNamedAccounts, ne from: deployer, args: deployArgs, log: true, - waitConfirmations: waitBlockConfirmations, + waitConfirmations: 1, }); log(`Factory deployed at address ${factory.address}`); diff --git a/hardhat.config.ts b/hardhat.config.ts index 2e5cb34..878c651 100755 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -22,6 +22,22 @@ const accounts: string[] | { mnemonic: string } = walletSecret.length === 64 ? [walletSecret] : { mnemonic: walletSecret }; const config: HardhatUserConfig = { + namedAccounts: { + deployer: 0, + admin: 1, + stamper: 2, + oracle: 3, + redistributor: 4, + pauser: 5, + node_0: 6, + node_1: 7, + node_2: 8, + node_3: 9, + node_4: 10, + node_5: 11, + node_6: 12, + node_7: 13, + }, defaultNetwork: 'hardhat', solidity: { compilers: [ @@ -47,11 +63,24 @@ const config: HardhatUserConfig = { }, networks: { hardhat: { + chainId: 12345, + accounts: [ + // deployer 0x3c8F39EE625fCF97cB6ee22bCe25BE1F1E5A5dE8 + { + privateKey: '0x0d8f0a76e88539c4ceaa6ad01372cce44fb621b56b34b2cc614b4c77fb081f20', + balance: '10000000000000000000000', + }, + // admin 0x7E71bA1aB8AF3454a01CFafe358BEbb7691d02f8 + { + privateKey: '0x8d56d322a1bb1e94c7d64ccd62aa2e5cc9760f59575eda0f7fd392bab8d6ba0d', + balance: '10000000000000000000000', + }, + ], deploy: ['deploy/local/'], }, localhost: { url: 'http://localhost:8545', - accounts, + // accounts, if not defined uses the same as above hardhat chainId: 12345, deploy: ['deploy/local/'], }, diff --git a/test/swutils.ts b/test/swutils.ts index b3e11ab..faed7a8 100755 --- a/test/swutils.ts +++ b/test/swutils.ts @@ -36,13 +36,13 @@ function signTypedData(eip712data: any, signee: string): Promise { return signer._signTypedData(eip712data.domain, eip712data.types, eip712data.message); } -// the chainId is set to 31337 which is the hardhat default +// the chainId is set to 12345 which is the hardhat default async function signCheque( swap: any, beneficiary: string, cumulativePayout: any, signee: string, - chainId = 31337 + chainId = 12345 ): Promise { const cheque = { chequebook: swap.address, @@ -74,7 +74,7 @@ async function signCashOut( beneficiaryAgent: string, callerPayout: any, signee: string, - chainId = 31337 + chainId = 12345 ): Promise { const eip712data = { types: { @@ -104,7 +104,7 @@ async function signCustomDecreaseTimeout( beneficiary: string, decreaseTimeout: any, signee: string, - chainId = 31337 + chainId = 12345 ): Promise { const eip712data = { types: {