diff --git a/pkgs/subgraph/schema.graphql b/pkgs/subgraph/schema.graphql index 9381afb..ec30ef8 100644 --- a/pkgs/subgraph/schema.graphql +++ b/pkgs/subgraph/schema.graphql @@ -20,13 +20,11 @@ type InitializedFractionToken @entity { type TransferFractionToken @entity { id: ID! - from: String! - to: String! - tokenId: BigInt! - amount: BigInt! workspaceId: ID! + holderAddress: String! hatId: BigInt! wearer: String! - blockTimestamp: BigInt! - blockNumber: BigInt! + tokenId: BigInt! + balance: BigInt! + updatedAt: BigInt! } diff --git a/pkgs/subgraph/src/mapping.ts b/pkgs/subgraph/src/mapping.ts index 6f199a6..06b45a4 100644 --- a/pkgs/subgraph/src/mapping.ts +++ b/pkgs/subgraph/src/mapping.ts @@ -59,15 +59,14 @@ export function handleTransferSingle(ev: TransferSingle): void { ); let transfer = new TransferFractionToken(id); - transfer.from = ev.params.from.toHex(); - transfer.to = ev.params.to.toHex(); - transfer.tokenId = ev.params.id; - transfer.amount = ev.params.value; + transfer.id = `${ev.address}${ev.params.id}`; transfer.workspaceId = ""; + transfer.holderAddress = ev.params.from.toHex(); transfer.hatId = BigInt.fromString("0"); transfer.wearer = ""; - transfer.blockNumber = ev.block.number; - transfer.blockTimestamp = ev.block.timestamp; + transfer.tokenId = ev.params.id; + transfer.balance = ev.params.value; // TODO: 送金前の残高から送金額のvalueを引く + transfer.updatedAt = ev.block.timestamp; if (initializedFractionToken) { transfer.workspaceId = initializedFractionToken.workspaceId;