-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed issues with array management * Bytes.empty() is really just null, persist distributionPeriod mutations * tests liked null, graph deploy did not * add some logging * added another log * adjustments * needed this to get matchstick working * rename standardProposals to proposals * more logging * eliminated grantFundAddressTable * debug conversion from u24 to bytes * attempt to fix issue converting bigint to bytes * try converting other way as signed * wrote unit test which reproduced the problem * hacked around oddball BigInt behavior * fixed unit test * tidy, remove debug logging
- Loading branch information
Showing
14 changed files
with
232 additions
and
191 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { BigInt } from '@graphprotocol/graph-ts' | ||
import { assert, describe, test } from "matchstick-as/assembly/index"; | ||
import { ONE_BI } from "../src/utils/constants"; | ||
import { bigIntToBytes, bytesToBigInt } from "../src/utils/convert"; | ||
|
||
describe("Conversions", () => { | ||
test("Reliably convert integer contract values to bytes", () => { | ||
const one_bi = BigInt.fromU32(1) | ||
const one_number = 1 | ||
assert.bigIntEquals(one_bi, BigInt.fromI32(one_number)); | ||
|
||
const one_bytes_from_bi = bigIntToBytes(one_bi); | ||
const one_bytes_from_number = bigIntToBytes(BigInt.fromI32(one_number)); | ||
assert.bytesEquals(one_bytes_from_bi, one_bytes_from_number); | ||
}); | ||
|
||
test("Convert values which exceed 64 bits to bytes and back", () => { | ||
const actually_big_number = BigInt.fromI32(2).pow(64) | ||
const as_bytes = bigIntToBytes(actually_big_number); | ||
const back_to_bigint = bytesToBigInt(as_bytes) | ||
assert.bigIntEquals(actually_big_number, back_to_bigint); | ||
}); | ||
}); |
Oops, something went wrong.