Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
128 changes: 128 additions & 0 deletions packages/subgraph/abis/HorizonStaking.json
Original file line number Diff line number Diff line change
Expand Up @@ -2468,5 +2468,133 @@
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "indexer",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "subgraphDeploymentID",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "epoch",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokens",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "allocationID",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "poi",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "bool",
"name": "isPublic",
"type": "bool"
}
],
"name": "AllocationClosed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "assetHolder",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "indexer",
"type": "address"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "subgraphDeploymentID",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "allocationID",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "epoch",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "tokens",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "protocolTax",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "curationFees",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "queryFees",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "queryRebates",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "delegationRewards",
"type": "uint256"
}
],
"name": "RebateCollected",
"type": "event"
}
]
4 changes: 4 additions & 0 deletions packages/subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ type DelegationPool @entity(immutable: false) {
"Tokens currently thawing"
tokensThawing: BigInt!

# Legacy delegation parameters (only set for legacy pools migrated from pre-Horizon)
"[Legacy] Percentage of indexing rewards for the indexer, in PPM. Used to calculate delegation rewards from legacy allocations."
legacyIndexingRewardCut: Int

# Metadata
"Block number when entity was created"
createdAtBlock: BigInt!
Expand Down
143 changes: 142 additions & 1 deletion packages/subgraph/src/config/arbitrum-one/delegation-seed.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// AUTO-GENERATED FILE - DO NOT EDIT MANUALLY
// Regenerate with: cd packages/tools && NETWORK=arbitrum-one pnpm seed:delegations
// Generated: 2026-05-12T13:42:53.536Z
// Generated: 2026-05-15T17:51:09.515Z
// Network: arbitrum-one
// Block: 408825706
//
// Indexers with delegations: 135
// Note: Individual delegators/delegations are lazy-initialized, not seeded at genesis

// Indexer addresses with delegations (for DelegationPool seeding)
// IMPORTANT: LEGACY_INDEXER_REWARD_CUTS must be in the same order as this array
export const DELEGATED_INDEXER_ADDRESSES: string[] = [
"0x0058223c6617cca7ce76fc929ec9724cd43d4542",
"0x01e110178f15aeec1cccc507939109175dc9c121",
Expand Down Expand Up @@ -145,3 +146,143 @@ export const DELEGATED_INDEXER_ADDRESSES: string[] = [
"0xfc842f81490dcb37e82d416b2d28327dfb24ba9a",
"0xfeff9093f6b32d0e5cddba743b06a1fedb87c004",
]

// Legacy indexing reward cuts in PPM (parallel array, same order as DELEGATED_INDEXER_ADDRESSES)
// Used to calculate delegation rewards from legacy allocations
export const LEGACY_INDEXER_REWARD_CUTS: i32[] = [
831000,
880000,
780000,
610000,
1000000,
150000,
200000,
250000,
1000000,
100000,
230000,
1000000,
1000000,
1000000,
350000,
373300,
1000000,
1000000,
1000000,
100000,
1000000,
480000,
500000,
295000,
1000000,
301000,
1000000,
180000,
800000,
780700,
50000,
900000,
350000,
200000,
1000000,
1000000,
490000,
20,
500000,
999950,
340000,
280000,
600000,
1000000,
220100,
540000,
1000000,
1000000,
1000000,
900000,
1000000,
950000,
1000000,
425560,
1000000,
700000,
1000000,
1000000,
800000,
1000000,
899560,
697300,
560000,
0,
220600,
1000000,
900000,
1000000,
200000,
201500,
1000000,
300000,
250000,
1000000,
200000,
220000,
255340,
930000,
1000000,
1000000,
1000000,
70000,
183610,
846000,
1000000,
1000000,
1000000,
1000000,
1000000,
610000,
880000,
251060,
126000,
1000000,
200000,
450000,
1000000,
530000,
885000,
1000000,
1000000,
1000000,
1000000,
1000000,
350000,
418600,
360000,
1000000,
487065,
200000,
247100,
880000,
1000000,
1000000,
150000,
1000000,
1000000,
207500,
290000,
273700,
1000000,
177500,
1000000,
580000,
300000,
1000000,
1000000,
960000,
1000000,
1000000,
210000,
255000,
1000000,
278000,
485000,
]
5 changes: 3 additions & 2 deletions packages/subgraph/src/config/arbitrum-one/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Address } from "@graphprotocol/graph-ts"
import { NetworkConfig } from "../types"
import { SERVICE_PROVIDER_ADDRESSES } from "./indexer-seed"
import { DELEGATED_INDEXER_ADDRESSES } from "./delegation-seed"
import { DELEGATED_INDEXER_ADDRESSES, LEGACY_INDEXER_REWARD_CUTS } from "./delegation-seed"

export const config = new NetworkConfig(
"arbitrum-one",
Address.fromString("0x00669A4CF01450B64E8A2A20E9b1FCB71E61eF03"),
Address.fromString("0xb2Bb92d0DE618878E438b55D5846cfecD9301105"),
408_825_706,
SERVICE_PROVIDER_ADDRESSES,
DELEGATED_INDEXER_ADDRESSES
DELEGATED_INDEXER_ADDRESSES,
LEGACY_INDEXER_REWARD_CUTS
)
7 changes: 7 additions & 0 deletions packages/subgraph/src/config/test/delegation-seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ export const DELEGATED_INDEXER_ADDRESSES: string[] = [
"0x1111111111111111111111111111111111111111",
"0x2222222222222222222222222222222222222222",
]

// Legacy indexing reward cuts in PPM (parallel array, same order as DELEGATED_INDEXER_ADDRESSES)
// Used to calculate delegation rewards from legacy allocations
export const LEGACY_INDEXER_REWARD_CUTS: i32[] = [
823076, // 82.3076% to indexer, 17.6924% to delegators
823076,
]
5 changes: 3 additions & 2 deletions packages/subgraph/src/config/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Address } from "@graphprotocol/graph-ts"
import { NetworkConfig } from "../types"
import { SERVICE_PROVIDER_ADDRESSES } from "./indexer-seed"
import { DELEGATED_INDEXER_ADDRESSES } from "./delegation-seed"
import { DELEGATED_INDEXER_ADDRESSES, LEGACY_INDEXER_REWARD_CUTS } from "./delegation-seed"

export const config = new NetworkConfig(
"test",
Address.fromString("0x4444444444444444444444444444444444444444"),
Address.fromString("0x5555555555555555555555555555555555555555"),
1,
SERVICE_PROVIDER_ADDRESSES,
DELEGATED_INDEXER_ADDRESSES
DELEGATED_INDEXER_ADDRESSES,
LEGACY_INDEXER_REWARD_CUTS
)
12 changes: 11 additions & 1 deletion packages/subgraph/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,32 @@ export class NetworkConfig {
horizonStakingAddress: Address
subgraphServiceAddress: Address
startBlock: i32
// List of existing service providers with stake > 0 at Horizon genesis
// Used to trigger state migration
serviceProviderAddresses: string[]
// List of existing delegation pools with tokens > 0 at Horizon genesis
// Used to trigger state migration
delegatedIndexerAddresses: string[]
// Legacy indexer reward cuts in PPM (parts per million)
// Parallel array with delegatedIndexerAddresses - same index = same indexer
// Used to calculate delegation rewards from legacy indexing rewards
legacyIndexerRewardCuts: i32[]

constructor(
network: string,
horizonStakingAddress: Address,
subgraphServiceAddress: Address,
startBlock: i32,
serviceProviderAddresses: string[],
delegatedIndexerAddresses: string[]
delegatedIndexerAddresses: string[],
legacyIndexerRewardCuts: i32[]
) {
this.network = network
this.horizonStakingAddress = horizonStakingAddress
this.subgraphServiceAddress = subgraphServiceAddress
this.startBlock = startBlock
this.serviceProviderAddresses = serviceProviderAddresses
this.delegatedIndexerAddresses = delegatedIndexerAddresses
this.legacyIndexerRewardCuts = legacyIndexerRewardCuts
}
}
Loading
Loading