Skip to content

Commit

Permalink
cleanup: removed goerli (#13540)
Browse files Browse the repository at this point in the history
* removed goerli

* removed stale include

* linting

* using op instead of goerli in tests

* fixing tests
  • Loading branch information
julien51 authored Mar 30, 2024
1 parent cf05771 commit d48ef89
Show file tree
Hide file tree
Showing 23 changed files with 42 additions and 169 deletions.
6 changes: 0 additions & 6 deletions locksmith/.op.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ ON_HEROKU=true
DEFENDER_RELAY_KEY_1=op://secrets/open-zeppelin-relay/ethereum-key
DEFENDER_RELAY_SECRET_1=op://secrets/open-zeppelin-relay/ethereum-secret

DEFENDER_RELAY_KEY_5=op://secrets/open-zeppelin-relay/goerli-key
DEFENDER_RELAY_SECRET_5=op://secrets/open-zeppelin-relay/goerli-secret

DEFENDER_RELAY_KEY_10=op://secrets/open-zeppelin-relay/optimism-key
DEFENDER_RELAY_SECRET_10=op://secrets/open-zeppelin-relay/optimism-secret

Expand Down Expand Up @@ -44,9 +41,6 @@ DEFENDER_RELAY_SECRET_43114=op://secrets/open-zeppelin-relay/avalanche-secret
DEFENDER_RELAY_KEY_80001=op://secrets/open-zeppelin-relay/mumbai-key
DEFENDER_RELAY_SECRET_80001=op://secrets/open-zeppelin-relay/mumbai-secret

DEFENDER_RELAY_KEY_84531=op://secrets/open-zeppelin-relay/base-goerli-key
DEFENDER_RELAY_SECRET_84531=op://secrets/open-zeppelin-relay/base-goerli-secret

DEFENDER_RELAY_KEY_11155111=op://secrets/open-zeppelin-relay/sepolia-key
DEFENDER_RELAY_SECRET_11155111=op://secrets/open-zeppelin-relay/sepolia-secret

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { vi, describe, expect } from 'vitest'

const lockAddress = '0x3F09aD349a693bB62a162ff2ff3e097bD1cE9a8C'
const wrongLockAddress = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
const network = 5
const network = 10
const tokenId = 147
const wrongTokenId = '666'
const owner = `0x00192fb10df37c9fb26829eb2cc623cd1bf599e8`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { vi } from 'vitest'
let lockAddress = '0x62CcB13A72E6F991dE53b9B7AC42885151588Cd2'
const template = 'keyMinded'

const network = 5
const network = 10
const customEmailContent = `Custom Email Content`

vi.mock('@unlock-protocol/unlock-js', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { vi, expect } from 'vitest'
import { SupplierBody } from '../../../src/controllers/v2/receiptBaseController'

const lockAddress = '0x62CcB13A72E6F991dE53b9B7AC42885151588Cd2'
const network = 5
const network = 10

const supplier: z.infer<typeof SupplierBody> = {
supplierName: 'Monkey D. Luffy',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const lockManager = `0x00192fb10df37c9fb26829eb2cc623cd1bf599e8`
const hash =
'0x68bd005bd3fba4c467f3289afdb773a797d3f5fe63ca13fd3ec7f16794b3858b'
const payer = '0xE91efB608747f8f99CBB7d77020B80ECaEc16E26'
const network = 5
const network = 10

const purchaser: z.infer<typeof PurchaserBody> = {
fullname: 'Mario Rossi',
Expand Down
4 changes: 2 additions & 2 deletions locksmith/__tests__/controllers/v2/rsvpController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { vi } from 'vitest'

const lockAddress = '0x62CcB13A72E6F991dE53b9B7AC42885151588Cd2'
const userAddress = '0x81Dd955D02D337DB81BA6c9C5F6213E647672052'
const network = 5
const network = 10

// eslint-disable-next-line
var mockWeb3Service = {
Expand Down Expand Up @@ -51,7 +51,7 @@ describe('RSVP', () => {
'0x81Dd955D02D337DB81BA6c9C5F6213E647672052'
)
expect(response.body.approval).toEqual('pending')
expect(response.body.network).toEqual(5)
expect(response.body.network).toEqual(10)
})

it('stores the RSVP in the right table even if there is no wallet', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function* keyIdGen() {

const lockAddress = '0x3F09aD349a693bB62a162ff2ff3e097bD1cE9a8C'
const wrongLockAddress = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
const network = 5
const network = 10
const keyGen = keyIdGen()
const tokenId = keyGen.next().value!
const wrongTokenId = '666'
Expand Down
4 changes: 2 additions & 2 deletions locksmith/__tests__/operations/lockSettingsOperations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('lockSettingsOperations', () => {
it('should save and retrieve lock settings with protected data', async () => {
expect.assertions(2)
const lockAddress = '0x95de5F777A3e283bFf0c47374998E10D8A2183C7'
const network = 5
const network = 10

await saveSettings({
lockAddress,
Expand All @@ -30,7 +30,7 @@ describe('lockSettingsOperations', () => {
it('correctly save and retrieve lock settings without protected data', async () => {
expect.assertions(2)
const lockAddress = '0xAaAdEED4c0B861cB36f4cE006a9C90BA2E43fdc2'
const network = 5
const network = 10

await saveSettings({
lockAddress,
Expand Down
2 changes: 1 addition & 1 deletion locksmith/__tests__/operations/pricingOperations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const lockAddressErc20 = '0x8D33b257bce083eE0c7504C7635D1840b3858AFD'
const lockAddressWithSettings = '0xBd55144A3A30907E080595cabF652Bc079728B2f'
const lockAddressWithoutSettings = '0x0dDf835Dc0C326c4A677a807b21Af1d7a521F275'
const lockWithEurCurrency = '0x1a1D8b22555521D9E664981Af56438e8aCe2134E'
const network = 5
const network = 10
const decimals = 18
const currencyContractAddress = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6'
const keyPrice = 40000
Expand Down
4 changes: 2 additions & 2 deletions locksmith/__tests__/operations/wedlocksOperations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ describe('Wedlocks operations', () => {

it('Correctly save and retrieve', async () => {
expect.assertions(2)
const network = 5
const network = 10
const template = 'keyMined'

const { loginResponse } = await loginRandomUser(app)
Expand All @@ -225,7 +225,7 @@ describe('Wedlocks operations', () => {

it('Custom content can not be retrieved when is not stored', async () => {
expect.assertions(3)
const network = 5
const network = 10
const template = 'RandomTemplate'

const { loginResponse } = await loginRandomUser(app)
Expand Down
2 changes: 1 addition & 1 deletion locksmith/__tests__/utils/certificationHelper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { it, expect } from 'vitest'
import { getCertificateLinkedinShareUrl } from '../../src/utils/certificationHelpers'

const lockAddress = '0xDd4356111193f7B28A20b5FC2Dc7750c249E55d2'
const network = 5
const network = 10
const tokenId = '2'

const metadata = {
Expand Down
2 changes: 1 addition & 1 deletion locksmith/__tests__/utils/pricing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const currencyContractAddress = '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6'
const cabinDaoLock = '0x45aCCac0E5C953009cDa713a3b722F87F2907F86'

const lockAddress = '0x551c6ecdf819Dc90c5287971072B4651119accD3'
const network = 5
const network = 10
const keyPrice = 9000000000000000
const gasPrice = 12.4
vi.mock('../../src/operations/lockSettingOperations', () => {
Expand Down
4 changes: 2 additions & 2 deletions locksmith/src/controllers/v2/contractsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const LockContractOptions = z.object({
export class ContractsController {
async createLockContract(request: Request, response: Response) {
const network = Number(request.params.network)
// Only supported on goerli, polygon, and gnosis.
if (![5, 137, 100].includes(network)) {
// Only supported on polygon, and gnosis.
if (![137, 100].includes(network)) {
return response.status(404).send({
message: `Network ${
networks[network]?.name || network
Expand Down
3 changes: 1 addition & 2 deletions packages/hardhat-helpers/src/etherscan.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const etherscan = {
// xdai requires only placeholder api key
xdai: 'api-key',
polygon: 'W9TVEYKW2CDTQ94T3A2V93IX6U3IHQN5Y3',
goerli: 'HPSH1KQDPJTNAPU3335G931SC6Y3ZYK3BF',
mainnet: 'HPSH1KQDPJTNAPU3335G931SC6Y3ZYK3BF',
sepolia: 'HPSH1KQDPJTNAPU3335G931SC6Y3ZYK3BF',
bsc: '6YUDRP3TFPQNRGGZQNYAEI1UI17NK96XGK',
Expand Down Expand Up @@ -68,7 +67,7 @@ const etherscan = {
}

if (process.env.ETHERSCAN_API_KEY) {
;['mainnet', 'goerli', 'sepolia'].forEach(
;['mainnet', 'sepolia'].forEach(
// eslint-disable-next-line no-return-assign
(netName) => (etherscan.apiKey[netName] = process.env.ETHERSCAN_API_KEY)
)
Expand Down
131 changes: 0 additions & 131 deletions packages/networks/src/networks/goerli.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/networks/src/networks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from './polygon'
export * from './bsc'
export * from './optimism'
export * from './mumbai'
export * from './goerli'
export * from './celo'
export * from './arbitrum'
export * from './avalanche'
Expand Down
26 changes: 22 additions & 4 deletions packages/unlock-js/src/__tests__/web3Service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { describe, it, expect, vi } from 'vitest'
var web3Service = new Web3Service(networks)
const lock = {
address: '0xe6A85e67905d41A479A32FF59892861351c825E8',
network: 5,
network: 10,
}

describe('Web3Service', () => {
Expand All @@ -28,6 +28,9 @@ describe('Web3Service', () => {
return result
},
}
web3Service.getUnlockContract = vi.fn(() => ({
locks: vi.fn(() => ({ deployed: true })),
}))
web3Service.lockContractAbiVersion = vi.fn(() => version)
const r = await web3Service[method](...args)
expect(r).toBe(result)
Expand All @@ -53,13 +56,28 @@ describe('Web3Service', () => {
async () => {
expect.assertions(2)
const service = new Web3Service(networks)
const response = await service.getLock(lock.address, 5)
service.getUnlockContract = vi.fn(() => ({
locks: vi.fn(() => ({ deployed: true })),
}))
// Fake implementation of getLock
const version = {
getLock: (_args) => {
return {
unlockContractAddress: networks[lock.network].unlockAddress,
}
},
}
service.lockContractAbiVersion = vi.fn(() => version)

const response = await service.getLock(lock.address, 10)
expect(response.address).toBe(lock.address)
const notFromUnlockFactoryContract = async () => {
// Fake generated address
service.getUnlockContract = vi.fn(() => ({
locks: vi.fn(() => ({ deployed: false })),
}))
const response = await service.getLock(
'0xAfC5356c67853fC8045586722fE6a253023039eB',
5
10
)
return response
}
Expand Down
2 changes: 2 additions & 0 deletions packages/unlock-js/src/web3Service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,12 @@ export default class Web3Service extends UnlockService {
// Add the lock address
lock.address = address

// Add the unlock address
lock.unlockContractAddress = ethers.utils.getAddress(
lock.unlockContractAddress
)

// Check that the Unlock address matches an "official one"
const previousDeployAddresses = (networkConfig.previousDeploys || []).map(
(d: any) => ethers.utils.getAddress(d.unlockAddress)
)
Expand Down
1 change: 0 additions & 1 deletion provider/src/supportedNetworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Env } from './types'
const supportedNetworks = (env: Env, networkId: string): string | undefined => {
return {
'1': env.MAINNET_PROVIDER,
'5': env.GOERLI_PROVIDER,
'10': env.OPTIMISM_PROVIDER,
'56': env.BSC_PROVIDER,
'100': env.GNOSIS_PROVIDER,
Expand Down
1 change: 0 additions & 1 deletion provider/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export interface Env {
BSC_PROVIDER: string
CELO_PROVIDER: string
GNOSIS_PROVIDER: string
GOERLI_PROVIDER: string
MAINNET_PROVIDER: string
MUMBAI_PROVIDER: string
OPTIMISM_PROVIDER: string
Expand Down
Loading

0 comments on commit d48ef89

Please sign in to comment.