diff --git a/abis/ERC7432.json b/abis/ERC7432.json index ebb3940..47f3b19 100644 --- a/abis/ERC7432.json +++ b/abis/ERC7432.json @@ -122,7 +122,7 @@ "components": [ { "internalType": "bytes32", - "name": "roleassignment", + "name": "role", "type": "bytes32" }, { @@ -172,7 +172,7 @@ "components": [ { "internalType": "bytes32", - "name": "roleassignment", + "name": "role", "type": "bytes32" }, { diff --git a/schema.graphql b/schema.graphql index a6e46fe..fed3ff6 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1,9 +1,9 @@ type Nft @entity { id: ID! # tokenId + tokenAddress - address: String! + tokenAddress: String! tokenId: BigInt! owner: Account! - rolesHistory: [Role!] @derivedFrom(field: "nft") + roles: [Role!] @derivedFrom(field: "nft") } type Account @entity { diff --git a/src/utils/helper.ts b/src/utils/helper.ts index 1b2507e..c253312 100644 --- a/src/utils/helper.ts +++ b/src/utils/helper.ts @@ -15,7 +15,7 @@ export function findOrCreateAccount(id: string): Account { export function createNft(id: string, contractAddress: string, tokenId: BigInt, owner: string): Nft { const nft = new Nft(id) nft.tokenId = tokenId - nft.address = contractAddress.toLowerCase() + nft.tokenAddress = contractAddress.toLowerCase() nft.owner = owner.toLowerCase() nft.save() return nft diff --git a/tests/erc721/transfer-handler.test.ts b/tests/erc721/transfer-handler.test.ts index dcc3f24..c12a5ae 100644 --- a/tests/erc721/transfer-handler.test.ts +++ b/tests/erc721/transfer-handler.test.ts @@ -22,7 +22,7 @@ describe('ERC-721 Transfer Handler', () => { assert.entityCount('Account', 1) const _id = generateNftId(event.address.toHexString(), event.params.tokenId.toString()) - assert.fieldEquals('Nft', _id, 'address', ZERO_ADDRESS) + assert.fieldEquals('Nft', _id, 'tokenAddress', ZERO_ADDRESS) assert.fieldEquals('Nft', _id, 'tokenId', tokenId) assert.fieldEquals('Nft', _id, 'owner', Addresses[1]) }) @@ -38,7 +38,7 @@ describe('ERC-721 Transfer Handler', () => { assert.entityCount('Account', 2) const _id = generateNftId(event.address.toHexString(), event.params.tokenId.toString()) - assert.fieldEquals('Nft', _id, 'address', ZERO_ADDRESS) + assert.fieldEquals('Nft', _id, 'tokenAddress', ZERO_ADDRESS) assert.fieldEquals('Nft', _id, 'tokenId', tokenId) assert.fieldEquals('Nft', _id, 'owner', Addresses[2]) }) @@ -54,7 +54,7 @@ describe('ERC-721 Transfer Handler', () => { assert.entityCount('Account', 2) const _id = generateNftId(event.address.toHexString(), event.params.tokenId.toString()) - assert.fieldEquals('Nft', _id, 'address', ZERO_ADDRESS) + assert.fieldEquals('Nft', _id, 'tokenAddress', ZERO_ADDRESS) assert.fieldEquals('Nft', _id, 'tokenId', tokenId) assert.fieldEquals('Nft', _id, 'owner', Addresses[2]) }) diff --git a/tests/erc7432/revoke-handler.test.ts b/tests/erc7432/revoke-handler.test.ts index e56aea0..601a3ac 100644 --- a/tests/erc7432/revoke-handler.test.ts +++ b/tests/erc7432/revoke-handler.test.ts @@ -25,7 +25,7 @@ describe('ERC-7432 RoleRevoked Handler', () => { const nftId = generateNftId(tokenAddress, tokenId) const nft = new Nft(nftId) - nft.address = tokenAddress + nft.tokenAddress = tokenAddress nft.tokenId = BigInt.fromString(tokenId) nft.owner = revoker diff --git a/tests/helpers/entities.ts b/tests/helpers/entities.ts index 3101373..bf2503a 100644 --- a/tests/helpers/entities.ts +++ b/tests/helpers/entities.ts @@ -5,7 +5,7 @@ import { assert } from 'matchstick-as' export function createMockNft(tokenAddress: string, tokenId: string, ownerAddress: string): Nft { const nft = new Nft(generateNftId(tokenAddress, tokenId)) - nft.address = tokenAddress + nft.tokenAddress = tokenAddress nft.tokenId = BigInt.fromString(tokenId) const nftOwner = createMockAccount(ownerAddress) diff --git a/tests/helpers/events.ts b/tests/helpers/events.ts index 954b5f9..f4437b0 100644 --- a/tests/helpers/events.ts +++ b/tests/helpers/events.ts @@ -23,7 +23,7 @@ export function createNewRoleRevokedEvent( const event = changetype(newMockEvent()) event.parameters = new Array() event.parameters.push(buildEventParamBytes('_role', roleassignment)) - event.parameters.push(buildEventParamAddress('_tokenAddress', nft.address)) + event.parameters.push(buildEventParamAddress('_tokenAddress', nft.tokenAddress)) event.parameters.push(buildEventParamUint('_tokenId', nft.tokenId)) event.parameters.push(buildEventParamAddress('_revoker', revoker)) event.parameters.push(buildEventParamAddress('_grantee', grantee))