Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
37c51d4
remove HMToken related entities and handlers from subgraph
portuu3 Feb 20, 2026
f7568d2
Add Human HMT statistics subgraph
flopez7 Feb 25, 2026
91d10db
integrate HMT subgraph support and update related queries in Python SDK
flopez7 Feb 25, 2026
543e99b
Generated changeset for SDKs
flopez7 Feb 26, 2026
b494158
Move subgraphs into new /subgraph folder
flopez7 Mar 4, 2026
a3f4ff2
Read fee values from kvstore in the escrow contract
portuu3 Mar 4, 2026
0f6d084
Update matchstick.yaml libsFolder path and enhance internalTransactio…
flopez7 Mar 4, 2026
8ada099
Update libsFolder path in matchstick.yaml for correct module resolution
flopez7 Mar 4, 2026
6d20998
Add permissions section for subgraph CI workflow
flopez7 Mar 4, 2026
abc40f3
- implement PendingV3 event with manifest and fee percentages in Escr…
portuu3 Mar 4, 2026
245d616
Fix job launcher server tests
portuu3 Mar 5, 2026
f83c0a2
Add transaction creation and tests for fund events in Escrow
flopez7 Mar 5, 2026
0f334e5
remove script update
portuu3 Mar 5, 2026
e3e2e0c
Moved subgraphs from SDK to their own folder in package level
flopez7 Mar 5, 2026
aeb9d2d
Merge branch 'remove-hmt-subgraph' into escrow-fee-kvstore
portuu3 Mar 5, 2026
c17c40c
Update subgraph URL references to use NETWORKS configuration in Escro…
portuu3 Mar 6, 2026
3bb32ce
refactor getManifest backward-compatible
portuu3 Mar 6, 2026
302d03e
upgrade amoy and bsc testnet
portuu3 Mar 9, 2026
364cc72
Upgrade sepolia
portuu3 Mar 9, 2026
aa367f6
[Subgraph] Remove unused event entities and related logic from subgra…
flopez7 Mar 9, 2026
6226ef1
Update TS subgraph URLs for testnets
flopez7 Mar 10, 2026
631f780
Update cd/ci subgraphs
portuu3 Mar 10, 2026
9285cb0
Merge branch 'develop' into escrow-fee-kvstore
flopez7 Mar 10, 2026
9eee932
Fix subgraph package names in yarn.lock
flopez7 Mar 10, 2026
a6bc6dc
Fix USDC token address in tokens.ts
flopez7 Mar 10, 2026
0b7ff83
Update USDC and USDT token decimals from 6 to 18 in bsc testnet
flopez7 Mar 10, 2026
d8d2354
Add new Subpraph URLs to SDKs and update changeset to reflect core ch…
flopez7 Mar 11, 2026
2cfea32
Potential fix for code scanning alert no. 183: Workflow does not cont…
portuu3 Mar 12, 2026
cd63a43
Potential fix for code scanning alert no. 182: Workflow does not cont…
portuu3 Mar 12, 2026
cbfd134
[SDK] feat: kvstore.get to return none/undefined when no key found (#…
dnechay Mar 12, 2026
7296738
Improve manifest fetching fallback logic
portuu3 Mar 12, 2026
b16196a
[SDK] feat: consistent kvstore.get in python sdk (#3820)
dnechay Mar 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/cozy-poets-go.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@human-protocol/sdk": major
"@human-protocol/python-sdk": major
---

Updated KV Store utils in sdk to return empty string in case no value in subgraph instead of throwing and error
11 changes: 11 additions & 0 deletions .changeset/nine-seas-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@human-protocol/core": major
"@human-protocol/sdk": major
Comment thread
dnechay marked this conversation as resolved.
"@human-protocol/python-sdk": major
---

Updated escrow contracts and SDKs to fetch oracle fees from `KVStore` instead of passing fee values during escrow setup. `Escrow.setup(...)` and factory setup flows no longer accept fee arguments, escrow deployments now require a `KVStore` address, and fee validation is enforced on-chain from `KVStore` values, including per-oracle and total fee limits. Added upgrade-safe `EscrowFactory` support for storing and updating the `KVStore` address.

Updated TypeScript and Python SDK escrow setup APIs to match the new contract signatures by removing fee arguments from `setup(...)` and create-and-setup helpers. Existing config fee fields remain optional for backward compatibility but are ignored by setup calls.

Updated SDKs to use a dedicated HMT stats subgraph endpoint for HMT statistics methods and removed `totalAmountPaid` and `averageAmountPerWorker` from `IDailyPayment`.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
name: Subgraph deployment
name: HMT Subgraph Deployment

permissions:
contents: read

on:
workflow_dispatch:
inputs:
Expand All @@ -11,7 +15,7 @@ on:

jobs:
subgraph:
name: Deploy Subgraph
name: Deploy HMT Subgraph
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -45,17 +49,17 @@ jobs:
fi
done
echo "Match found: $MATCH"
echo "::set-output name=continue::$MATCH"
echo "continue=$MATCH" >> "$GITHUB_OUTPUT"
- name: Install dependencies
if: steps.filter_networks.outputs.continue == 'true'
run: yarn workspaces focus @tools/subgraph
run: yarn workspaces focus @tools/subgraph-hmt
- name: Build packages (scoped)
if: steps.filter_networks.outputs.continue == 'true'
run: yarn workspaces foreach -Rpt --from @tools/subgraph run build
run: yarn workspaces foreach -Rpt --from @tools/subgraph-hmt run build
- name: Generate and build Subgraph
if: steps.filter_networks.outputs.continue == 'true'
run: yarn generate && yarn build
working-directory: ./packages/sdk/typescript/subgraph
working-directory: ./packages/subgraph/hmt
env:
NETWORK: ${{ matrix.network.name }}
- name: Authenticate & Deploy
Expand All @@ -64,9 +68,9 @@ jobs:
API_KEY: ${{ secrets.HP_GRAPH_API_KEY }}
NETWORK: ${{ matrix.network.name }}
LABEL: ${{ github.event.inputs.label }}
working-directory: ./packages/sdk/typescript/subgraph
working-directory: ./packages/subgraph/hmt
run: |
yarn dlx @graphprotocol/graph-cli@0.71.2 \
auth --studio "$API_KEY"
yarn dlx @graphprotocol/graph-cli@0.71.2 \
deploy --studio ${NETWORK} -l ${LABEL}
deploy --studio hmt-${NETWORK} -l ${LABEL}
76 changes: 76 additions & 0 deletions .github/workflows/cd-subgraph-human.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Human Protocol Subgraph Deployment

permissions:
contents: read

on:
workflow_dispatch:
inputs:
label:
description: "New version label"
required: true
networks:
description: "Comma-separated list of networks to deploy"
required: true

jobs:
subgraph:
name: Deploy Human Protocol Subgraph
runs-on: ubuntu-latest
strategy:
matrix:
network:
- name: amoy
- name: bsc-testnet
- name: bsc
- name: ethereum
- name: polygon
- name: sepolia
fail-fast: true
max-parallel: 3
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: yarn
- name: Filter Networks
id: filter_networks
run: |
INPUT_NETWORKS="${{ github.event.inputs.networks }}"
IFS=',' read -ra NETWORK_LIST <<< "$INPUT_NETWORKS"
echo "Input networks: $INPUT_NETWORKS"
echo "Current matrix network: ${{ matrix.network.name }}"
MATCH=false
for network in "${NETWORK_LIST[@]}"; do
if [[ "${network}" == "${{ matrix.network.name }}" ]]; then
MATCH=true
break
fi
done
echo "Match found: $MATCH"
echo "continue=$MATCH" >> "$GITHUB_OUTPUT"
- name: Install dependencies
if: steps.filter_networks.outputs.continue == 'true'
run: yarn workspaces focus @tools/subgraph-human-protocol
- name: Build packages (scoped)
if: steps.filter_networks.outputs.continue == 'true'
run: yarn workspaces foreach -Rpt --from @tools/subgraph-human-protocol run build
- name: Generate and build Subgraph
if: steps.filter_networks.outputs.continue == 'true'
run: yarn generate && yarn build
working-directory: ./packages/subgraph/human-protocol
env:
NETWORK: ${{ matrix.network.name }}
- name: Authenticate & Deploy
if: steps.filter_networks.outputs.continue == 'true'
env:
API_KEY: ${{ secrets.HP_GRAPH_API_KEY }}
NETWORK: ${{ matrix.network.name }}
LABEL: ${{ github.event.inputs.label }}
working-directory: ./packages/subgraph/human-protocol
run: |
yarn dlx @graphprotocol/graph-cli@0.71.2 \
auth --studio "$API_KEY"
yarn dlx @graphprotocol/graph-cli@0.71.2 \
deploy --studio human-${NETWORK} -l ${LABEL}
Comment thread Fixed
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: Subgraph check
name: HMT Subgraph check

on:
push:
branches: "**"
paths:
- "packages/core/**"
- "packages/sdk/typescript/subgraph/**"
- "packages/subgraph/hmt/**"

permissions:
contents: read

jobs:
subgraph-test:
name: Subgraph Test
name: HMT Subgraph Test
# TODO: Use ubuntu-latest when graph binary is not failing on ubuntu 24.04
runs-on: ubuntu-22.04
steps:
Expand All @@ -19,10 +22,10 @@ jobs:
node-version-file: .nvmrc
cache: yarn
- name: Install dependencies
run: yarn workspaces focus @tools/subgraph
run: yarn workspaces focus @tools/subgraph-hmt
- name: Build core package
run: yarn workspace @human-protocol/core build
- name: Generate manifest for Polygon for tests
run: NETWORK=polygon yarn workspace @tools/subgraph generate
run: NETWORK=polygon yarn workspace @tools/subgraph-hmt generate
- name: Run subgraph test
run: yarn workspace @tools/subgraph test
run: yarn workspace @tools/subgraph-hmt test
31 changes: 31 additions & 0 deletions .github/workflows/ci-test-subgraph-human.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Human Protocol Subgraph check

on:
push:
branches: "**"
paths:
- "packages/core/**"
- "packages/subgraph/human-protocol/**"

permissions:
contents: read

jobs:
subgraph-test:
name: Human Protocol Subgraph Test
# TODO: Use ubuntu-latest when graph binary is not failing on ubuntu 24.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: yarn
- name: Install dependencies
run: yarn workspaces focus @tools/subgraph-human-protocol
- name: Build core package
run: yarn workspace @human-protocol/core build
- name: Generate manifest for Polygon for tests
run: NETWORK=polygon yarn workspace @tools/subgraph-human-protocol generate
- name: Run subgraph test
run: yarn workspace @tools/subgraph-human-protocol test
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,11 @@ export class JobService {
recordingOracleSolutions.filter((solution) => !solution.error).length >=
submissionsRequired
) {
let reputationOracleWebhook: string | null = null;
try {
const reputationOracleAddress =
await escrowClient.getReputationOracleAddress(webhook.escrowAddress);
reputationOracleWebhook = (await KVStoreUtils.get(
webhook.chainId,
reputationOracleAddress,
KVStoreKeys.webhookUrl,
)) as string;
} catch {
//Ignore the error
}
const reputationOracleWebhook = await KVStoreUtils.get(
webhook.chainId,
await escrowClient.getReputationOracleAddress(webhook.escrowAddress),
KVStoreKeys.webhookUrl,
);

if (reputationOracleWebhook) {
await sendWebhook(
Expand All @@ -239,16 +232,11 @@ export class JobService {
}

if (errorSolutions.length) {
let exchangeOracleURL: string | null = null;
try {
exchangeOracleURL = (await KVStoreUtils.get(
webhook.chainId,
await escrowClient.getExchangeOracleAddress(webhook.escrowAddress),
KVStoreKeys.webhookUrl,
)) as string;
} catch {
//Ignore the error
}
const exchangeOracleURL = await KVStoreUtils.get(
webhook.chainId,
await escrowClient.getExchangeOracleAddress(webhook.escrowAddress),
KVStoreKeys.webhookUrl,
);

if (exchangeOracleURL) {
const eventData: AssignmentRejection[] = errorSolutions.map(
Expand Down Expand Up @@ -311,18 +299,11 @@ export class JobService {
{ timeoutMs: this.web3ConfigService.txTimeoutMs },
);

let reputationOracleWebhook: string | null = null;
try {
const reputationOracleAddress =
await escrowClient.getReputationOracleAddress(webhook.escrowAddress);
reputationOracleWebhook = (await KVStoreUtils.get(
webhook.chainId,
reputationOracleAddress,
KVStoreKeys.webhookUrl,
)) as string;
} catch {
//Ignore the error
}
const reputationOracleWebhook = await KVStoreUtils.get(
webhook.chainId,
await escrowClient.getReputationOracleAddress(webhook.escrowAddress),
KVStoreKeys.webhookUrl,
);

if (reputationOracleWebhook) {
await sendWebhook(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
ChainId,
InvalidKeyError,
KVStoreKeys,
KVStoreUtils,
} from '@human-protocol/sdk';
import { ChainId, KVStoreKeys, KVStoreUtils } from '@human-protocol/sdk';
import { CACHE_MANAGER } from '@nestjs/cache-manager';
import { HttpException, Inject, Injectable } from '@nestjs/common';
import { Cache } from 'cache-manager';
Expand Down Expand Up @@ -36,9 +31,7 @@ export class KvStoreGateway {

oracleUrl = await KVStoreUtils.get(chainId, address, KVStoreKeys.url);
} catch (error) {
if (error instanceof InvalidKeyError) {
oracleUrl = '';
} else if (error.toString().includes('Error: Invalid address')) {
if (error.toString().includes('Error: Invalid address')) {
throw new HttpException(
`Unable to retrieve URL from address: ${address}`,
400,
Expand All @@ -53,7 +46,7 @@ export class KvStoreGateway {
}
}

if (!oracleUrl || oracleUrl === '') {
if (!oracleUrl) {
throw new HttpException('Oracle does not have URL set in KV store', 422);
}

Expand Down Expand Up @@ -92,7 +85,7 @@ export class KvStoreGateway {
}
}

if (!jobTypes || jobTypes === '') {
if (!jobTypes) {
return;
} else {
await this.cacheManager.set(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ export const TOKEN_ADDRESSES: {
symbol: EscrowFundToken.HMT,
},
[EscrowFundToken.USDC]: {
address: '0x64544969ed7EBf5f083679233325356EbE738930ho',
decimals: 6,
address: '0x64544969ed7EBf5f083679233325356EbE738930',
decimals: 18,
symbol: EscrowFundToken.USDC,
},
[EscrowFundToken.USDT]: {
address: '0x66E972502A34A625828C544a1914E8D8cc2A9dE5',
decimals: 6,
decimals: 18,
symbol: EscrowFundToken.USDT,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,8 @@ describe('JobService', () => {
jobEntity.userId.toString(),
expect.objectContaining({
recordingOracle: jobEntity.recordingOracle,
recordingOracleFee: 1n,
reputationOracle: jobEntity.reputationOracle,
reputationOracleFee: 1n,
exchangeOracle: jobEntity.exchangeOracle,
exchangeOracleFee: 1n,
manifest: jobEntity.manifestUrl,
manifestHash: jobEntity.manifestHash,
}),
Expand Down
28 changes: 5 additions & 23 deletions packages/apps/job-launcher/server/src/modules/job/job.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,20 +318,8 @@ export class JobService {

const escrowConfig = {
recordingOracle: jobEntity.recordingOracle,
recordingOracleFee: await this.getOracleFee(
jobEntity.recordingOracle,
jobEntity.chainId,
),
reputationOracle: jobEntity.reputationOracle,
reputationOracleFee: await this.getOracleFee(
jobEntity.reputationOracle,
jobEntity.chainId,
),
exchangeOracle: jobEntity.exchangeOracle,
exchangeOracleFee: await this.getOracleFee(
jobEntity.exchangeOracle,
jobEntity.chainId,
),
manifest: jobEntity.manifestUrl,
manifestHash: jobEntity.manifestHash,
};
Expand Down Expand Up @@ -792,17 +780,11 @@ export class JobService {
oracleAddress: string,
chainId: ChainId,
): Promise<bigint> {
let feeValue: string | undefined;

try {
feeValue = await KVStoreUtils.get(
chainId,
oracleAddress,
KVStoreKeys.fee,
);
} catch {
// Ignore error
}
const feeValue = await KVStoreUtils.get(
chainId,
oracleAddress,
KVStoreKeys.fee,
);

return BigInt(feeValue ? feeValue : 1);
}
Expand Down
Loading
Loading