Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 16 additions & 0 deletions src/Classes/APIBots/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const publicClient = createPublicClient({
const EXPLORATIONS_CONTRACTS = require('../../ProjectConfig/explorationsContracts.json')

const CORE_CONTRACTS = require('../../ProjectConfig/coreContracts.json')
const BLOCKED_MINT_CONTRACTS: Record<string, Record<string, string>> = require('../../ProjectConfig/blockedMintContracts.json')

// ENS cache: stores resolved names ('' means no ENS name exists)
const ensAddressMap: { [id: string]: string } = {}
Expand Down Expand Up @@ -283,6 +284,21 @@ export function isCoreContract(contractAddress: string): boolean {
return Object.values(CORE_CONTRACTS).includes(contractAddress.toLowerCase())
}

export function isBlockedMintContract(
chainId: number,
contractAddress: string
): boolean {
const blocked = BLOCKED_MINT_CONTRACTS[String(chainId)]
if (!blocked) {
return false
}

const normalized = contractAddress.toLowerCase()
return Object.values(blocked).some(
(address) => address.toLowerCase() === normalized
)
}

export async function getCollectionType(
contractAddress: string
): Promise<CollectionType> {
Expand Down
24 changes: 14 additions & 10 deletions src/Classes/MintBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@ import {
replaceToPNG,
waitForEngineContracts,
waitForStudioContracts,
isBlockedMintContract,
} from './APIBots/utils'
import { ensOrAddress } from './APIBots/utils'
import { TwitterBot } from './TwitterBot'
import { logger } from '../logger'

// When true, only post mints from mainnet (chain ID 1). Non-mainnet mints are skipped.
// Set to false in a couple weeks to enable L2/other chain mints.
const HIDE_NON_MAINNET_MINTS = true

const MAINNET_CHAIN_ID = 1

const MINT_CONFIG: {
[id: string]: string[]
} = require('../ProjectConfig/mintBotConfig.json')
Expand Down Expand Up @@ -144,7 +139,10 @@ export class MintBot {

const contentType = imageRes.headers.get('content-type')
if (!contentType?.startsWith('image/')) {
logger.info({ id, contentType }, 'Invalid content type for mint')
logger.info(
{ id, contentType },
'Invalid content type for mint'
)
return
}

Expand Down Expand Up @@ -199,8 +197,11 @@ export class MintBot {
return
}

if (HIDE_NON_MAINNET_MINTS && chainId !== MAINNET_CHAIN_ID) {
logger.info({ chainId }, 'Skipping mint for non-mainnet chain (HIDE_NON_MAINNET_MINTS=true)')
if (isBlockedMintContract(chainId, contractAddress)) {
logger.info(
{ contractAddress, chainId },
'Skipping mint for blocked contract'
)
return
}

Expand All @@ -222,7 +223,10 @@ export class MintBot {
startRoutine() {
this.intervalId = setInterval(async () => {
if (Object.keys(this.mintsToPost).length > 0) {
logger.info({ count: Object.keys(this.mintsToPost).length }, 'mints to post')
logger.info(
{ count: Object.keys(this.mintsToPost).length },
'mints to post'
)
}
await this.checkAndPostMints()
}, parseInt(MINT_REFRESH_TIME_SECONDS) * 1000)
Expand Down
6 changes: 6 additions & 0 deletions src/ProjectConfig/blockedMintContracts.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"8453": {
"DEV-1": "0x0061b590a42433392bc76b3f3fe1404a5df449c9",
"DEV-2": "0xa39abc16d7b6cfbf2cb1d02de65a0b28101cdad1"
}
}
Loading