Skip to content

Commit

Permalink
Adds L2 curation contract sources and adds default configs for prod a…
Browse files Browse the repository at this point in the history
…nd staging
  • Loading branch information
jim-toth committed Oct 22, 2023
1 parent 79f586f commit e019849
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 40 deletions.
49 changes: 9 additions & 40 deletions src/client/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { LoggerFactory, Warp, WarpFactory } from 'warp-contracts'
import { DeployPlugin } from 'warp-contracts-plugin-deploy'

import ArtByCityLegacy from '../legacy'
import { ArtByCityConfig } from '../config'
import {
ARTBYCITY_STAGING_CONFIG,
ArtByCityConfig,
DEFAULT_ARTBYCITY_CONFIG
} from '../config'
import { ArtByCityCurations } from '../curation'

export default class ArtByCity {
Expand All @@ -15,46 +19,11 @@ export default class ArtByCity {

constructor(arweave?: Arweave, config?: Partial<ArtByCityConfig>) {
const environment = config?.environment || 'production'
const defaultConfig = environment === 'staging'
? ARTBYCITY_STAGING_CONFIG
: DEFAULT_ARTBYCITY_CONFIG

const usernamesContractId = config?.contracts?.usernames
? config.contracts.usernames
: environment === 'production'
? 'BaAP2wyqSiF7Eqw3vcBvVss3C0H8i1NGQFgMY6nGpnk'
: 'UHPC-7wenVg-JyS81EXKCnLlKvjSbfrIsnWt1F8hueg'

const ownableCurationContractId = config?.contracts?.curation?.ownable
? config.contracts.curation.ownable
: 'dPAv4JO4gLCZDlO464GGAUo-K6pUHFJsyjMPYV91Smk'

const whitelistCurationContractId = config?.contracts?.curation?.whitelist
? config.contracts.curation.whitelist
: 'Dv9zE2I3YqouYh1GJ_JkBlQtf0a19fX3L9A7QzKJmgw'

const collaborativeCurationContractId =
config?.contracts?.curation?.collaborative
? config.contracts.curation.collaborative
: '8VDyl_fFYn2zosAcb0-u_P4VvJi6Ucc4QRyZdusV3Sk'

const collaborativeWhitelistCurationContractId =
config?.contracts?.curation?.collaborativeWhitelist
? config.contracts.curation.collaborativeWhitelist
: 'eD4Dm458zE14NIF2Ip2tgu9O1GVaPjLeyUyf6Azehts'

this.config = {
environment,
contracts: {
usernames: usernamesContractId,
curation: {
ownable: ownableCurationContractId,
whitelist: whitelistCurationContractId,
collaborative: collaborativeCurationContractId,
collaborativeWhitelist: collaborativeWhitelistCurationContractId
}
},
cache: {
type: config?.cache?.type === 'disabled' ? 'disabled' : 'memcache'
}
}
this.config = { ...defaultConfig, ...config }

LoggerFactory.INST.logLevel(
environment !== 'development' ? 'fatal' : 'error'
Expand Down
32 changes: 32 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,35 @@ export type ArtByCityConfig = {
type: CacheStrategy
}
}

export const DEFAULT_ARTBYCITY_CONFIG: ArtByCityConfig = {
environment: 'production',
contracts: {
usernames: 'BaAP2wyqSiF7Eqw3vcBvVss3C0H8i1NGQFgMY6nGpnk',
curation: {
ownable: 'FYeph502kp_B7JT5S7431SPerldciZLcMEZDzgmnmWc',
whitelist: 'wQyCsSM-gROX2iVUaezrfNJg-z9MJdy_FCJB5oEx8cY',
collaborative: 'O_SmOtUfUNYf8Z8BqFao1MzBM_9Ydh8djkcDAV2u7eM',
collaborativeWhitelist: '3M_dT7kclnFtiITTMDRKvrbfAZEWWZb05KWH6OojEWs'
}
},
cache: {
type: 'memcache'
}
}

export const ARTBYCITY_STAGING_CONFIG: ArtByCityConfig = {
environment: 'staging',
contracts: {
usernames: 'UHPC-7wenVg-JyS81EXKCnLlKvjSbfrIsnWt1F8hueg',
curation: {
ownable: 'FYeph502kp_B7JT5S7431SPerldciZLcMEZDzgmnmWc',
whitelist: 'wQyCsSM-gROX2iVUaezrfNJg-z9MJdy_FCJB5oEx8cY',
collaborative: 'O_SmOtUfUNYf8Z8BqFao1MzBM_9Ydh8djkcDAV2u7eM',
collaborativeWhitelist: '3M_dT7kclnFtiITTMDRKvrbfAZEWWZb05KWH6OojEWs'
}
},
cache: {
type: 'memcache'
}
}

0 comments on commit e019849

Please sign in to comment.