Skip to content

Commit

Permalink
refactor: add more tests in simulation on BNB
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Dec 4, 2024
1 parent 8646911 commit 1de5938
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion simulations/vip-405/bscmainnet.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { expect } from "chai";
import { ethers } from "hardhat";
import { NETWORK_ADDRESSES } from "src/networkAddresses";

import { expectEvents } from "../../src/utils";
import { forking, testVip } from "../../src/vip-framework";
import vip405 from "../../vips/vip-405/bscmainnet";
import vip405, { BSC_ACM, BSC_ACM_AGGREGATOR, DEFAULT_ADMIN_ROLE } from "../../vips/vip-405/bscmainnet";
import ACM_COMMANDS_AGGREGATOR_ABI from "./abi/ACMCommandsAggregator.json";
import ACCESS_CONTROL_MANAGER_ABI from "./abi/AccessControlManager.json";
import OMNICHAIN_PROPOSAL_SENDER_ABI from "./abi/OmnichainProposalSender.json";

const { bscmainnet } = NETWORK_ADDRESSES;
const GUARDIAN3 = "0x3a3284dc0faffb0b5f0d074c4c704d14326c98cf";

forking(44521298, async () => {
testVip("VIP 405 Multichain Governance - Permissions", await vip405(), {
callbackAfterExecution: async txResponse => {
Expand All @@ -18,4 +25,21 @@ forking(44521298, async () => {
await expectEvents(txResponse, [ACM_COMMANDS_AGGREGATOR_ABI], ["GrantPermissionsExecuted"], [1]);
},
});

describe("Post-VIP behaviour", async () => {
const acm = new ethers.Contract(BSC_ACM, ACCESS_CONTROL_MANAGER_ABI, ethers.provider);
it("check if DEFAULT_ROLE has been revoked for ACMAggregator", async () => {
expect(await acm.hasRole(DEFAULT_ADMIN_ROLE, BSC_ACM_AGGREGATOR)).to.be.false;
});

it("check few permissions", async () => {
const role1 = ethers.utils.solidityPack(
["address", "string"],
[bscmainnet.REDSTONE_ORACLE, "setTokenConfig(TokenConfig)"],
);

const roleHash = ethers.utils.keccak256(role1);
expect(await acm.hasRole(roleHash, GUARDIAN3)).to.be.true;
});
});
});

0 comments on commit 1de5938

Please sign in to comment.