mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
Saving providerFee as a string
This commit is contained in:
parent
ec2b925c30
commit
f0552a63e9
@ -10,7 +10,8 @@ import {
|
|||||||
RemovedMinter,
|
RemovedMinter,
|
||||||
RemovedPaymentManager,
|
RemovedPaymentManager,
|
||||||
CleanedPermissions,
|
CleanedPermissions,
|
||||||
OrderReused
|
OrderReused,
|
||||||
|
ProviderFee
|
||||||
} from '../@types/templates/ERC20Template/ERC20Template'
|
} from '../@types/templates/ERC20Template/ERC20Template'
|
||||||
|
|
||||||
import { integer } from './utils/constants'
|
import { integer } from './utils/constants'
|
||||||
@ -18,14 +19,7 @@ import { weiToDecimal } from './utils/generic'
|
|||||||
import { addOrder } from './utils/globalUtils'
|
import { addOrder } from './utils/globalUtils'
|
||||||
import { getToken, getUSDValue } from './utils/tokenUtils'
|
import { getToken, getUSDValue } from './utils/tokenUtils'
|
||||||
import { getUser } from './utils/userUtils'
|
import { getUser } from './utils/userUtils'
|
||||||
|
import { getOrder, getOrderId } from './utils/orderUtils'
|
||||||
function getOrderId(
|
|
||||||
tx: string,
|
|
||||||
tokenAddress: string,
|
|
||||||
fromAddress: string
|
|
||||||
): string {
|
|
||||||
return `${tx}-${tokenAddress}-${fromAddress}`
|
|
||||||
}
|
|
||||||
|
|
||||||
export function handleOrderStarted(event: OrderStarted): void {
|
export function handleOrderStarted(event: OrderStarted): void {
|
||||||
const order = new Order(
|
const order = new Order(
|
||||||
@ -204,6 +198,25 @@ export function handleNewPaymentCollector(event: NewPaymentCollector): void {
|
|||||||
token.save()
|
token.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function handleProviderFee(event: ProviderFee): void {
|
||||||
|
const order = getOrder(
|
||||||
|
event.transaction.hash.toHex(),
|
||||||
|
event.address.toHex(),
|
||||||
|
event.transaction.from.toHex()
|
||||||
|
)
|
||||||
|
const providerFee = `{providerFeeAddress: ${event.params.providerFeeAddress.toHex()}, providerFeeToken: ${event.params.providerFeeToken.toHex()}, providerFeeAmount: ${
|
||||||
|
event.params.providerFeeAmount
|
||||||
|
}, providerData: ${event.params.providerData.toHexString()}, v: ${
|
||||||
|
event.params.v
|
||||||
|
}, r: ${event.params.r.toHexString()}, s: ${event.params.s.toHexString()}, validUntil: ${
|
||||||
|
event.params.validUntil
|
||||||
|
}
|
||||||
|
}`
|
||||||
|
|
||||||
|
order.providerFee = providerFee
|
||||||
|
order.save()
|
||||||
|
}
|
||||||
|
|
||||||
// export function handlePublishMarketFees(event: PublishMarketFees): void {
|
// export function handlePublishMarketFees(event: PublishMarketFees): void {
|
||||||
// const order = Order.load(
|
// const order = Order.load(
|
||||||
// getOrderId(
|
// getOrderId(
|
||||||
|
Loading…
Reference in New Issue
Block a user