From aff5388c54d8a4cbd768aaa2bb6def6d0b66f4f1 Mon Sep 17 00:00:00 2001 From: Colin Kennedy Date: Thu, 22 Sep 2022 12:06:06 -0300 Subject: [PATCH] Merge pull request #5 from statechannels/tests Add contract tests --- packages/hardhat/contracts/Streamer.sol | 1 - packages/hardhat/test/challenge_1.js | 188 ---- .../hardhat/test/statechannel_challenge.js | 184 ++++ .../src/contracts/external_contracts.js | 801 ------------------ .../react-app/src/helpers/loadAppContracts.js | 3 - 5 files changed, 184 insertions(+), 993 deletions(-) delete mode 100644 packages/hardhat/test/challenge_1.js create mode 100644 packages/hardhat/test/statechannel_challenge.js delete mode 100644 packages/react-app/src/contracts/external_contracts.js diff --git a/packages/hardhat/contracts/Streamer.sol b/packages/hardhat/contracts/Streamer.sol index a820556..19a7ce1 100644 --- a/packages/hardhat/contracts/Streamer.sol +++ b/packages/hardhat/contracts/Streamer.sol @@ -61,7 +61,6 @@ contract Streamer is Ownable { // adjust the channel balance, and pay the contract owner. (Get the owner address with // the `owner()` function) - } /* diff --git a/packages/hardhat/test/challenge_1.js b/packages/hardhat/test/challenge_1.js deleted file mode 100644 index dd2893e..0000000 --- a/packages/hardhat/test/challenge_1.js +++ /dev/null @@ -1,188 +0,0 @@ -// -// this script executes when you run 'yarn test' -// -// you can also test remote submissions like: -// CONTRACT_ADDRESS=0x43Ab1FCd430C1f20270C2470f857f7a006117bbb yarn test --network rinkeby -// -// you can even run commands if the tests pass like: -// yarn test && echo "PASSED" || echo "FAILED" -// - -const hre = require("hardhat"); - -const { ethers } = hre; -const { use, expect } = require("chai"); -const { solidity } = require("ethereum-waffle"); - -use(solidity); - -describe("🚩 Challenge 1: 🥩 Decentralized Staking App", function () { - this.timeout(120000); - - let stakerContract; - let exampleExternalContract; - - // console.log("hre:",Object.keys(hre)) // <-- you can access the hardhat runtime env here - - describe("Staker", function () { - if (process.env.CONTRACT_ADDRESS) { - it("Should connect to external contract", async function () { - stakerContract = await ethers.getContractAt( - "Staker", - process.env.CONTRACT_ADDRESS - ); - console.log( - " 🛰 Connected to external contract", - stakerContract.address - ); - }); - } else { - it("Should deploy ExampleExternalContract", async function () { - const ExampleExternalContract = await ethers.getContractFactory( - "ExampleExternalContract" - ); - exampleExternalContract = await ExampleExternalContract.deploy(); - }); - it("Should deploy Staker", async function () { - const Staker = await ethers.getContractFactory("Staker"); - stakerContract = await Staker.deploy(exampleExternalContract.address); - }); - } - - describe("🥩 Stake!", function () { - it("Balance should go up when you stake()", async function () { - const [owner] = await ethers.getSigners(); - - console.log("\t", " 🧑‍🏫 Tester Address: ", owner.address); - - const startingBalance = await stakerContract.balances(owner.address); - console.log("\t", " ⚖️ Starting balance: ", startingBalance.toNumber()); - - console.log("\t", " 🔨 Staking..."); - const stakeResult = await stakerContract.stake({ - value: ethers.utils.parseEther("0.001"), - }); - console.log("\t", " 🏷 stakeResult: ", stakeResult.hash); - - console.log("\t", " ⏳ Waiting for confirmation..."); - const txResult = await stakeResult.wait(); - expect(txResult.status).to.equal(1); - - const newBalance = await stakerContract.balances(owner.address); - console.log( - "\t", - " 🔎 New balance: ", - ethers.utils.formatEther(newBalance) - ); - expect(newBalance).to.equal( - startingBalance.add(ethers.utils.parseEther("0.001")) - ); - }); - - if (process.env.CONTRACT_ADDRESS) { - console.log( - " 🤷 since we will run this test on a live contract this is as far as the automated tests will go..." - ); - } else { - it("If enough is staked and time has passed, you should be able to complete", async function () { - const timeLeft1 = await stakerContract.timeLeft(); - console.log( - "\t", - "⏱ There should be some time left: ", - timeLeft1.toNumber() - ); - expect(timeLeft1.toNumber()).to.greaterThan(0); - - console.log("\t", " 🚀 Staking a full eth!"); - const stakeResult = await stakerContract.stake({ - value: ethers.utils.parseEther("1"), - }); - console.log("\t", " 🏷 stakeResult: ", stakeResult.hash); - - console.log("\t", " ⌛️ fast forward time..."); - await network.provider.send("evm_increaseTime", [3600]); - await network.provider.send("evm_mine"); - - const timeLeft2 = await stakerContract.timeLeft(); - console.log("\t", "⏱ Time should be up now: ", timeLeft2.toNumber()); - expect(timeLeft2.toNumber()).to.equal(0); - - console.log("\t", " 🎉 calling execute"); - const execResult = await stakerContract.execute(); - console.log("\t", " 🏷 execResult: ", execResult.hash); - - const result = await exampleExternalContract.completed(); - console.log("\t", " 🥁 complete: ", result); - expect(result).to.equal(true); - }); - - it("Should redeploy Staker, stake, not get enough, and withdraw", async function () { - const [owner, secondAccount] = await ethers.getSigners(); - - const ExampleExternalContract = await ethers.getContractFactory( - "ExampleExternalContract" - ); - exampleExternalContract = await ExampleExternalContract.deploy(); - - const Staker = await ethers.getContractFactory("Staker"); - stakerContract = await Staker.deploy(exampleExternalContract.address); - - console.log("\t", " 🔨 Staking..."); - const stakeResult = await stakerContract - .connect(secondAccount) - .stake({ value: ethers.utils.parseEther("0.001") }); - console.log("\t", " 🏷 stakeResult: ", stakeResult.hash); - - console.log("\t", " ⏳ Waiting for confirmation..."); - const txResult = await stakeResult.wait(); - expect(txResult.status).to.equal(1); - - console.log("\t", " ⌛️ fast forward time..."); - await network.provider.send("evm_increaseTime", [3600]); - await network.provider.send("evm_mine"); - - console.log("\t", " 🎉 calling execute"); - const execResult = await stakerContract.execute(); - console.log("\t", " 🏷 execResult: ", execResult.hash); - - const result = await exampleExternalContract.completed(); - console.log("\t", " 🥁 complete should be false: ", result); - expect(result).to.equal(false); - - const startingBalance = await ethers.provider.getBalance( - secondAccount.address - ); - - console.log("\t", " 💵 calling withdraw"); - const withdrawResult = await stakerContract - .connect(secondAccount) - .withdraw(); - console.log("\t", " 🏷 withdrawResult: ", withdrawResult.hash); - - // need to account for the gas cost from calling withdraw - const tx = await ethers.provider.getTransaction(withdrawResult.hash); - const receipt = await ethers.provider.getTransactionReceipt( - withdrawResult.hash - ); - const gasCost = tx.gasPrice.mul(receipt.gasUsed); - - const endingBalance = await ethers.provider.getBalance( - secondAccount.address - ); - - expect(endingBalance).to.equal( - startingBalance.add(ethers.utils.parseEther("0.001")).sub(gasCost) - ); - }); - } - // - - /*it("Should track tokens of owner by index", async function () { - const [ owner ] = await ethers.getSigners(); - const startingBalance = await myContract.balanceOf(owner.address) - const token = await myContract.tokenOfOwnerByIndex(owner.address,startingBalance.sub(1)); - expect(token.toNumber()).to.greaterThan(0); - });*/ - }); - }); -}); diff --git a/packages/hardhat/test/statechannel_challenge.js b/packages/hardhat/test/statechannel_challenge.js new file mode 100644 index 0000000..9fa4103 --- /dev/null +++ b/packages/hardhat/test/statechannel_challenge.js @@ -0,0 +1,184 @@ +// +// this script executes when you run 'yarn test' +// +// you can also test remote submissions like: +// CONTRACT_ADDRESS=0x43Ab1FCd430C1f20270C2470f857f7a006117bbb yarn test --network rinkeby +// +// you can even run commands if the tests pass like: +// yarn test && echo "PASSED" || echo "FAILED" +// + +const hre = require("hardhat"); + +const { ethers } = hre; +const { use, expect, assert } = require("chai"); +const { solidity } = require("ethereum-waffle"); +const { network } = require("hardhat"); + +use(solidity); + +describe("Statechannel Challenge: The Guru's Offering", function () { + this.timeout(120000); + let streamerContract; + + /** + * asserts that the steamerContract's balance is equal to b, + * denominated in ether + * + * @param {string} b + */ + async function assertBalance(b) { + return expect( + await network.provider.send("eth_getBalance", [streamerContract.address]) + ).to.equal(ethers.utils.parseEther(b)); + } + + /** + * Creates a redeemable voucher for the given balance + * in the name of `signer` + * + * @param {ethers.BigNumber} updatedBalance + * @param {ethers.SignerWithAddress} signer + * @returns + */ + async function createVoucher(updatedBalance, signer) { + const packed = ethers.utils.solidityPack(["uint256"], [updatedBalance]); + const hashed = ethers.utils.keccak256(packed); + const arrayified = ethers.utils.arrayify(hashed); + + const carolSig = await signer.signMessage(arrayified); + + const voucher = { + updatedBalance, + sig: ethers.utils.splitSignature(carolSig), + }; + return voucher; + } + + describe("contract Streamer.sol", function () { + it("deploys", async function () { + const streamerFct = await ethers.getContractFactory("Streamer"); + streamerContract = await streamerFct.deploy(); + // console.log(`Streamer deployed to: ${streamerContract.address}`); + }); + + it("allows channel funding & emits 'Opened' event", async function () { + const fundingTx = await streamerContract.fundChannel({ + value: ethers.utils.parseEther("1"), + }); + expect(fundingTx).to.emit(streamerContract, "Opened"); + }); + + it("refuses multiple funding from single user", async function () { + await expect( + streamerContract.fundChannel({ + value: ethers.utils.parseEther("1"), // first funded channel + }) + ).to.be.reverted; + }); + + it("allows multiple client channels", async function () { + const [, alice, bob] = await ethers.getSigners(); + + await expect( + streamerContract.connect(alice).fundChannel({ + value: ethers.utils.parseEther("1"), // second funded channel + }) + ).to.emit(streamerContract, "Opened"); + + await expect( + streamerContract.connect(bob).fundChannel({ + value: ethers.utils.parseEther("1"), // third funded channel + }) + ).to.emit(streamerContract, "Opened"); + + await assertBalance("3"); // running total + }); + + it("allows legitimate withdrawals", async function () { + const [, alice] = await ethers.getSigners(); + + const updatedBalance = ethers.utils.parseEther("0.5"); // cut channel balance from 1 -> 0.5 + const voucher = await createVoucher(updatedBalance, alice); + + await expect(streamerContract.withdrawEarnings(voucher)).to.emit( + streamerContract, + "Withdrawn" + ); + await assertBalance("2.5"); // 3 - 0.5 = 2.5 + }); + + it("refuses redundant withdrawals", async function () { + const [, alice] = await ethers.getSigners(); + + const updatedBalance = ethers.utils.parseEther("0.5"); // equal to the current balance, should fail + const voucher = await createVoucher(updatedBalance, alice); + + await expect(streamerContract.withdrawEarnings(voucher)).to.be.reverted; + await assertBalance("2.5"); // contract total unchanged because withdrawal fails + }); + + it("refuses illegitimate withdrawals", async function () { + const [, , , carol] = await ethers.getSigners(); // carol has no open channel + + const updatedBalance = ethers.utils.parseEther("0.5"); + const voucher = await createVoucher(updatedBalance, carol); + + await expect(streamerContract.withdrawEarnings(voucher)).to.be.reverted; + await assertBalance("2.5"); // contract total unchanged because carol has no channel + }); + + it("refusus defunding when no challenge has been registered", async function () { + const [, , bob] = await ethers.getSigners(); + + await expect(streamerContract.connect(bob).defundChannel()).to.be + .reverted; + await assertBalance("2.5"); // contract total unchanged because defund fails + }); + + it("emits a challenged event", async function () { + const [, , bob] = await ethers.getSigners(); + await expect(streamerContract.connect(bob).challengeChannel()).to.emit( + streamerContract, + "Challenged" + ); + await assertBalance("2.5"); // contract total unchanged because challenge does not move funds + }); + + it("refusus defunding during the challenge period", async function () { + const [, , bob] = await ethers.getSigners(); + + await expect(streamerContract.connect(bob).defundChannel()).to.be + .reverted; + await assertBalance("2.5"); // contract total unchanged becaues defund fails + }); + + it("allows defunding after the challenge period", async function () { + const [, , bob] = await ethers.getSigners(); + + const initBobBalance = ethers.BigNumber.from( + await network.provider.send("eth_getBalance", [bob.address]) + ); + + network.provider.send("evm_increaseTime", [3600]); // fast-forward one hour + network.provider.send("evm_mine"); + + await expect(streamerContract.connect(bob).defundChannel()).to.emit( + streamerContract, + "Closed" + ); + await assertBalance("1.5"); // 2.5-1 = 1.5 (bob defunded his unused channel) + + const finalBobBalance = ethers.BigNumber.from( + await network.provider.send("eth_getBalance", [bob.address]) + ); + + // check that bob's channel balance returned to bob's address + // + // init + 1 is not exactly final because ether is spent as gas for + // executing the tx + const zeroPlusGasFee = initBobBalance.add(1).sub(finalBobBalance); + assert(zeroPlusGasFee.lt(ethers.utils.parseEther("0.000000000001"))); + }); + }); +}); diff --git a/packages/react-app/src/contracts/external_contracts.js b/packages/react-app/src/contracts/external_contracts.js deleted file mode 100644 index 5ab4769..0000000 --- a/packages/react-app/src/contracts/external_contracts.js +++ /dev/null @@ -1,801 +0,0 @@ -const ERC20ABI = [ - { - constant: true, - inputs: [], - name: "name", - outputs: [ - { - name: "", - type: "string", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - name: "_spender", - type: "address", - }, - { - name: "_value", - type: "uint256", - }, - ], - name: "approve", - outputs: [ - { - name: "", - type: "bool", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [], - name: "totalSupply", - outputs: [ - { - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - name: "_from", - type: "address", - }, - { - name: "_to", - type: "address", - }, - { - name: "_value", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [ - { - name: "", - type: "bool", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [], - name: "decimals", - outputs: [ - { - name: "", - type: "uint8", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: true, - inputs: [ - { - name: "_owner", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - name: "balance", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: true, - inputs: [], - name: "symbol", - outputs: [ - { - name: "", - type: "string", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - name: "_to", - type: "address", - }, - { - name: "_value", - type: "uint256", - }, - ], - name: "transfer", - outputs: [ - { - name: "", - type: "bool", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [ - { - name: "_owner", - type: "address", - }, - { - name: "_spender", - type: "address", - }, - ], - name: "allowance", - outputs: [ - { - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - payable: true, - stateMutability: "payable", - type: "fallback", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: "owner", - type: "address", - }, - { - indexed: true, - name: "spender", - type: "address", - }, - { - indexed: false, - name: "value", - type: "uint256", - }, - ], - name: "Approval", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - name: "from", - type: "address", - }, - { - indexed: true, - name: "to", - type: "address", - }, - { - indexed: false, - name: "value", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, -]; -const DAIABI = [ - { - inputs: [ - { - internalType: "uint256", - name: "chainId_", - type: "uint256", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "constructor", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "src", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "guy", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "Approval", - type: "event", - }, - { - anonymous: true, - inputs: [ - { - indexed: true, - internalType: "bytes4", - name: "sig", - type: "bytes4", - }, - { - indexed: true, - internalType: "address", - name: "usr", - type: "address", - }, - { - indexed: true, - internalType: "bytes32", - name: "arg1", - type: "bytes32", - }, - { - indexed: true, - internalType: "bytes32", - name: "arg2", - type: "bytes32", - }, - { - indexed: false, - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "LogNote", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "src", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "dst", - type: "address", - }, - { - indexed: false, - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "Transfer", - type: "event", - }, - { - constant: true, - inputs: [], - name: "DOMAIN_SEPARATOR", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: true, - inputs: [], - name: "PERMIT_TYPEHASH", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: true, - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - { - internalType: "address", - name: "", - type: "address", - }, - ], - name: "allowance", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "usr", - type: "address", - }, - { - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "approve", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - name: "balanceOf", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "usr", - type: "address", - }, - { - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "burn", - outputs: [], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [], - name: "decimals", - outputs: [ - { - internalType: "uint8", - name: "", - type: "uint8", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "guy", - type: "address", - }, - ], - name: "deny", - outputs: [], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "usr", - type: "address", - }, - { - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "mint", - outputs: [], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "src", - type: "address", - }, - { - internalType: "address", - name: "dst", - type: "address", - }, - { - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "move", - outputs: [], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: true, - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - name: "nonces", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "holder", - type: "address", - }, - { - internalType: "address", - name: "spender", - type: "address", - }, - { - internalType: "uint256", - name: "nonce", - type: "uint256", - }, - { - internalType: "uint256", - name: "expiry", - type: "uint256", - }, - { - internalType: "bool", - name: "allowed", - type: "bool", - }, - { - internalType: "uint8", - name: "v", - type: "uint8", - }, - { - internalType: "bytes32", - name: "r", - type: "bytes32", - }, - { - internalType: "bytes32", - name: "s", - type: "bytes32", - }, - ], - name: "permit", - outputs: [], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "usr", - type: "address", - }, - { - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "pull", - outputs: [], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "usr", - type: "address", - }, - { - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "push", - outputs: [], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "guy", - type: "address", - }, - ], - name: "rely", - outputs: [], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [], - name: "symbol", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: true, - inputs: [], - name: "totalSupply", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "dst", - type: "address", - }, - { - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "transfer", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: false, - inputs: [ - { - internalType: "address", - name: "src", - type: "address", - }, - { - internalType: "address", - name: "dst", - type: "address", - }, - { - internalType: "uint256", - name: "wad", - type: "uint256", - }, - ], - name: "transferFrom", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - payable: false, - stateMutability: "nonpayable", - type: "function", - }, - { - constant: true, - inputs: [], - name: "version", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, - { - constant: true, - inputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - name: "wards", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - payable: false, - stateMutability: "view", - type: "function", - }, -]; - -// Mainnet DAI, Optimism and Arbitrium Rollup Contracts with local addresses -module.exports = { - 1: { - contracts: { - DAI: { - address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", - abi: DAIABI, - }, - UNI: { - address: "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", - abi: ERC20ABI, - }, - }, - }, -}; diff --git a/packages/react-app/src/helpers/loadAppContracts.js b/packages/react-app/src/helpers/loadAppContracts.js index f87efa2..cce27c9 100644 --- a/packages/react-app/src/helpers/loadAppContracts.js +++ b/packages/react-app/src/helpers/loadAppContracts.js @@ -1,10 +1,7 @@ const contractListPromise = import("../contracts/hardhat_contracts.json"); -// @ts-ignore -const externalContractsPromise = import("../contracts/external_contracts"); export const loadAppContracts = async () => { const config = {}; config.deployedContracts = (await contractListPromise).default ?? {}; - config.externalContracts = (await externalContractsPromise).default ?? {}; return config; };