diff --git a/.gitignore b/.gitignore index e5c1c5e..b019b32 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ logs/ # Generated by server prebuild (copied from shared/ and indexer/src/) server/src/system-context.ts server/src/schema-defs.ts -server/src/table-metadata.ts \ No newline at end of file +server/src/table-metadata.ts +server/ponder-env.d.ts diff --git a/indexer/abis/PoRepMarket.ts b/indexer/abis/PoRepMarket.ts new file mode 100644 index 0000000..9100744 --- /dev/null +++ b/indexer/abis/PoRepMarket.ts @@ -0,0 +1,1838 @@ +// PoRep Market (fidlabs/porep-market) mainnet V1 ABI. +// Source: fidlabs/porep-market@8a20c1a (branch v1) abis/PoRepMarket.json +export const PoRepMarketAbi = [ + { + "type": "constructor", + "inputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_ADMIN_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "EPOCHS_IN_MONTH", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MAX_DEAL_DURATION_DAYS", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint32", + "internalType": "uint32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MIN_DEAL_DURATION_DAYS", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint32", + "internalType": "uint32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "SECTOR_SIZE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADER_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADE_INTERFACE_VERSION", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "acceptDeal", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "completeDeal", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "getClientSmartContract", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getCompletedDeals", + "inputs": [], + "outputs": [ + { + "name": "completedDeals", + "type": "tuple[]", + "internalType": "struct PoRepTypes.DealProposal[]", + "components": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "client", + "type": "address", + "internalType": "address" + }, + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "requirements", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "terms", + "type": "tuple", + "internalType": "struct SLITypes.DealTerms", + "components": [ + { + "name": "dealSizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pricePerSectorPerMonth", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "durationDays", + "type": "uint32", + "internalType": "uint32" + } + ] + }, + { + "name": "validator", + "type": "address", + "internalType": "address" + }, + { + "name": "state", + "type": "uint8", + "internalType": "enum PoRepTypes.DealState" + }, + { + "name": "railId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "proposedAtBlock", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "manifestLocation", + "type": "string", + "internalType": "string" + }, + { + "name": "manifestHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getDealCompletionPadding", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getDealProposal", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct PoRepTypes.DealProposal", + "components": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "client", + "type": "address", + "internalType": "address" + }, + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "requirements", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "terms", + "type": "tuple", + "internalType": "struct SLITypes.DealTerms", + "components": [ + { + "name": "dealSizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pricePerSectorPerMonth", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "durationDays", + "type": "uint32", + "internalType": "uint32" + } + ] + }, + { + "name": "validator", + "type": "address", + "internalType": "address" + }, + { + "name": "state", + "type": "uint8", + "internalType": "enum PoRepTypes.DealState" + }, + { + "name": "railId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "proposedAtBlock", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "manifestLocation", + "type": "string", + "internalType": "string" + }, + { + "name": "manifestHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getDealProposalExpiration", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getDeals", + "inputs": [], + "outputs": [ + { + "name": "deals", + "type": "tuple[]", + "internalType": "struct PoRepTypes.DealProposal[]", + "components": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "client", + "type": "address", + "internalType": "address" + }, + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "requirements", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "terms", + "type": "tuple", + "internalType": "struct SLITypes.DealTerms", + "components": [ + { + "name": "dealSizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pricePerSectorPerMonth", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "durationDays", + "type": "uint32", + "internalType": "uint32" + } + ] + }, + { + "name": "validator", + "type": "address", + "internalType": "address" + }, + { + "name": "state", + "type": "uint8", + "internalType": "enum PoRepTypes.DealState" + }, + { + "name": "railId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "proposedAtBlock", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "manifestLocation", + "type": "string", + "internalType": "string" + }, + { + "name": "manifestHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getDealsForOrganizationByState", + "inputs": [ + { + "name": "organization", + "type": "address", + "internalType": "address" + }, + { + "name": "state", + "type": "uint8", + "internalType": "enum PoRepTypes.DealState" + } + ], + "outputs": [ + { + "name": "deals", + "type": "tuple[]", + "internalType": "struct PoRepTypes.DealProposal[]", + "components": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "client", + "type": "address", + "internalType": "address" + }, + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "requirements", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "terms", + "type": "tuple", + "internalType": "struct SLITypes.DealTerms", + "components": [ + { + "name": "dealSizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pricePerSectorPerMonth", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "durationDays", + "type": "uint32", + "internalType": "uint32" + } + ] + }, + { + "name": "validator", + "type": "address", + "internalType": "address" + }, + { + "name": "state", + "type": "uint8", + "internalType": "enum PoRepTypes.DealState" + }, + { + "name": "railId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "proposedAtBlock", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "manifestLocation", + "type": "string", + "internalType": "string" + }, + { + "name": "manifestHash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getManifestHash", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "manifestHash", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getManifestLocation", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "manifestLocation", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getRoleAdmin", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getSPRegistryContract", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getValidatorFactoryContract", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "grantRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "hasRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "_admin", + "type": "address", + "internalType": "address" + }, + { + "name": "_validatorFactory", + "type": "address", + "internalType": "address" + }, + { + "name": "_spRegistry", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "proposeDeal", + "inputs": [ + { + "name": "requirements", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "terms", + "type": "tuple", + "internalType": "struct SLITypes.DealTerms", + "components": [ + { + "name": "dealSizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pricePerSectorPerMonth", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "durationDays", + "type": "uint32", + "internalType": "uint32" + } + ] + }, + { + "name": "manifestInfo", + "type": "tuple", + "internalType": "struct PoRepTypes.ManifestStruct", + "components": [ + { + "name": "location", + "type": "string", + "internalType": "string" + }, + { + "name": "hash", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "proxiableUUID", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "rejectAcceptedDeal", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "rejectDeal", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "rejectExpiredDeal", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "callerConfirmation", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "revokeRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setClientSmartContract", + "inputs": [ + { + "name": "_clientSmartContract", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setDealCompletionPadding", + "inputs": [ + { + "name": "padding", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setNewDealProposalExpiration", + "inputs": [ + { + "name": "newDealProposalExpiration", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "terminateDeal", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "terminator", + "type": "address", + "internalType": "address" + }, + { + "name": "endEpoch", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "updateManifestLocation", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "newManifestLocation", + "type": "string", + "internalType": "string" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "updateRailId", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "railId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "updateValidator", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "upgradeToAndCall", + "inputs": [ + { + "name": "newImplementation", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "event", + "name": "ClientSmartContractUpdated", + "inputs": [ + { + "name": "clientSmartContract", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DealAccepted", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "owner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DealCompleted", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "client", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "actualSizeBytes", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DealCompletionPaddingUpdated", + "inputs": [ + { + "name": "oldPadding", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "newPadding", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DealProposalCreated", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "client", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "requirements", + "type": "tuple", + "indexed": false, + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "manifestLocation", + "type": "string", + "indexed": false, + "internalType": "string" + }, + { + "name": "manifestHash", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "totalDealSize", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "proposedAtBlock", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DealProposalExpirationUpdated", + "inputs": [ + { + "name": "newDealProposalExpiration", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DealProposalExpired", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "expiredAtBlock", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DealRejected", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "rejector", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DealTerminated", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "terminator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "endEpoch", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ManifestLocationUpdated", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "oldManifestLocation", + "type": "string", + "indexed": false, + "internalType": "string" + }, + { + "name": "newManifestLocation", + "type": "string", + "indexed": false, + "internalType": "string" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RailIdUpdated", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "railId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleAdminChanged", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "previousAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "newAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleGranted", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleRevoked", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Upgraded", + "inputs": [ + { + "name": "implementation", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ValidatorUpdated", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "validator", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AccessControlBadConfirmation", + "inputs": [] + }, + { + "type": "error", + "name": "AccessControlUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "neededRole", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "CallerIsNotValidator", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "caller", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "DealCompletionPaddingTooHigh", + "inputs": [ + { + "name": "padding", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxPadding", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "DealDoesNotExist", + "inputs": [] + }, + { + "type": "error", + "name": "DealNotExpiredYet", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "currentBlock", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "expirationBlock", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "DealNotInExpectedState", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "currentState", + "type": "uint8", + "internalType": "enum PoRepTypes.DealState" + }, + { + "name": "expectedState", + "type": "uint8", + "internalType": "enum PoRepTypes.DealState" + } + ] + }, + { + "type": "error", + "name": "DealNotRejectable", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ERC1967InvalidImplementation", + "inputs": [ + { + "name": "implementation", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC1967NonPayable", + "inputs": [] + }, + { + "type": "error", + "name": "EmptyManifestHash", + "inputs": [] + }, + { + "type": "error", + "name": "EmptyManifestLocation", + "inputs": [] + }, + { + "type": "error", + "name": "FailedCall", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidAllocationSizeForDealCompletion", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidClientSmartContractAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidDealDuration", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidDealPricePerSectorPerMonth", + "inputs": [ + { + "name": "totalPerMonth", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "epochsInMonth", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InvalidDealProposalExpiration", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidDealSize", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidIndexingPct", + "inputs": [ + { + "name": "value", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidOrganizationAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidRailId", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidRetrievabilityBps", + "inputs": [ + { + "name": "value", + "type": "uint16", + "internalType": "uint16" + } + ] + }, + { + "type": "error", + "name": "NoProviderFoundForDeal", + "inputs": [] + }, + { + "type": "error", + "name": "NotInitializing", + "inputs": [] + }, + { + "type": "error", + "name": "NotTheClientAddress", + "inputs": [] + }, + { + "type": "error", + "name": "NotTheClientOrStorageProviderOrAdmin", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "rejector", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "NotTheControllingAddress", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "msgSender", + "type": "address", + "internalType": "address" + }, + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ] + }, + { + "type": "error", + "name": "NotTheDealValidator", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "validator", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "NotTheRegisteredValidator", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "validator", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "RailIdAlreadySet", + "inputs": [] + }, + { + "type": "error", + "name": "TooLongManifestLocation", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnauthorizedCallContext", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnsupportedProxiableUUID", + "inputs": [ + { + "name": "slot", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "ValidatorAlreadySet", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ValidatorNotSet", + "inputs": [] + } +] as const diff --git a/indexer/abis/PoRepSLIOracle.ts b/indexer/abis/PoRepSLIOracle.ts new file mode 100644 index 0000000..4bcbefe --- /dev/null +++ b/indexer/abis/PoRepSLIOracle.ts @@ -0,0 +1,597 @@ +// PoRep Market (fidlabs/porep-market) mainnet V1 ABI. +// Source: fidlabs/porep-market@8a20c1a (branch v1) abis/SLIOracle.json +export const PoRepSLIOracleAbi = [ + { + "type": "constructor", + "inputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_ADMIN_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "ORACLE_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADER_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADE_INTERFACE_VERSION", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getAttestation", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ], + "outputs": [ + { + "name": "attestation", + "type": "tuple", + "internalType": "struct SLITypes.Attestation", + "components": [ + { + "name": "lastUpdate", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "slis", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getRoleAdmin", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "grantRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "hasRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "admin", + "type": "address", + "internalType": "address" + }, + { + "name": "oracle", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "multicall", + "inputs": [ + { + "name": "data", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "outputs": [ + { + "name": "results", + "type": "bytes[]", + "internalType": "bytes[]" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "proxiableUUID", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "callerConfirmation", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "revokeRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setSLI", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "slis", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "upgradeToAndCall", + "inputs": [ + { + "name": "newImplementation", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleAdminChanged", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "previousAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "newAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleGranted", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleRevoked", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "SLIAttestationUpdate", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "lastUpdate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "slis", + "type": "tuple", + "indexed": false, + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Upgraded", + "inputs": [ + { + "name": "implementation", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AccessControlBadConfirmation", + "inputs": [] + }, + { + "type": "error", + "name": "AccessControlUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "neededRole", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC1967InvalidImplementation", + "inputs": [ + { + "name": "implementation", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC1967NonPayable", + "inputs": [] + }, + { + "type": "error", + "name": "FailedCall", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidAdmin", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidIndexingPct", + "inputs": [ + { + "name": "value", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidOracle", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidRetrievabilityBps", + "inputs": [ + { + "name": "value", + "type": "uint16", + "internalType": "uint16" + } + ] + }, + { + "type": "error", + "name": "NotInitializing", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnauthorizedCallContext", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnsupportedProxiableUUID", + "inputs": [ + { + "name": "slot", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } +] as const diff --git a/indexer/abis/PoRepSPRegistry.ts b/indexer/abis/PoRepSPRegistry.ts new file mode 100644 index 0000000..413566d --- /dev/null +++ b/indexer/abis/PoRepSPRegistry.ts @@ -0,0 +1,1731 @@ +// PoRep Market (fidlabs/porep-market) mainnet V1 ABI. +// Source: fidlabs/porep-market@8a20c1a (branch v1) abis/SPRegistry.json +export const PoRepSPRegistryAbi = [ + { + "type": "constructor", + "inputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_ADMIN_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MARKET_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MAX_DEAL_DURATION_DAYS", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint32", + "internalType": "uint32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MAX_PROVIDERS", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MAX_TOLERANCE_BPS", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "OPERATOR_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADER_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADE_INTERFACE_VERSION", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "blockProvider", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "commitCapacity", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "estimatedSizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "actualSizeBytes", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "getCommittedProviders", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint64[]", + "internalType": "CommonTypes.FilActorId[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getPayee", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getProviderForDeal", + "inputs": [ + { + "name": "requirements", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "terms", + "type": "tuple", + "internalType": "struct SLITypes.DealTerms", + "components": [ + { + "name": "dealSizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pricePerSectorPerMonth", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "durationDays", + "type": "uint32", + "internalType": "uint32" + } + ] + }, + { + "name": "manifestHash", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "", + "type": "bool", + "internalType": "bool" + }, + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "getProviderInfo", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ], + "outputs": [ + { + "name": "info", + "type": "tuple", + "internalType": "struct ISPRegistry.ProviderInfo", + "components": [ + { + "name": "organization", + "type": "address", + "internalType": "address" + }, + { + "name": "payee", + "type": "address", + "internalType": "address" + }, + { + "name": "paused", + "type": "bool", + "internalType": "bool" + }, + { + "name": "blocked", + "type": "bool", + "internalType": "bool" + }, + { + "name": "capabilities", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "availableBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "committedBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pendingBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pricePerSectorPerMonth", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "minDealDurationDays", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "maxDealDurationDays", + "type": "uint32", + "internalType": "uint32" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getProviders", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint64[]", + "internalType": "CommonTypes.FilActorId[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getProvidersByOrganization", + "inputs": [ + { + "name": "organization", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint64[]", + "internalType": "CommonTypes.FilActorId[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getRoleAdmin", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getToleranceBps", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "grantRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "hasRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "_admin", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "initialize2", + "inputs": [ + { + "name": "_poRepMarket", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "isAuthorizedForProvider", + "inputs": [ + { + "name": "caller", + "type": "address", + "internalType": "address" + }, + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isProviderRegistered", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "pauseProvider", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "proxiableUUID", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "registerProviderFor", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "organization", + "type": "address", + "internalType": "address" + }, + { + "name": "capabilities", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "name": "availableBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pricePerSectorPerMonth", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "payee", + "type": "address", + "internalType": "address" + }, + { + "name": "minDealDurationDays", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "maxDealDurationDays", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "releaseCapacity", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "sizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "manifestHash", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "releasePendingCapacity", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "sizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "manifestHash", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "renounceRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "callerConfirmation", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "revokeRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setCapabilities", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "capabilities", + "type": "tuple", + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setDealDurationLimits", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "minDealDurationDays", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "maxDealDurationDays", + "type": "uint32", + "internalType": "uint32" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setPayee", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "payee", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setPrice", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "pricePerSectorPerMonth", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setToleranceBps", + "inputs": [ + { + "name": "bps", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "unblockProvider", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "unpauseProvider", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "updateAvailableSpace", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "availableBytes", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "upgradeToAndCall", + "inputs": [ + { + "name": "newImplementation", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "event", + "name": "AvailableSpaceUpdated", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "availableBytes", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "CapabilitiesUpdated", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "capabilities", + "type": "tuple", + "indexed": false, + "internalType": "struct SLITypes.SLIThresholds", + "components": [ + { + "name": "retrievabilityBps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "bandwidthMbps", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "latencyMs", + "type": "uint16", + "internalType": "uint16" + }, + { + "name": "indexingPct", + "type": "uint8", + "internalType": "uint8" + } + ] + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "CapacityCommitted", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "committedBytes", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "CapacityReleased", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "releasedBytes", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "DealDurationLimitsUpdated", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "minDealDurationDays", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + }, + { + "name": "maxDealDurationDays", + "type": "uint32", + "indexed": false, + "internalType": "uint32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OrganizationAdded", + "inputs": [ + { + "name": "organization", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "PayeeUpdated", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "oldPayee", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newPayee", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "PendingCapacityReleased", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "sizeBytes", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "PendingCapacityReserved", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "sizeBytes", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "PriceUpdated", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "oldPrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newPrice", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProviderBlocked", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProviderPaused", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProviderRegistered", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "organization", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProviderUnblocked", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProviderUnpaused", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "indexed": true, + "internalType": "CommonTypes.FilActorId" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleAdminChanged", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "previousAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "newAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleGranted", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleRevoked", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ToleranceBpsUpdated", + "inputs": [ + { + "name": "oldBps", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + }, + { + "name": "newBps", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Upgraded", + "inputs": [ + { + "name": "implementation", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AccessControlBadConfirmation", + "inputs": [] + }, + { + "type": "error", + "name": "AccessControlUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "neededRole", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "ActorNotFound", + "inputs": [] + }, + { + "type": "error", + "name": "ActualSizeExceedsTolerance", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "actualSize", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxAllowed", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "AvailableBelowCommittedPlusPending", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "availableBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "committedBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pendingBytes", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "CommitExceedsAvailable", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "newCommitted", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "availableBytes", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "DurationExceedsProtocolMax", + "inputs": [ + { + "name": "durationDays", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "maxDays", + "type": "uint32", + "internalType": "uint32" + } + ] + }, + { + "type": "error", + "name": "ERC1967InvalidImplementation", + "inputs": [ + { + "name": "implementation", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC1967NonPayable", + "inputs": [] + }, + { + "type": "error", + "name": "ExitCodeError", + "inputs": [] + }, + { + "type": "error", + "name": "FailToCallActor", + "inputs": [] + }, + { + "type": "error", + "name": "FailedCall", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidActorID", + "inputs": [ + { + "name": "actorId", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ] + }, + { + "type": "error", + "name": "InvalidAdminAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidCodec", + "inputs": [ + { + "name": "", + "type": "uint64", + "internalType": "uint64" + } + ] + }, + { + "type": "error", + "name": "InvalidIndexingPct", + "inputs": [ + { + "name": "value", + "type": "uint8", + "internalType": "uint8" + } + ] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidOrganizationAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidPayeeAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidPoRepMarketAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidProviderActorId", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidResponseLength", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidRetrievabilityBps", + "inputs": [ + { + "name": "value", + "type": "uint16", + "internalType": "uint16" + } + ] + }, + { + "type": "error", + "name": "MaxProvidersReached", + "inputs": [ + { + "name": "maxProviders", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "MinDurationExceedsMax", + "inputs": [ + { + "name": "minDays", + "type": "uint32", + "internalType": "uint32" + }, + { + "name": "maxDays", + "type": "uint32", + "internalType": "uint32" + } + ] + }, + { + "type": "error", + "name": "NotAdminOrOperator", + "inputs": [ + { + "name": "caller", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "NotEnoughBalance", + "inputs": [ + { + "name": "balance", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "value", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "NotInitializing", + "inputs": [] + }, + { + "type": "error", + "name": "NotProviderControllerOrAdmin", + "inputs": [ + { + "name": "caller", + "type": "address", + "internalType": "address" + }, + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ] + }, + { + "type": "error", + "name": "ProviderAlreadyRegistered", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ] + }, + { + "type": "error", + "name": "ProviderIsBlocked", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ] + }, + { + "type": "error", + "name": "ProviderNotRegistered", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + } + ] + }, + { + "type": "error", + "name": "ReleaseExceedsCommitted", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "sizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "committedBytes", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ReleasePendingExceedsPending", + "inputs": [ + { + "name": "provider", + "type": "uint64", + "internalType": "CommonTypes.FilActorId" + }, + { + "name": "sizeBytes", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "pendingBytes", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "ToleranceBpsTooHigh", + "inputs": [ + { + "name": "bps", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "maxBps", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "UUPSUnauthorizedCallContext", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnsupportedProxiableUUID", + "inputs": [ + { + "name": "slot", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } +] as const diff --git a/indexer/abis/PoRepValidatorFactory.ts b/indexer/abis/PoRepValidatorFactory.ts new file mode 100644 index 0000000..7c80f83 --- /dev/null +++ b/indexer/abis/PoRepValidatorFactory.ts @@ -0,0 +1,657 @@ +// PoRep Market (fidlabs/porep-market) mainnet V1 ABI. +// Source: fidlabs/porep-market@8a20c1a (branch v1) abis/ValidatorFactory.json +export const PoRepValidatorFactoryAbi = [ + { + "type": "constructor", + "inputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "DEFAULT_ADMIN_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADER_ROLE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADE_INTERFACE_VERSION", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "create", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "getBeacon", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getInstance", + "inputs": [ + { + "name": "dealId", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getRoleAdmin", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "grantRole", + "inputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "hasRole", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "admin", + "type": "address", + "internalType": "address" + }, + { + "name": "implementation", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "initialize2", + "inputs": [ + { + "name": "_poRepService", + "type": "address", + "internalType": "address" + }, + { + "name": "_filecoinPay", + "type": "address", + "internalType": "address" + }, + { + "name": "_sliScorer", + "type": "address", + "internalType": "address" + }, + { + "name": "_clientSmartContract", + "type": "address", + "internalType": "address" + }, + { + "name": "_poRepMarket", + "type": "address", + "internalType": "address" + }, + { + "name": "_SPRegistry", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "isValidatorContract", + "inputs": [ + { + "name": "contractAddress", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "proxiableUUID", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceRole", + "inputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "revokeRole", + "inputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "setAdmin", + "inputs": [ + { + "name": "newAdmin", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setUpgraderRole", + "inputs": [ + { + "name": "newUpgraderRole", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "upgradeToAndCall", + "inputs": [ + { + "name": "newImplementation", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "event", + "name": "AdminChanged", + "inputs": [ + { + "name": "newAdmin", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "ProxyCreated", + "inputs": [ + { + "name": "proxy", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "dealId", + "type": "uint256", + "indexed": true, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleAdminChanged", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "previousAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "newAdminRole", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleGranted", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "RoleRevoked", + "inputs": [ + { + "name": "role", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "account", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "sender", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Upgraded", + "inputs": [ + { + "name": "implementation", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "UpgraderRoleChanged", + "inputs": [ + { + "name": "newUpgraderRole", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AccessControlBadConfirmation", + "inputs": [] + }, + { + "type": "error", + "name": "AccessControlUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + }, + { + "name": "neededRole", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "Create2EmptyBytecode", + "inputs": [] + }, + { + "type": "error", + "name": "ERC1967InvalidImplementation", + "inputs": [ + { + "name": "implementation", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC1967NonPayable", + "inputs": [] + }, + { + "type": "error", + "name": "FailedCall", + "inputs": [] + }, + { + "type": "error", + "name": "FailedDeployment", + "inputs": [] + }, + { + "type": "error", + "name": "InstanceAlreadyExists", + "inputs": [] + }, + { + "type": "error", + "name": "InsufficientBalance", + "inputs": [ + { + "name": "balance", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "needed", + "type": "uint256", + "internalType": "uint256" + } + ] + }, + { + "type": "error", + "name": "InvalidAdminAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidClientAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidClientSmartContractAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidFilecoinPayAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidImplementationAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidNewAdminAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidNewUpgraderRoleAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidPoRepMarketAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidPoRepServiceAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidSPRegistryAddress", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidSliScorerAddress", + "inputs": [] + }, + { + "type": "error", + "name": "NotInitializing", + "inputs": [] + }, + { + "type": "error", + "name": "RoleManagementDisabled", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnauthorizedCallContext", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnsupportedProxiableUUID", + "inputs": [ + { + "name": "slot", + "type": "bytes32", + "internalType": "bytes32" + } + ] + } +] as const diff --git a/indexer/ponder.config.calibnet.ts b/indexer/ponder.config.calibnet.ts index 4b93dfc..f3100c2 100644 --- a/indexer/ponder.config.calibnet.ts +++ b/indexer/ponder.config.calibnet.ts @@ -5,6 +5,10 @@ import { FilecoinPayV1Abi } from "./abis/FilecoinPayV1" import { ServiceProviderRegistryAbi } from "./abis/ServiceProviderRegistry" import { SessionKeyRegistryAbi } from "./abis/SessionKeyRegistry" import { FilBeamOperatorAbi } from "./abis/FilBeamOperator" +import { PoRepMarketAbi } from "./abis/PoRepMarket" +import { PoRepValidatorFactoryAbi } from "./abis/PoRepValidatorFactory" +import { PoRepSPRegistryAbi } from "./abis/PoRepSPRegistry" +import { PoRepSLIOracleAbi } from "./abis/PoRepSLIOracle" // Calibnet proxy addresses (deployed at v1.0.0, same addresses across UUPS upgrades) // Source: https://github.com/FilOzone/filecoin-services/blob/main/service_contracts/deployments.json @@ -24,12 +28,22 @@ const CALIBNET = { "0xea6631b25ba4c9c9e285da25a03aa96acc921530", // v1.0.1 "0x5991e4f9fcef4ae23959ee03638b4688a7e1ecff", // v1.0.2 (current) ], + // PoRep Market V1 deployment at calibnet block 3,648,217. + // Source: fidlabs/porep-market@8a20c1a deployments/calibnet/3648217.json. + // PoRep Market V2 is not indexed. + POREP_MARKET: "0x32B13b88b038652B3D48262DeCF003a1799345B0", + POREP_VALIDATOR_FACTORY: "0xB97628717A1455AEAB0f155563fF581d9B500ca4", + POREP_SP_REGISTRY: "0x5be8aFda370e0a438171c2994570C22A4dE7f779", + POREP_SLI_ORACLE: "0x24879927832AD22b66E129f2825da7408dC1f753", } as const // Snapshot floor is 3,090,000 (null round); start +2 so the parent is valid. // Captures FilecoinPay rail 1 (3,125,305) and PDPVerifier sets 1-48 (3,144,601 onward). const START_BLOCK = 3_090_002 +// PoRep Market V1 deployed at calibnet block 3,648,217. +const POREP_START_BLOCK = 3_648_217 + export default createConfig({ database: { kind: "postgres", @@ -100,5 +114,33 @@ export default createConfig({ startBlock: START_BLOCK, includeTransactionReceipts: true, }, + PoRepMarket: { + abi: PoRepMarketAbi, + chain: "calibnet", + address: CALIBNET.POREP_MARKET, + startBlock: POREP_START_BLOCK, + includeTransactionReceipts: true, + }, + PoRepValidatorFactory: { + abi: PoRepValidatorFactoryAbi, + chain: "calibnet", + address: CALIBNET.POREP_VALIDATOR_FACTORY, + startBlock: POREP_START_BLOCK, + includeTransactionReceipts: true, + }, + PoRepSPRegistry: { + abi: PoRepSPRegistryAbi, + chain: "calibnet", + address: CALIBNET.POREP_SP_REGISTRY, + startBlock: POREP_START_BLOCK, + includeTransactionReceipts: true, + }, + PoRepSLIOracle: { + abi: PoRepSLIOracleAbi, + chain: "calibnet", + address: CALIBNET.POREP_SLI_ORACLE, + startBlock: POREP_START_BLOCK, + includeTransactionReceipts: true, + }, }, }) diff --git a/indexer/ponder.config.mainnet.ts b/indexer/ponder.config.mainnet.ts index e976149..2c25e4e 100644 --- a/indexer/ponder.config.mainnet.ts +++ b/indexer/ponder.config.mainnet.ts @@ -5,6 +5,10 @@ import { FilecoinPayV1Abi } from "./abis/FilecoinPayV1" import { ServiceProviderRegistryAbi } from "./abis/ServiceProviderRegistry" import { SessionKeyRegistryAbi } from "./abis/SessionKeyRegistry" import { FilBeamOperatorAbi } from "./abis/FilBeamOperator" +import { PoRepMarketAbi } from "./abis/PoRepMarket" +import { PoRepValidatorFactoryAbi } from "./abis/PoRepValidatorFactory" +import { PoRepSPRegistryAbi } from "./abis/PoRepSPRegistry" +import { PoRepSLIOracleAbi } from "./abis/PoRepSLIOracle" // Mainnet proxy addresses (deployed at v1.0.0, same addresses across UUPS upgrades) // Source: https://github.com/FilOzone/filecoin-services/blob/main/service_contracts/deployments.json @@ -23,11 +27,22 @@ const MAINNET = { "0xea6631b25ba4c9c9e285da25a03aa96acc921530", // v1.0.1 "0x9e90749d298c4ca43bb468ca859dfe167f9cdcf2", // v1.0.2 (current) ], + // PoRep Market V1 deployment at mainnet block 5,934,189. This separate service + // uses FilecoinPay and deploys one Validator (FilecoinPay operator) per deal. + // Source: fidlabs/porep-market@8a20c1a deployments/mainnet/latest.json. + POREP_MARKET: "0xBD669aBd1188F52e82aF114E17aCE2842DCc0Eb4", + POREP_VALIDATOR_FACTORY: "0x1814d77CDef6297e9E015667d912aE11ae6f68D8", + POREP_SP_REGISTRY: "0x504cF6660109fBa811d7e928Cb9d2d87cBa799d9", + POREP_SLI_ORACLE: "0x09c513F1C68d74b69a9550745BB779F346556577", } as const // v1.0.0 deployed ~epoch 5,220,000 on mainnet (Nov 2, 2025). Start slightly before. const START_BLOCK = 5_215_000 +// PoRep Market V1 deployed at block 5,934,189 on mainnet (after the FOC contracts); +// its contracts start there to skip ~700k blocks of empty history. +const POREP_START_BLOCK = 5_934_189 + export default createConfig({ database: { kind: "postgres", @@ -98,5 +113,33 @@ export default createConfig({ startBlock: START_BLOCK, includeTransactionReceipts: true, }, + PoRepMarket: { + abi: PoRepMarketAbi, + chain: "mainnet", + address: MAINNET.POREP_MARKET, + startBlock: POREP_START_BLOCK, + includeTransactionReceipts: true, + }, + PoRepValidatorFactory: { + abi: PoRepValidatorFactoryAbi, + chain: "mainnet", + address: MAINNET.POREP_VALIDATOR_FACTORY, + startBlock: POREP_START_BLOCK, + includeTransactionReceipts: true, + }, + PoRepSPRegistry: { + abi: PoRepSPRegistryAbi, + chain: "mainnet", + address: MAINNET.POREP_SP_REGISTRY, + startBlock: POREP_START_BLOCK, + includeTransactionReceipts: true, + }, + PoRepSLIOracle: { + abi: PoRepSLIOracleAbi, + chain: "mainnet", + address: MAINNET.POREP_SLI_ORACLE, + startBlock: POREP_START_BLOCK, + includeTransactionReceipts: true, + }, }, }) diff --git a/indexer/ponder.schema.ts b/indexer/ponder.schema.ts index 93ef455..848cf32 100644 --- a/indexer/ponder.schema.ts +++ b/indexer/ponder.schema.ts @@ -144,3 +144,19 @@ export const storachaFwssOwnershipTransferred = tables.storacha_fwss_ownership_t export const storachaFwssServiceDeployed = tables.storacha_fwss_service_deployed export const storachaFwssFilbeamControllerChanged = tables.storacha_fwss_filbeam_controller_changed export const storachaFwssViewContractSet = tables.storacha_fwss_view_contract_set + +// PoRep Market (fidlabs cold-storage market on shared FilecoinPay), mainnet V1 +export const porepDealProposalCreated = tables.porep_deal_proposal_created +export const porepDealAccepted = tables.porep_deal_accepted +export const porepValidatorUpdated = tables.porep_validator_updated +export const porepRailIdUpdated = tables.porep_rail_id_updated +export const porepDealCompleted = tables.porep_deal_completed +export const porepDealTerminated = tables.porep_deal_terminated +export const porepDealRejected = tables.porep_deal_rejected +export const porepDealProposalExpired = tables.porep_deal_proposal_expired +export const porepProxyCreated = tables.porep_proxy_created +export const porepSpRegistered = tables.porep_sp_registered +export const porepSpPayeeUpdated = tables.porep_sp_payee_updated +export const porepSpPriceUpdated = tables.porep_sp_price_updated +export const porepSpCapabilitiesUpdated = tables.porep_sp_capabilities_updated +export const porepSliAttestationUpdate = tables.porep_sli_attestation_update diff --git a/indexer/src/porep.ts b/indexer/src/porep.ts new file mode 100644 index 0000000..e8c6456 --- /dev/null +++ b/indexer/src/porep.ts @@ -0,0 +1,149 @@ +import { ponder } from "ponder:registry" +import { + porepDealProposalCreated, + porepDealAccepted, + porepValidatorUpdated, + porepRailIdUpdated, + porepDealCompleted, + porepDealTerminated, + porepDealRejected, + porepDealProposalExpired, + porepProxyCreated, + porepSpRegistered, + porepSpPayeeUpdated, + porepSpPriceUpdated, + porepSpCapabilitiesUpdated, + porepSliAttestationUpdate, +} from "ponder:schema" +import { eventId, eventMeta } from "./event-utils.js" + +/** SLIThresholds tuple -> flat integer columns. Fields are uint16/uint8, safe as JS numbers. */ +function sliColumns(t: { + retrievabilityBps: number | bigint + bandwidthMbps: number | bigint + latencyMs: number | bigint + indexingPct: number | bigint +}) { + return { + retrievabilityBps: Number(t.retrievabilityBps), + bandwidthMbps: Number(t.bandwidthMbps), + latencyMs: Number(t.latencyMs), + indexingPct: Number(t.indexingPct), + } +} + +// -- PoRepMarket: deal lifecycle -- + +ponder.on("PoRepMarket:DealProposalCreated", async ({ event, context }) => { + const { dealId, client, provider, requirements, manifestLocation, manifestHash, totalDealSize, proposedAtBlock } = + event.args + await context.db.insert(porepDealProposalCreated).values({ + id: eventId(event), + dealId, + client, + providerId: provider, + ...sliColumns(requirements), + manifestLocation, + manifestHash, + totalDealSize, + proposedAtBlock, + ...eventMeta(event), + }) +}) + +ponder.on("PoRepMarket:DealAccepted", async ({ event, context }) => { + const { dealId, owner, provider } = event.args + await context.db + .insert(porepDealAccepted) + .values({ id: eventId(event), dealId, owner, providerId: provider, ...eventMeta(event) }) +}) + +ponder.on("PoRepMarket:ValidatorUpdated", async ({ event, context }) => { + const { dealId, validator } = event.args + await context.db + .insert(porepValidatorUpdated) + .values({ id: eventId(event), dealId, validator, ...eventMeta(event) }) +}) + +ponder.on("PoRepMarket:RailIdUpdated", async ({ event, context }) => { + const { dealId, railId } = event.args + await context.db + .insert(porepRailIdUpdated) + .values({ id: eventId(event), dealId, railId, ...eventMeta(event) }) +}) + +ponder.on("PoRepMarket:DealCompleted", async ({ event, context }) => { + const { dealId, client, actualSizeBytes, provider } = event.args + await context.db + .insert(porepDealCompleted) + .values({ id: eventId(event), dealId, client, actualSizeBytes, providerId: provider, ...eventMeta(event) }) +}) + +ponder.on("PoRepMarket:DealTerminated", async ({ event, context }) => { + const { dealId, terminator, endEpoch } = event.args + await context.db + .insert(porepDealTerminated) + .values({ id: eventId(event), dealId, terminator, endEpoch, ...eventMeta(event) }) +}) + +ponder.on("PoRepMarket:DealRejected", async ({ event, context }) => { + const { dealId, rejector } = event.args + await context.db + .insert(porepDealRejected) + .values({ id: eventId(event), dealId, rejector, ...eventMeta(event) }) +}) + +ponder.on("PoRepMarket:DealProposalExpired", async ({ event, context }) => { + const { dealId, expiredAtBlock } = event.args + await context.db + .insert(porepDealProposalExpired) + .values({ id: eventId(event), dealId, expiredAtBlock, ...eventMeta(event) }) +}) + +// -- ValidatorFactory: per-deal operator discovery -- + +ponder.on("PoRepValidatorFactory:ProxyCreated", async ({ event, context }) => { + const { proxy, dealId } = event.args + await context.db + .insert(porepProxyCreated) + .values({ id: eventId(event), proxy, dealId, ...eventMeta(event) }) +}) + +// -- PoRep SP registry (separate from FOC ServiceProviderRegistry) -- + +ponder.on("PoRepSPRegistry:ProviderRegistered", async ({ event, context }) => { + const { provider, organization } = event.args + await context.db + .insert(porepSpRegistered) + .values({ id: eventId(event), providerId: provider, organization, ...eventMeta(event) }) +}) + +ponder.on("PoRepSPRegistry:PayeeUpdated", async ({ event, context }) => { + const { provider, oldPayee, newPayee } = event.args + await context.db + .insert(porepSpPayeeUpdated) + .values({ id: eventId(event), providerId: provider, oldPayee, newPayee, ...eventMeta(event) }) +}) + +ponder.on("PoRepSPRegistry:PriceUpdated", async ({ event, context }) => { + const { provider, oldPrice, newPrice } = event.args + await context.db + .insert(porepSpPriceUpdated) + .values({ id: eventId(event), providerId: provider, oldPrice, newPrice, ...eventMeta(event) }) +}) + +ponder.on("PoRepSPRegistry:CapabilitiesUpdated", async ({ event, context }) => { + const { provider, capabilities } = event.args + await context.db + .insert(porepSpCapabilitiesUpdated) + .values({ id: eventId(event), providerId: provider, ...sliColumns(capabilities), ...eventMeta(event) }) +}) + +// -- SLIOracle: provider attestations used during settlement -- + +ponder.on("PoRepSLIOracle:SLIAttestationUpdate", async ({ event, context }) => { + const { provider, lastUpdate, slis } = event.args + await context.db + .insert(porepSliAttestationUpdate) + .values({ id: eventId(event), providerId: provider, lastUpdate, ...sliColumns(slis), ...eventMeta(event) }) +}) diff --git a/indexer/src/schema-defs.ts b/indexer/src/schema-defs.ts index 6b321e7..b504778 100644 --- a/indexer/src/schema-defs.ts +++ b/indexer/src/schema-defs.ts @@ -727,4 +727,143 @@ export const TABLES: Record = { viewContract: { type: "hex" }, }, }, + + // -- PoRep Market (fidlabs cold-storage market on shared FilecoinPay) -- + // A separate service with its own SP registry, DataCap+SLI proof, and + // one per-deal Validator contract as the FilecoinPay operator. These tables + // track mainnet V1 events. Bridge to payment data via porep_rail_id_updated. + porep_deal_proposal_created: { + description: "PoRep Market deal proposed. client = payer, providerId = SP Filecoin actor id (uint64), the four SLI columns are the deal's required thresholds, manifestHash = content id, totalDealSize in bytes. Price is recorded in porep_sp_price_updated. Bridge to the payment rail via porep_rail_id_updated.rail_id -> fp_rail_created.rail_id.", + columns: { + dealId: { type: "bigint" }, + client: { type: "hex", note: "payer address" }, + providerId: { type: "bigint", note: "SP Filecoin actor id" }, + retrievabilityBps: { type: "int", note: "required SLI: retrievability, basis points" }, + bandwidthMbps: { type: "int", note: "required SLI: bandwidth, Mbps" }, + latencyMs: { type: "int", note: "required SLI: latency, ms" }, + indexingPct: { type: "int", note: "required SLI: indexing, percent" }, + manifestLocation: { type: "text" }, + manifestHash: { type: "hex", note: "bytes32 content-addressed deal data hash" }, + totalDealSize: { type: "bigint", note: "bytes" }, + proposedAtBlock: { type: "bigint" }, + }, + indexes: ["dealId", "client", "providerId", "blockNumber"], + }, + porep_deal_accepted: { + description: "PoRep Market deal accepted by the SP (Proposed -> Accepted)", + columns: { + dealId: { type: "bigint" }, + owner: { type: "hex" }, + providerId: { type: "bigint", note: "SP Filecoin actor id" }, + }, + indexes: ["dealId", "providerId"], + }, + porep_validator_updated: { + description: "PoRep deal's per-deal Validator (FilecoinPay operator) contract set. validator = fp_rail_created.operator. Redundant with porep_proxy_created but keyed by dealId.", + columns: { + dealId: { type: "bigint" }, + validator: { type: "hex" }, + }, + indexes: ["dealId", "validator"], + }, + porep_rail_id_updated: { + description: "Links a PoRep deal to its FilecoinPay rail. Primary bridge: railId joins fp_rail_created / fp_rail_settled; dealId joins the porep_deal_* tables. Lets fp_* revenue/settlement analytics attribute to PoRep deals, clients, and SPs.", + columns: { + dealId: { type: "bigint" }, + railId: { type: "bigint" }, + }, + indexes: ["dealId", "railId", "blockNumber"], + }, + porep_deal_completed: { + description: "PoRep Market deal completed (Accepted -> Completed). actualSizeBytes = realized stored size.", + columns: { + dealId: { type: "bigint" }, + client: { type: "hex" }, + actualSizeBytes: { type: "bigint", note: "bytes" }, + providerId: { type: "bigint", note: "SP Filecoin actor id" }, + }, + indexes: ["dealId", "providerId"], + }, + porep_deal_terminated: { + description: "PoRep Market deal terminated. endEpoch = payment obligation end.", + columns: { + dealId: { type: "bigint" }, + terminator: { type: "hex" }, + endEpoch: { type: "bigint", note: "epoch" }, + }, + indexes: ["dealId"], + }, + porep_deal_rejected: { + description: "PoRep Market deal proposal rejected by the SP", + columns: { + dealId: { type: "bigint" }, + rejector: { type: "hex" }, + }, + indexes: ["dealId"], + }, + porep_deal_proposal_expired: { + description: "PoRep Market deal proposal expired without acceptance", + columns: { + dealId: { type: "bigint" }, + expiredAtBlock: { type: "bigint" }, + }, + indexes: ["dealId"], + }, + porep_proxy_created: { + description: "PoRep ValidatorFactory deployed a per-deal Validator (the FilecoinPay operator for that deal). proxy = fp_rail_created.operator; dealId links to porep_deal_*. Discovers every per-deal operator address.", + columns: { + proxy: { type: "hex", note: "per-deal Validator = fp_rail_created.operator" }, + dealId: { type: "bigint" }, + }, + indexes: ["proxy", "dealId"], + }, + porep_sp_registered: { + description: "SP registered in the PoRep SP registry (separate from FOC ServiceProviderRegistry). providerId = Filecoin actor id; organization = the registering wallet (also the default payee).", + columns: { + providerId: { type: "bigint", note: "SP Filecoin actor id" }, + organization: { type: "hex" }, + }, + indexes: ["providerId", "organization"], + }, + porep_sp_payee_updated: { + description: "PoRep SP payee address changed. newPayee = fp_rail_created.payee; providerId = SP Filecoin actor id. Resolves rail payees to PoRep SPs. This event fires only when the payee changes. An SP whose initial custom payee never changes requires a getPayee(providerId) RPC read; otherwise organization from porep_sp_registered is the default payee.", + columns: { + providerId: { type: "bigint", note: "SP Filecoin actor id" }, + oldPayee: { type: "hex" }, + newPayee: { type: "hex" }, + }, + indexes: ["providerId", "newPayee"], + }, + porep_sp_price_updated: { + description: "PoRep SP price changed. newPrice = price per 32GiB sector per month as a raw integer. Deal rate = price * sectorCount / 86400 epochs. The payment token is chosen per-deal at createRail (mainnet: USDFC or axlUSDC), so scale by the deal's rail token decimals (USDFC 1e18, axlUSDC 1e6), not a fixed 1e18.", + columns: { + providerId: { type: "bigint", note: "SP Filecoin actor id" }, + oldPrice: { type: "bigint" }, + newPrice: { type: "bigint", note: "per 32GiB sector per month, smallest units of the deal's payment token (token is per-deal, not stored here)" }, + }, + indexes: ["providerId"], + }, + porep_sp_capabilities_updated: { + description: "PoRep SP advertised SLI capability thresholds changed. The four SLI columns are the SP's advertised capabilities.", + columns: { + providerId: { type: "bigint", note: "SP Filecoin actor id" }, + retrievabilityBps: { type: "int", note: "advertised SLI: retrievability, basis points" }, + bandwidthMbps: { type: "int", note: "advertised SLI: bandwidth, Mbps" }, + latencyMs: { type: "int", note: "advertised SLI: latency, ms" }, + indexingPct: { type: "int", note: "advertised SLI: indexing, percent" }, + }, + indexes: ["providerId"], + }, + porep_sli_attestation_update: { + description: "PoRep SLI oracle attestation for an SP. The four SLI columns are the measured values used to evaluate deal requirements during settlement. A below-threshold attestation causes zero payment for the settlement interval. lastUpdate is the Filecoin epoch of the attestation.", + columns: { + providerId: { type: "bigint", note: "SP Filecoin actor id" }, + lastUpdate: { type: "bigint", note: "Filecoin epoch of attestation" }, + retrievabilityBps: { type: "int", note: "attested SLI: retrievability, basis points" }, + bandwidthMbps: { type: "int", note: "attested SLI: bandwidth, Mbps" }, + latencyMs: { type: "int", note: "attested SLI: latency, ms" }, + indexingPct: { type: "int", note: "attested SLI: indexing, percent" }, + }, + indexes: ["providerId", "blockNumber"], + }, } diff --git a/server/src/sql-validator.ts b/server/src/sql-validator.ts index c582f43..61a8b5f 100644 --- a/server/src/sql-validator.ts +++ b/server/src/sql-validator.ts @@ -210,6 +210,8 @@ const ALLOWED_NODE_TYPES = new Set([ const ALLOWED_FUNCTIONS = new Set([ // Aggregates "count", "sum", "avg", "min", "max", + "stddev", "stddev_samp", "stddev_pop", "variance", "var_samp", "var_pop", + "percentile_cont", "percentile_disc", "mode", "corr", "covar_pop", "covar_samp", "array_agg", "string_agg", "bool_and", "bool_or", "json_agg", "jsonb_agg", "json_object_agg", "jsonb_object_agg", diff --git a/server/test/sql-validation.test.ts b/server/test/sql-validation.test.ts index 8ca6a7e..998141b 100644 --- a/server/test/sql-validation.test.ts +++ b/server/test/sql-validation.test.ts @@ -131,6 +131,26 @@ describe("SQL validation (libpg-query AST allow-list)", () => { expect(() => validateSql("SELECT jsonb_array_length(pieces::jsonb) FROM pdp_pieces_added")).not.toThrow() }) + test("allows statistical aggregates", () => { + expect(() => validateSql("SELECT stddev(amount), stddev_samp(amount), stddev_pop(amount) FROM fp_deposit")).not.toThrow() + expect(() => validateSql("SELECT variance(amount), var_samp(amount), var_pop(amount) FROM fp_deposit")).not.toThrow() + expect(() => validateSql("SELECT corr(amount, block_number), covar_pop(amount, block_number), covar_samp(amount, block_number) FROM fp_deposit")).not.toThrow() + }) + + test("allows ordered-set aggregates (WITHIN GROUP)", () => { + expect(() => validateSql("SELECT percentile_cont(0.5) WITHIN GROUP (ORDER BY amount) FROM fp_deposit")).not.toThrow() + expect(() => validateSql("SELECT percentile_disc(0.9) WITHIN GROUP (ORDER BY amount) AS p90 FROM fp_deposit")).not.toThrow() + expect(() => validateSql("SELECT mode() WITHIN GROUP (ORDER BY amount) FROM fp_deposit")).not.toThrow() + }) + + test("ordered-set WITHIN GROUP does not bypass function validation", () => { + expect(() => validateSql("SELECT percentile_cont(0.5) WITHIN GROUP (ORDER BY pg_read_file('/etc/passwd')) FROM fp_deposit")).toThrow(/pg_read_file.*not allowed/) + }) + + test("ordered-set WITHIN GROUP does not bypass table validation", () => { + expect(() => validateSql("SELECT mode() WITHIN GROUP (ORDER BY (SELECT COUNT(*) FROM pg_shadow)) FROM fp_deposit")).toThrow(/not a known FOC event table/) + }) + test("strips BOM prefix", () => { expect(() => validateSql("\uFEFFSELECT 1")).not.toThrow() }) diff --git a/shared/system-context.ts b/shared/system-context.ts index 70a8577..be5adf5 100644 --- a/shared/system-context.ts +++ b/shared/system-context.ts @@ -58,7 +58,7 @@ FOC is a layered system. The foundation is generic; service contracts are opinio **Service contracts (opinionated applications built on FilecoinPay):** - **FWSS (FilecoinWarmStorageService)**: FilOz's warm storage service. Creates 3 payment rails per dataset (PDP, CDN, cache-miss), validates proving, manages pricing. Operator: 0x8408502033c418e1bbc97ce9ac48e5528f371a9f (mainnet). Indexed in fwss_* tables. -- **Storacha (FWSS fork)**: A separate FWSS-fork listener contract running on the SAME PDPVerifier and SAME FilecoinPay as FilOz's FWSS. Mainnet: 0x56e53c5e7f27504b810494cc3b88b2aa0645a839. Calibnet: 0x0c6875983B20901a7C3c86871f43FdEE77946424. Their SPs are registered in the SAME ServiceProviderRegistry but use did:key names. Largest FilecoinPay user by volume. Indexed in storacha_fwss_* tables (mirror of fwss_* schema). +- **Storacha (FWSS fork)**: A separate FWSS-fork listener contract running on the SAME PDPVerifier and SAME FilecoinPay as FilOz's FWSS. Mainnet: 0x56e53c5e7f27504b810494cc3b88b2aa0645a839. Calibnet: 0x0c6875983B20901a7C3c86871f43FdEE77946424. Their SPs are registered in the SAME ServiceProviderRegistry but use did:key names. Wound down, historical only (see Storacha section). Indexed in storacha_fwss_* tables (mirror of fwss_* schema). - **ProviderIdSet**: Curated endorsed provider set, maintained by FilOz. **FilBeam (CDN bandwidth ledger):** Non-upgradeable operator contract. Off-chain measures CDN/cache-miss bytes per dataset, periodically calls recordUsageRollups -> emits UsageReported. Settlement of CDN rails happens via FilBeamOperator.settleCDNPaymentRails -> FWSS.settleFilBeamPaymentRails -> FilecoinPay one-time payment. Indexed in fb_* tables. Multiple historical addresses per network (redeployed periodically); join to fwss_data_set_created via data_set_id, then to fp_rail_created via cdn_rail_id / cache_miss_rail_id. NOT used by Storacha. @@ -80,7 +80,7 @@ FOC is a layered system. The foundation is generic; service contracts are opinio - **FaultRecord**: Fires only when nextProvingPeriod is called with missed proof. Silent SPs produce NO fault events. - **Operator**: Contract that manages rails on FilecoinPay. Multiple operators can exist: FWSS is one, Storacha runs another. Query SELECT DISTINCT operator FROM fp_rail_created to find all operators. Validator: arbiter during settlement (checks proofs on PDP rails; CDN rails have no validator). - **Settlement**: Funds flow from payer to payee. For PDP rails: proven periods = full payment, faulted = zero, open = blocked. All fp_rail_settled amount fields are INCREMENTAL per event, SUM() for totals. -- **USDFC**: Payment token. All amounts bigint, 18 decimals (divide by 1e18). +- **USDFC**: Primary payment token, bigint, 18 decimals. Token decimals vary though: axlUSDC = 6 (see Data Conventions). - **Epoch**: Filecoin block height, ~30 seconds. block_number in database = epoch. - **Piece**: Data unit with PieceCID (max 1016 MiB, Curio limit). raw_size in fwss_piece_added is the exact original data size. - **Leaf**: 32-byte chunk of FR32-expanded piece data. leafCount reflects expanded size, do NOT use as a proxy for raw data size. @@ -88,12 +88,12 @@ FOC is a layered system. The foundation is generic; service contracts are opinio ## Data Conventions -- Amounts: bigint, 18 decimals. 1 USDFC = 1000000000000000000. +- Amounts: bigint. Decimals are PER-TOKEN, not universally 18: USDFC and FIL = 18, axlUSDC = 6. Never SUM(amount)/1e18 across mixed-token rails (axlUSDC's 6-decimal values silently vanish); JOIN fp_rail_created.token and scale per token, GROUP BY token on every fp_* aggregate. - Timestamps: unix seconds. Use TO_TIMESTAMP(timestamp) for dates. - Provider IDs: small integers. Always resolve to names via get_providers, show as "Name (ID)". - Dataset metadata: "source" identifies creating app (e.g. "filecoin-pin"). Indexed column. - Known wallets (both networks): DealBot (legacy): 0xa5F90bc2AA73a2E0Bad4D7092a932644d5dD5d71, DealBot (current multisig): 0x305025D07c1DEe47F25a4990179eFf2becddCA0B, Storacha: 0x3c1ae7a70a2b51458fcb7927fd77aae408a1b857, Tippy/ezpdpz: 0x3E4E5f067cfdA2F16Aade21912B8324c3D9624F8 (endorsed SP operator), PinMe: 0xd19d84c77bbb901971e460830e310933a210dbaa. Use payer address to filter by party, not source metadata. -- Storacha runs a separate service contract (FWSS fork) as both operator and validator on their rails. Their SPs use did:key names in ServiceProviderRegistry and are not managed by FWSS. Storacha is the largest FilecoinPay user on mainnet by deposit and settlement volume. +- FilecoinPay is shared across services: FWSS and PoRep Market (porep_* tables, see Aggregate Metrics) are live; Storacha (storacha_fwss_*) is wound down, see the Storacha section. Don't assume a rail is FWSS - scope by operator. - 3 rails per dataset: PDP (storage, validated), CDN (bandwidth, unvalidated), cache-miss (origin fetch, unvalidated). - fwss tables use data_set_id, pdp tables use set_id, same value, JOIN them directly. - Query perf: aggregate per set/rail with GROUP BY joins, not per-row correlated subqueries; avoid COUNT(*) on large tables (pdp_possession_proven, fwss_piece_added) which seq-scan; MAX(block_number) for head, bounded block/time ranges for windows; LIMIT while exploring; 30s statement timeout. @@ -201,20 +201,22 @@ SELECT d.* FROM fwss_data_set_created d WHERE NOT EXISTS (SELECT 1 FROM fwss_ser ## Proving and Faults +This section is PDP possession-proving (FWSS, Storacha). PoRep Market proves differently: SLI-oracle attestation (porep_sli_attestation_update), no proving periods or pdp_* faults - don't apply it to porep_* deals. + **Proving periods**: Calibnet = 240 epochs (~2h). Mainnet = 2880 epochs (~24h). The SP must call provePossession() within the challenge window each period. -**Proving period convention**: Exclusive-inclusive ranges (A, A+M]. Activation epoch A is a boundary, not billable. Period N covers epochs (A+N*M, A+(N+1)*M]. The deadline is A+(N+1)*M. +**Proving period convention**: Exclusive-inclusive ranges (A, A+M]. Activation epoch A is a boundary, not billable. Period N covers epochs (A+N*M, A+(N+1)*M], deadline A+(N+1)*M. **FaultRecord events**: CRITICAL - FaultRecord only fires when nextProvingPeriod() is called. If an SP stops calling nextProvingPeriod entirely, NO fault events are emitted. Silence does NOT mean the SP is healthy. To detect truly dead SPs, look for data sets with no recent pdp_next_proving_period events. -**periodsFaulted**: The count of consecutive proving periods missed since the last successful proof. This resets to 0 when the SP proves successfully. A periodsFaulted of 20 means the SP missed 20 consecutive periods before nextProvingPeriod was called. +**periodsFaulted**: The count of consecutive proving periods missed since the last successful proof, reset to 0 when the SP proves successfully. **Proving status from get_dataset_proving()**: - live: is the data set active in PDPVerifier - provenThisPeriod: has the SP proven in the current period (false + approaching deadline = about to fault) - lastProvenEpoch: when the last successful proof was submitted - provingDeadline: deadline for the current period -- activePieceCount: number of live pieces (0 after all pieces removed) +- activePieceCount: live piece count (0 when all removed) ## Settlement Validation @@ -232,13 +234,17 @@ This means: ## Token Addresses -**USDFC** (the payment token for FOC storage): +Decimals are PER-TOKEN, not universally 18. Scale each rail by its own token's decimals; never SUM(amount)/1e18 across mixed-token rails. + +**USDFC** (primary FOC payment token, 18 decimals): - Calibnet: 0xb3042734b608a1B16e9e86B374A3f3e389B4cDf0 - Mainnet: 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 -**Native FIL**: represented as address(0) = 0x0000000000000000000000000000000000000000 +**axlUSDC** (Axelar-bridged USDC, mainnet only, 6 decimals): 0xEB466342C4d449BC9f53A865D5Cb90586f405215. Used by PoRep Market; can carry material mainnet value, so scaling by 1e18 or omitting it understates totals. Divide by 1e6, not 1e18. + +**Native FIL**: address(0) = 0x0000000000000000000000000000000000000000 (18 decimals). -In FilecoinPay tables, the token column distinguishes USDFC-denominated rails from FIL-denominated rails. Most FOC rails use USDFC. Filter by token address to separate them. +The token column identifies the currency; filter or GROUP BY it on every aggregate. ## FilecoinPay Analytics @@ -463,7 +469,7 @@ The current FOC contracts (same proxy addresses) were deployed across two releas To query upgrade history: SELECT contract, version, implementation, TO_TIMESTAMP(timestamp) as upgraded_at FROM contract_upgraded ORDER BY block_number. This shared table covers PDPVerifier, FWSS, and SPRegistry upgrades. -**Orphan rails from defunct service contracts**: FilecoinPay is shared; rails created by pre-v1.0.0 FWSS or other abandoned operators persist in fp_* with no matching fwss_data_set_created. Filter \`fp_rail_created.operator\` to scope aggregates. Known abandoned operator: calibnet 0xd3de778c05f89e1240ef70100fb0d9e5b2efd258 (rails 1-23, pre-v1.0.0 FWSS, never settle). +**Rails with no fwss_/storacha_ dataset**: FilecoinPay is shared. Two causes: (a) defunct pre-v1.0.0 operators (calibnet 0xd3de778c05f89e1240ef70100fb0d9e5b2efd258, rails 1-23, never settle); (b) live PoRep Market - those map to porep_rail_id_updated instead. Scope aggregates by \`fp_rail_created.operator\`, but dataset-less does NOT mean dead, so do not filter these out as junk. Interpretation: pre-~epoch 3,414,500 (calibnet) / 5,476,400 (mainnet) is v1.0.0; v1.1.0 ran after; v1.2.0 added the sybil-fee burn rail; v1.3.0 (calibnet only) replaces it with a direct-to-SP 0.025 USDFC fee, per-dataset pricing, and the abandonment lifecycle. @@ -543,31 +549,25 @@ Three places to get fault/proving data: ## Aggregate FilecoinPay Metrics (network-wide, all operators) -CRITICAL: For network-wide metrics, start from fp_* tables. Do NOT join to fwss_* tables, since that only captures FWSS-operated rails and misses other operators like Storacha (which accounts for ~74% of mainnet settlement volume). - -**Total revenue**: SUM(total_net_payee_amount::numeric)/1e18 FROM fp_rail_settled. This is all USDFC paid to all SPs across all operators. -**Total revenue including one-time payments**: Add SUM(net_payee_amount::numeric)/1e18 FROM fp_one_time_payment. -**ARR (Annual Recurring Revenue)**: Use fp_rail_rate_modified (NOT fwss_rail_rate_updated which is FWSS-only). For active non-terminated non-finalized rails: SUM the latest new_rate per rail_id, multiply by epochs_per_year (2880 * 365). Or query live rail state via get_rail for each active rail. -**Revenue by operator**: JOIN fp_rail_settled to fp_rail_created on rail_id, GROUP BY operator. This shows FWSS vs Storacha vs other operators. -**Revenue by SP**: JOIN fp_rail_settled to fp_rail_created on rail_id, GROUP BY payee. Each payee is an SP address. -**Deposits/TVL**: fp_deposit and fp_withdrawal directly, no FWSS join needed. - -Known operators on mainnet: -- FWSS: 0x8408502033c418e1bbc97ce9ac48e5528f371a9f -- Storacha: 0x56e53c5e7f27504b810494cc3b88b2aa0645a839 -- Discover others: SELECT DISTINCT operator, COUNT(*) as rails FROM fp_rail_created GROUP BY operator - -## Storacha (separate listener on shared infrastructure) +CRITICAL: For network-wide metrics, start from fp_* tables. Do NOT join to fwss_* tables, which only capture FWSS-operated rails and miss every other operator (FWSS, Storacha [wound down], PoRep Market, and occasional one-offs). Do not assume FWSS dominates; operator shares shift, so compute them per question via Revenue by operator. -Storacha runs a fork of FWSS as a parallel listener contract on the SAME PDPVerifier and SAME FilecoinPay used by FilOz's FWSS. Their datasets, pieces, faults, and rate updates are tracked in storacha_fwss_* tables (mirror of the fwss_* schema). Their rails, settlements, and deposits are in fp_* tables shared with FWSS. Their proving periods and proofs are in pdp_* tables shared with FWSS. +CRITICAL: Decimals are per-token; a bare SUM(amount)/1e18 drops all axlUSDC (6-decimal) value to ~0. JOIN fp_rail_created.token and GROUP BY token on every aggregate. -**To query Storacha-specific data**: use storacha_fwss_* tables exactly the same way you'd use fwss_* tables. Schema is identical (dataSetId, payer, payee, etc.). +**Total revenue (per token)**: JOIN fp_rail_settled to fp_rail_created on rail_id, GROUP BY rc.token; divide each token's SUM(total_net_payee_amount::numeric) by its decimals (USDFC/FIL 1e18, axlUSDC 1e6). All value paid to all SPs across all operators. +**Including one-time payments**: add SUM(net_payee_amount::numeric) FROM fp_one_time_payment, same per-token scaling. +**ARR (Annual Recurring Revenue)**: Use fp_rail_rate_modified (NOT fwss_rail_rate_updated which is FWSS-only). For active non-terminated non-finalized rails: SUM the latest new_rate per rail_id, multiply by epochs_per_year (2880 * 365), per token. Or query live rail state via get_rail. +**Revenue by operator**: JOIN fp_rail_settled to fp_rail_created on rail_id, GROUP BY operator, token. Shows FWSS vs Storacha vs PoRep Market. +**Revenue by SP**: same JOIN, GROUP BY payee, token. Each payee is an SP address. +**Deposits/TVL**: fp_deposit and fp_withdrawal directly, GROUP BY token, no FWSS join needed. -**To query Storacha settlements**: filter fp_rail_settled / fp_rail_created by operator = '0x56e53c5e7f27504b810494cc3b88b2aa0645a839' (mainnet) or '0x0c6875983b20901a7c3c86871f43fdee77946424' (calibnet). Same fp_* tables as FWSS, just different operator. +Operators on mainnet (recompute shares as above): +- FWSS (FilOz), 0x8408502033c418e1bbc97ce9ac48e5528f371a9f: live. +- Storacha, 0x56e53c5e7f27504b810494cc3b88b2aa0645a839: wound down, historical. +- PoRep Market (fidlabs cold-storage, aka "FCSS"): a separate service on shared FilecoinPay, settling in USDFC and axlUSDC, indexed in porep_* tables. One Validator (operator == validator) per deal, so operator is per-deal, not a service id, and its rails have no fwss_*/storacha_fwss_* row. Attribute via porep_rail_id_updated.rail_id = fp_rail_created.rail_id, then porep_deal_proposal_created for client/SP/size. Own SP registry, per-deal-token pricing. -**To query Storacha proving health**: get_proving_health works for ALL providers regardless of which listener owns their datasets, because it uses pdp_* tables (shared) and the proof-gap method. Storacha SPs use did:key names in get_providers. +## Storacha (wound down 2026-04, historical only) -**Storacha-specific facts**: Their pricing is 0.9 USDFC/TiB/month (vs FWSS's 2.5). They do not use FilBeam (CDN tables fb_* will not have Storacha activity). They revert SP changes (storacha_fwss_data_set_sp_changed will be empty). They are version 1.1.0 of the FWSS contract; FilOz is on 1.2.0. The events are byte-identical between versions. +Storacha ran a fork of FWSS as a parallel listener on the SAME PDPVerifier and FilecoinPay as FilOz's FWSS. Last mainnet settlement was 2026-04-19; treat all Storacha data as historical, not live. Datasets, pieces, faults, and rates are in storacha_fwss_* tables (identical schema to fwss_*, queried the same way); rails and settlements are in fp_* filtered by operator = '0x56e53c5e7f27504b810494cc3b88b2aa0645a839' (mainnet) or '0x0c6875983b20901a7c3c86871f43fdee77946424' (calibnet). SPs use did:key names. Pricing was 0.9 USDFC/TiB/month (vs FWSS 2.5); stayed on FWSS v1.2.x semantics; never used FilBeam. get_proving_health still works for their SPs (shared pdp_* tables). ## FilBeam (incentivized data delivery / CDN) @@ -649,7 +649,7 @@ For gas analysis: JOIN your event table to tx_meta USING (tx_hash). Piece count **Total data stored**: SUM(raw_size) from fwss_piece_added gives total bytes of original (unpadded) data. Divide by 1e12 for TiB. Filter by provider via JOIN with fwss_data_set_created. Exclude terminated datasets by LEFT JOIN with fwss_service_terminated and filtering WHERE terminated IS NULL. -**Total revenue**: SUM(total_net_payee_amount) / 1e18 from fp_rail_settled gives all-time USDFC paid to SPs. Join with fwss_data_set_created via pdp_rail_id for per-provider breakdown. Remember: these fields are INCREMENTAL per event, so SUM() is correct. +**Total revenue**: JOIN fp_rail_settled to fp_rail_created on rail_id, GROUP BY token, and scale each token by its decimals (USDFC 1e18, axlUSDC 1e6); a bare SUM()/1e18 drops all axlUSDC value. Join fwss_data_set_created via pdp_rail_id for per-FWSS-provider breakdown. Fields are INCREMENTAL per event, so SUM() is correct. **Time filtering**: Use timestamp column (unix seconds). Last 7 days: WHERE timestamp > EXTRACT(EPOCH FROM NOW()) - 7*86400. By date: WHERE TO_TIMESTAMP(timestamp) >= '2026-03-01'. By epoch: WHERE block_number > 5860000.