Skip to content

Commit cfa5fa0

Browse files
authored
fix: Add a new allowed selector (sponserdCallV2) for committee txn inputs (#112)
* fix: Add a new allowed selector (sponserdCallV2) for committee txn inputs * chore: Updates node-version * fix: AssemblyScript method * refactor: Move isAllowedCommitteeTxInput to utils * fix: Move method to a properly module * fix: Update satsuma deployment ids * fix: Update graph studio deployment id
1 parent 77120cc commit cfa5fa0

File tree

5 files changed

+34
-18
lines changed

5 files changed

+34
-18
lines changed

.github/workflows/node.js.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ name: Node.js CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
jobs:
1010
build:
11-
1211
runs-on: ubuntu-latest
1312

1413
steps:
1514
- uses: actions/checkout@v3
16-
- uses: actions/setup-node@v3
15+
- name: Use Node.js 20.x
16+
uses: actions/setup-node@v3
1717
with:
18-
node-version: 16.x
18+
node-version: 20.x
1919
# Cache dependencies as `npm ci` takes like 6 minutes to run.
2020
# https://github.com/actions/cache/blob/main/examples.md#node---npm
2121
- id: npm-cache-dir

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
| Network | Provider | URL | Current | Previous |
44
| ---------- | --------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
5-
| Mainnet | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-ethereum-mainnet/playground | QmQVuFfc5quYrG7t4jVPRTNXjBWhPrqVtwwKkGrWoqnSHw | Qmf4SMTepdDoFh1ozcaAUMieGF83tnNa2G2Jr4KkH5jPRA |
5+
| Mainnet | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-ethereum-mainnet/playground | QmUB93QwfnCHoivBT46XVKUN58hCwioVmJTtwYbekQTjAg | QmXd2SSKpMa9Z4igqbGwr6vSvA7rgxRUFmYipgNFBbnMHN |
66
| Mainnet | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-ethereum-mainnet | QmQVuFfc5quYrG7t4jVPRTNXjBWhPrqVtwwKkGrWoqnSHw | Qmf4SMTepdDoFh1ozcaAUMieGF83tnNa2G2Jr4KkH5jPRA |
7-
| Sepolia | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-ethereum-sepolia/playground | QmSYyRTthY69mSHxkAY6ym3beCWQr97NwecWdpxjiHypKh | QmWQZiMSV5AnUPN34NFmAYtxGntxewMUUwuS9r5vBpc5Ys |
7+
| Sepolia | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-ethereum-sepolia/playground | Qme5ou2ivyxTsosbmK5W5RWzpNmtDZFSqpGzDxpJUrdbhj | QmSYyRTthY69mSHxkAY6ym3beCWQr97NwecWdpxjiHypKh |
88
| Sepolia | Graph Studio | https://api.studio.thegraph.com/query/49472/collections-ethereum-sepolia/version/latest | QmSYyRTthY69mSHxkAY6ym3beCWQr97NwecWdpxjiHypKh | QmWQZiMSV5AnUPN34NFmAYtxGntxewMUUwuS9r5vBpc5Ys |
9-
| Matic | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-matic-mainnet/playground | QmVtyq4MTv7ajHhBg3WHszkCQDnD1DM57AEcxMFb1PkHkk | QmPAV5PzFgu7iaiSYYmRTPGFR4ADGfeKSTPqTPt5eKVAVv |
10-
| Matic | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mainnet | QmVtyq4MTv7ajHhBg3WHszkCQDnD1DM57AEcxMFb1PkHkk | QmPAV5PzFgu7iaiSYYmRTPGFR4ADGfeKSTPqTPt5eKVAVv |
9+
| Matic | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-matic-mainnet/playground | QmTmqmgdZ58JRp5N7nKj2XiE4b6R2HjsPNeMmbtU92Uc2x | QmTNHaULmSpzSsaMnFvUDqSpHUw7o5hGS7oGxj5hQo8pwX |
10+
| Matic | Graph Studio | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mainnet | Qmddr5gN7TY67SVZQzqGKSgwz3boofKdcnDD7QxSopraHV | QmTNHaULmSpzSsaMnFvUDqSpHUw7o5hGS7oGxj5hQo8pwX |
1111
| Matic Temp | Hosted Services | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mainnet-temp | QmTKztw187jUHZ33S2pndtyo68K462XwewcvMVAVH7mwZR | Qmf3igvJs24gozdwCwnDyPNz9DEBQMPQRFmEhUzEvgxZSq |
12-
| Mumbai | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-matic-mumbai/playground | QmdqoM3jpJWWbK1EMTZcSE5WJgiUaoSpKcSLeQRHhqQSea | QmYVGaMGvqkcBMrJ4F5XrkzwCzhB3FfJvHRBERbtgovCai |
13-
| Mumbai | Hosted Service | https://thegraph.com/explorer/subgraph/decentraland/collections-matic-mumbai | QmdqoM3jpJWWbK1EMTZcSE5WJgiUaoSpKcSLeQRHhqQSea | QmYVGaMGvqkcBMrJ4F5XrkzwCzhB3FfJvHRBERbtgovCai |
14-
| Amoy | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-matic-amoy/playground | QmeJBtfn5mgPH2CbRJpWbwUBmjg64vxTA5KTERaHUtG15u | QmZKxA9VfjFTDNbNDASec194y3rZxiamtEMakWaoFaD8ov |
12+
| Amoy | Satsuma | https://subgraph.satsuma-prod.com/decentraland/collections-matic-amoy/playground | Qmd3Fxkiv9gWH87sWiNDaagU61mns77MizCMoKNDmhqbhK | QmeJBtfn5mgPH2CbRJpWbwUBmjg64vxTA5KTERaHUtG15u |
1513

1614
Using [The Graph](https://thegraph.com) and [Alchemy](https://www.alchemy.com/)
1715

src/handlers/collection.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { RaritiesWithOracle } from '../entities/RaritiesWithOracle/RaritiesWithO
3030
import { getURNForWearableV2, getURNForCollectionV2 } from '../modules/metadata/wearable'
3131
import { getStoreAddress } from '../modules/store'
3232
import { getOrCreateAnalyticsDayData } from '../modules/analytics'
33-
import { getCurationId, getBlockWhereRescueItemsStarted } from '../modules/curation'
33+
import { getCurationId, getBlockWhereRescueItemsStarted, isAllowedCommitteeTxInput } from '../modules/curation'
3434
import { toLowerCase } from '../utils'
3535
import { getRaritiesWithOracleAddress } from '../modules/rarity'
3636

@@ -212,8 +212,7 @@ export function handleRescueItem(event: RescueItem): void {
212212
if ((isNewContent && event.block.number.gt(block)) || event.block.number.equals(block)) {
213213
// Create curation
214214
let txInput = event.transaction.input.toHexString()
215-
// forwardMetaTx(address _target, bytes calldata _data) or manageCollection(address,address,address,bytes[]) selector
216-
if (txInput.startsWith('0x07bd3522') || txInput.startsWith('0x81c9308e')) {
215+
if (isAllowedCommitteeTxInput(txInput)) {
217216
let curationId = getCurationId(collectionAddress, event.transaction.hash.toHexString(), event.logIndex.toString())
218217
let curation = new Curation(curationId)
219218
let curator = ''
@@ -517,8 +516,7 @@ export function handleSetApproved(event: SetApproved): void {
517516
if (event.block.number.lt(block)) {
518517
// Create curation
519518
let txInput = event.transaction.input.toHexString()
520-
// forwardMetaTx(address _target, bytes calldata _data) or manageCollection(address,address,address,bytes[]) selector
521-
if (txInput.startsWith('0x07bd3522') || txInput.startsWith('0x81c9308e')) {
519+
if (isAllowedCommitteeTxInput(txInput)) {
522520
let curationId = getCurationId(collectionAddress, event.transaction.hash.toHexString(), event.logIndex.toString())
523521
let curation = new Curation(curationId)
524522
let curator = ''

src/modules/curation/index.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,23 @@ export function getBlockWhereRescueItemsStarted(): BigInt {
2222

2323
return BigInt.fromI32(I32.MAX_VALUE)
2424
}
25+
26+
// List of allowed committee function selectors
27+
// 0x07bd3522: forwardMetaTx(address _target, bytes calldata _data)
28+
// 0xad718d2a: sponsoredCallV2(address _target,bytes _data,bytes32 _correlationId,bytes32 _r,bytes32 _vs)
29+
// 0x81c9308e: manageCollection(address,address,address,bytes[]) selector
30+
export const ALLOWED_SELECTORS: string[] = ['0x07bd3522', '0xad718d2a', '0x81c9308e']
31+
32+
/**
33+
* Verify if it's an allowed committee transaction input.
34+
* @param txInput - The transaction input data as a hexadecimal string.
35+
* @returns True if the input starts with an allowed selector, false otherwise.
36+
*/
37+
export function isAllowedCommitteeTxInput(txInput: string): boolean {
38+
for (let i = 0; i < ALLOWED_SELECTORS.length; i++) {
39+
if (txInput.startsWith(ALLOWED_SELECTORS[i])) {
40+
return true
41+
}
42+
}
43+
return false
44+
}

src/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ export function toLowerCase(str: string): string {
1212
}
1313

1414
return result
15-
}
15+
}

0 commit comments

Comments
 (0)