import { loadFixture } from "@nomicfoundation/hardhat-toolbox/network-helpers"; import { ethers } from "hardhat"; import { expect } from "chai"; import { deployAndExecuteProposal } from "./utils"; const tornAddr = "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C"; const myAddr = "0x9b78e16456c8C0A1FE386894c6f1E7F7C0104ADC"; describe("Proposal", function () { describe("Deployment", async function () { it("Relayer Got Compensation", async function () { const TORN = await ethers.getContractAt("IERC20", tornAddr); // Data from 'data/relayerLosses.txt', generated by 'scripts/calculateLosses.ts' const relayerLosses: { [key: string]: bigint } = { '0x076D4E32C6A5D888fC4658281539c94E778C796d': BigInt('2380374405606021763001'), // 2380.374405606021763001 TORN '0x28907F21F43B419F34226d6f10aCbCf1832b1D4d': BigInt('4468422129821830327039'), // 4468.422129821830327039 TORN '0x2Ee39Ff05643bC7cc9ed31B71e142429044A425C': BigInt('3040216359787595395455'), // 3040.216359787595395455 TORN '0xb0Cdc0AB2D454F2360d4629d519819E13DBE816A': BigInt('103765685766980694091'), // 103.765685766980694091 TORN '0xb578603D3fB9216158c29488c1A902Dd0300c115': BigInt('816848044379099935494'), // 816.848044379099935494 TORN '0xD8f1Eb586Ecb93745392EE254a028f1F67E1437E': BigInt('6688475991532709870006') // 6688.475991532709870006 TORN } let relayerBalance: { [key: string]: bigint } = {}; for (const addr in relayerLosses) { relayerBalance[addr] = await TORN.balanceOf(addr); } const myBalance = await TORN.balanceOf(myAddr); await loadFixture(deployAndExecuteProposal); for (const addr in relayerBalance) { const balance = await TORN.balanceOf(addr); expect(balance).to.equal(relayerBalance[addr] + relayerLosses[addr]); } expect(await TORN.balanceOf(myAddr)).to.equal(myBalance + BigInt(5e19)); }); }); })