Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 7e10d7e

Browse files
Merge pull request #37 from decentraland/fix/polygon-issues
feat: fix some Polygon logic issues
2 parents d4d4d00 + 3f2c4e8 commit 7e10d7e

File tree

17 files changed

+525
-18
lines changed

17 files changed

+525
-18
lines changed

abi/polygon/CollectionManager.json

+245
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
[
2+
{
3+
"inputs": [
4+
{ "internalType": "address", "name": "_owner", "type": "address" },
5+
{ "internalType": "contract IERC20", "name": "_acceptedToken", "type": "address" },
6+
{ "internalType": "address", "name": "_committee", "type": "address" },
7+
{ "internalType": "address", "name": "_feesCollector", "type": "address" },
8+
{ "internalType": "contract IRarities", "name": "_rarities", "type": "address" },
9+
{ "internalType": "bytes4[]", "name": "_committeeMethods", "type": "bytes4[]" },
10+
{ "internalType": "bool[]", "name": "_committeeValues", "type": "bool[]" }
11+
],
12+
"stateMutability": "nonpayable",
13+
"type": "constructor"
14+
},
15+
{
16+
"anonymous": false,
17+
"inputs": [
18+
{ "indexed": true, "internalType": "contract IERC20", "name": "_oldAcceptedToken", "type": "address" },
19+
{ "indexed": true, "internalType": "contract IERC20", "name": "_newAcceptedToken", "type": "address" }
20+
],
21+
"name": "AcceptedTokenSet",
22+
"type": "event"
23+
},
24+
{
25+
"anonymous": false,
26+
"inputs": [
27+
{ "indexed": true, "internalType": "bytes4", "name": "_method", "type": "bytes4" },
28+
{ "indexed": false, "internalType": "bool", "name": "_isAllowed", "type": "bool" }
29+
],
30+
"name": "CommitteeMethodSet",
31+
"type": "event"
32+
},
33+
{
34+
"anonymous": false,
35+
"inputs": [
36+
{ "indexed": true, "internalType": "address", "name": "_oldCommittee", "type": "address" },
37+
{ "indexed": true, "internalType": "address", "name": "_newCommittee", "type": "address" }
38+
],
39+
"name": "CommitteeSet",
40+
"type": "event"
41+
},
42+
{
43+
"anonymous": false,
44+
"inputs": [
45+
{ "indexed": true, "internalType": "address", "name": "_oldFeesCollector", "type": "address" },
46+
{ "indexed": true, "internalType": "address", "name": "_newFeesCollector", "type": "address" }
47+
],
48+
"name": "FeesCollectorSet",
49+
"type": "event"
50+
},
51+
{
52+
"anonymous": false,
53+
"inputs": [
54+
{ "indexed": false, "internalType": "address", "name": "userAddress", "type": "address" },
55+
{ "indexed": false, "internalType": "address", "name": "relayerAddress", "type": "address" },
56+
{ "indexed": false, "internalType": "bytes", "name": "functionSignature", "type": "bytes" }
57+
],
58+
"name": "MetaTransactionExecuted",
59+
"type": "event"
60+
},
61+
{
62+
"anonymous": false,
63+
"inputs": [
64+
{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" },
65+
{ "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }
66+
],
67+
"name": "OwnershipTransferred",
68+
"type": "event"
69+
},
70+
{
71+
"anonymous": false,
72+
"inputs": [
73+
{ "indexed": true, "internalType": "contract IRarities", "name": "_oldRarities", "type": "address" },
74+
{ "indexed": true, "internalType": "contract IRarities", "name": "_newRarities", "type": "address" }
75+
],
76+
"name": "RaritiesSet",
77+
"type": "event"
78+
},
79+
{
80+
"inputs": [],
81+
"name": "acceptedToken",
82+
"outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }],
83+
"stateMutability": "view",
84+
"type": "function"
85+
},
86+
{
87+
"inputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }],
88+
"name": "allowedCommitteeMethods",
89+
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
90+
"stateMutability": "view",
91+
"type": "function"
92+
},
93+
{
94+
"inputs": [],
95+
"name": "committee",
96+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
97+
"stateMutability": "view",
98+
"type": "function"
99+
},
100+
{
101+
"inputs": [
102+
{ "internalType": "contract IForwarder", "name": "_forwarder", "type": "address" },
103+
{ "internalType": "contract IERC721CollectionFactoryV2", "name": "_factory", "type": "address" },
104+
{ "internalType": "bytes32", "name": "_salt", "type": "bytes32" },
105+
{ "internalType": "string", "name": "_name", "type": "string" },
106+
{ "internalType": "string", "name": "_symbol", "type": "string" },
107+
{ "internalType": "string", "name": "_baseURI", "type": "string" },
108+
{ "internalType": "address", "name": "_creator", "type": "address" },
109+
{
110+
"components": [
111+
{ "internalType": "string", "name": "rarity", "type": "string" },
112+
{ "internalType": "uint256", "name": "price", "type": "uint256" },
113+
{ "internalType": "address", "name": "beneficiary", "type": "address" },
114+
{ "internalType": "string", "name": "metadata", "type": "string" }
115+
],
116+
"internalType": "struct IERC721CollectionV2.ItemParam[]",
117+
"name": "_items",
118+
"type": "tuple[]"
119+
}
120+
],
121+
"name": "createCollection",
122+
"outputs": [],
123+
"stateMutability": "nonpayable",
124+
"type": "function"
125+
},
126+
{
127+
"inputs": [],
128+
"name": "domainSeparator",
129+
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
130+
"stateMutability": "view",
131+
"type": "function"
132+
},
133+
{
134+
"inputs": [
135+
{ "internalType": "address", "name": "userAddress", "type": "address" },
136+
{ "internalType": "bytes", "name": "functionSignature", "type": "bytes" },
137+
{ "internalType": "bytes32", "name": "sigR", "type": "bytes32" },
138+
{ "internalType": "bytes32", "name": "sigS", "type": "bytes32" },
139+
{ "internalType": "uint8", "name": "sigV", "type": "uint8" }
140+
],
141+
"name": "executeMetaTransaction",
142+
"outputs": [{ "internalType": "bytes", "name": "", "type": "bytes" }],
143+
"stateMutability": "payable",
144+
"type": "function"
145+
},
146+
{
147+
"inputs": [],
148+
"name": "feesCollector",
149+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
150+
"stateMutability": "view",
151+
"type": "function"
152+
},
153+
{
154+
"inputs": [],
155+
"name": "getChainId",
156+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
157+
"stateMutability": "pure",
158+
"type": "function"
159+
},
160+
{
161+
"inputs": [{ "internalType": "address", "name": "user", "type": "address" }],
162+
"name": "getNonce",
163+
"outputs": [{ "internalType": "uint256", "name": "nonce", "type": "uint256" }],
164+
"stateMutability": "view",
165+
"type": "function"
166+
},
167+
{
168+
"inputs": [
169+
{ "internalType": "contract IForwarder", "name": "_forwarder", "type": "address" },
170+
{ "internalType": "contract IERC721CollectionV2", "name": "_collection", "type": "address" },
171+
{ "internalType": "bytes", "name": "_data", "type": "bytes" }
172+
],
173+
"name": "manageCollection",
174+
"outputs": [],
175+
"stateMutability": "nonpayable",
176+
"type": "function"
177+
},
178+
{
179+
"inputs": [],
180+
"name": "owner",
181+
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
182+
"stateMutability": "view",
183+
"type": "function"
184+
},
185+
{
186+
"inputs": [],
187+
"name": "pricePerItem",
188+
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
189+
"stateMutability": "view",
190+
"type": "function"
191+
},
192+
{
193+
"inputs": [],
194+
"name": "rarities",
195+
"outputs": [{ "internalType": "contract IRarities", "name": "", "type": "address" }],
196+
"stateMutability": "view",
197+
"type": "function"
198+
},
199+
{ "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" },
200+
{
201+
"inputs": [{ "internalType": "contract IERC20", "name": "_newAcceptedToken", "type": "address" }],
202+
"name": "setAcceptedToken",
203+
"outputs": [],
204+
"stateMutability": "nonpayable",
205+
"type": "function"
206+
},
207+
{
208+
"inputs": [{ "internalType": "address", "name": "_newCommittee", "type": "address" }],
209+
"name": "setCommittee",
210+
"outputs": [],
211+
"stateMutability": "nonpayable",
212+
"type": "function"
213+
},
214+
{
215+
"inputs": [
216+
{ "internalType": "bytes4[]", "name": "_methods", "type": "bytes4[]" },
217+
{ "internalType": "bool[]", "name": "_values", "type": "bool[]" }
218+
],
219+
"name": "setCommitteeMethods",
220+
"outputs": [],
221+
"stateMutability": "nonpayable",
222+
"type": "function"
223+
},
224+
{
225+
"inputs": [{ "internalType": "address", "name": "_newFeesCollector", "type": "address" }],
226+
"name": "setFeesCollector",
227+
"outputs": [],
228+
"stateMutability": "nonpayable",
229+
"type": "function"
230+
},
231+
{
232+
"inputs": [{ "internalType": "contract IRarities", "name": "_newRarities", "type": "address" }],
233+
"name": "setRarities",
234+
"outputs": [],
235+
"stateMutability": "nonpayable",
236+
"type": "function"
237+
},
238+
{
239+
"inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }],
240+
"name": "transferOwnership",
241+
"outputs": [],
242+
"stateMutability": "nonpayable",
243+
"type": "function"
244+
}
245+
]

db/migrations/1720782180337-Data.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = class Data1720782180337 {
2+
name = 'Data1720782180337'
3+
4+
async up(db) {
5+
await db.query(`ALTER TABLE "nft" DROP COLUMN "contract_address"`)
6+
await db.query(`ALTER TABLE "nft" ADD "contract_address" text NOT NULL`)
7+
await db.query(`ALTER TABLE "sale" DROP COLUMN "search_contract_address"`)
8+
await db.query(`ALTER TABLE "sale" ADD "search_contract_address" text NOT NULL`)
9+
}
10+
11+
async down(db) {
12+
await db.query(`ALTER TABLE "nft" ADD "contract_address" bytea NOT NULL`)
13+
await db.query(`ALTER TABLE "nft" DROP COLUMN "contract_address"`)
14+
await db.query(`ALTER TABLE "sale" ADD "search_contract_address" bytea NOT NULL`)
15+
await db.query(`ALTER TABLE "sale" DROP COLUMN "search_contract_address"`)
16+
}
17+
}

schema.graphql

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ type Data @entity {
153153
type NFT @entity {
154154
id: ID!
155155
tokenId: BigInt!
156-
contractAddress: Bytes!
156+
contractAddress: String!
157157
category: Category!
158158
owner: Account!
159159
tokenURI: String
@@ -351,7 +351,7 @@ type Sale @entity {
351351

352352
# search
353353
searchTokenId: BigInt!
354-
searchContractAddress: Bytes!
354+
searchContractAddress: String!
355355
searchCategory: String!
356356

357357
## collections subgraph fields

src/common/utils/network.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function getNetwork(network: Network): string {
44
const chainId =
55
network === Network.ETHEREUM
66
? process.env.ETHEREUM_CHAIN_ID
7-
: process.env.MATIC_CHAIN_ID;
7+
: process.env.POLYGON_CHAIN_ID;
88
const chainName =
99
network === Network.ETHEREUM
1010
? chainId === ChainId.ETHEREUM_MAINNET.toString()

src/eth/handlers/nft.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export function handleTransfer(
9191

9292
nft.tokenId = tokenId;
9393
nft.owner = toAccount;
94-
nft.contractAddress = Buffer.from(contractAddress.slice(2), "hex");
94+
nft.contractAddress = contractAddress;
9595
nft.category = category as Category;
9696
nft.updatedAt = timestamp;
9797
nft.soldAt = null;

src/model/generated/nft.model.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, BigIntColumn as BigIntColumn_, BytesColumn as BytesColumn_, ManyToOne as ManyToOne_, Index as Index_, StringColumn as StringColumn_, OneToMany as OneToMany_, OneToOne as OneToOne_, JoinColumn as JoinColumn_, IntColumn as IntColumn_, BooleanColumn as BooleanColumn_} from "@subsquid/typeorm-store"
1+
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, BigIntColumn as BigIntColumn_, StringColumn as StringColumn_, ManyToOne as ManyToOne_, Index as Index_, OneToMany as OneToMany_, OneToOne as OneToOne_, JoinColumn as JoinColumn_, IntColumn as IntColumn_, BooleanColumn as BooleanColumn_} from "@subsquid/typeorm-store"
22
import {Category} from "./_category"
33
import {Account} from "./account.model"
44
import {Order} from "./order.model"
@@ -29,8 +29,8 @@ export class NFT {
2929
@BigIntColumn_({nullable: false})
3030
tokenId!: bigint
3131

32-
@BytesColumn_({nullable: false})
33-
contractAddress!: Uint8Array
32+
@StringColumn_({nullable: false})
33+
contractAddress!: string
3434

3535
@Column_("varchar", {length: 8, nullable: false})
3636
category!: Category

src/model/generated/sale.model.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export class Sale {
3838
@BigIntColumn_({nullable: false})
3939
searchTokenId!: bigint
4040

41-
@BytesColumn_({nullable: false})
42-
searchContractAddress!: Uint8Array
41+
@StringColumn_({nullable: false})
42+
searchContractAddress!: string
4343

4444
@StringColumn_({nullable: false})
4545
searchCategory!: string

0 commit comments

Comments
 (0)