Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
83303d3
feat: prepared configs, placeholder mapping file
juanmardefago Feb 19, 2025
dfa15dd
feat: added basic service registry for Horizon
juanmardefago Feb 20, 2025
3c5144b
fix: abi.decode potential decoding failure
juanmardefago Feb 24, 2025
dc3485a
chore: placeholder event handlers
juanmardefago Feb 20, 2025
c53dafc
chore: updated ABIs
juanmardefago Feb 24, 2025
9b7848f
feat: implemented AllocationCreated, Closed and Resized
juanmardefago Feb 24, 2025
ec7b808
fix: build issues
juanmardefago Feb 24, 2025
e294b7d
chore: placeholder handler definition
juanmardefago Feb 24, 2025
c6cfb8f
feat: added indexing rewards collection handler
juanmardefago Feb 25, 2025
e369281
feat: add QueryFeesCollected support
juanmardefago Feb 26, 2025
6e10a77
feat: added QueryFeesCollected handler with latest contract changes
juanmardefago Feb 27, 2025
100cc4d
feat: add GraphPayments abi
juanmardefago Feb 27, 2025
c1591c0
feat: add tax tracking for Horizon through GraphPayments
juanmardefago Feb 27, 2025
a39e714
feat: placeholders and manifest changes for delegation
juanmardefago Feb 27, 2025
82e1367
feat: added horizon delegation events support
juanmardefago Mar 3, 2025
2134b1b
fix: missing inits
juanmardefago Mar 6, 2025
77e8285
fix: address gh pr feedback
juanmardefago Mar 30, 2025
acaa649
fix: build issues and feedback from PaymentCollection PR
juanmardefago Mar 30, 2025
de56491
fix: addressed AllocationManagement pr feedback
juanmardefago Mar 30, 2025
272e9f1
fix: address feedback from Subgraph Indexing Registration PR
juanmardefago Mar 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/addresses.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class Addresses {
l1GraphTokenGateway: string
l2GraphTokenGateway: string
ethereumDIDRegistry: string
subgraphService: string
isL1: boolean
}

Expand All @@ -45,5 +46,6 @@ export let addresses: Addresses = {
l1GraphTokenGateway: '{{l1GraphTokenGateway}}',
l2GraphTokenGateway: '{{l2GraphTokenGateway}}',
ethereumDIDRegistry: '{{ethereumDIDRegistry}}',
subgraphService: '{{subgraphService}}',
isL1: {{isL1}},
}
51 changes: 0 additions & 51 deletions config/arbitrumGoerliAddressScript.ts

This file was deleted.

1 change: 1 addition & 0 deletions config/arbitrumSepoliaAddressScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export let addresses: Addresses = {
l1GraphTokenGateway: '',
l2GraphTokenGateway: '{{arbsep.L2GraphTokenGateway.address}}',
ethereumDIDRegistry: '{{arbsep.EthereumDIDRegistry.address}}',
subgraphService: '{{arbsep.SubgraphService.address}}',
isL1: false,
}

Expand Down
52 changes: 0 additions & 52 deletions config/goerliAddressScript.ts

This file was deleted.

3 changes: 0 additions & 3 deletions config/ipfs.json

This file was deleted.

52 changes: 0 additions & 52 deletions config/mainnetAddressScript.ts

This file was deleted.

5 changes: 5 additions & 0 deletions config/mainnetArbitrumAddressScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export let addresses: Addresses = {
l1GraphTokenGateway: '',
l2GraphTokenGateway: '{{arbitrum.L2GraphTokenGateway.address}}',
ethereumDIDRegistry: '{{arbitrum.IEthereumDIDRegistry.address}}',
subgraphService: '{{arbitrum.SubgraphService.address}}',
isL1: false,
}

Expand All @@ -46,6 +47,10 @@ const main = (): void => {
if(output.ens == '') {
output.ens = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
// remove once we have proper packages
if(output.subgraphService == '') {
output.subgraphService = '0x0000000000000000000000000000000000000000' // to avoid crashes due to bad config
}
fs.writeFileSync(__dirname + '/generatedAddresses.json', JSON.stringify(output, null, 2))
} catch (e) {
console.log(`Error saving artifacts: ${e.message}`)
Expand Down
3 changes: 0 additions & 3 deletions config/no-ipfs.json

This file was deleted.

55 changes: 0 additions & 55 deletions config/sepoliaAddressScript.ts

This file was deleted.

1 change: 1 addition & 0 deletions config/testAddressesL1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export let addresses: Addresses = {
l1GraphTokenGateway: '0x0000000000000000000000000000000000000000',
l2GraphTokenGateway: '',
ethereumDIDRegistry: '0x0000000000000000000000000000000000000000',
subgraphService: '0x0000000000000000000000000000000000000000',
isL1: true,
}

Expand Down
1 change: 1 addition & 0 deletions config/testAddressesL2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export let addresses: Addresses = {
l1GraphTokenGateway: '',
l2GraphTokenGateway: '0x0000000000000000000000000000000000000000',
ethereumDIDRegistry: '0x0000000000000000000000000000000000000000',
subgraphService: '0x0000000000000000000000000000000000000000',
isL1: false,
}

Expand Down
7 changes: 7 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,13 @@ type Provision @entity {
delegatorShares: BigInt!
"Exchange rate of of tokens received for each share"
delegationExchangeRate: BigDecimal!

"Service registry URL for the indexer"
url: String
"Geohash of the indexer. Shows where their indexer is located in the world"
geoHash: String
"Address set as rewards destination for payments to the service provider"
rewardsDestination: Bytes
}

enum PaymentTypes {
Expand Down
22 changes: 22 additions & 0 deletions src/mappings/subgraphService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ethereum, ValueKind, log } from "@graphprotocol/graph-ts"
import { RewardsDestinationSet, ServiceProviderRegistered } from "../types/SubgraphService/SubgraphService"
import { createOrLoadProvision } from "./helpers/helpers"

export function handleServiceProviderRegistered(event: ServiceProviderRegistered): void {
let decodedCalldata = ethereum.decode('(string,string,address)', event.params.data)
if( decodedCalldata != null && decodedCalldata.kind == ethereum.ValueKind.TUPLE) {
let tupleData = decodedCalldata.toTuple()
let provision = createOrLoadProvision(event.params.serviceProvider, event.address, event.block.timestamp)
provision.url = tupleData[0].toString()
provision.geoHash = tupleData[1].toString()
provision.save()
} else {
log.warning("ServiceProviderRegistered failed to decode: {}", [event.params.data.toHexString()])
}
}

export function handleRewardsDestinationSet(event: RewardsDestinationSet): void {
let provision = createOrLoadProvision(event.params.indexer, event.address, event.block.timestamp)
provision.rewardsDestination = event.params.rewardsDestination
provision.save()
}
26 changes: 26 additions & 0 deletions subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,32 @@ dataSources:
handler: handleDelegationFeeCutSet
- event: TokensToDelegationPoolAdded(indexed address,indexed address,uint256)
handler: handleTokensToDelegationPoolAdded
- kind: ethereum/contract
name: SubgraphService
network: {{network}}
source:
address: "{{subgraphService}}"
abi: SubgraphService
startBlock: {{blockNumber}}
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
file: ./src/mappings/subgraphService.ts
entities:
- GraphNetwork
abis:
- name: SubgraphService
file: ./abis/SubgraphService.json
- name: GraphToken
file: ./node_modules/@graphprotocol/contracts/dist/abis/GraphToken.json
- name: EpochManager
file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json
eventHandlers:
- event: ServiceProviderRegistered(indexed address,bytes)
handler: handleServiceProviderRegistered
- event: RewardsDestinationSet(indexed address,indexed address)
handler: handleRewardsDestinationSet
- kind: ethereum/contract
name: Curation
network: {{network}}
Expand Down