Created
May 23, 2022 13:40
-
-
Save shredding/ef9398bfca7146203bf36f9e88e0bb29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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