From 59eded9dba4d4f7b3019a1fe7675630eaab9a271 Mon Sep 17 00:00:00 2001 From: Miguel de Elias Date: Mon, 6 Nov 2023 16:00:53 -0300 Subject: [PATCH] feat: added sepolia testnet to contracts --- packages/contracts/addresses.json | 8 ++++++++ packages/contracts/hardhat.config.ts | 18 ++++++++++++++++++ packages/contracts/scripts/deploy.ts | 14 +++++++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 packages/contracts/addresses.json diff --git a/packages/contracts/addresses.json b/packages/contracts/addresses.json new file mode 100644 index 00000000..cc0151b9 --- /dev/null +++ b/packages/contracts/addresses.json @@ -0,0 +1,8 @@ +{ + "421614": { + "DataEdge": "0x17f1fcD16E2A9fF2a55c63C97a778D96Fa473548" + }, + "11155111": { + "DataEdge": "0x00C602A72363917Bc30a793593731F93352eB85d" + } +} \ No newline at end of file diff --git a/packages/contracts/hardhat.config.ts b/packages/contracts/hardhat.config.ts index a66e052b..626d3c0a 100644 --- a/packages/contracts/hardhat.config.ts +++ b/packages/contracts/hardhat.config.ts @@ -36,6 +36,7 @@ const networkConfigs: NetworkConfig[] = [ { network: 'ropsten', chainId: 3 }, { network: 'rinkeby', chainId: 4 }, { network: 'kovan', chainId: 42 }, + { network: 'sepolia', chainId: 11155111 }, { network: 'arbitrum-one', chainId: 42161, @@ -46,6 +47,11 @@ const networkConfigs: NetworkConfig[] = [ chainId: 421613, url: 'https://goerli-rollup.arbitrum.io/rpc', }, + { + network: 'arbitrum-sepolia', + chainId: 421614, + url: 'https://sepolia-rollup.arbitrum.io/rpcblock', + }, ] function getAccountMnemonic() { @@ -129,9 +135,21 @@ const config: HardhatUserConfig = { apiKey: { mainnet: process.env.ETHERSCAN_API_KEY, goerli: process.env.ETHERSCAN_API_KEY, + sepolia: process.env.ETHERSCAN_API_KEY, arbitrumOne: process.env.ARBISCAN_API_KEY, arbitrumGoerli: process.env.ARBISCAN_API_KEY, + arbitrumSepolia: process.env.ARBISCAN_API_KEY, }, + customChains: [ + { + network: 'arbitrumSepolia', + chainId: 421614, + urls: { + apiURL: 'https://api-sepolia.arbiscan.io/api', + browserURL: 'https://sepolia.arbiscan.io', + }, + }, + ], }, gasReporter: { enabled: process.env.REPORT_GAS ? true : false, diff --git a/packages/contracts/scripts/deploy.ts b/packages/contracts/scripts/deploy.ts index 2f302b99..f71c2695 100644 --- a/packages/contracts/scripts/deploy.ts +++ b/packages/contracts/scripts/deploy.ts @@ -1,5 +1,9 @@ import '@nomiclabs/hardhat-ethers' -import { ethers } from 'hardhat' +import { ethers, network } from 'hardhat' + +import addresses from '../addresses.json' + +import { promises as fs } from 'fs' async function main() { const factory = await ethers.getContractFactory('DataEdge') @@ -17,6 +21,14 @@ async function main() { // The contract is NOT deployed yet; we must wait until it is mined await contract.deployed() console.log(`Done!`) + + // Update addresses.json + const chainId = (network.config.chainId as number).toString() + if (!addresses[chainId]) { + addresses[chainId] = {} + } + addresses[chainId]['DataEdge'] = contract.address + return fs.writeFile('addresses.json', JSON.stringify(addresses, null, 2)) } main()