mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
schema update + other
This commit is contained in:
parent
c708e8367b
commit
dd7710b2f1
281
schema.graphql
281
schema.graphql
@ -1,29 +1,43 @@
|
|||||||
type Token @entity {
|
type Token @entity {
|
||||||
id: ID! #
|
|
||||||
symbol: String #
|
|
||||||
name: String #
|
|
||||||
decimals: Int! #
|
|
||||||
address: String! #
|
|
||||||
cap: BigDecimal #
|
|
||||||
supply: BigDecimal #
|
|
||||||
isDatatoken: Boolean! #
|
|
||||||
|
|
||||||
owner: String # address of ERC721 that owns the token, valid only for datatokens
|
id: ID!
|
||||||
minter: [User!] # array of addresses with minter role, can be user wallet address, dispenser etc.
|
symbol: String
|
||||||
feeManager: String # TODO: maybe we change name , depends on audit results . It's the address that collects the payments (NOT fees)
|
name: String
|
||||||
publishMarketFeeAddress: String # address of the market where the datatoken was created. This address collects market fees.
|
decimals: Int!
|
||||||
publishMarketFeeToken: String # adreess of fee token (can be Ocean, ETH, etc.)
|
address: String!
|
||||||
publishMarketFeeAmmount: BigDecimal # fee amount. Fixed value, expressed in wei in contracts, needs conversion in decimals.
|
cap: BigDecimal
|
||||||
templateId: Int # template ID of the datatoken
|
supply: BigDecimal
|
||||||
|
isDatatoken: Boolean!
|
||||||
|
|
||||||
holderCount: BigInt # Number of addresses holding a balance of datatoken , TODO: can we actually calculate this? what happens when users trade the dts
|
"address of ERC721 that owns the token, valid only for datatokens"
|
||||||
orderCount: BigInt # Number of orders executed for this datatoken
|
owner: String
|
||||||
|
"array of addresses with minter role, can be user wallet address, dispenser etc."
|
||||||
|
minter: [User!]
|
||||||
|
"TODO: maybe we change name , depends on audit results . It's the address that collects the payments (NOT fees)"
|
||||||
|
feeManager: String
|
||||||
|
"address of the market where the datatoken was created. This address collects market fees."
|
||||||
|
publishMarketFeeAddress: String
|
||||||
|
"adreess of fee token (can be Ocean, ETH, etc.)"
|
||||||
|
publishMarketFeeToken: String
|
||||||
|
"fee amount. Fixed value, expressed in wei in contracts, needs conversion in decimals."
|
||||||
|
publishMarketFeeAmmount: BigDecimal
|
||||||
|
"template ID of the datatoken"
|
||||||
|
templateId: Int
|
||||||
|
|
||||||
createdTimestamp: Int # Block time datatoken was created
|
"number of addresses holding a balance of datatoken , TODO: can we actually calculate this? what happens when users trade the dts"
|
||||||
tx: Bytes # Datatoken creation transaction id
|
holderCount: BigInt
|
||||||
block: Int # Block number when it was created
|
"number of orders executed for this datatoken"
|
||||||
|
orderCount: BigInt
|
||||||
|
|
||||||
|
"block time datatoken was created"
|
||||||
|
createdTimestamp: Int
|
||||||
|
"datatoken creation transaction id"
|
||||||
|
tx: Bytes
|
||||||
|
"block number when it was created"
|
||||||
|
block: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"utility type"
|
||||||
type TokenValuePair @entity {
|
type TokenValuePair @entity {
|
||||||
id : ID!
|
id : ID!
|
||||||
token : Token!
|
token : Token!
|
||||||
@ -31,64 +45,100 @@ type TokenValuePair @entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Nft @entity{
|
type Nft @entity{
|
||||||
id: ID! # nft address
|
"nft address"
|
||||||
symbol: String! #
|
id: ID!
|
||||||
name: String! #
|
symbol: String!
|
||||||
tokenUri: String! #
|
name: String!
|
||||||
owner: String! # owner of the nft
|
tokenUri: String!
|
||||||
address: String! #
|
"address of the owner of the nft"
|
||||||
providerUrl: String # provider url that can decrypt the ddo
|
owner: String!
|
||||||
assetState: Int! # state of the asset (described in docs)
|
"same as id, it's just for easy discoverability"
|
||||||
|
address: String!
|
||||||
|
"provider url that can decrypt the ddo"
|
||||||
|
providerUrl: String
|
||||||
|
"state of the asset (described in docs)"
|
||||||
|
assetState: Int!
|
||||||
|
|
||||||
managerRole: [String!]
|
managerRole: [String!]
|
||||||
erc20DeployerRole: [String!]
|
erc20DeployerRole: [String!]
|
||||||
storeUpdateRole: [String!]
|
storeUpdateRole: [String!]
|
||||||
metadataRole: [String!] # addresses that can update the metadata
|
"addresses that can update the metadata"
|
||||||
|
metadataRole: [String!]
|
||||||
|
|
||||||
template: String! # template address
|
"template address"
|
||||||
createdTimestamp: Int! # Block time pool was created
|
template: String!
|
||||||
tx: Bytes # Pool creation transaction id
|
|
||||||
block: Int # Block number when it was created
|
|
||||||
|
"block time nft was created"
|
||||||
|
createdTimestamp: Int!
|
||||||
|
"nft creation transaction id"
|
||||||
|
tx: Bytes
|
||||||
|
"block number when it was created"
|
||||||
|
block: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type Pool @entity {
|
type Pool @entity {
|
||||||
id: ID! # Pool address
|
"pool address"
|
||||||
owner: String! # Owner address, pool controller
|
id: ID!
|
||||||
|
"owner address, pool controller"
|
||||||
|
owner: String!
|
||||||
|
"if swap/trade is activated, probably always true"
|
||||||
|
isPublicSwap: Boolean!
|
||||||
|
"only finalized pools are relevant to us"
|
||||||
|
isFinalized: Boolean!
|
||||||
|
|
||||||
isPublicSwap: Boolean! # if swap/trade is activated, probably always true
|
"pool token symbol"
|
||||||
isFinalized: Boolean! # only finalized pools are relevant to us
|
symbol: String
|
||||||
|
"pool token name"
|
||||||
|
name: String
|
||||||
|
"maximum supply if any, converted from wei"
|
||||||
|
cap: BigDecimal
|
||||||
|
"pool is active"
|
||||||
|
isActive: Boolean!
|
||||||
|
|
||||||
symbol: String # Pool token symbol
|
baseToken: PoolToken!
|
||||||
name: String # Pool token name
|
datatoken: PoolToken!
|
||||||
cap: BigDecimal # Maximum supply if any, converted from wei
|
"pool Fee percent, fee goes to all liquidity providers : SWAP, JOIN , EXIT"
|
||||||
isActive: Boolean! # pool is active
|
poolFee: BigDecimal!
|
||||||
|
"OPF Fee percent, fee that goes to Ocean Protocol Foundation : SWAP"
|
||||||
|
opfFee: BigDecimal!
|
||||||
|
"market fee percent, fee that goes to the market where the pool was created : SWAP"
|
||||||
|
marketFee: BigDecimal!
|
||||||
|
"actual value of fee collected in both tokens"
|
||||||
|
totalPoolFee: [TokenValuePair!]!
|
||||||
|
"actual value of fee collected in both tokens"
|
||||||
|
totalOpfFee: [TokenValuePair!]!
|
||||||
|
"actual value of fee collected in both tokens"
|
||||||
|
totalMarketFee: [TokenValuePair!]!
|
||||||
|
|
||||||
baseToken: PoolToken! @derivedFrom(field: "pool")
|
"fee after collection = totalFee - colectedFee"
|
||||||
datatoken: PoolToken! @derivedFrom(field: "pool")
|
currentOpfFee: [TokenValuePair!]!
|
||||||
poolFee: BigDecimal! # Pool Fee percent, fee goes to all liquidity providers : SWAP, JOIN , EXIT
|
"fee after collection totalFee - colectedFee"
|
||||||
opfFee: BigDecimal! # OPF Fee percent, fee that goes to Ocean Protocol Foundation : SWAP
|
currentMarketFee: [TokenValuePair!]!
|
||||||
marketFee: BigDecimal! # Market fee percent, fee that goes to the market where the pool was created : SWAP
|
|
||||||
totalPoolFee: [TokenValuePair!]! # actual value of fee collected in both tokens
|
|
||||||
totalOpfFee: [TokenValuePair!]! # actual value of fee collected in both tokens
|
|
||||||
totalMarketFee: [TokenValuePair!]! # actual value of fee collected in both tokens
|
|
||||||
|
|
||||||
currentOpfFee: [TokenValuePair!]! # fee after collection totalFee - colectedFee
|
"it's always 100 TODO: should be removed, seems redundant"
|
||||||
currentMarketFee: [TokenValuePair!]! # fee after collection totalFee - colectedFee
|
totalWeight: BigDecimal!
|
||||||
|
"total pool token shares"
|
||||||
|
totalShares: BigDecimal!
|
||||||
|
"total tokens that were swaped"
|
||||||
|
totalSwapVolume: [TokenValuePair!]!
|
||||||
|
|
||||||
totalWeight: BigDecimal! # it's always 100
|
spotPrice: BigDecimal!
|
||||||
totalShares: BigDecimal! # Total pool token shares
|
|
||||||
totalSwapVolume: [TokenValuePair!]! # total tokens that were swaped
|
|
||||||
|
|
||||||
spotPrice: BigDecimal! # spot price
|
"count for when liquidity has been added"
|
||||||
|
joinCount: BigInt!
|
||||||
joinCount: BigInt! # liquidity has been added
|
"count for when liquidity has been removed"
|
||||||
exitCount: BigInt! # liquidity has been removed
|
exitCount: BigInt!
|
||||||
swapCount: BigInt!
|
swapCount: BigInt!
|
||||||
transactionCount: BigInt! # Number of transactions in this pool involving liquidity changes
|
"number of transactions in this pool involving liquidity changes"
|
||||||
|
transactionCount: BigInt!
|
||||||
|
|
||||||
createdTimestamp: Int! # Block time pool was created
|
"block time when pool was created"
|
||||||
tx: Bytes # Pool creation transaction id
|
createdTimestamp: Int!
|
||||||
block: Int # Block number when it was created
|
"pool creation transaction id"
|
||||||
|
tx: Bytes
|
||||||
|
"block number when it was created"
|
||||||
|
block: Int
|
||||||
|
|
||||||
shares: [PoolShare!] @derivedFrom(field: "pool")
|
shares: [PoolShare!] @derivedFrom(field: "pool")
|
||||||
transactions: [PoolTransaction!] @derivedFrom(field: "pool")
|
transactions: [PoolTransaction!] @derivedFrom(field: "pool")
|
||||||
@ -96,32 +146,48 @@ type Pool @entity {
|
|||||||
|
|
||||||
# should not pe @entity
|
# should not pe @entity
|
||||||
type PoolToken @entity {
|
type PoolToken @entity {
|
||||||
id: ID! # poolId + token address
|
"pool address + token address"
|
||||||
pool: Pool! #
|
id: ID!
|
||||||
|
pool: Pool!
|
||||||
token: Token!
|
token: Token!
|
||||||
balance: BigDecimal! # balance of the token in this pool
|
"balance of the token in this pool"
|
||||||
denormWeight: BigDecimal! # weight of token in the pool (50% for our pools)
|
balance: BigDecimal!
|
||||||
|
"weight of token in the pool (50% for ocean bpools)"
|
||||||
|
denormWeight: BigDecimal!
|
||||||
}
|
}
|
||||||
|
|
||||||
# we will need to track pool share tx between users - bpool transfer tx event
|
# we will need to track pool share tx between users - bpool transfer tx event
|
||||||
type PoolShare @entity {
|
type PoolShare @entity {
|
||||||
id: ID! # poolId + userAddress
|
"poolAddress + userAddress"
|
||||||
|
id: ID!
|
||||||
user: User!
|
user: User!
|
||||||
pool: Pool!
|
pool: Pool!
|
||||||
balance: BigDecimal!
|
balance: BigDecimal!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum PoolTransactionType {
|
||||||
|
JOIN,
|
||||||
|
EXIT,
|
||||||
|
SWAP,
|
||||||
|
SETUP
|
||||||
|
}
|
||||||
|
|
||||||
type PoolTransaction @entity {
|
type PoolTransaction @entity {
|
||||||
id: ID! # tx + caller
|
"tx address + caller address"
|
||||||
pool: Pool! # Pool related to this tx
|
id: ID!
|
||||||
user: User! # User that initiates the tx
|
"pool related to this tx"
|
||||||
type: Int # 0 - JOIN, 1 - EXIT , 2 - SWAP, maybe change to enum
|
pool: Pool!
|
||||||
|
"user that initiates the tx"
|
||||||
|
user: User!
|
||||||
|
type: PoolTransactionType
|
||||||
|
|
||||||
sharesTransferAmount: BigDecimal # Number of shares transfered
|
"number of shares transfered"
|
||||||
|
sharesTransferAmount: BigDecimal
|
||||||
|
|
||||||
poolFee: BigDecimal! # Pool Fee percent, fee goes to all liquidity providers : SWAP, JOIN , EXIT
|
"pool fee percent, fee goes to all liquidity providers : SWAP, JOIN , EXIT"
|
||||||
opfFee: BigDecimal! # OPF Fee percent, fee that goes to Ocean Protocol Foundation : SWAP
|
poolFee: BigDecimal!
|
||||||
|
"OPF Fee percent, fee that goes to Ocean Protocol Foundation : SWAP"
|
||||||
|
opfFee: BigDecimal!
|
||||||
marketFee: BigDecimal!
|
marketFee: BigDecimal!
|
||||||
|
|
||||||
event: String # TODO: what is this?
|
event: String # TODO: what is this?
|
||||||
@ -131,10 +197,13 @@ type PoolTransaction @entity {
|
|||||||
timestamp: Int!
|
timestamp: Int!
|
||||||
|
|
||||||
gasLimit: BigDecimal!
|
gasLimit: BigDecimal!
|
||||||
gasPrice: BigDecimal! # in eth
|
"price expressed in eth"
|
||||||
|
gasPrice: BigDecimal!
|
||||||
|
|
||||||
# change to baseToken and dataToken
|
# change to baseToken and dataToken
|
||||||
baseToken: TokenValuePair # tokens transfered , if value is negative it means it was removed,
|
"base tokens transfered , if value is negative it means it was removed"
|
||||||
|
baseToken: TokenValuePair
|
||||||
|
"datatokens transfered , if value is negative it means it was removed"
|
||||||
datatoken: TokenValuePair
|
datatoken: TokenValuePair
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,17 +256,22 @@ type User @entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FixedRateExchange @entity {
|
type FixedRateExchange @entity {
|
||||||
id: ID! # fixed rate exchange id
|
"fixed rate exchange id"
|
||||||
|
id: ID!
|
||||||
owner: User!
|
owner: User!
|
||||||
datatoken: Token!
|
datatoken: Token!
|
||||||
baseToken: Token!
|
baseToken: Token!
|
||||||
price: BigDecimal!
|
price: BigDecimal!
|
||||||
active: Boolean!
|
active: Boolean!
|
||||||
totalSwapValue: BigDecimal! # amount of total basetokens spent
|
"amount of total basetokens spent"
|
||||||
allowedSwapper: String # address that is allowed to swap tokens
|
totalSwapValue: BigDecimal!
|
||||||
|
"address that is allowed to swap tokens"
|
||||||
|
allowedSwapper: String
|
||||||
supply: BigInt!
|
supply: BigInt!
|
||||||
withMint: Boolean # if the owner allowes the fre to mint
|
"if the owner allowes the fre to mint"
|
||||||
isMinter: Boolean # if the fre has the minter role on the datatoken
|
withMint: Boolean
|
||||||
|
"if the fre has the minter role on the datatoken"
|
||||||
|
isMinter: Boolean
|
||||||
|
|
||||||
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
|
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
|
||||||
swaps: [FixedRateExchangeSwap!] @derivedFrom(field: "exchangeId")
|
swaps: [FixedRateExchangeSwap!] @derivedFrom(field: "exchangeId")
|
||||||
@ -236,19 +310,22 @@ type FixedRateExchangeSwap @entity {
|
|||||||
tx: Bytes!
|
tx: Bytes!
|
||||||
}
|
}
|
||||||
|
|
||||||
# since in the template that we will use minterApproved is sort of "bundled" with isTrueMinter i think we should have only one field here to easily check if dispenser cand mint
|
|
||||||
|
|
||||||
type Dispenser @entity {
|
type Dispenser @entity {
|
||||||
id: ID! # it's the datatoken address
|
"datatoken address"
|
||||||
|
id: ID!
|
||||||
active: Boolean!
|
active: Boolean!
|
||||||
owner: User!
|
owner: User!
|
||||||
datatoken: Token!
|
datatoken: Token!
|
||||||
|
|
||||||
allowedSwapper: String
|
allowedSwapper: String
|
||||||
isMinter: Boolean # if the fre has the minter role on the datatoken
|
isMinter: Boolean
|
||||||
maxTokens: BigDecimal! # max tokens that can be dispensed
|
"max tokens that can be dispensed"
|
||||||
maxBalance: BigDecimal! # max balance of requester. If the balance is higher, the dispense is rejected
|
maxTokens: BigDecimal!
|
||||||
balance: BigDecimal! # how many tokens are left
|
"max balance of requester. If the balance is higher, the dispense is rejected"
|
||||||
|
maxBalance: BigDecimal!
|
||||||
|
"how many tokens are left"
|
||||||
|
balance: BigDecimal!
|
||||||
|
|
||||||
dispenses: [DispenserTransaction!] @derivedFrom(field: "dispenser")
|
dispenses: [DispenserTransaction!] @derivedFrom(field: "dispenser")
|
||||||
}
|
}
|
||||||
@ -268,9 +345,12 @@ type PoolSnapshot @entity {
|
|||||||
id: ID!
|
id: ID!
|
||||||
pool: Pool!
|
pool: Pool!
|
||||||
totalShares: BigDecimal!
|
totalShares: BigDecimal!
|
||||||
swapVolume: BigDecimal! # swap value 24h
|
"swap value 24h"
|
||||||
swapFees: BigDecimal! # swap fee value 24h
|
swapVolume: BigDecimal!
|
||||||
createdTimestamp: Int! # date without time
|
"swap fee value 24h"
|
||||||
|
swapFees: BigDecimal!
|
||||||
|
"date without time"
|
||||||
|
createdTimestamp: Int!
|
||||||
spotPrice: BigDecimal! # TODO: last spot price or first one?
|
spotPrice: BigDecimal! # TODO: last spot price or first one?
|
||||||
tokens: [PoolSnapshotTokenValue!] @derivedFrom(field: "poolSnapshot")
|
tokens: [PoolSnapshotTokenValue!] @derivedFrom(field: "poolSnapshot")
|
||||||
}
|
}
|
||||||
@ -286,15 +366,22 @@ type PoolSnapshotTokenValue @entity {
|
|||||||
type Global @entity {
|
type Global @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
|
|
||||||
totalValueLocked: [TokenValuePair!] # total value locked represented in the base token , basically 2x liqudity for each base token
|
"total value locked represented in the base token , basically 2x liqudity for each base token"
|
||||||
totalLiquidity: [TokenValuePair!] # total liquidity for each base token
|
totalValueLocked: [TokenValuePair!]
|
||||||
totalSwapVolume: [TokenValuePair!] # total swap volume for each base token. pools and fre
|
"total liquidity for each base token"
|
||||||
|
totalLiquidity: [TokenValuePair!]
|
||||||
|
"total swap volume for each base token. pools and fre"
|
||||||
|
totalSwapVolume: [TokenValuePair!]
|
||||||
|
|
||||||
orderCount: BigInt # Number of total consumes, pools + fre
|
"number of total consumes, pools + fre"
|
||||||
|
orderCount: BigInt
|
||||||
|
|
||||||
poolCount: Int! # Number of pools for all factories
|
"number of pools for all factories"
|
||||||
finalizedPoolCount: Int! # Number of finalized pools for all factories
|
poolCount: Int!
|
||||||
totalOrderVolume: BigDecimal # probably remove due to inconsistencies and imposibility to calculate
|
"number of finalized pools for all factories"
|
||||||
|
finalizedPoolCount: Int!
|
||||||
|
"probably remove due to inconsistencies and imposibility to calculate"
|
||||||
|
totalOrderVolume: BigDecimal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
} from '../@types/Dispenser/Dispenser'
|
} from '../@types/Dispenser/Dispenser'
|
||||||
import { DispenserCreated } from '../@types/ERC721Factory/ERC721Factory'
|
import { DispenserCreated } from '../@types/ERC721Factory/ERC721Factory'
|
||||||
import { DispenserTransaction } from '../@types/schema'
|
import { DispenserTransaction } from '../@types/schema'
|
||||||
import { ZERO_BD } from './utils/constants'
|
import { decimal } from './utils/constants'
|
||||||
import { createDispenser, getDispenser } from './utils/dispenserUtils'
|
import { createDispenser, getDispenser } from './utils/dispenserUtils'
|
||||||
import { getUser } from './utils/userUtils'
|
import { getUser } from './utils/userUtils'
|
||||||
|
|
||||||
@ -60,6 +60,6 @@ export function handleTokensDispensed(event: TokensDispensed): void {
|
|||||||
|
|
||||||
export function handleOwnerWinthdraw(event: OwnerWithdrawed): void {
|
export function handleOwnerWinthdraw(event: OwnerWithdrawed): void {
|
||||||
const dispenser = getDispenser(event.params.datatoken.toHex())
|
const dispenser = getDispenser(event.params.datatoken.toHex())
|
||||||
dispenser.balance = ZERO_BD
|
dispenser.balance = decimal.ZERO_BD
|
||||||
dispenser.save()
|
dispenser.save()
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { NFTCreated, TokenCreated } from '../@types/ERC721Factory/ERC721Factory'
|
import { NFTCreated, TokenCreated } from '../@types/ERC721Factory/ERC721Factory'
|
||||||
import { Nft, Token } from '../@types/schema'
|
import { Nft, Token } from '../@types/schema'
|
||||||
import { ZERO_BD } from './utils/constants'
|
import { decimal } from './utils/constants'
|
||||||
import { getUser } from './utils/userUtils'
|
import { getUser } from './utils/userUtils'
|
||||||
|
|
||||||
export function handleNftCreated(event: NFTCreated): void {
|
export function handleNftCreated(event: NFTCreated): void {
|
||||||
@ -28,6 +28,6 @@ export function handleNewToken(event: TokenCreated): void {
|
|||||||
|
|
||||||
token.name = event.params.tokenName.toString()
|
token.name = event.params.tokenName.toString()
|
||||||
token.decimals = 18
|
token.decimals = 18
|
||||||
token.supply = ZERO_BD
|
token.supply = decimal.ZERO_BD
|
||||||
token.save()
|
token.save()
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@ import {
|
|||||||
FixedRateExchangeSwap,
|
FixedRateExchangeSwap,
|
||||||
FixedRateExchangeUpdate
|
FixedRateExchangeUpdate
|
||||||
} from '../@types/schema'
|
} from '../@types/schema'
|
||||||
import { tokenToDecimal } from '../helpers'
|
|
||||||
import { getFixedRateExchange, getUpdateOrSwapId } from './utils/fixedRateUtils'
|
import { getFixedRateExchange, getUpdateOrSwapId } from './utils/fixedRateUtils'
|
||||||
|
import { tokenToDecimal } from './utils/generic'
|
||||||
import { getToken } from './utils/tokenUtils'
|
import { getToken } from './utils/tokenUtils'
|
||||||
import { getUser } from './utils/userUtils'
|
import { getUser } from './utils/userUtils'
|
||||||
|
|
||||||
@ -146,8 +146,9 @@ export function handleSwap(event: Swapped): void {
|
|||||||
|
|
||||||
// reduce supply if the fixed rate is not minting tokens
|
// reduce supply if the fixed rate is not minting tokens
|
||||||
if (fixedRateExchange.isMinter || fixedRateExchange.withMint) {
|
if (fixedRateExchange.isMinter || fixedRateExchange.withMint) {
|
||||||
fixedRateExchange.supply =
|
fixedRateExchange.supply = fixedRateExchange.supply.minus(
|
||||||
fixedRateExchange.supply - event.params.dataTokenSwappedAmount
|
event.params.dataTokenSwappedAmount
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const swap = new FixedRateExchangeSwap(
|
const swap = new FixedRateExchangeSwap(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Pool, PoolTransaction } from '../@types/schema'
|
import { Pool, PoolTransaction } from '../@types/schema'
|
||||||
import { LOG_JOIN } from '../@types/templates/BPool/BPool'
|
import { LOG_JOIN } from '../@types/templates/BPool/BPool'
|
||||||
import { integer, PoolTransactionType } from './utils/constants'
|
import { integer } from './utils/constants'
|
||||||
import { gweiToEth } from './utils/generic'
|
import { gweiToEth } from './utils/generic'
|
||||||
import { getUser } from './utils/userUtils'
|
import { getUser } from './utils/userUtils'
|
||||||
|
|
||||||
@ -17,7 +17,6 @@ export function handleJoin(event: LOG_JOIN): void {
|
|||||||
const user = getUser(event.params.caller.toHex())
|
const user = getUser(event.params.caller.toHex())
|
||||||
poolTx.user = user.id
|
poolTx.user = user.id
|
||||||
poolTx.pool = pool.id
|
poolTx.pool = pool.id
|
||||||
poolTx.type = PoolTransactionType.JOIN
|
|
||||||
|
|
||||||
poolTx.timestamp = event.block.timestamp.toI32()
|
poolTx.timestamp = event.block.timestamp.toI32()
|
||||||
poolTx.tx = event.transaction.hash
|
poolTx.tx = event.transaction.hash
|
||||||
|
@ -2,13 +2,6 @@ import { BigDecimal, BigInt } from '@graphprotocol/graph-ts'
|
|||||||
|
|
||||||
export const ENABLE_DEBUG = true
|
export const ENABLE_DEBUG = true
|
||||||
|
|
||||||
export const enum PoolTransactionType {
|
|
||||||
JOIN = 'join',
|
|
||||||
EXIT = 'exit',
|
|
||||||
SWAP = 'swap',
|
|
||||||
SETUP = 'setup'
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace integer {
|
export namespace integer {
|
||||||
export const NEGATIVE_ONE = BigInt.fromI32(-1)
|
export const NEGATIVE_ONE = BigInt.fromI32(-1)
|
||||||
export const ZERO = BigInt.fromI32(0)
|
export const ZERO = BigInt.fromI32(0)
|
||||||
@ -17,7 +10,7 @@ export namespace integer {
|
|||||||
export const ONE_BASE_18 = BigInt.fromI32(10).pow(18 as u8)
|
export const ONE_BASE_18 = BigInt.fromI32(10).pow(18 as u8)
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace deciaml {
|
export namespace decimal {
|
||||||
export const ZERO_BD = BigDecimal.fromString('0.0')
|
export const ZERO_BD = BigDecimal.fromString('0.0')
|
||||||
export const MINUS_1_BD = BigDecimal.fromString('-1.0')
|
export const MINUS_1_BD = BigDecimal.fromString('-1.0')
|
||||||
export const ONE_BD = BigDecimal.fromString('1.0')
|
export const ONE_BD = BigDecimal.fromString('1.0')
|
||||||
|
Loading…
Reference in New Issue
Block a user