ocean-subgraph/src/mappings/erc20Templates.ts

320 lines
10 KiB
TypeScript
Raw Normal View History

import { Order, Nft, OrderReuse } from '../@types/schema'
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
import { BigInt, BigDecimal, Address, log } from '@graphprotocol/graph-ts'
import {
NewPaymentCollector,
OrderStarted,
2022-02-17 11:26:05 +01:00
PublishMarketFee,
2022-02-18 12:09:18 +01:00
PublishMarketFeeChanged,
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
ConsumeMarketFee,
2022-02-18 12:09:18 +01:00
AddedMinter,
AddedPaymentManager,
RemovedMinter,
RemovedPaymentManager,
CleanedPermissions,
OrderReused,
ProviderFee
} from '../@types/templates/ERC20Template/ERC20Template'
2021-11-26 09:04:14 +01:00
import { integer } from './utils/constants'
import { weiToDecimal } from './utils/generic'
import { addOrder } from './utils/globalUtils'
import { getToken, getUSDValue } from './utils/tokenUtils'
2021-11-26 09:04:14 +01:00
import { getUser } from './utils/userUtils'
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
import {
getOrderId,
searchOrderForEvent,
searchOrderReusedForEvent
} from './utils/orderUtils'
2021-11-26 09:04:14 +01:00
export function handleOrderStarted(event: OrderStarted): void {
const order = new Order(
getOrderId(
event.transaction.hash.toHex(),
event.address.toHex(),
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
event.transaction.from.toHex(),
event.logIndex.toI32()
2021-11-26 09:04:14 +01:00
)
)
2022-02-18 12:09:18 +01:00
const token = getToken(event.address, true)
2022-01-31 11:43:50 +01:00
order.datatoken = token.id
2021-11-26 09:04:14 +01:00
token.orderCount = token.orderCount.plus(integer.ONE)
const consumer = getUser(event.params.consumer.toHex())
order.consumer = consumer.id
if (token.nft) {
const nft = Nft.load(token.nft as string) as Nft
const nftOwner = getUser(nft.owner)
order.nftOwner = nftOwner.id
}
2021-11-26 09:04:14 +01:00
const payer = getUser(event.params.payer.toHex())
payer.totalOrders = payer.totalOrders.plus(integer.ONE)
payer.save()
2021-11-26 09:04:14 +01:00
order.payer = payer.id
order.amount = weiToDecimal(
event.params.amount.toBigDecimal(),
token.decimals
)
2022-01-31 11:43:50 +01:00
order.serviceIndex = event.params.serviceIndex.toI32()
2021-11-26 09:04:14 +01:00
const publishMarket = getUser(event.params.publishMarketAddress.toHex())
order.publishingMarket = publishMarket.id
order.createdTimestamp = event.block.timestamp.toI32()
2021-12-02 12:08:47 +01:00
order.tx = event.transaction.hash.toHex()
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
order.eventIndex = event.logIndex.toI32()
2021-11-26 09:04:14 +01:00
order.block = event.block.number.toI32()
const tokenId = token.lastPriceToken
if (tokenId) {
const priceToken = getToken(Address.fromString(tokenId), false)
order.lastPriceToken = priceToken.id
order.lastPriceValue = token.lastPriceValue
order.estimatedUSDValue = getUSDValue(
priceToken.id,
order.lastPriceValue,
order.createdTimestamp
)
}
if (event.receipt !== null && event.receipt!.gasUsed) {
order.gasUsed = event.receipt!.gasUsed.toBigDecimal()
} else {
order.gasUsed = BigDecimal.zero()
}
if (event.transaction.gasPrice) {
order.gasPrice = event.transaction.gasPrice
} else {
order.gasPrice = BigInt.zero()
}
2021-11-26 09:04:14 +01:00
order.save()
token.save()
addOrder()
2022-02-17 13:00:54 +01:00
if (token.nft) {
const nft = Nft.load(token.nft as string) as Nft
if (nft) {
nft.orderCount = nft.orderCount.plus(integer.ONE)
nft.save()
}
const owner = getUser(nft.owner)
owner.totalSales = owner.totalSales.plus(integer.ONE)
owner.save()
2022-02-17 13:00:54 +01:00
}
2021-11-26 09:04:14 +01:00
}
export function handlerOrderReused(event: OrderReused): void {
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
const order = searchOrderForEvent(
event.params.orderTxId.toHexString(),
event.address.toHex(),
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
event.params.caller.toHex(),
event.logIndex.toI32()
)
if (!order) return
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
const eventIndex: number = event.logIndex.toI32()
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
const reuseOrder = new OrderReuse(
`${event.transaction.hash.toHex()}-${eventIndex}`
)
if (event.transaction.gasPrice)
reuseOrder.gasPrice = event.transaction.gasPrice
else reuseOrder.gasPrice = BigInt.zero()
if (event.receipt !== null && event.receipt!.gasUsed) {
reuseOrder.gasUsed = event.receipt!.gasUsed.toBigDecimal()
} else reuseOrder.gasUsed = BigDecimal.zero()
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
reuseOrder.order = order.id
reuseOrder.caller = event.params.caller.toHexString()
reuseOrder.createdTimestamp = event.params.timestamp.toI32()
reuseOrder.tx = event.transaction.hash.toHex()
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
reuseOrder.eventIndex = event.logIndex.toI32()
reuseOrder.block = event.params.number.toI32()
reuseOrder.save()
}
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
export function handlePublishMarketFee(event: PublishMarketFee): void {
const order = searchOrderForEvent(
event.transaction.hash.toHex(),
event.address.toHex(),
event.transaction.from.toHex(),
event.logIndex.toI32()
)
if (!order) return
const publishMarket = getUser(event.params.PublishMarketFeeAddress.toHex())
order.publishingMarket = publishMarket.id
const publishMarketToken = getToken(event.params.PublishMarketFeeToken, true)
order.publishingMarketToken = publishMarketToken.id
order.publishingMarketAmmount = weiToDecimal(
event.params.PublishMarketFeeAmount.toBigDecimal(),
publishMarketToken.decimals
)
order.save()
}
2022-02-17 11:26:05 +01:00
export function handlePublishMarketFeeChanged(
event: PublishMarketFeeChanged
): void {
2022-02-18 12:09:18 +01:00
const token = getToken(event.address, true)
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()
2022-02-17 11:26:05 +01:00
}
token.publishMarketFeeAmount = weiToDecimal(
event.params.PublishMarketFeeAmount.toBigDecimal(),
decimals
)
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
token.eventIndex = event.logIndex.toI32()
token.save()
// TODO - shold we have a history
2022-02-17 11:26:05 +01:00
}
2022-02-18 12:09:18 +01:00
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
export function handleConsumeMarketFee(event: ConsumeMarketFee): void {
const order = searchOrderForEvent(
event.transaction.hash.toHex(),
event.address.toHex(),
event.transaction.from.toHex(),
event.logIndex.toI32()
)
if (!order) return
const consumeMarket = getUser(event.params.consumeMarketFeeAddress.toHex())
order.consumerMarket = consumeMarket.id
const consumeMarketToken = getToken(event.params.consumeMarketFeeToken, false)
order.consumerMarketToken = consumeMarketToken.id
order.consumerMarketAmmount = weiToDecimal(
event.params.consumeMarketFeeAmount.toBigDecimal(),
consumeMarketToken.decimals
)
order.save()
}
2022-02-18 12:09:18 +01:00
// roles
// roles
export function handleAddedMinter(event: AddedMinter): void {
const token = getToken(event.address, true)
let existingRoles: string[]
if (!token.minter) existingRoles = []
else existingRoles = token.minter as string[]
if (!existingRoles.includes(event.params.user.toHexString()))
existingRoles.push(event.params.user.toHexString())
token.minter = existingRoles
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
token.eventIndex = event.logIndex.toI32()
2022-02-18 12:09:18 +01:00
token.save()
}
export function handleRemovedMinter(event: RemovedMinter): void {
const token = getToken(event.address, true)
const newList: string[] = []
let existingRoles: string[]
if (!token.minter) existingRoles = []
else existingRoles = token.minter as string[]
if (!existingRoles || existingRoles.length < 1) return
while (existingRoles.length > 0) {
const role = existingRoles.shift().toString()
if (!role) break
if (role !== event.params.user.toHexString()) newList.push(role)
}
token.minter = newList
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
token.eventIndex = event.logIndex.toI32()
2022-02-18 12:09:18 +01:00
token.save()
}
export function handleAddedPaymentManager(event: AddedPaymentManager): void {
const token = getToken(event.address, true)
let existingRoles: string[]
if (!token.paymentManager) existingRoles = []
else existingRoles = token.paymentManager as string[]
if (!existingRoles.includes(event.params.user.toHexString()))
existingRoles.push(event.params.user.toHexString())
token.paymentManager = existingRoles
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
token.eventIndex = event.logIndex.toI32()
2022-02-18 12:09:18 +01:00
token.save()
}
export function handleRemovedPaymentManager(
event: RemovedPaymentManager
): void {
const token = getToken(event.address, true)
const newList: string[] = []
let existingRoles: string[]
if (!token.paymentManager) existingRoles = []
else existingRoles = token.paymentManager as string[]
if (!existingRoles || existingRoles.length < 1) return
while (existingRoles.length > 0) {
const role = existingRoles.shift().toString()
if (!role) break
if (role !== event.params.user.toHexString()) newList.push(role)
}
token.paymentManager = newList
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
token.eventIndex = event.logIndex.toI32()
2022-02-18 12:09:18 +01:00
token.save()
}
export function handleCleanedPermissions(event: CleanedPermissions): void {
const token = getToken(event.address, true)
const newList: string[] = []
token.paymentManager = newList
token.minter = newList
const nft = Nft.load(token.nft as string)
if (nft) token.paymentCollector = nft.owner
else token.paymentCollector = '0x0000000000000000000000000000000000000000'
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
token.eventIndex = event.logIndex.toI32()
2022-02-18 12:09:18 +01:00
token.save()
}
export function handleNewPaymentCollector(event: NewPaymentCollector): void {
const token = getToken(event.address, true)
token.paymentCollector = event.params._newPaymentCollector.toHexString()
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
token.eventIndex = event.logIndex.toI32()
2022-02-18 12:09:18 +01:00
token.save()
}
export function handleProviderFee(event: ProviderFee): void {
const providerFee: string = `{"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
}"}`
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
const order = searchOrderForEvent(
event.transaction.hash.toHex(),
event.address.toHex(),
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
event.transaction.from.toHex(),
event.logIndex.toI32()
)
if (order) {
order.providerFee = providerFee
order.providerFeeValidUntil = event.params.validUntil
order.save()
return
}
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
const orderReuse = searchOrderReusedForEvent(
event.transaction.hash.toHex(),
event.address.toHex(),
event.logIndex.toI32()
)
if (orderReuse) {
Fix #628 & #629 & #621: Store event log index for all records (#630) * Store eventIndex. * Changed in veDelegation. Removed import of String. * linter. * Removed tx hash. * Revert some tweaks. * added logIndex. * converted to big int. * 0 -> BigInt.zero(). * Added eventIndex to template and OPC. * updated tweak * updated tweak2 * Added eventIndex in tests. * revert. * Added eventIndex for TokenCreated and NFTCreated events. Increase time sleep for graphql request. * Changed position of eventIndex in entity. * Added eventIndex for order events and for dt events. Added new test commands in package.json. * Added eventIndex for NFT Update events. * Added eventIndex for dispenser. * Modified dispenser tests. * Reverted sleep secs. Updated tests. * Updated dispenser tests. Added eventIndex for FRE. * Added eventIndex in df rewards. * Updated Ve with eventIndex. * Updating order id with event index. * Updated @ocean/lib with multichain version. * Updated to number type. * Updated tests for order. * some changes. * Fix dt tests. Added logs for provider fee. Need fix for Simple publish and consume tests. * Problem raised by retrieving order event index in provider fee event handler. * Added function for searching the right order. * Debug order with provider fee. * Removed console logs. * Added debug logs. * Hardcoded eventIndex just for testing. * Paste logs from graph node. * added extra sleep in test. * fixed command. * Added comments. Modified util function for Order Reuse. * Added more logs and other tweaks. * fixed command for docker logs. * Added more logs. * Converted to lowercase. * Removed condition just for test. * Added more logs. Order is not null. * Call getOrder. * Added verification back. * converted to hex and add toString. * Pass toString as param. * Added ethereumjs util. * replaced with ==. * Refactored logic. * Print event index. * added more logs of event index. * Modified tweaks and asserts. * Added log for reuse order. * updates. * Reverted changes. * Added check for eventIndex == 0. * Enhanced the code. Replaced while with for. * Added more logs for reuse test. * added another condition. * Added logs in tests. Removed redundant condition. * Added more logs to test. * Fixed typo. * still debugging * Refactored code. * Getting closer. * Fix tests for orders part. Removed logs. * Removed more logs. * Fix DT tests related to order. * Implemented Publishing Market Fee event handler. Added test. * Added consume market fee handler. Test consume market fee handler. * Fixed tests for fees. Added TODOs. * Generated ID with eventIndex in ficed rate. Added assert errors messages. * Added FRE tests to workflow. * Generated dispenser transaction with event index. * Fixed dispenser tests. * Add event index for NftUpdate entity ID. * Changed IDs for VeDelegation and VeAllocationUpdate. * Added full test suite to workflow. * Fixed nft transfer ID. * print blocks. * test just dt and ending test to see the last block. * Added df test. * Added dispenser test. * Added FRE test. * Added NFT test. * Added simple publish consume test. * Added simple subgraph test. * Added users test. * Added ve test. * Increased sleep time. * commented delegation test. * respect lint * Fixed ending tests. Removed commented code. Brought back test suite. * Print values from failing tests. Updated mappings. * Rollback changes in veDelegation and veUtils. Added more prints for debug in tests. * Removed veDelegation creation record. * Rollback to the approach for veDelegation like it is in main. * Removed prints. Match changes with main. * Removed -1 from last block. * Added prints for eventIndex. Fixed some suggestions. * Fixed veDelegation. * Removed prints.
2023-05-13 14:00:52 +02:00
log.info('order reuse id in provider fee handler: {}', [orderReuse.id])
orderReuse.providerFee = providerFee
orderReuse.providerFeeValidUntil = event.params.validUntil
orderReuse.save()
}
}