Skip to content

Commit

Permalink
feat: Remove matic vigil RPC (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
LautaroPetaccio committed Jun 23, 2022
1 parent 1cfb51a commit eca2613
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 29 deletions.
2 changes: 0 additions & 2 deletions .ci/Pulumi.services-builder-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ config:
secure: v1:otw+92ejjeAgoBNw:au9UYhAZ0iHuFuFHMyRFVg==
service-builder:FORUM_API_KEY:
secure: v1:DyogukMdO4GbO6PI:UbWJce41J1Yumv9CNSgYHgMRCd+ONSXiPiFsoXjooRKoTdP345+Kbg/PmKvn/d03VQrE7NNxsKCWtUzYgqqJZvz6GfiGv1xTzLMRAAMRM94=
service-builder:MATIC_RPC_URL:
secure: v1:y/iM1Wm+dYBLHDYj:M0aTQQ/VY1MFxHisx+WOX4IppE1CTMrd2VS7PFf16HdlQEgNPYdJvBaZX/O2mrMDxhe5MBJFJZBCL5hYCZSx88IhmoRky59nYiQeCJAueH000Vtch0SOtv+/UrdY
service-builder:OPEN_SEA_API_KEY:
secure: v1:OL2jZRoBBWA9ouLG:vNKw88qloxfUo0o7CwT4yiFdKbvIV9nRUh45KuCzIWCB0hThPJnyHPE/b+XyC2+R
service-builder:WAREHOUSE_TOKEN:
Expand Down
2 changes: 0 additions & 2 deletions .ci/Pulumi.services-builder-prd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ config:
secure: v1:HNZMo29miOz4dVR6:+omHZh9/0MbGCOA9bsRBU4qYQFSQe5Tai/LrnzO4b2+rDiXOu1N+ZpdpAv0uqJnYZf5ZFpY8NGTWPUT/TI1wnOOpSzT1fi4YxbtQ/dvrmF/4qEaO+8Ugit62g7OKJFU6lo3ubxbKR+aHrh/T1dYPUg==
service-builder:FORUM_API_KEY:
secure: v1:xw9q2g5u4lcmsM/1:7rS7AYKWSM5uwZvTcWC0J1zzD+K2skTTKrIOXtKogD5yl4UERSGASK7Y3mWjzT47I0VQuS1J41Y9/NO+WCS9YmAUyIZNu+lzASXFpL/q35g=
service-builder:MATIC_RPC_URL:
secure: v1:rlJUnHubQnu9din0:bYMrrBvWby6RV4EFau1pECrbQFbJeY8LuG7QbnaJCltVwgRjjOzKcU8jNk2Me4FIXHOe1OjIJMJtUODbkRUq1gKqh9UjJlcOOCvI4LmT5w+o236V73SySI47hSZXhw==
service-builder:OPEN_SEA_API_KEY:
secure: v1:eUmpidoKIP3dzRZ5:MP7ooTh17ZcQ51xxni/0LdROOYzU3TYQ3+pEdbuXd+0JXp/rc3x+rcSpv0gpk4zD
service-builder:WAREHOUSE_TOKEN:
Expand Down
2 changes: 0 additions & 2 deletions .ci/Pulumi.services-builder-stg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ config:
secure: v1:Z6ATv1FIz/wtbRce:hSfRsb3J7bH5OyuPnbrQSRXkgrTVJmBBXcPB3fkBXF/vAiTc7rsaUpSProJVxsfBeOTe4IWZDD0U4XdlhcRF1O35kpBhOZjn8LM/ZBiJVY/GvHe0F7HXGe3c2xEPY2TZ7Sp7M9u5KLwSy1wlCqmOmA==
service-builder:FORUM_API_KEY:
secure: v1:iCSHNMm87JmCkeIw:rvM2L53K9ZqsfSyhMCPNWMfCFwAMwKRX6tu1eLExwR2wxekpH772rrBtIiAixeeqkS9OTjxaIOW2LBwqIrMABJQfi4oDQ7JEPfZDStW8Tms=
service-builder:MATIC_RPC_URL:
secure: v1:o/HvBkGrqSPuupAY:TNg7tIV3+Ty11lJLbTpFqxMWDUGYBZQ58gOEVJQ3pLfJs9Mz//BHMNT2HnQ1D9/WAo/kUfL1FalrAV5lIYdBNE4oReeEyoCcYJKMGzHOS++y1TuEXCTdYa/h34Mv6A==
service-builder:OPEN_SEA_API_KEY:
secure: v1:H1N6sE1uwje9dPFP:Biix9ZJokBqZBuJlYsKvuQESpenOONcHaEhv04mg0g4xIjCcmGQEWt9AJ4kVnnMy
service-builder:WAREHOUSE_TOKEN:
Expand Down
7 changes: 5 additions & 2 deletions .ci/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,11 @@ export = async function main() {
value: prometheusStack.getOutput('serviceMetricsBearerToken'),
},
{
name: 'MATIC_RPC_URL',
value: config.requireSecret('MATIC_RPC_URL'),
name: 'RPC_URL',
value:
env === 'prd' || env === 'stg'
? 'https://rpc.decentraland.org/polygon'
: 'https://rpc.decentraland.org/mumbai',
},
{ name: 'WAREHOUSE_URL', value: config.requireSecret('WAREHOUSE_URL') },
{ name: 'WAREHOUSE_CONTEXT_PREFIX', value: env },
Expand Down
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ COLLECTIONS_GRAPH_URL=

PEER_URL=

MATIC_RPC_URL=

RPC_URL=
WAREHOUSE_URL=
WAREHOUSE_TOKEN=
WAREHOUSE_CONTEXT_PREFIX=
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
AWS_ACCESS_KEY: AWS_ACCESS_KEY
AWS_ACCESS_SECRET: AWS_ACCESS_SECRET
AWS_BUCKET_NAME: AWS_BUCKET_NAME
MATIC_RPC_URL: MATIC_RPC_URL
RPC_URL: RPC_URL
WAREHOUSE_URL: WAREHOUSE_URL
WAREHOUSE_TOKEN: WAREHOUSE_TOKEN
AUTH0_DOMAIN: AUTH0_DOMAIN
Expand Down
4 changes: 3 additions & 1 deletion src/Collection/Collection.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ export class CollectionService {

return {
collection: Bridge.mergeTPCollection(dbCollection, lastItemCuration),
items: await Bridge.consolidateTPItems(dbItems, itemCurations, [dbCollection]),
items: await Bridge.consolidateTPItems(dbItems, itemCurations, [
dbCollection,
]),
itemCurations,
}
}
Expand Down
13 changes: 2 additions & 11 deletions src/Rarity/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { env } from 'decentraland-commons'
import { ContractName, getContract } from 'decentraland-transactions'
import { ethers } from 'ethers'
import { getMappedChainIdForCurrentChainName } from '../ethereum/utils'
import { getRpcUrl } from '../utils/eth'

export function isUsingRaritiesWithOracle(): boolean {
return env.get<string | undefined>('FF_RARITIES_WITH_ORACLE') === '1'
Expand All @@ -17,7 +18,7 @@ export function getRarityFromBlockchain(
chainId
)

const provider = new ethers.providers.JsonRpcProvider(getMaticRpcUrl())
const provider = new ethers.providers.JsonRpcProvider(getRpcUrl())

const contract = new ethers.Contract(
raritiesWithOracle.address,
Expand All @@ -27,13 +28,3 @@ export function getRarityFromBlockchain(

return contract.getRarityByName(name)
}

function getMaticRpcUrl(): string {
const maticRpcUrl = env.get<string | undefined>('MATIC_RPC_URL')

if (!maticRpcUrl) {
throw new Error('MATIC_RPC_URL not defined')
}

return maticRpcUrl
}
1 change: 1 addition & 0 deletions src/ethereum/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './FactoryCollection'
export * from './utils'
15 changes: 9 additions & 6 deletions src/utils/eth.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { providers } from 'ethers'
import { env } from 'decentraland-commons'
import { providers } from 'ethers'
import { isContract } from 'decentraland-transactions'

export const MATIC_RPC_URL = env.get('MATIC_RPC_URL', '')
export function getRpcUrl(): string {
const rpcUrl = env.get<string | undefined>('RPC_URL')

if (!MATIC_RPC_URL) {
throw new Error('Please set a MATIC_RPC_URL env variable')
}
if (!rpcUrl) {
throw new Error('RPC_URL not defined')
}

const provider = new providers.JsonRpcProvider(MATIC_RPC_URL)
return rpcUrl
}

export async function isPublished(collectionAddress: string) {
const provider = new providers.JsonRpcProvider(getRpcUrl())
return isContract(provider, collectionAddress)
}

0 comments on commit eca2613

Please sign in to comment.