From 423970f8b8a1ace25a735bec5f4783efe45e6bc6 Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 1 Aug 2023 00:34:26 -0400 Subject: [PATCH] hardcode encoded propsal params in grant fund unit tests --- tests/grant-fund.test.ts | 63 +++++++++------------------------------- 1 file changed, 13 insertions(+), 50 deletions(-) diff --git a/tests/grant-fund.test.ts b/tests/grant-fund.test.ts index 00081d4..c165334 100644 --- a/tests/grant-fund.test.ts +++ b/tests/grant-fund.test.ts @@ -197,16 +197,9 @@ describe("Grant Fund assertions", () => { "transfer(address,uint256)", "transfer(address,uint256)", ]; - const paramsArray: Array = [ - ethereum.Value.fromAddress(proposer), - ethereum.Value.fromUnsignedBigInt(ONE_BI), - ]; - const params = changetype(paramsArray) - const encodedparamsOne = ethereum.encode(ethereum.Value.fromTuple(params))!; - const encodedparamsTwo = ethereum.encode(ethereum.Value.fromTuple(params))!; const calldatas = [ - encodedparamsOne, - encodedparamsTwo, + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000"), + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000") ]; const distributionId = BigInt.fromI32(234); @@ -264,7 +257,7 @@ describe("Grant Fund assertions", () => { "Proposal", `${bigIntToBytes(proposalId).toHexString()}`, "totalTokensRequested", - `${wadToDecimal(BigInt.fromI32(2))}` + `${wadToDecimal(BigInt.fromString("2000000000000000000000"))}` // 2000 * 1e18 ); }); @@ -289,16 +282,9 @@ describe("Grant Fund assertions", () => { "transfer(address,uint256)", "transfer(address,uint256)", ]; - const paramsArray: Array = [ - ethereum.Value.fromAddress(proposer), - ethereum.Value.fromUnsignedBigInt(ONE_BI), - ]; - const params = changetype(paramsArray) - const encodedparamsOne = ethereum.encode(ethereum.Value.fromTuple(params))!; - const encodedparamsTwo = ethereum.encode(ethereum.Value.fromTuple(params))!; const calldatas = [ - encodedparamsOne, - encodedparamsTwo, + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000"), + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000") ]; const distributionId = BigInt.fromI32(234); @@ -369,7 +355,7 @@ describe("Grant Fund assertions", () => { "Proposal", `${bigIntToBytes(proposalId).toHexString()}`, "totalTokensRequested", - `${wadToDecimal(BigInt.fromI32(2))}` + `${wadToDecimal(BigInt.fromString("2000000000000000000000"))}` // 2000 * 1e18 ); assert.fieldEquals( @@ -389,7 +375,7 @@ describe("Grant Fund assertions", () => { "DistributionPeriod", `${expectedDistributionId}`, "totalTokensDistributed", - `${wadToDecimal(BigInt.fromI32(2))}` + `${wadToDecimal(BigInt.fromString("2000000000000000000000"))}` // 2000 * 1e18 ); }); @@ -414,16 +400,9 @@ describe("Grant Fund assertions", () => { "transfer(address,uint256)", "transfer(address,uint256)", ]; - const paramsArray: Array = [ - ethereum.Value.fromAddress(proposer), - ethereum.Value.fromUnsignedBigInt(ONE_BI), - ]; - const params = changetype(paramsArray) - const encodedparamsOne = ethereum.encode(ethereum.Value.fromTuple(params))!; - const encodedparamsTwo = ethereum.encode(ethereum.Value.fromTuple(params))!; const calldatas = [ - encodedparamsOne, - encodedparamsTwo, + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000"), + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000") ]; const distributionId = ONE_BI; @@ -527,16 +506,9 @@ describe("Grant Fund assertions", () => { "transfer(address,uint256)", "transfer(address,uint256)", ]; - const paramsArray: Array = [ - ethereum.Value.fromAddress(proposer), - ethereum.Value.fromUnsignedBigInt(ONE_BI), - ]; - const params = changetype(paramsArray) - const encodedparamsOne = ethereum.encode(ethereum.Value.fromTuple(params))!; - const encodedparamsTwo = ethereum.encode(ethereum.Value.fromTuple(params))!; const calldatas = [ - encodedparamsOne, - encodedparamsTwo, + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000"), + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000") ]; const distributionId = ONE_BI; @@ -731,16 +703,9 @@ describe("Grant Fund assertions", () => { "transfer(address,uint256)", "transfer(address,uint256)", ]; - const paramsArray: Array = [ - ethereum.Value.fromAddress(proposer), - ethereum.Value.fromUnsignedBigInt(BigInt.fromString("1000000000000000000000")), // 1000 * 1e18 - ]; - const params = changetype(paramsArray) - const encodedparamsOne = ethereum.encode(ethereum.Value.fromTuple(params))!; - const encodedparamsTwo = ethereum.encode(ethereum.Value.fromTuple(params))!; const calldatas = [ - encodedparamsOne, - encodedparamsTwo, + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000"), + Bytes.fromHexString("0xa9059cbb000000000000000000000000c91f4871cfdd1947df6c23771f230853e0e2740700000000000000000000000000000000000000000000003635c9adc5dea00000") ]; const distributionId = ONE_BI; const startBlock = ONE_BI; @@ -803,8 +768,6 @@ describe("Grant Fund assertions", () => { const updateSlateEvent = createFundedSlateUpdatedEvent(distributionId, fundedSlateHash) handleFundedSlateUpdated(updateSlateEvent); - logStore(); - /********************/ /*** Assert State ***/ /********************/