diff --git a/package.json b/package.json index 6ba8a2da..a8812d74 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "devDependencies": { "@graphprotocol/client-cli": "^3.0.0", "@graphprotocol/graph-cli": "0.56.0", - "@graphprotocol/graph-ts": "0.27.0", + "@graphprotocol/graph-ts": "0.31.0", "@nomicfoundation/hardhat-chai-matchers": "^1.0.3", "@nomicfoundation/hardhat-network-helpers": "^1.0.4", "@nomicfoundation/hardhat-toolbox": "^1.0.2", @@ -67,7 +67,7 @@ "hardhat-gas-reporter": "^1.0.8", "husky": "^3.0.5", "lint-staged": "^12.3.3", - "matchstick-as": "^0.5.0", + "matchstick-as": "^0.6.0", "module-alias": "^2.2.2", "mustache": "^4.2.0", "patch-package": "6.5.1", diff --git a/subgraphs/isolated-pools/tests/Pool/index.test.ts b/subgraphs/isolated-pools/tests/Pool/index.test.ts index 55914c0c..ac10f4cd 100644 --- a/subgraphs/isolated-pools/tests/Pool/index.test.ts +++ b/subgraphs/isolated-pools/tests/Pool/index.test.ts @@ -10,6 +10,7 @@ import { test, } from 'matchstick-as/assembly'; +import { Pool } from '../../generated/schema'; import { oneBigInt, zeroBigInt32 } from '../../src/constants'; import { handleActionPausedMarket, @@ -373,11 +374,8 @@ describe('Pool Events', () => { comptrollerAddress.toHexString(), ); - assert.fieldEquals( - 'Pool', - comptrollerAddress.toHex(), - 'rewardsDistributors', - `[${rewardsDistributorAddress.toHexString()}]`, - ); + const pool = Pool.load(comptrollerAddress.toHex())!; + const rewardsDistributors = pool.rewardsDistributors.load(); + assert.stringEquals(rewardsDistributorAddress.toHexString(), rewardsDistributors[0].id); }); }); diff --git a/subgraphs/isolated-pools/tests/RewardsDistributor/index.test.ts b/subgraphs/isolated-pools/tests/RewardsDistributor/index.test.ts index 0c7a4721..a03cdbc5 100644 --- a/subgraphs/isolated-pools/tests/RewardsDistributor/index.test.ts +++ b/subgraphs/isolated-pools/tests/RewardsDistributor/index.test.ts @@ -10,6 +10,7 @@ import { test, } from 'matchstick-as/assembly/index'; +import { RewardsDistributor } from '../../generated/schema'; import { handleNewRewardsDistributor } from '../../src/mappings/pool'; import { handleRewardTokenBorrowSpeedUpdated, @@ -77,12 +78,9 @@ describe('Rewards Distributor', () => { assert.fieldEquals('RewardSpeed', rewardId, 'supplySpeedPerBlockMantissa', '0'); assert.fieldEquals('RewardSpeed', rewardId, 'borrowSpeedPerBlockMantissa', newBorrowRate); - assert.fieldEquals( - 'RewardsDistributor', - rewardsDistributorAddress.toHex(), - 'rewardSpeeds', - `[${rewardId}]`, - ); + const rewardsDistributor = RewardsDistributor.load(rewardsDistributorAddress.toHex())!; + const rewardSpeeds = rewardsDistributor.rewardSpeeds.load(); + assert.stringEquals(rewardId, rewardSpeeds[0].id); }); test('indexes new supply speed', () => { @@ -107,11 +105,8 @@ describe('Rewards Distributor', () => { assert.fieldEquals('RewardSpeed', rewardId, 'supplySpeedPerBlockMantissa', newSupplyRate); assert.fieldEquals('RewardSpeed', rewardId, 'borrowSpeedPerBlockMantissa', '0'); - assert.fieldEquals( - 'RewardsDistributor', - rewardsDistributorAddress.toHex(), - 'rewardSpeeds', - `[${rewardId}]`, - ); + const rewardsDistributor = RewardsDistributor.load(rewardsDistributorAddress.toHex())!; + const rewardSpeeds = rewardsDistributor.rewardSpeeds.load(); + assert.stringEquals(rewardId, rewardSpeeds[0].id); }); }); diff --git a/subgraphs/venus-governance/tests/unit/Alpha/index.test.ts b/subgraphs/venus-governance/tests/unit/Alpha/index.test.ts index 6f8905ad..0a12ad35 100644 --- a/subgraphs/venus-governance/tests/unit/Alpha/index.test.ts +++ b/subgraphs/venus-governance/tests/unit/Alpha/index.test.ts @@ -48,7 +48,7 @@ beforeAll(() => { }); beforeEach(() => { - getOrCreateDelegate(user1.toHexString()); + getOrCreateDelegate(user1); const proposalCreatedEvent = createProposalCreatedEvent( 1, user1, @@ -77,7 +77,10 @@ describe('Alpha', () => { assertDelegateDocument('id', user1.toHexString()); assertDelegateDocument('totalVotesMantissa', '0'); assertDelegateDocument('delegateCount', '0'); - assertDelegateDocument('proposals', '[1]'); + + const delegate = Delegate.load(user1.toHex())!; + const proposals = delegate.proposals.load(); + assert.stringEquals('1', proposals[0].id); // Proposal const assertProposalDocument = (key: string, value: string): void => { @@ -92,7 +95,6 @@ describe('Alpha', () => { assertProposalDocument('startBlock', `${startBlock}`); assertProposalDocument('endBlock', `${endBlock}`); assertProposalDocument('description', description); - assertProposalDocument('status', 'PENDING'); }); test('cancel proposal', () => { @@ -168,7 +170,5 @@ describe('Alpha', () => { assertVoteDocument('votes', votes.toString()); assertVoteDocument('support', 'FOR'); assertVoteDocument('votes', votes.toString()); - - assert.fieldEquals('Proposal', '1', 'status', 'ACTIVE'); }); }); diff --git a/subgraphs/venus-governance/tests/unit/Bravo/index.test.ts b/subgraphs/venus-governance/tests/unit/Bravo/index.test.ts index 3b7f21e6..38a61750 100644 --- a/subgraphs/venus-governance/tests/unit/Bravo/index.test.ts +++ b/subgraphs/venus-governance/tests/unit/Bravo/index.test.ts @@ -65,7 +65,7 @@ beforeAll(() => { beforeEach(() => { /** setup test */ - getOrCreateDelegate(user1.toHexString()); + getOrCreateDelegate(user1); const proposalCreatedEvent = createProposalCreatedEvent( 1, user1, @@ -109,7 +109,10 @@ describe('Bravo', () => { assertDelegateDocument('id', user1.toHexString()); assertDelegateDocument('totalVotesMantissa', '0'); assertDelegateDocument('delegateCount', '0'); - assertDelegateDocument('proposals', '[1]'); + + const delegate = Delegate.load(user1.toHex())!; + const proposals = delegate.proposals.load(); + assert.stringEquals('1', proposals[0].id); // Proposal const assertProposalDocument = (key: string, value: string): void => { @@ -152,7 +155,10 @@ describe('Bravo', () => { assertDelegateDocument('id', user1.toHexString()); assertDelegateDocument('totalVotesMantissa', '0'); assertDelegateDocument('delegateCount', '0'); - assertDelegateDocument('proposals', '[1]'); + + const delegate = Delegate.load(user1.toHex())!; + const proposals = delegate.proposals.load(); + assert.stringEquals('1', proposals[0].id); // Proposal const assertProposalDocument = (key: string, value: string): void => { @@ -261,8 +267,6 @@ describe('Bravo', () => { assertVoteDocument('votes', votes.toString()); assertVoteDocument('support', 'FOR'); assertVoteDocument('votes', votes.toString()); - - assert.fieldEquals('Proposal', '1', 'status', 'ACTIVE'); }); test('registers new implementation', () => { diff --git a/subgraphs/venus-governance/tests/unit/XVSVault/index.test.ts b/subgraphs/venus-governance/tests/unit/XVSVault/index.test.ts index 52e6d689..e0e4c8de 100644 --- a/subgraphs/venus-governance/tests/unit/XVSVault/index.test.ts +++ b/subgraphs/venus-governance/tests/unit/XVSVault/index.test.ts @@ -25,7 +25,7 @@ beforeAll(() => { beforeEach(() => { /** setup test */ - getOrCreateDelegate(user1.toHexString()); + getOrCreateDelegate(user1); const proposalCreatedEvent = createProposalCreatedEvent( 1, user1, diff --git a/yarn.lock b/yarn.lock index 3c930174..2435f499 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2448,12 +2448,12 @@ __metadata: languageName: node linkType: hard -"@graphprotocol/graph-ts@npm:0.27.0": - version: 0.27.0 - resolution: "@graphprotocol/graph-ts@npm:0.27.0" +"@graphprotocol/graph-ts@npm:0.31.0": + version: 0.31.0 + resolution: "@graphprotocol/graph-ts@npm:0.31.0" dependencies: assemblyscript: 0.19.10 - checksum: d2916b9d0a8063ed3f00486012fd625301332fced8c9407f57908b43f0724d512c56b89b1c40e1cb67eca2ced9b1d437e237b04ab588b1d962573c301848a31a + checksum: 20394b17d3241a662f0b2efebdc02f44e4e0814fdbb09b4cac0c84b84a173798325840bc1daf1d11ebaf27b1b3e13ff6e2766567c755cb77c1321ba1462fbecc languageName: node linkType: hard @@ -12297,12 +12297,12 @@ __metadata: languageName: node linkType: hard -"matchstick-as@npm:^0.5.0": - version: 0.5.2 - resolution: "matchstick-as@npm:0.5.2" +"matchstick-as@npm:^0.6.0": + version: 0.6.0 + resolution: "matchstick-as@npm:0.6.0" dependencies: wabt: 1.0.24 - checksum: 6493b2c27e4e2d47397e111dd188ba637b76a46674b2165350f7f1571728acfae3bdb3e12c440ad0793853140aff4dca5bcd322eebe259074cc1fc508e2da926 + checksum: 340025caf2fe677675d9e388f2726b9517dcd977e13c1d5d13517d3d72ebfe561ea849e5859df74e1ccf48559d5fe3a9bb7cce107187102ec9a3d0d677c596ff languageName: node linkType: hard @@ -15749,7 +15749,7 @@ __metadata: dependencies: "@graphprotocol/client-cli": ^3.0.0 "@graphprotocol/graph-cli": 0.56.0 - "@graphprotocol/graph-ts": 0.27.0 + "@graphprotocol/graph-ts": 0.31.0 "@nomicfoundation/hardhat-chai-matchers": ^1.0.3 "@nomicfoundation/hardhat-network-helpers": ^1.0.4 "@nomicfoundation/hardhat-toolbox": ^1.0.2 @@ -15781,7 +15781,7 @@ __metadata: hardhat-gas-reporter: ^1.0.8 husky: ^3.0.5 lint-staged: ^12.3.3 - matchstick-as: ^0.5.0 + matchstick-as: ^0.6.0 module-alias: ^2.2.2 mustache: ^4.2.0 patch-package: 6.5.1