Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>
This commit is contained in:
mihaisc 2022-04-29 14:37:07 +03:00 committed by GitHub
parent 04eddaaac0
commit a13ff28062
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 29 deletions

1
package-lock.json generated
View File

@ -5,7 +5,6 @@
"requires": true,
"packages": {
"": {
"name": "ocean-subgraph",
"version": "1.2.0",
"license": "Apache-2.0",
"dependencies": {

View File

@ -26,8 +26,8 @@ type Token @entity {
"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
"fee amount. Fixed value."
publishMarketFeeAmount: BigDecimal
"template ID of the datatoken"
templateId: Int
@ -150,10 +150,7 @@ type Pool @entity {
"Liquidty provider fee value"
liquidityProviderSwapFee: BigDecimal
"liquidity provider fee total amount"
liquidityProviderSwapFeeAmount: BigDecimal!
"OPF Fee percent, fee that goes to Ocean Protocol Foundation : SWAP"
opcFee: BigDecimal!
liquidityProviderSwapFeeAmount: BigDecimal!
"total pool token shares"
totalShares: BigDecimal!
@ -328,8 +325,6 @@ type FixedRateExchange @entity {
"if the fre has the minter role on the datatoken"
isMinter: Boolean
marketSwapFee: BigDecimal!
updates: [FixedRateExchangeUpdate!] @derivedFrom(field: "exchangeId")
swaps: [FixedRateExchangeSwap!] @derivedFrom(field: "exchangeId")
@ -340,7 +335,7 @@ type FixedRateExchange @entity {
"address of the market where the datatoken was created. This address collects market fees."
publishMarketFeeAddress: String
"fee amount. Fixed value, expressed in wei in contracts, needs conversion in decimals."
"fee amount. Fixed value"
publishMarketSwapFee: BigDecimal
}

View File

@ -90,26 +90,24 @@ export function handlePublishMarketFeeChanged(
event: PublishMarketFeeChanged
): void {
const token = getToken(event.address, true)
if (token != null) {
token.publishMarketFeeAddress =
event.params.PublishMarketFeeAddress.toHexString()
token.publishMarketFeeToken =
event.params.PublishMarketFeeToken.toHexString()
let decimals = BigInt.fromI32(18).toI32()
if (
token.publishMarketFeeToken !=
'0x0000000000000000000000000000000000000000'
) {
const token = getToken(event.params.PublishMarketFeeToken, false)
decimals = BigInt.fromI32(token.decimals).toI32()
}
token.publishMarketFeeAmmount = weiToDecimal(
event.params.PublishMarketFeeAmount.toBigDecimal(),
decimals
)
token.save()
// TODO - shold we have a history
if (!token) return
token.publishMarketFeeAddress =
event.params.PublishMarketFeeAddress.toHexString()
token.publishMarketFeeToken = event.params.PublishMarketFeeToken.toHexString()
let decimals = BigInt.fromI32(18).toI32()
if (
token.publishMarketFeeToken != '0x0000000000000000000000000000000000000000'
) {
const token = getToken(event.params.PublishMarketFeeToken, false)
decimals = BigInt.fromI32(token.decimals).toI32()
}
token.publishMarketFeeAmount = weiToDecimal(
event.params.PublishMarketFeeAmount.toBigDecimal(),
decimals
)
token.save()
// TODO - shold we have a history
}
// roles