Skip to content

Instantly share code, notes, and snippets.

@shredding
Created May 23, 2022 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shredding/ef9398bfca7146203bf36f9e88e0bb29 to your computer and use it in GitHub Desktop.
Save shredding/ef9398bfca7146203bf36f9e88e0bb29 to your computer and use it in GitHub Desktop.
import { abacus, ethers } from "hardhat";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { Contract } from "ethers";
import { utils as aUtils } from "@abacus-network/utils";
import { expect } from "chai";
const chainADomain = 1000;
const chainBDomain = 2000;
describe("Playground", async () => {
let owner: SignerWithAddress;
let someone: SignerWithAddress;
let contractA: Contract;
let contractB: Contract;
before(async () => {
[owner, someone] = await ethers.getSigners();
});
beforeEach(async () => {
await abacus.deploy([chainADomain, chainBDomain], owner);
const Playground = await ethers.getContractFactory("Playground");
contractA = await Playground.deploy(
abacus.abacusConnectionManager(chainADomain).address
);
await contractA.deployed();
contractB = await Playground.deploy(
abacus.abacusConnectionManager(chainBDomain).address
);
await contractB.deployed();
await contractA.enrollRemoteRouter(
chainBDomain,
aUtils.addressToBytes32(contractB.address)
);
await contractB.enrollRemoteRouter(
contractA,
aUtils.addressToBytes32(contractA.address)
);
});
it("should send a message", async () => {
await contractA.connect(someone).foo(chainBDomain, "Hello World");
await abacus.processMessages();
expect(await contractA.message()).to.equal("Hello World");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment