From be25bf29dd74024c206a300fe3b5659d8285f053 Mon Sep 17 00:00:00 2001 From: Bruno Menezes Date: Thu, 28 Mar 2024 12:08:35 +1300 Subject: [PATCH] feat: Add sepolia configs for pool, pos e util files. Also the Ropsten configs were removed. --- src/contracts/pool.ts | 4 ++-- src/contracts/pos.ts | 4 ++-- src/contracts/util.ts | 4 ++-- test/contracts/pos.spec.ts | 14 ++++++++++++++ test/contracts/util.spec.ts | 16 ++++++++++++++++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/contracts/pool.ts b/src/contracts/pool.ts index 00c9626..fef4856 100644 --- a/src/contracts/pool.ts +++ b/src/contracts/pool.ts @@ -17,11 +17,11 @@ import { import { ChainMap } from "."; import goerli from "@cartesi/staking-pool/export/abi/goerli.json"; -import ropsten from "@cartesi/staking-pool/export/abi/ropsten.json"; +import sepolia from "@cartesi/staking-pool/export/abi/sepolia.json"; import localhost from "./localhost.json"; const abis: ChainMap = { - 3: ropsten, + 11155111: sepolia, 5: goerli, 31337: localhost, }; diff --git a/src/contracts/pos.ts b/src/contracts/pos.ts index e7c9d45..7dc4728 100644 --- a/src/contracts/pos.ts +++ b/src/contracts/pos.ts @@ -25,12 +25,12 @@ import { ChainMap, getAddress } from "."; import mainnet from "@cartesi/pos/export/abi/mainnet.json"; import goerli from "@cartesi/pos/export/abi/goerli.json"; -import ropsten from "@cartesi/pos/export/abi/ropsten.json"; +import sepolia from "@cartesi/pos/export/abi/sepolia.json"; import localhost from "./localhost.json"; const abis: ChainMap = { 1: mainnet, - 3: ropsten, + 11155111: sepolia, 5: goerli, 31337: localhost, }; diff --git a/src/contracts/util.ts b/src/contracts/util.ts index 98df428..463a054 100644 --- a/src/contracts/util.ts +++ b/src/contracts/util.ts @@ -19,12 +19,12 @@ import { ChainMap, getAddress } from "."; import mainnet from "@cartesi/util/export/abi/mainnet.json"; import goerli from "@cartesi/util/export/abi/goerli.json"; -import ropsten from "@cartesi/util/export/abi/ropsten.json"; +import sepolia from "@cartesi/util/export/abi/sepolia.json"; import localhost from "./localhost.json"; const abis: ChainMap = { 1: mainnet, - 3: ropsten, + 11155111: sepolia, 5: goerli, 31337: localhost, }; diff --git a/test/contracts/pos.spec.ts b/test/contracts/pos.spec.ts index 59a17fa..7ddd116 100644 --- a/test/contracts/pos.spec.ts +++ b/test/contracts/pos.spec.ts @@ -16,6 +16,7 @@ import { createPoS } from "../../src/contracts"; import mainnet from "@cartesi/pos/export/abi/mainnet.json"; import goerli from "@cartesi/pos/export/abi/goerli.json"; +import sepolia from "@cartesi/pos/export/abi/sepolia.json"; describe("pos contracts test suite", () => { it("should create PoS mainnet contract", async () => { @@ -31,6 +32,19 @@ describe("pos contracts test suite", () => { expect(pos.signer).to.equal(signer); }); + it("should create PoS sepolia contract", async () => { + const network: Network = { + chainId: 11155111, + name: "sepolia", + }; + const signer: Signer = new VoidSigner( + "0x569369A96be963B7ef2bA01dA792EF95fDcCD5b0" + ); + const pos = await createPoS(network, signer); + expect(pos.address).to.equal(sepolia.contracts.PoS.address); + expect(pos.signer).to.equal(signer); + }); + it("should create PoS goerli contract", async () => { const network: Network = { chainId: 5, diff --git a/test/contracts/util.spec.ts b/test/contracts/util.spec.ts index 4e5e8dc..cd95bdc 100644 --- a/test/contracts/util.spec.ts +++ b/test/contracts/util.spec.ts @@ -16,6 +16,7 @@ import { createWorkerManager } from "../../src/contracts/util"; import mainnet from "@cartesi/util/export/abi/mainnet.json"; import goerli from "@cartesi/util/export/abi/goerli.json"; +import sepolia from "@cartesi/util/export/abi/sepolia.json"; describe("util contracts test suite", () => { it("should create mainnet contract", async () => { @@ -47,4 +48,19 @@ describe("util contracts test suite", () => { ); expect(workerManager.signer).to.equal(signer); }); + + it("should create sepolia contract", async () => { + const network: Network = { + chainId: 11155111, + name: "sepolia", + }; + const signer: Signer = new VoidSigner( + "0x569369A96be963B7ef2bA01dA792EF95fDcCD5b0" + ); + const workerManager = await createWorkerManager(network, signer); + expect(workerManager.address).to.equal( + sepolia.contracts.WorkerManagerAuthManagerImpl.address + ); + expect(workerManager.signer).to.equal(signer); + }); });