proposal-47/test/Proposal.js

70 lines
2.3 KiB
JavaScript
Raw Normal View History

2024-01-31 15:04:44 +03:00
const { ethers, network } = require("hardhat");
const contentHash = require("content-hash");
const { expect, assert } = require("chai");
const { time } = require("@nomicfoundation/hardhat-toolbox/network-helpers");
const { deployAndExecuteProposal } = require("./utils");
const tornAddr = "0x77777FeDdddFfC19Ff86DB637967013e6C6A116C";
const sablierAddr = "0xCD18eAa163733Da39c232722cBC4E8940b1D8888";
const governanceAddr = "0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce";
async function getManyEth(addr) {
await network.provider.send("hardhat_setBalance", [addr, "0x111166630153555558483537"]);
}
async function getEnsRegistry() {
const ensAddr = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
return await ethers.getContractAt(require("./abi/ensRegistry.abi.json"), ensAddr);
}
async function getEnsResolver(ensName) {
const ensRegistry = await getEnsRegistry();
const resolverAddr = await ensRegistry.resolver(ethers.namehash(ensName));
return await ethers.getContractAt(require("./abi/ensResolver.abi.json"), resolverAddr);
}
async function resolveAddr(ensName) {
if (ethers.isAddress(ensName)) return ensName;
const ensResolver = await getEnsResolver(ensName);
return await ensResolver.addr(ethers.namehash(ensName));
}
async function getTornContract() {
return await ethers.getContractAt(require("./abi/torn.abi.json"), tornAddr);
}
async function getSablierContract() {
return await ethers.getContractAt(require("./abi/sabler.abi.json"), sablierAddr);
}
async function getMe() {
return await resolveAddr("butterfly-attractor.eth");
}
describe("Proposal results check", function () {
beforeEach(async function () {
await network.provider.request({
method: "hardhat_reset",
params: [
{
forking: {
jsonRpcUrl: config.networks.hardhat.forking.url,
blockNumber: config.networks.hardhat.forking.blockNumber,
},
},
],
});
});
async function getStreamArgs() {
const sablier = await getSablierContract();
const filter = sablier.filters.CreateStream;
const events = await sablier.queryFilter(filter, config.networks.hardhat.forking.blockNumber - 1);
return events[0].args;
}
it("Proposal executed", async function () {
await deployAndExecuteProposal();
});
});