mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
fix veDeposit id generation (#606)
* fix veDeposit id generation * handle both deposit & withdraw
This commit is contained in:
parent
25021ac9ea
commit
26a53431ea
@ -486,7 +486,7 @@ type VeOCEAN @entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type VeDeposit @entity {
|
type VeDeposit @entity {
|
||||||
"id = {user address}-{timestamp}"
|
"id = {user address}-{tx}-{eventIndex}"
|
||||||
id: ID!
|
id: ID!
|
||||||
"veOcean holder"
|
"veOcean holder"
|
||||||
provider:String!
|
provider:String!
|
||||||
|
@ -12,7 +12,13 @@ export function handleDeposit(event: Deposit): void {
|
|||||||
|
|
||||||
const veOCEAN = getveOCEAN(provider.toHex())
|
const veOCEAN = getveOCEAN(provider.toHex())
|
||||||
// Create new Deposit entity
|
// 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.provider = provider.toHex()
|
||||||
deposit.value = weiToDecimal(value.toBigDecimal(), 18)
|
deposit.value = weiToDecimal(value.toBigDecimal(), 18)
|
||||||
deposit.unlockTime = locktime
|
deposit.unlockTime = locktime
|
||||||
@ -39,7 +45,13 @@ export function handleWithdraw(event: Withdraw): void {
|
|||||||
|
|
||||||
const veOCEAN = getveOCEAN(provider.toHex())
|
const veOCEAN = getveOCEAN(provider.toHex())
|
||||||
// Create new Deposit entity
|
// 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.provider = provider.toHex()
|
||||||
deposit.value = weiToDecimal(value.toBigDecimal(), 18).neg()
|
deposit.value = weiToDecimal(value.toBigDecimal(), 18).neg()
|
||||||
deposit.unlockTime = BigInt.zero()
|
deposit.unlockTime = BigInt.zero()
|
||||||
|
Loading…
Reference in New Issue
Block a user