ethereumjs-util#zeroAddress TypeScript Examples

The following examples show how to use ethereumjs-util#zeroAddress. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: spokeRegistry.test.ts    From hubble-contracts with MIT License 6 votes vote down vote up
describe("spokeRegistry", async () => {
    let spokeRegistry: SpokeRegistry;

    beforeEach(async () => {
        const [signer] = await ethers.getSigners();
        spokeRegistry = await new SpokeRegistry__factory(signer).deploy();
    });
    it("Spoke registration", async function() {
        const expectedSpokeID = 1;
        const fakeAddress = randomAddress();

        const tx = await spokeRegistry.registerSpoke(fakeAddress);
        const [event] = await spokeRegistry.queryFilter(
            spokeRegistry.filters.SpokeRegistered(null, null),
            tx.blockHash
        );

        assert.equal(event.args?.spokeID.toNumber(), expectedSpokeID);
        assert.equal(event.args?.spokeContract, fakeAddress);

        const gotSpokeAddress = await spokeRegistry.getSpokeAddress(
            expectedSpokeID
        );
        assert.equal(gotSpokeAddress, fakeAddress);
    });
    it("Spoke does not exist", async function() {
        const spokeID = 10;
        const gotSpokeAddress = await spokeRegistry.getSpokeAddress(spokeID);
        assert.equal(gotSpokeAddress, zeroAddress());
    });
});