Saving providerFee as a string

This commit is contained in:
Jamie Hewitt 2022-06-29 17:40:09 +03:00
parent ec2b925c30
commit f0552a63e9

View File

@ -10,7 +10,8 @@ import {
RemovedMinter,
RemovedPaymentManager,
CleanedPermissions,
OrderReused
OrderReused,
ProviderFee
} from '../@types/templates/ERC20Template/ERC20Template'
import { integer } from './utils/constants'
@ -18,14 +19,7 @@ import { weiToDecimal } from './utils/generic'
import { addOrder } from './utils/globalUtils'
import { getToken, getUSDValue } from './utils/tokenUtils'
import { getUser } from './utils/userUtils'
function getOrderId(
tx: string,
tokenAddress: string,
fromAddress: string
): string {
return `${tx}-${tokenAddress}-${fromAddress}`
}
import { getOrder, getOrderId } from './utils/orderUtils'
export function handleOrderStarted(event: OrderStarted): void {
const order = new Order(
@ -204,6 +198,25 @@ export function handleNewPaymentCollector(event: NewPaymentCollector): void {
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 {
// const order = Order.load(
// getOrderId(