Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add polygon amoy network #1767

Merged
merged 10 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
10 changes: 5 additions & 5 deletions content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"dependencies": {
"@dcl/block-indexer": "^1.1.2",
"@dcl/catalyst-api-specs": "^3.2.5",
"@dcl/catalyst-contracts": "^4.3.1",
"@dcl/catalyst-contracts": "^4.4.0",
"@dcl/catalyst-storage": "^4.2.0",
"@dcl/content-validator": "^5.1.1",
"@dcl/content-validator": "^5.2.0",
"@dcl/crypto": "^3.4.5",
"@dcl/hashing": "^3.0.4",
"@dcl/schemas": "^11.4.0",
"@dcl/schemas": "^11.5.0",
"@dcl/snapshots-fetcher": "^9.0.3",
"@dcl/urn-resolver": "^3.3.1",
"@dcl/urn-resolver": "^3.4.0",
"@well-known-components/env-config-provider": "^1.2.0",
"@well-known-components/fetch-component": "^2.0.2",
"@well-known-components/http-server": "^2.1.0",
Expand All @@ -39,7 +39,7 @@
"@well-known-components/multipart-wrapper": "^1.0.3",
"@well-known-components/thegraph-component": "^1.6.0",
"bloom-filters": "^3.0.0",
"dcl-catalyst-client": "^21.6.1",
"dcl-catalyst-client": "^21.7.0",
"eth-connect": "^6.2.4",
"form-data": "^4.0.0",
"fp-future": "^1.0.1",
Expand Down
18 changes: 8 additions & 10 deletions content/src/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,18 @@ export const DEFAULT_COLLECTIONS_SUBGRAPH_TESTNET =
'https://api.studio.thegraph.com/query/49472/collections-ethereum-sepolia/version/latest'
export const DEFAULT_COLLECTIONS_SUBGRAPH_MAINNET =
'https://api.thegraph.com/subgraphs/name/decentraland/collections-ethereum-mainnet'
export const DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_MUMBAI =
'https://api.thegraph.com/subgraphs/name/decentraland/collections-matic-mumbai'
export const DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_MAINNET =
'https://api.thegraph.com/subgraphs/name/decentraland/collections-matic-mainnet'
export const DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_MUMBAI =
'https://api.thegraph.com/subgraphs/name/decentraland/tpr-matic-mumbai'
export const DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_AMOY = 'https://subgraph.decentraland.org/collections-matic-amoy'
export const DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_AMOY = 'https://subgraph.decentraland.org/tpr-matic-amoy'
export const DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_MAINNET =
'https://api.thegraph.com/subgraphs/name/decentraland/tpr-matic-mainnet'
export const DEFAULT_BLOCKS_SUBGRAPH_TESTNET =
'https://api.studio.thegraph.com/query/49472/blocks-ethereum-sepolia/version/latest'
export const DEFAULT_BLOCKS_SUBGRAPH_MAINNET =
'https://api.thegraph.com/subgraphs/name/decentraland/blocks-ethereum-mainnet'
export const DEFAULT_BLOCKS_SUBGRAPH_MATIC_MUMBAI =
'https://api.thegraph.com/subgraphs/name/decentraland/blocks-matic-mumbai'
export const DEFAULT_BLOCKS_SUBGRAPH_MATIC_AMOY =
'https://api.studio.thegraph.com/query/49472/blocks-matic-amoy/version/latest'
export const DEFAULT_BLOCKS_SUBGRAPH_MATIC_MAINNET =
'https://api.thegraph.com/subgraphs/name/decentraland/blocks-matic-mainnet'

Expand All @@ -50,7 +48,7 @@ export const DEFAULT_DATABASE_CONFIG = {
database: 'content',
host: 'localhost',
schema: 'public',
port: 5432
port: 5433
}
const DEFAULT_SYNC_STREAM_TIMEOUT = '10m'

Expand Down Expand Up @@ -304,7 +302,7 @@ export class EnvironmentBuilder {
process.env.COLLECTIONS_L2_SUBGRAPH_URL ??
(process.env.ETH_NETWORK === 'mainnet'
? DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_MAINNET
: DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_MUMBAI)
: DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_AMOY)
)

this.registerConfigIfNotAlreadySet(
Expand All @@ -314,7 +312,7 @@ export class EnvironmentBuilder {
process.env.THIRD_PARTY_REGISTRY_L2_SUBGRAPH_URL ??
(process.env.ETH_NETWORK === 'mainnet'
? DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_MAINNET
: DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_MUMBAI)
: DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_AMOY)
)

this.registerConfigIfNotAlreadySet(
Expand All @@ -334,7 +332,7 @@ export class EnvironmentBuilder {
process.env.BLOCKS_L2_SUBGRAPH_URL ??
(process.env.ETH_NETWORK === 'mainnet'
? DEFAULT_BLOCKS_SUBGRAPH_MATIC_MAINNET
: DEFAULT_BLOCKS_SUBGRAPH_MATIC_MUMBAI)
: DEFAULT_BLOCKS_SUBGRAPH_MATIC_AMOY)
)
this.registerConfigIfNotAlreadySet(
env,
Expand Down
2 changes: 1 addition & 1 deletion content/src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export async function initComponentsWithEnv(env: Environment): Promise<AppCompon
const l2HttpProviderUrl: string = env.getConfig(EnvironmentConfig.L2_HTTP_PROVIDER_URL)
const useOnChainValidator = !!(l1HttpProviderUrl && l2HttpProviderUrl)

const l2Network = ethNetwork === 'mainnet' ? 'polygon' : 'mumbai'
const l2Network = ethNetwork === 'mainnet' ? 'polygon' : 'amoy'

const l1Provider = new HTTPProvider(
l1HttpProviderUrl || `https://rpc.decentraland.org/${encodeURIComponent(ethNetwork)}?project=catalyst-content`,
Expand Down
2 changes: 1 addition & 1 deletion content/src/logic/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export async function createL1Checker(provider: HTTPProvider, network: 'mainnet'
}
}

export async function createL2Checker(provider: HTTPProvider, network: 'mumbai' | 'polygon'): Promise<L2Checker> {
export async function createL2Checker(provider: HTTPProvider, network: 'polygon' | 'amoy'): Promise<L2Checker> {
const checkerAddress = l2Contracts[network].checker
const requestManager = new RequestManager(provider)
const factory = new ContractFactory(requestManager, checkerAbi)
Expand Down
2 changes: 1 addition & 1 deletion content/src/service/validations/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export async function createOnChainValidator(
): Promise<ValidateFn> {
const { env, metrics, logs, externalCalls } = components
const l1Network: 'mainnet' | 'sepolia' = env.getConfig(EnvironmentConfig.ETH_NETWORK)
const l2Network = l1Network === 'mainnet' ? 'polygon' : 'mumbai'
const l2Network = l1Network === 'mainnet' ? 'polygon' : 'amoy'

const l1Checker = await createL1Checker(l1Provider, l1Network)
const l2Checker = await createL2Checker(l2Provider, l2Network)
Expand Down
6 changes: 3 additions & 3 deletions lambdas/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"dependencies": {
"@dcl/catalyst-api-specs": "^3.2.5",
"@dcl/crypto": "^3.4.5",
"@dcl/schemas": "^11.4.0",
"@dcl/urn-resolver": "^3.3.1",
"@dcl/schemas": "^11.5.0",
"@dcl/urn-resolver": "^3.4.0",
"@well-known-components/env-config-provider": "^1.2.0",
"@well-known-components/fetch-component": "^2.0.2",
"@well-known-components/http-server": "^2.1.0",
Expand All @@ -24,7 +24,7 @@
"@well-known-components/thegraph-component": "^1.6.0",
"compression": "1.7.4",
"cors": "2.8.5",
"dcl-catalyst-client": "^21.6.1",
"dcl-catalyst-client": "^21.7.0",
"destroy": "1.2.0",
"eth-connect": "^6.2.4",
"express": "4.18.1",
Expand Down
10 changes: 4 additions & 6 deletions lambdas/src/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ export const DEFAULT_COLLECTIONS_SUBGRAPH_TESTNET =
'https://api.studio.thegraph.com/query/49472/collections-ethereum-sepolia/version/latest'
export const DEFAULT_COLLECTIONS_SUBGRAPH_MAINNET =
'https://api.thegraph.com/subgraphs/name/decentraland/collections-ethereum-mainnet'
export const DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_MUMBAI =
'https://api.thegraph.com/subgraphs/name/decentraland/collections-matic-mumbai'
export const DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_AMOY = 'https://subgraph.decentraland.org/collections-matic-amoy'
export const DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_MAINNET =
'https://api.thegraph.com/subgraphs/name/decentraland/collections-matic-mainnet'
export const DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_MUMBAI =
'https://api.thegraph.com/subgraphs/name/decentraland/tpr-matic-mumbai'
export const DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_AMOY = 'https://subgraph.decentraland.org/tpr-matic-amoy'
export const DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_MAINNET =
'https://api.thegraph.com/subgraphs/name/decentraland/tpr-matic-mainnet'

Expand Down Expand Up @@ -176,7 +174,7 @@ export class EnvironmentBuilder {
process.env.COLLECTIONS_L2_SUBGRAPH_URL ??
(process.env.ETH_NETWORK === 'mainnet'
? DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_MAINNET
: DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_MUMBAI)
: DEFAULT_COLLECTIONS_SUBGRAPH_MATIC_AMOY)
)

this.registerConfigIfNotAlreadySet(
Expand All @@ -186,7 +184,7 @@ export class EnvironmentBuilder {
process.env.THIRD_PARTY_REGISTRY_L2_SUBGRAPH_URL ??
(process.env.ETH_NETWORK === 'mainnet'
? DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_MAINNET
: DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_MUMBAI)
: DEFAULT_THIRD_PARTY_REGISTRY_SUBGRAPH_MATIC_AMOY)
)

this.registerConfigIfNotAlreadySet(env, EnvironmentConfig.COMMIT_HASH, () => process.env.COMMIT_HASH ?? 'Unknown')
Expand Down
2 changes: 2 additions & 0 deletions lambdas/src/apis/collections/controllers/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ function getProtocol(chainId: string): string | undefined {
return 'matic'
case ChainId.MATIC_MUMBAI:
return 'mumbai'
case ChainId.MATIC_AMOY:
return 'amoy'
}
}

Expand Down
4 changes: 2 additions & 2 deletions lambdas/src/ports/the-graph-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export async function createTheGraphClient(components: {
): Promise<WearableId[]> {
// Order will be L1 > L2
const L1_NETWORKS = ['mainnet', 'sepolia', 'ropsten', 'kovan', 'rinkeby', 'goerli']
const L2_NETWORKS = ['matic', 'mumbai']
const L2_NETWORKS = ['matic', 'mumbai', 'amoy']
const wearableTypes: BlockchainItemType[] = ['wearable_v1', 'wearable_v2', 'smart_wearable_v1', 'emote_v1']

let limit = pagination.limit
Expand Down Expand Up @@ -406,7 +406,7 @@ export async function createTheGraphClient(components: {
): Promise<EmoteId[]> {
// Order will be L1 > L2
const L1_NETWORKS = ['mainnet', 'sepolia', 'kovan', 'rinkeby', 'goerli']
const L2_NETWORKS = ['matic', 'mumbai']
const L2_NETWORKS = ['matic', 'mumbai', 'amoy']

let limit = pagination.limit
let lastId = pagination.lastId
Expand Down
Loading
Loading