Feature/graphnode 27 (#541)

* use custom barge

* update for 27

* bump to latest contracts

* add description

* use main barge
This commit is contained in:
Alex Coseru 2022-09-21 16:07:10 +03:00 committed by GitHub
parent f61cce9722
commit 8cb1d83a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 28 deletions

14
package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "2.0.6", "version": "2.0.6",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@oceanprotocol/contracts": "^1.1.4", "@oceanprotocol/contracts": "^1.1.6",
"@oceanprotocol/lib": "^2.0.2", "@oceanprotocol/lib": "^2.0.2",
"cross-fetch": "^3.1.4" "cross-fetch": "^3.1.4"
}, },
@ -860,9 +860,9 @@
} }
}, },
"node_modules/@oceanprotocol/contracts": { "node_modules/@oceanprotocol/contracts": {
"version": "1.1.4", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-1.1.4.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-1.1.6.tgz",
"integrity": "sha512-fIJjtyj1fxF3GNaITUDaUJbQ2FBCLqB6Hlg72k5SzBK2//yuSPfdZVAqomul0qQjgiKl0jlJRmWVpfer/a5z2g==" "integrity": "sha512-BF4Dkoa44ZCxvp96o/i03bMl4c5pYHrY1K/xvM8ZUc1NJ+BNCX+qKvtXzVfqbZXf02GwoWBWwRzQXXdOmXhxbw=="
}, },
"node_modules/@oceanprotocol/lib": { "node_modules/@oceanprotocol/lib": {
"version": "2.0.2", "version": "2.0.2",
@ -15278,9 +15278,9 @@
} }
}, },
"@oceanprotocol/contracts": { "@oceanprotocol/contracts": {
"version": "1.1.4", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-1.1.4.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-1.1.6.tgz",
"integrity": "sha512-fIJjtyj1fxF3GNaITUDaUJbQ2FBCLqB6Hlg72k5SzBK2//yuSPfdZVAqomul0qQjgiKl0jlJRmWVpfer/a5z2g==" "integrity": "sha512-BF4Dkoa44ZCxvp96o/i03bMl4c5pYHrY1K/xvM8ZUc1NJ+BNCX+qKvtXzVfqbZXf02GwoWBWwRzQXXdOmXhxbw=="
}, },
"@oceanprotocol/lib": { "@oceanprotocol/lib": {
"version": "2.0.2", "version": "2.0.2",

View File

@ -67,7 +67,7 @@
"typescript": "^4.8.3" "typescript": "^4.8.3"
}, },
"dependencies": { "dependencies": {
"@oceanprotocol/contracts": "^1.1.4", "@oceanprotocol/contracts": "^1.1.6",
"@oceanprotocol/lib": "^2.0.2", "@oceanprotocol/lib": "^2.0.2",
"cross-fetch": "^3.1.4" "cross-fetch": "^3.1.4"
}, },

View File

@ -134,8 +134,9 @@ type OrderReuse @entity {
block: Int! block: Int!
providerFee: String providerFee: String
providerFeeValidUntil: BigInt providerFeeValidUntil: BigInt
"gas price in Wei"
gasPrice: BigInt gasPrice: BigInt
gasUsed: BigInt gasUsed: BigDecimal
} }
type Order @entity { type Order @entity {
@ -169,7 +170,8 @@ type Order @entity {
lastPriceToken: String! lastPriceToken: String!
lastPriceValue: BigDecimal! lastPriceValue: BigDecimal!
estimatedUSDValue: BigDecimal! estimatedUSDValue: BigDecimal!
gasUsed: BigInt gasUsed: BigDecimal
"gas price in Wei"
gasPrice: BigInt gasPrice: BigInt
} }

View File

@ -1,5 +1,5 @@
import { Order, Nft, OrderReuse } from '../@types/schema' import { Order, Nft, OrderReuse } from '../@types/schema'
import { BigInt } from '@graphprotocol/graph-ts' import { BigInt, BigDecimal } from '@graphprotocol/graph-ts'
import { import {
NewPaymentCollector, NewPaymentCollector,
@ -66,10 +66,10 @@ export function handleOrderStarted(event: OrderStarted): void {
order.lastPriceValue, order.lastPriceValue,
order.createdTimestamp order.createdTimestamp
) )
if (event.receipt !== null) { if (event.receipt !== null && event.receipt!.gasUsed) {
order.gasUsed = event.receipt!.gasUsed order.gasUsed = event.receipt!.gasUsed.toBigDecimal()
} else { } else {
order.gasUsed = BigInt.zero() order.gasUsed = BigDecimal.zero()
} }
if (event.transaction.gasPrice) { if (event.transaction.gasPrice) {
order.gasPrice = event.transaction.gasPrice order.gasPrice = event.transaction.gasPrice
@ -105,8 +105,9 @@ export function handlerOrderReused(event: OrderReused): void {
if (event.transaction.gasPrice) if (event.transaction.gasPrice)
reuseOrder.gasPrice = event.transaction.gasPrice reuseOrder.gasPrice = event.transaction.gasPrice
else reuseOrder.gasPrice = BigInt.zero() else reuseOrder.gasPrice = BigInt.zero()
if (event.receipt !== null) reuseOrder.gasUsed = event.receipt!.gasUsed if (event.receipt !== null && event.receipt!.gasUsed) {
else reuseOrder.gasUsed = BigInt.zero() reuseOrder.gasUsed = event.receipt!.gasUsed.toBigDecimal()
} else reuseOrder.gasUsed = BigDecimal.zero()
reuseOrder.order = orderId reuseOrder.order = orderId
reuseOrder.caller = event.params.caller.toHexString() reuseOrder.caller = event.params.caller.toHexString()
reuseOrder.createdTimestamp = event.params.timestamp.toI32() reuseOrder.createdTimestamp = event.params.timestamp.toI32()
@ -254,8 +255,9 @@ export function handleProviderFee(event: ProviderFee): void {
if (event.transaction.gasPrice) if (event.transaction.gasPrice)
orderReuse.gasPrice = event.transaction.gasPrice orderReuse.gasPrice = event.transaction.gasPrice
else orderReuse.gasPrice = BigInt.zero() else orderReuse.gasPrice = BigInt.zero()
if (event.receipt !== null) orderReuse.gasUsed = event.receipt!.gasUsed if (event.receipt !== null && event.receipt!.gasUsed) {
else orderReuse.gasUsed = BigInt.zero() orderReuse.gasUsed = event.receipt!.gasUsed.toBigDecimal()
} else orderReuse.gasUsed = BigDecimal.zero()
orderReuse.save() orderReuse.save()
} }
} }

View File

@ -11,7 +11,7 @@ templates:
abi: ERC20Template abi: ERC20Template
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/erc20Templates.ts file: ./src/mappings/erc20Templates.ts
entities: entities:
@ -28,8 +28,10 @@ templates:
eventHandlers: eventHandlers:
- event: OrderStarted(indexed address,address,uint256,uint256,uint256,indexed address,uint256) - event: OrderStarted(indexed address,address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted handler: handleOrderStarted
receipt: true
- event: OrderReused(bytes32,address,uint256,uint256) - event: OrderReused(bytes32,address,uint256,uint256)
handler: handlerOrderReused handler: handlerOrderReused
receipt: true
- event: NewPaymentCollector(indexed address,indexed address,uint256,uint256) - event: NewPaymentCollector(indexed address,indexed address,uint256,uint256)
handler: handleNewPaymentCollector handler: handleNewPaymentCollector
- event: PublishMarketFee(indexed address,indexed address,uint256) - event: PublishMarketFee(indexed address,indexed address,uint256)
@ -48,6 +50,7 @@ templates:
handler: handleCleanedPermissions handler: handleCleanedPermissions
- event: ProviderFee(indexed address,indexed address,uint256,bytes,uint8,bytes32,bytes32,uint256) - event: ProviderFee(indexed address,indexed address,uint256,bytes,uint8,bytes32,bytes32,uint256)
handler: handleProviderFee handler: handleProviderFee
receipt: true
- name: ERC721Template - name: ERC721Template
kind: ethereum/contract kind: ethereum/contract
@ -56,7 +59,7 @@ templates:
abi: ERC721Template abi: ERC721Template
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/nftUpdate.ts file: ./src/mappings/nftUpdate.ts
entities: entities:
@ -107,7 +110,7 @@ templates:
abi: Dispenser abi: Dispenser
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts file: ./src/mappings/dispenser.ts
entities: entities:
@ -138,7 +141,7 @@ templates:
abi: FixedRateExchange abi: FixedRateExchange
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/fixedRateExchange.ts file: ./src/mappings/fixedRateExchange.ts
entities: entities:
@ -178,7 +181,7 @@ dataSources:
startBlock: __STARTBLOCK__ startBlock: __STARTBLOCK__
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/erc721Factory.ts file: ./src/mappings/erc721Factory.ts
entities: entities:
@ -203,7 +206,7 @@ dataSources:
startBlock: __STARTBLOCK__ startBlock: __STARTBLOCK__
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/factoryRouter.ts file: ./src/mappings/factoryRouter.ts
entities: entities:

View File

@ -7,7 +7,7 @@
startBlock: __STARTBLOCK__ startBlock: __STARTBLOCK__
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/veAllocate.ts file: ./src/mappings/veAllocate.ts
entities: entities:
@ -30,7 +30,7 @@
startBlock: __STARTBLOCK__ startBlock: __STARTBLOCK__
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/veOCEAN.ts file: ./src/mappings/veOCEAN.ts
entities: entities:
@ -55,7 +55,7 @@
startBlock: __STARTBLOCK__ startBlock: __STARTBLOCK__
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/veDelegation.ts file: ./src/mappings/veDelegation.ts
entities: entities:
@ -76,7 +76,7 @@
startBlock: __STARTBLOCK__ startBlock: __STARTBLOCK__
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.6 apiVersion: 0.0.7
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/dfRewards.ts file: ./src/mappings/dfRewards.ts
entities: entities: