Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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

Subgraph fix - Fix internal transaction handling when there is more than one main method event in the same transaction.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/ethereum/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmXGmcjEtwwEgB83KE2ECjjYY38kLMqzaq4ip8GWY7A6zz"
"https://gateway.thegraph.com/api/deployments/id/QmeCB3KX49nRAkzgqancc3yL3VMJvt65YtL1zrLCFgr2n5"
),
"hmt_address": "0xd1ba9BAC957322D6e8c07a160a3A8dA11A0d2867",
"factory_address": "0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a",
Expand All @@ -53,7 +53,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/sepolia/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmT4xNvZh8ymarrk1zdytjLhCW59iuTavsd4JgHS4LbCVB"
"https://gateway.thegraph.com/api/deployments/id/QmcMntqZSTh8wJddxgp2hYcdw78wZFU86LHTHzJ1bTVUDc"
),
"hmt_address": "0x792abbcC99c01dbDec49c9fa9A828a186Da45C33",
"factory_address": "0x5987A5558d961ee674efe4A8c8eB7B1b5495D3bf",
Expand All @@ -69,7 +69,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/bsc/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmdVdpm9NnFz5B8QyzhW1bW1nNfRWemTiFn2MrhYZGTSQD"
"https://gateway.thegraph.com/api/deployments/id/QmRexbu8eLZ1iE7ZLMtKxAr9GJnQ1JVrXhybKq6JkJ9XLE"
),
"hmt_address": "0x711Fd6ab6d65A98904522d4e3586F492B989c527",
"factory_address": "0x92FD968AcBd521c232f5fB8c33b342923cC72714",
Expand All @@ -85,7 +85,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmZjYMktZe8RAz7W7qL33VZBV6AC57xsLyE1cEfv6NABdZ"
"https://gateway.thegraph.com/api/deployments/id/QmfFBXsAP7nbckFx34XYcNq2hRnfoVNrfqCvuk7hmAtYJT"
),
"hmt_address": "0xE3D74BBFa45B4bCa69FF28891fBE392f4B4d4e4d",
"factory_address": "0x2bfA592DBDaF434DDcbb893B1916120d181DAD18",
Expand All @@ -103,7 +103,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/polygon/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmUt9mmfNjtC5ZnQNiWHRbFG3k5zfngMuoTyky9jhXYqG2"
"https://gateway.thegraph.com/api/deployments/id/QmUwHMDjnDHDB5cowGqd96SRJ1sZegoAPanjxBWUyLZghv"
),
"hmt_address": "0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF",
"factory_address": "0xBDBfD2cC708199C5640C6ECdf3B0F4A4C67AdfcB",
Expand All @@ -121,7 +121,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/amoy/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmWRUFWpWoRRUh7Ec1HUJEwxc84DkP4iFTfLLsoVngJAPa"
"https://gateway.thegraph.com/api/deployments/id/QmTJfcvVVmw8fe5CwRP6tZD5FzE2ESrm3ryygS1YZMYhM7"
),
"hmt_address": "0x792abbcC99c01dbDec49c9fa9A828a186Da45C33",
"factory_address": "0xAFf5a986A530ff839d49325A5dF69F96627E8D29",
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk/typescript/human-protocol-sdk/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmXGmcjEtwwEgB83KE2ECjjYY38kLMqzaq4ip8GWY7A6zz',
'https://gateway.thegraph.com/api/deployments/id/QmeCB3KX49nRAkzgqancc3yL3VMJvt65YtL1zrLCFgr2n5',
oldSubgraphUrl: '',
oldFactoryAddress: '',
},
Expand All @@ -51,7 +51,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmT4xNvZh8ymarrk1zdytjLhCW59iuTavsd4JgHS4LbCVB',
'https://gateway.thegraph.com/api/deployments/id/QmcMntqZSTh8wJddxgp2hYcdw78wZFU86LHTHzJ1bTVUDc',
oldSubgraphUrl: '',
oldFactoryAddress: '',
},
Expand All @@ -66,7 +66,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmdVdpm9NnFz5B8QyzhW1bW1nNfRWemTiFn2MrhYZGTSQD',
'https://gateway.thegraph.com/api/deployments/id/QmRexbu8eLZ1iE7ZLMtKxAr9GJnQ1JVrXhybKq6JkJ9XLE',
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
},
Expand All @@ -81,7 +81,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmZjYMktZe8RAz7W7qL33VZBV6AC57xsLyE1cEfv6NABdZ',
'https://gateway.thegraph.com/api/deployments/id/QmfFBXsAP7nbckFx34XYcNq2hRnfoVNrfqCvuk7hmAtYJT',
oldSubgraphUrl:
'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
Expand All @@ -97,7 +97,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmUt9mmfNjtC5ZnQNiWHRbFG3k5zfngMuoTyky9jhXYqG2',
'https://gateway.thegraph.com/api/deployments/id/QmUwHMDjnDHDB5cowGqd96SRJ1sZegoAPanjxBWUyLZghv',
oldSubgraphUrl:
'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
Expand All @@ -113,7 +113,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmWRUFWpWoRRUh7Ec1HUJEwxc84DkP4iFTfLLsoVngJAPa',
'https://gateway.thegraph.com/api/deployments/id/QmTJfcvVVmw8fe5CwRP6tZD5FzE2ESrm3ryygS1YZMYhM7',
oldSubgraphUrl: '',
oldFactoryAddress: '',
},
Expand Down
36 changes: 25 additions & 11 deletions packages/sdk/typescript/subgraph/src/mapping/utils/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { toEventId, toPreviousEventId } from './event';
const mainMethods: string[] = [
'createEscrow',
'setup',
'fund',
'bulkTransfer',
'storeResults',
'withdraw',
'requestCancellation',
'withdraw',
'fund',
'cancel',
'complete',
'storeResults',
'bulkTransfer',
'stake',
'unstake',
'slash',
Expand Down Expand Up @@ -71,13 +72,26 @@ export function createTransaction(
mainMethods.includes(method) &&
Address.fromBytes(transaction.to) == to
) {
transaction.method = method;
transaction.from = from;
transaction.value = value !== null ? value : BigInt.fromI32(0);
transaction.token = token;
transaction.escrow = escrow;
transaction.receiver = receiver;
transaction.save();
if (mainMethods.includes(transaction.method)) {
const internalTransaction = new InternalTransaction(toEventId(event));
internalTransaction.method = method;
internalTransaction.from = from;
internalTransaction.to = to;
internalTransaction.value = value !== null ? value : BigInt.fromI32(0);
internalTransaction.transaction = transaction.txHash;
internalTransaction.token = token;
internalTransaction.escrow = escrow;
internalTransaction.receiver = receiver;
internalTransaction.save();
} else {
transaction.method = method;
transaction.from = from;
transaction.value = value !== null ? value : BigInt.fromI32(0);
transaction.token = token;
transaction.escrow = escrow;
transaction.receiver = receiver;
transaction.save();
}
} else {
if (
transaction.method == 'set' &&
Expand Down