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

@ -1,130 +1,130 @@
type Token @entity { type Token @entity {
id: ID! id: ID!
symbol: String symbol: String
name: String name: String
decimals: Int! decimals: Int!
address: String! address: String!
cap: BigDecimal cap: BigDecimal
supply: BigDecimal supply: BigDecimal
isDatatoken: Boolean! isDatatoken: Boolean!
"address of ERC721 that owns the token, valid only for datatokens" "address of ERC721 that owns the token, valid only for datatokens"
nft: Nft nft: Nft
"array of addresses with minter role" "array of addresses with minter role"
minter: [String!] minter: [String!]
"array of addresses with payment manager minter role" "array of addresses with payment manager minter role"
paymentManager: [String!] paymentManager: [String!]
"address that collects the payments (NOT fees)" "address that collects the payments (NOT fees)"
paymentCollector: String paymentCollector: String
"address of the market where the datatoken was created. This address collects market fees." "address of the market where the datatoken was created. This address collects market fees."
publishMarketFeeAddress: String publishMarketFeeAddress: String
"adreess of fee token (can be Ocean, ETH, etc.)" "adreess of fee token (can be Ocean, ETH, etc.)"
publishMarketFeeToken: String publishMarketFeeToken: String
"fee amount. Fixed value." "fee amount. Fixed value."
publishMarketFeeAmount: BigDecimal publishMarketFeeAmount: BigDecimal
"template ID of the datatoken" "template ID of the datatoken"
templateId: Int templateId: Int
"number of addresses holding a balance of datatoken , TODO: can we actually calculate this? what happens when users trade the dts" "number of addresses holding a balance of datatoken , TODO: can we actually calculate this? what happens when users trade the dts"
holderCount: BigInt! holderCount: BigInt!
"number of orders executed for this datatoken" "number of orders executed for this datatoken"
orderCount: BigInt! orderCount: BigInt!
"orders created with the datatoken, only available for datatokens" "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" "fixed rate exchanges, only available for datatokens"
fixedRateExchanges: [FixedRateExchange!] @derivedFrom(field:"datatoken") fixedRateExchanges: [FixedRateExchange!] @derivedFrom(field: "datatoken")
"dispensers using this token" "dispensers using this token"
dispensers: [Dispenser!] @derivedFrom(field:"token") dispensers: [Dispenser!] @derivedFrom(field: "token")
"block time datatoken was created" "block time datatoken was created"
createdTimestamp: Int! createdTimestamp: Int!
"datatoken creation transaction id" "datatoken creation transaction id"
tx: String! tx: String!
"block number when it was created" "block number when it was created"
block: Int! block: Int!
lastPriceToken: Token lastPriceToken: Token
lastPriceValue: BigDecimal! lastPriceValue: BigDecimal!
} }
"utility type" "utility type"
type TokenValuePair @entity { type TokenValuePair @entity {
"address of the token" "address of the token"
id : ID! id: ID!
token : Token! token: Token!
value : BigDecimal! value: BigDecimal!
} }
type Nft @entity{ type Nft @entity {
"nft address" "nft address"
id: ID! id: ID!
symbol: String! symbol: String!
name: String! name: String!
tokenUri: String tokenUri: String
"address of the owner of the nft" "address of the owner of the nft"
owner: User! owner: User!
"address of the creator of the nft" "address of the creator of the nft"
creator: User! creator: User!
"same as id, it's just for easy discoverability" "same as id, it's just for easy discoverability"
address: String! address: String!
"provider url that can decrypt the ddo" "provider url that can decrypt the ddo"
providerUrl: String providerUrl: String
"state of the asset (described in docs)" "state of the asset (described in docs)"
assetState: Int! assetState: Int!
managerRole: [String!] managerRole: [String!]
erc20DeployerRole: [String!] erc20DeployerRole: [String!]
storeUpdateRole: [String!] storeUpdateRole: [String!]
"addresses that can update the metadata" "addresses that can update the metadata"
metadataRole: [String!] metadataRole: [String!]
"template address" "template address"
template: String! template: String!
"set if NFT is transferable" "set if NFT is transferable"
transferable: Boolean! transferable: Boolean!
"block time nft was created" "block time nft was created"
createdTimestamp: Int! createdTimestamp: Int!
"nft creation transaction id" "nft creation transaction id"
tx: String! tx: String!
"block number when it was created" "block number when it was created"
block: Int block: Int
"number of orders executed for all underlying datatokens" "number of orders executed for all underlying datatokens"
orderCount: BigInt! orderCount: BigInt!
"has metadata" "has metadata"
hasMetadata: Boolean! hasMetadata: Boolean!
nftData: [NftData!] @derivedFrom(field: "nft") nftData: [NftData!] @derivedFrom(field: "nft")
transferHistory: [NftTransferHistory!] @derivedFrom(field: "nft") transferHistory: [NftTransferHistory!] @derivedFrom(field: "nft")
} }
type NftData @entity{ type NftData @entity {
"nft address+key" "nft address+key"
id: ID! id: ID!
nft: Nft! nft: Nft!
key: Bytes key: Bytes
value: Bytes value: Bytes
} }
type OrderReuse @entity { type OrderReuse @entity {
id: ID! id: ID!
@ -138,7 +138,7 @@ type OrderReuse @entity {
"gas price in Wei" "gas price in Wei"
gasPrice: BigInt gasPrice: BigInt
gasUsed: BigDecimal gasUsed: BigDecimal
} }
type Order @entity { type Order @entity {
"transaction hash - token address - from address" "transaction hash - token address - from address"
@ -151,18 +151,16 @@ type Order @entity {
serviceIndex: Int! serviceIndex: Int!
nftOwner: User! nftOwner: User!
# the fees will be updated from an event that will be created after (todo) # the fees will be updated from an event that will be created after (todo)
publishingMarket: User publishingMarket: User
publishingMarketToken: Token # publishingMarketToken: Token #
publishingMarketAmmount: BigDecimal #call contract to get fee amount publishingMarketAmmount: BigDecimal #call contract to get fee amount
providerFee: String providerFee: String
providerFeeValidUntil: BigInt providerFeeValidUntil: BigInt
consumerMarket: User consumerMarket: User
consumerMarketToken: Token # consumerMarketToken: Token #
consumerMarketAmmount: BigDecimal #call contract to get fee amount consumerMarketAmmount: BigDecimal #call contract to get fee amount
reuses: [OrderReuse!] @derivedFrom(field: "order") reuses: [OrderReuse!] @derivedFrom(field: "order")
createdTimestamp: Int! createdTimestamp: Int!
@ -227,7 +225,6 @@ type FixedRateExchange @entity {
"fee amount. Fixed value" "fee amount. Fixed value"
publishMarketSwapFee: BigDecimal publishMarketSwapFee: BigDecimal
} }
type FixedRateExchangeUpdate @entity { type FixedRateExchangeUpdate @entity {
@ -258,11 +255,10 @@ type FixedRateExchangeSwap @entity {
createdTimestamp: Int! createdTimestamp: Int!
tx: String! tx: String!
oceanFeeAmount: BigDecimal! oceanFeeAmount: BigDecimal!
marketFeeAmount: BigDecimal! marketFeeAmount: BigDecimal!
consumeMarketFeeAmount: BigDecimal! consumeMarketFeeAmount: BigDecimal!
} }
type Dispenser @entity { type Dispenser @entity {
"token address" "token address"
id: ID! id: ID!
@ -281,7 +277,6 @@ type Dispenser @entity {
"how many tokens are left" "how many tokens are left"
balance: BigDecimal! balance: BigDecimal!
block: Int! block: Int!
createdTimestamp: Int! createdTimestamp: Int!
tx: String! tx: String!
@ -302,66 +297,67 @@ type DispenserTransaction @entity {
"utility type" "utility type"
type GlobalTotalLiquidityPair @entity { type GlobalTotalLiquidityPair @entity {
"address of the token" "address of the token"
id : ID! id: ID!
globalStatistic: GlobalStatistic! globalStatistic: GlobalStatistic!
token : Token! token: Token!
value : BigDecimal! value: BigDecimal!
} }
"utility type" "utility type"
type GlobalTotalFixedSwapPair @entity { type GlobalTotalFixedSwapPair @entity {
"address of the token" "address of the token"
id : ID! id: ID!
globalStatistic: GlobalStatistic! globalStatistic: GlobalStatistic!
token : Token! token: Token!
value : BigDecimal! value: BigDecimal!
count: BigInt! count: BigInt!
} }
type GlobalStatistic @entity { type GlobalStatistic @entity {
id: ID! id: ID!
"total swap volume for each base token in fixed rate exchanges" "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" "number of total orders. fixed rate exchange orders + dispenser orders"
orderCount: Int! orderCount: Int!
"total nfts(erc721) created" "total nfts(erc721) created"
nftCount: Int! nftCount: Int!
"total datatokens (tokens with isDatatoken = true) created" "total datatokens (tokens with isDatatoken = true) created"
datatokenCount:Int! datatokenCount: Int!
"number of fixed rate exchanges" "number of fixed rate exchanges"
fixedCount: Int! fixedCount: Int!
"number of dispensers created" "number of dispensers created"
dispenserCount: Int! dispenserCount: Int!
"total ocean locked in veOcean" "total ocean locked in veOcean"
totalOceanLocked:BigDecimal! totalOceanLocked: BigDecimal!
"current version" "current version"
version: String version: String
} }
type OPC @entity { type OPC @entity {
id: ID! id: ID!
"fee in percent for swaps involving OPC approved tokens" "fee in percent for swaps involving OPC approved tokens"
swapOceanFee: BigDecimal swapOceanFee: BigDecimal
"fee in percent for swaps involving non OPC approved tokens" "fee in percent for swaps involving non OPC approved tokens"
swapNonOceanFee: BigDecimal swapNonOceanFee: BigDecimal
"fee in percent taken by OPC from orderFees" "fee in percent taken by OPC from orderFees"
orderFee: BigDecimal orderFee: BigDecimal
"fee in percent taken by OPC from providerFees" "fee in percent taken by OPC from providerFees"
providerFee: BigDecimal providerFee: BigDecimal
approvedTokens: [Token!] approvedTokens: [Token!]
} }
enum NftUpdateType { enum NftUpdateType {
METADATA_CREATED, METADATA_CREATED
METADATA_UPDATED, METADATA_UPDATED
STATE_UPDATED, STATE_UPDATED
TOKENURI_UPDATED TOKENURI_UPDATED
} }
@ -373,7 +369,7 @@ type NftUpdate @entity {
"provider url that can decrypt the ddo" "provider url that can decrypt the ddo"
providerUrl: String providerUrl: String
"user that made the update" "user that made the update"
userAddress: String! userAddress: String!
"state of the asset in this update" "state of the asset in this update"
@ -387,7 +383,7 @@ type NftUpdate @entity {
tx: String! tx: String!
} }
type Template @entity{ type Template @entity {
id: ID! id: ID!
fixedRateTemplates: [String!] fixedRateTemplates: [String!]
dispenserTemplates: [String!] dispenserTemplates: [String!]
@ -395,7 +391,7 @@ type Template @entity{
} }
# Not tracking allocationToId or idToAllocation # Not tracking allocationToId or idToAllocation
type VeAllocateUser @entity{ type VeAllocateUser @entity {
"id = {user}" "id = {user}"
id: ID! id: ID!
@ -409,7 +405,7 @@ type VeAllocateUser @entity{
veOcean: VeOCEAN! veOcean: VeOCEAN!
} }
type VeAllocateId @entity{ type VeAllocateId @entity {
"id = {DataNFT Address}-{chain id}" "id = {DataNFT Address}-{chain id}"
id: ID! id: ID!
nftAddress: String! nftAddress: String!
@ -444,7 +440,7 @@ type VeAllocation @entity {
} }
enum veAllocationUpdateType { enum veAllocationUpdateType {
SET, SET
REMOVED REMOVED
} }
@ -469,11 +465,10 @@ type VeDelegation @entity {
tokenId: BigInt! tokenId: BigInt!
amount: BigDecimal! amount: BigDecimal!
lockedAmount: BigDecimal! lockedAmount: BigDecimal!
timeLeft: Int! timeLeftUnlock: Int!
cancelTime: BigInt! cancelTime: BigInt!
expireTime: BigInt! expireTime: BigInt!
updates: [VeDelegationUpdate!] @derivedFrom(field: "veDelegation") updates: [VeDelegationUpdate!] @derivedFrom(field: "veDelegation")
} }
type VeDelegationUpdate @entity { type VeDelegationUpdate @entity {
@ -487,11 +482,10 @@ type VeDelegationUpdate @entity {
cancelTime: BigInt! cancelTime: BigInt!
expireTime: BigInt! expireTime: BigInt!
"type: CREATE_BOOST = 0, EXTEND_BOOST = 1, BURN_BOOST = 2" "type: CREATE_BOOST = 0, EXTEND_BOOST = 1, BURN_BOOST = 2"
type:Int! type: Int!
veDelegation:VeDelegation! veDelegation: VeDelegation!
} }
type VeOCEAN @entity { type VeOCEAN @entity {
"id = {user address}" "id = {user address}"
id: ID! id: ID!
@ -511,7 +505,7 @@ type VeDeposit @entity {
"id = {user address}-{tx}-{eventIndex}" "id = {user address}-{tx}-{eventIndex}"
id: ID! id: ID!
"veOcean holder" "veOcean holder"
provider:String! provider: String!
"who initiated the tx" "who initiated the tx"
sender: String! sender: String!
"amount of tokens locked" "amount of tokens locked"
@ -519,22 +513,22 @@ type VeDeposit @entity {
"unlock timestamp" "unlock timestamp"
unlockTime: BigInt! unlockTime: BigInt!
"deposit type: DEPOSIT_FOR = 0, CREATE_LOCK_TYPE = 1,INCREASE_LOCK_AMOUNT = 2,INCREASE_UNLOCK_TIME = 3, WITHDRAW = 4" "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! timestamp: BigInt!
block: Int! block: Int!
tx: String! tx: String!
veOcean: VeOCEAN! veOcean: VeOCEAN!
totalOceanLocked:BigDecimal! totalOceanLocked: BigDecimal!
} }
type VeFeeDistributor @entity { type VeFeeDistributor @entity {
"id = contract address" "id = contract address"
id: ID! id: ID!
"token used by FeeDistributor" "token used by FeeDistributor"
token: Token! token: Token!
claims: [VeClaim!] @derivedFrom(field: "VeFeeDistributor") claims: [VeClaim!] @derivedFrom(field: "VeFeeDistributor")
checkpoints: [VeFeeDistributorCheckPoint!] @derivedFrom(field: "VeFeeDistributor") checkpoints: [VeFeeDistributorCheckPoint!]
@derivedFrom(field: "VeFeeDistributor")
} }
type VeFeeDistributorCheckPoint @entity { type VeFeeDistributorCheckPoint @entity {
@ -567,7 +561,7 @@ type VeClaim @entity {
} }
enum DFHistoryType { enum DFHistoryType {
Allocated, Allocated
Claimed Claimed
} }
@ -579,7 +573,6 @@ type DFAvailableClaim @entity {
token: Token! token: Token!
} }
type DFHistory @entity { type DFHistory @entity {
"id = {user-id}-{txId}-{eventId}" "id = {user-id}-{txId}-{eventId}"
id: ID! id: ID!
@ -592,7 +585,6 @@ type DFHistory @entity {
tx: String! tx: String!
} }
type DFReward @entity { type DFReward @entity {
"id = {user address}" "id = {user address}"
id: ID! id: ID!

View File

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

View File

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