diff --git a/schema.graphql b/schema.graphql index 2988cec..1905595 100644 --- a/schema.graphql +++ b/schema.graphql @@ -486,7 +486,7 @@ type VeOCEAN @entity { } type VeDeposit @entity { - "id = {user address}-{timestamp}" + "id = {user address}-{tx}-{eventIndex}" id: ID! "veOcean holder" provider:String! diff --git a/src/mappings/veOCEAN.ts b/src/mappings/veOCEAN.ts index 90fc607..4e4cb08 100644 --- a/src/mappings/veOCEAN.ts +++ b/src/mappings/veOCEAN.ts @@ -12,7 +12,13 @@ export function handleDeposit(event: Deposit): void { const veOCEAN = getveOCEAN(provider.toHex()) // Create new Deposit entity - const deposit = getDeposit(provider.toHex() + '-' + locktime.toString()) + const deposit = getDeposit( + provider.toHex() + + '-' + + event.transaction.hash.toHex() + + '-' + + event.logIndex.toString() + ) deposit.provider = provider.toHex() deposit.value = weiToDecimal(value.toBigDecimal(), 18) deposit.unlockTime = locktime @@ -39,7 +45,13 @@ export function handleWithdraw(event: Withdraw): void { const veOCEAN = getveOCEAN(provider.toHex()) // Create new Deposit entity - const deposit = getDeposit(provider.toHex() + '-' + ts.toString()) + const deposit = getDeposit( + provider.toHex() + + '-' + + event.transaction.hash.toHex() + + '-' + + event.logIndex.toString() + ) deposit.provider = provider.toHex() deposit.value = weiToDecimal(value.toBigDecimal(), 18).neg() deposit.unlockTime = BigInt.zero()