Fix and rename

This commit is contained in:
trizin 2023-05-04 16:02:48 +03:00 committed by GitHub
parent c0fe3cd6b4
commit 70846eafe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 198 additions and 206 deletions

View File

@ -39,13 +39,13 @@ type Token @entity {
orderCount: BigInt!
"orders created with the datatoken, only available for datatokens"
orders: [Order!] @derivedFrom(field:"datatoken")
orders: [Order!] @derivedFrom(field: "datatoken")
"fixed rate exchanges, only available for datatokens"
fixedRateExchanges: [FixedRateExchange!] @derivedFrom(field:"datatoken")
fixedRateExchanges: [FixedRateExchange!] @derivedFrom(field: "datatoken")
"dispensers using this token"
dispensers: [Dispenser!] @derivedFrom(field:"token")
dispensers: [Dispenser!] @derivedFrom(field: "token")
"block time datatoken was created"
createdTimestamp: Int!
@ -63,12 +63,12 @@ type Token @entity {
"utility type"
type TokenValuePair @entity {
"address of the token"
id : ID!
token : Token!
value : BigDecimal!
id: ID!
token: Token!
value: BigDecimal!
}
type Nft @entity{
type Nft @entity {
"nft address"
id: ID!
symbol: String!
@ -118,13 +118,13 @@ type Nft @entity{
transferHistory: [NftTransferHistory!] @derivedFrom(field: "nft")
}
type NftData @entity{
type NftData @entity {
"nft address+key"
id: ID!
nft: Nft!
key: Bytes
value: Bytes
}
}
type OrderReuse @entity {
id: ID!
@ -138,7 +138,7 @@ type OrderReuse @entity {
"gas price in Wei"
gasPrice: BigInt
gasUsed: BigDecimal
}
}
type Order @entity {
"transaction hash - token address - from address"
@ -151,7 +151,6 @@ type Order @entity {
serviceIndex: Int!
nftOwner: User!
# the fees will be updated from an event that will be created after (todo)
publishingMarket: User
publishingMarketToken: Token #
@ -162,7 +161,6 @@ type Order @entity {
consumerMarket: User
consumerMarketToken: Token #
consumerMarketAmmount: BigDecimal #call contract to get fee amount
reuses: [OrderReuse!] @derivedFrom(field: "order")
createdTimestamp: Int!
@ -227,7 +225,6 @@ type FixedRateExchange @entity {
"fee amount. Fixed value"
publishMarketSwapFee: BigDecimal
}
type FixedRateExchangeUpdate @entity {
@ -262,7 +259,6 @@ type FixedRateExchangeSwap @entity {
consumeMarketFeeAmount: BigDecimal!
}
type Dispenser @entity {
"token address"
id: ID!
@ -281,7 +277,6 @@ type Dispenser @entity {
"how many tokens are left"
balance: BigDecimal!
block: Int!
createdTimestamp: Int!
tx: String!
@ -303,26 +298,27 @@ type DispenserTransaction @entity {
"utility type"
type GlobalTotalLiquidityPair @entity {
"address of the token"
id : ID!
id: ID!
globalStatistic: GlobalStatistic!
token : Token!
value : BigDecimal!
token: Token!
value: BigDecimal!
}
"utility type"
type GlobalTotalFixedSwapPair @entity {
"address of the token"
id : ID!
id: ID!
globalStatistic: GlobalStatistic!
token : Token!
value : BigDecimal!
token: Token!
value: BigDecimal!
count: BigInt!
}
type GlobalStatistic @entity {
id: ID!
"total swap volume for each base token in fixed rate exchanges"
totalFixedSwapVolume: [GlobalTotalFixedSwapPair!] @derivedFrom(field: "globalStatistic")
totalFixedSwapVolume: [GlobalTotalFixedSwapPair!]
@derivedFrom(field: "globalStatistic")
"number of total orders. fixed rate exchange orders + dispenser orders"
orderCount: Int!
@ -330,7 +326,7 @@ type GlobalStatistic @entity {
"total nfts(erc721) created"
nftCount: Int!
"total datatokens (tokens with isDatatoken = true) created"
datatokenCount:Int!
datatokenCount: Int!
"number of fixed rate exchanges"
fixedCount: Int!
@ -339,7 +335,7 @@ type GlobalStatistic @entity {
dispenserCount: Int!
"total ocean locked in veOcean"
totalOceanLocked:BigDecimal!
totalOceanLocked: BigDecimal!
"current version"
version: String
@ -358,10 +354,10 @@ type OPC @entity {
approvedTokens: [Token!]
}
enum NftUpdateType {
METADATA_CREATED,
METADATA_UPDATED,
STATE_UPDATED,
enum NftUpdateType {
METADATA_CREATED
METADATA_UPDATED
STATE_UPDATED
TOKENURI_UPDATED
}
@ -387,7 +383,7 @@ type NftUpdate @entity {
tx: String!
}
type Template @entity{
type Template @entity {
id: ID!
fixedRateTemplates: [String!]
dispenserTemplates: [String!]
@ -395,7 +391,7 @@ type Template @entity{
}
# Not tracking allocationToId or idToAllocation
type VeAllocateUser @entity{
type VeAllocateUser @entity {
"id = {user}"
id: ID!
@ -409,7 +405,7 @@ type VeAllocateUser @entity{
veOcean: VeOCEAN!
}
type VeAllocateId @entity{
type VeAllocateId @entity {
"id = {DataNFT Address}-{chain id}"
id: ID!
nftAddress: String!
@ -444,7 +440,7 @@ type VeAllocation @entity {
}
enum veAllocationUpdateType {
SET,
SET
REMOVED
}
@ -469,11 +465,10 @@ type VeDelegation @entity {
tokenId: BigInt!
amount: BigDecimal!
lockedAmount: BigDecimal!
timeLeft: Int!
timeLeftUnlock: Int!
cancelTime: BigInt!
expireTime: BigInt!
updates: [VeDelegationUpdate!] @derivedFrom(field: "veDelegation")
}
type VeDelegationUpdate @entity {
@ -487,11 +482,10 @@ type VeDelegationUpdate @entity {
cancelTime: BigInt!
expireTime: BigInt!
"type: CREATE_BOOST = 0, EXTEND_BOOST = 1, BURN_BOOST = 2"
type:Int!
veDelegation:VeDelegation!
type: Int!
veDelegation: VeDelegation!
}
type VeOCEAN @entity {
"id = {user address}"
id: ID!
@ -511,7 +505,7 @@ type VeDeposit @entity {
"id = {user address}-{tx}-{eventIndex}"
id: ID!
"veOcean holder"
provider:String!
provider: String!
"who initiated the tx"
sender: String!
"amount of tokens locked"
@ -519,22 +513,22 @@ type VeDeposit @entity {
"unlock timestamp"
unlockTime: BigInt!
"deposit type: DEPOSIT_FOR = 0, CREATE_LOCK_TYPE = 1,INCREASE_LOCK_AMOUNT = 2,INCREASE_UNLOCK_TIME = 3, WITHDRAW = 4"
type:BigInt!
type: BigInt!
timestamp: BigInt!
block: Int!
tx: String!
veOcean: VeOCEAN!
totalOceanLocked:BigDecimal!
totalOceanLocked: BigDecimal!
}
type VeFeeDistributor @entity {
"id = contract address"
id: ID!
"token used by FeeDistributor"
token: Token!
claims: [VeClaim!] @derivedFrom(field: "VeFeeDistributor")
checkpoints: [VeFeeDistributorCheckPoint!] @derivedFrom(field: "VeFeeDistributor")
checkpoints: [VeFeeDistributorCheckPoint!]
@derivedFrom(field: "VeFeeDistributor")
}
type VeFeeDistributorCheckPoint @entity {
@ -567,7 +561,7 @@ type VeClaim @entity {
}
enum DFHistoryType {
Allocated,
Allocated
Claimed
}
@ -579,7 +573,6 @@ type DFAvailableClaim @entity {
token: Token!
}
type DFHistory @entity {
"id = {user-id}-{txId}-{eventId}"
id: ID!
@ -592,7 +585,6 @@ type DFHistory @entity {
tx: String!
}
type DFReward @entity {
"id = {user address}"
id: ID!

View File

@ -137,7 +137,7 @@ export function getveDelegation(
veDelegation.receiver = ''
veDelegation.delegator = ''
veDelegation.lockedAmount = BigDecimal.zero()
veDelegation.timeLeft = BigInt.zero()
veDelegation.timeLeftUnlock = 0
veDelegation.save()
}
return veDelegation

View File

@ -30,7 +30,7 @@ export function handleDelegation(event: DelegateBoost): void {
BigInt.fromI32(18).toI32()
)
veDelegation.lockedAmount = delegator.lockedAmount
veDelegation.timeLeft = delegator.unlockTime.toI32().minus(ts)
veDelegation.timeLeftUnlock = delegator.unlockTime.toI32() - ts
veDelegation.cancelTime = _cancelTime
veDelegation.expireTime = _expireTime
veDelegation.save()