diff --git a/src/utils/convert.ts b/src/utils/convert.ts index dc452ae..ddfe29b 100644 --- a/src/utils/convert.ts +++ b/src/utils/convert.ts @@ -23,7 +23,7 @@ export function addressArrayToBytesArray(addresses: Address[]): Bytes[] { } export function bigIntToBytes(bi: BigInt): Bytes { - if (bi.isI32()) + if (bi.isI32()) // HACK: handle padding oddities when converting BigInt which came from a signed number return Bytes.fromByteArray(Bytes.fromBigInt(BigInt.fromI32(bi.toI32()))) else return Bytes.fromByteArray(Bytes.fromBigInt(bi)) diff --git a/tests/grant-fund.test.ts b/tests/grant-fund.test.ts index 67d7e44..5cecae9 100644 --- a/tests/grant-fund.test.ts +++ b/tests/grant-fund.test.ts @@ -180,12 +180,19 @@ describe("Grant Fund assertions", () => { Bytes.fromHexString("0x000000"), Bytes.fromHexString("0x000000"), ]; + const distributionId = BigInt.fromI32(234); const startBlock = ONE_BI; const endBlock = startBlock.plus(DISTRIBUTION_PERIOD_LENGTH); const description = "test proposal"; // mock GrantFund contract calls - const distributionId = BigInt.fromI32(234); + const newDistributionPeriodStartedEvent = createDistributionPeriodStartedEvent( + distributionId, + startBlock, + endBlock + ); + newDistributionPeriodStartedEvent.address = grantFundAddress + handleDistributionPeriodStarted(newDistributionPeriodStartedEvent); mockGetDistributionId(grantFundAddress, distributionId); // create mock event @@ -235,12 +242,19 @@ describe("Grant Fund assertions", () => { Bytes.fromHexString("0x000000"), Bytes.fromHexString("0x000000"), ]; + const distributionId = BigInt.fromI32(234); const startBlock = ONE_BI; const endBlock = startBlock.plus(DISTRIBUTION_PERIOD_LENGTH); const description = "test proposal"; // mock GrantFund contract calls - const distributionId = BigInt.fromI32(234); + const newDistributionPeriodStartedEvent = createDistributionPeriodStartedEvent( + distributionId, + startBlock, + endBlock + ); + newDistributionPeriodStartedEvent.address = grantFundAddress + handleDistributionPeriodStarted(newDistributionPeriodStartedEvent); mockGetDistributionId(grantFundAddress, distributionId); // create mock event