From 962f86cc7cfcefee0efe0c26cefb0f33032cfdf7 Mon Sep 17 00:00:00 2001 From: Coderdan Date: Sun, 1 Dec 2024 17:19:27 +0800 Subject: [PATCH] chore: fix claim time --- src/mappings/polter.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mappings/polter.ts b/src/mappings/polter.ts index 0c99fa3..152d982 100644 --- a/src/mappings/polter.ts +++ b/src/mappings/polter.ts @@ -1963,8 +1963,17 @@ export function handleTransfer(event: Transfer): void { if (gotchi) { gotchi = updateAavegotchiInfo(gotchi, event.params._tokenId, event); gotchi = updateAavegotchiWearables(gotchi, event); - gotchi.claimedAt = event.block.number; - gotchi.claimedTime = event.block.timestamp; + + let claimTime = contract.try_aavegotchiClaimTime( + BigInt.fromString(tokenId) + ); + + if (!claimTime.reverted) { + gotchi.claimedTime = claimTime.value; + //we do not have access to the block number here, so we use the claimed time + gotchi.claimedAt = claimTime.value; + } + gotchi.gotchiId = event.params._tokenId; gotchi.save();