修改合作伙伴配置及解析方式

This commit is contained in:
CounterFire2023 2024-04-18 12:31:32 +08:00
parent 004bfee4e0
commit ae5bfeca59
3 changed files with 257 additions and 195 deletions

View File

@ -1,246 +1,292 @@
[ [
{ {
"projectName": "Test", "Project": "L3E7",
"link": "https://x.com/sparky-chain", "Twitter": "https://twitter.com/L3E7_Official",
"contract": "0x50A8e60041A206AcaA5F844a1104896224be6F39", "Contract": "0x20577896ea6113ed8c94b2f08f3893bdc08eba22",
"collection": "Test Collection", "Collection name": "L3E7 Worlds",
"guild": "1222509817411665920", "Supply": "600",
"role": "1229658972793999391" "Floor Price": "-",
"ROLE ID": "1229439602142613564",
"TIER": "Tier 1"
}, },
{ {
"projectName": "L3E7", "Project": "Ultiverse",
"link": "https://twitter.com/L3E7_Official", "Twitter": "https://twitter.com/UltiverseDAO",
"contract": "0x20577896ea6113ed8c94b2f08f3893bdc08eba22", "Contract": "0x3fd36d72f05fb1af76ee7ce9257ca850faba91ed",
"collection": "L3E7 Worlds", "Collection name": "Eletric Sheep",
"guild": "930002266868555827", "Supply": "6992",
"role": "1229439602142613564" "Floor Price": "-",
"ROLE ID": "1229439712650067978",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Ultiverse", "Project": "Pixelmon",
"link": "https://twitter.com/UltiverseDAO", "Twitter": "https://twitter.com/Pixelmon",
"contract": "0x3fd36d72f05fb1af76ee7ce9257ca850faba91ed", "Contract": "0x32973908faee0bf825a343000fe412ebe56f802a",
"collection": "Eletric Sheep", "Collection name": "Pixelmon - Gen1",
"guild": "930002266868555827", "Supply": "12566",
"role": "1229439712650067978" "Floor Price": "1.5e",
"ROLE ID": "1229439784552763482",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Pixelmon", "Project": "Pixelmon",
"link": "https://twitter.com/Pixelmon", "Twitter": "https://twitter.com/Pixelmon",
"contract": "0x32973908faee0bf825a343000fe412ebe56f802a", "Contract": "0x8a3749936e723325c6b645a0901470cd9e790b94",
"collection": "Pixelmon - Gen1", "Collection name": "Pixelmon - Trainers",
"guild": "930002266868555827", "Supply": "7000",
"role": "1229439784552763482" "Floor Price": "0.34e",
"ROLE ID": "1229439872503255092",
"TIER": "Tier 2"
}, },
{ {
"projectName": "Pixelmon", "Project": "Metacene",
"link": "https://twitter.com/Pixelmon", "Twitter": "https://twitter.com/MetaCeneGame",
"contract": "0x8a3749936e723325c6b645a0901470cd9e790b94", "Contract": "0xebb8cb5d88cc02f781fc23e40a558f177109226c",
"collection": "Pixelmon - Trainers", "Collection name": "Metacene Apostle",
"guild": "930002266868555827", "Supply": "500",
"role": "1229439872503255092" "Floor Price": "1.27e",
"ROLE ID": "1229439964819886123",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Metacene", "Project": "Metacene",
"link": "https://twitter.com/MetaCeneGame", "Twitter": "https://twitter.com/MetaCeneGame",
"contract": "0xebb8cb5d88cc02f781fc23e40a558f177109226c", "Contract": "0xca7c484cbaa83900ab91b6aefa1de0478ba71eb7",
"collection": "Metacene Apostle", "Collection name": "Cece Cube",
"guild": "930002266868555827", "Supply": "2043",
"role": "1229439964819886123" "Floor Price": "0.26e",
"ROLE ID": "1229440053810561195",
"TIER": "Tier 2"
}, },
{ {
"projectName": "Metacene", "Project": "Metacene",
"link": "https://twitter.com/MetaCeneGame", "Twitter": "https://twitter.com/MetaCeneGame",
"contract": "0xca7c484cbaa83900ab91b6aefa1de0478ba71eb7", "Contract": "0xd406dc865e45e28c43dd791512b4d844745f314a",
"collection": "Cece Cube", "Collection name": "Burned cube",
"guild": "930002266868555827", "Supply": "",
"role": "1229440053810561195" "Floor Price": "",
"ROLE ID": "1229440053810561195",
"TIER": "Tier 2"
}, },
{ {
"projectName": "Metacene", "Project": "Matr1x",
"link": "", "Twitter": "https://twitter.com/Matr1xOfficial",
"contract": "0xd406dc865e45e28c43dd791512b4d844745f314a", "Contract": "0x00723c39194f7f449be736da0d1c4ec809dde793",
"collection": "Burned cube", "Collection name": "Matr1x - YATC",
"Supply": "", "Supply": "520",
"Floor Price": "", "Floor Price": "19.5e",
"guild": "930002266868555827", "ROLE ID": "1229440105069023374",
"role": "1229440053810561195" "TIER": "Tier 1"
}, },
{ {
"projectName": "Matr1x", "Project": "Matr1x",
"link": "https://twitter.com/Matr1xOfficial", "Twitter": "https://twitter.com/Matr1xOfficial",
"contract": "0x00723c39194f7f449be736da0d1c4ec809dde793", "Contract": "0x596a5cd859ad53fec23cd3fcd77522f0b407920d",
"collection": "Matr1x - YATC", "Collection name": "Matr1x - KUKU",
"guild": "930002266868555827", "Supply": "6666",
"role": "1229440105069023374" "Floor Price": "1.6",
"ROLE ID": "1229440209398272081",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Matr1x", "Project": "Memeland",
"link": "https://twitter.com/Matr1xOfficial", "Twitter": "https://twitter.com/Memeland",
"contract": "0x596a5cd859ad53fec23cd3fcd77522f0b407920d", "Contract": "0x6efc003d3f3658383f06185503340c2cf27a57b6",
"collection": "Matr1x - KUKU", "Collection name": "MVP",
"guild": "930002266868555827", "Supply": "420",
"role": "1229440209398272081" "Floor Price": "63e",
"ROLE ID": "1229440774261833879",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Memeland", "Project": "Memeland",
"link": "https://twitter.com/Memeland", "Twitter": "https://twitter.com/Memeland",
"contract": "0x6efc003d3f3658383f06185503340c2cf27a57b6", "Contract": "0x769272677fab02575e84945f03eca517acc544cc",
"collection": "MVP", "Collection name": "The Captainz",
"guild": "930002266868555827", "Supply": "9999",
"role": "1229440774261833879" "Floor Price": "3.35e",
"ROLE ID": "1229440836639391866",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Memeland", "Project": "Today",
"link": "https://twitter.com/Memeland", "Twitter": "https://twitter.com/todaythegame",
"contract": "0x769272677fab02575e84945f03eca517acc544cc", "Contract": "0x2a478d7b790346c7c4f19c223d368d1cf41c7a1e",
"collection": "The Captainz", "Collection name": "TODAY - Ancient Seed",
"guild": "930002266868555827", "Supply": "777",
"role": "1229440836639391866" "Floor Price": "1.3e",
"ROLE ID": "1229440890951434281",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Today", "Project": "Asterix",
"link": "https://twitter.com/todaythegame", "Twitter": "https://twitter.com/asterixlabs",
"contract": "0x2a478d7b790346c7c4f19c223d368d1cf41c7a1e", "Contract": "0x0000000000c26fabfe894d13233d5ec73f61cc72",
"collection": "TODAY - Ancient Seed", "Collection name": "Asterix",
"guild": "930002266868555827", "Supply": "7565",
"role": "1229440890951434281" "Floor Price": "0.79",
"ROLE ID": "1229441161031061545",
"TIER": "Tier 2"
}, },
{ {
"projectName": "Asterix", "Project": "PG",
"link": "https://twitter.com/asterixlabs", "Twitter": "https://twitter.com/PGodjira",
"contract": "0x0000000000c26fabfe894d13233d5ec73f61cc72", "Contract": "0x9ada21a8bc6c33b49a089cfc1c24545d2a27cd81",
"collection": "Asterix", "Collection name": "PG Genesis",
"guild": "930002266868555827", "Supply": "333",
"role": "1229441161031061545" "Floor Price": "7e",
"ROLE ID": "1229441706366210059",
"TIER": "Tier 1"
}, },
{ {
"projectName": "PG", "Project": "PG",
"link": "https://twitter.com/PGodjira", "Twitter": "https://twitter.com/PGodjira",
"contract": "0x9ada21a8bc6c33b49a089cfc1c24545d2a27cd81", "Contract": "0xEDc3AD89f7b0963fe23D714B34185713706B815b",
"collection": "PG Genesis", "Collection name": "PG Gen 2 ",
"guild": "930002266868555827", "Supply": "3333",
"role": "1229441706366210059" "Floor Price": "0.26",
"ROLE ID": "1229441916173684849",
"TIER": "Tier 2"
}, },
{ {
"projectName": "PG", "Project": "Delabs Games",
"link": "https://twitter.com/PGodjira", "Twitter": "https://twitter.com/delabsOfficial",
"contract": "0xEDc3AD89f7b0963fe23D714B34185713706B815b", "Contract": "0xa7088ed1a460a154404adbfd7d6a3873e9f90340",
"collection": "PG Gen 2 ", "Collection name": "Delabs Adventure Pass Official",
"guild": "930002266868555827", "Supply": "3433",
"role": "1229441916173684849" "Floor Price": "0.31e",
"ROLE ID": "1229441983794249798",
"TIER": "Tier 2"
}, },
{ {
"projectName": "Delabs Games", "Project": "Delabs Games",
"link": "https://twitter.com/delabsOfficial", "Twitter": "https://twitter.com/delabsOfficial",
"contract": "0xa7088ed1a460a154404adbfd7d6a3873e9f90340", "Contract": "0x36267105d35e765f40c34d062bc569bf93eb810e",
"collection": "Delabs Adventure Pass Official", "Collection name": "Delabs Metabolts",
"guild": "930002266868555827", "Supply": "4444",
"role": "1229441983794249798" "Floor Price": "0.04e",
"ROLE ID": "1229442168167333888",
"TIER": "Tier 2"
}, },
{ {
"projectName": "Delabs Games", "Project": "Space Nation",
"link": "https://twitter.com/delabsOfficial", "Twitter": "https://twitter.com/spacenationol",
"contract": "0x36267105d35e765f40c34d062bc569bf93eb810e", "Contract": "0xff2b4721f997c242ff406a626f17df083bd2c568",
"collection": "Delabs Metabolts", "Collection name": "Alpha Gate",
"guild": "930002266868555827", "Supply": "515",
"role": "1229442168167333888" "Floor Price": ".2.12e",
"ROLE ID": "1229442236140355645",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Space Nation", "Project": "Space Nation",
"link": "https://twitter.com/spacenationol", "Twitter": "https://twitter.com/spacenationol",
"contract": "0xff2b4721f997c242ff406a626f17df083bd2c568", "Contract": "0xcb65bac4d4a2e400af9e1aaa999b3e7a4c42930a",
"collection": "Alpha Gate", "Collection name": "Prime Navigator",
"guild": "930002266868555827", "Supply": "3056",
"role": "1229442236140355645" "Floor Price": "0.6e",
"ROLE ID": "1229442283867471976",
"TIER": "Tier 2"
}, },
{ {
"projectName": "Space Nation", "Project": "Pirate Nation",
"link": "https://twitter.com/spacenationol", "Twitter": "https://twitter.com/PirateNation",
"contract": "0xcb65bac4d4a2e400af9e1aaa999b3e7a4c42930a", "Contract": "0x1b41d54b3f8de13d58102c50d7431fd6aa1a2c48",
"collection": "Prime Navigator", "Collection name": "Founder's Pirate",
"guild": "930002266868555827", "Supply": "9999",
"role": "1229442283867471976" "Floor Price": "0.83e",
"ROLE ID": "1229442333565653013",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Pirate Nation", "Project": "Neo Tokyo",
"link": "https://twitter.com/PirateNation", "Twitter": "https://twitter.com/NeoTokyoCode",
"contract": "0x1b41d54b3f8de13d58102c50d7431fd6aa1a2c48", "Contract": "0xb9951b43802dcf3ef5b14567cb17adf367ed1c0f",
"collection": "Founder's Pirate", "Collection name": "Neo Tokyo Citizens\r",
"guild": "930002266868555827", "Supply": "1989",
"role": "1229442333565653013" "Floor Price": "8.5e",
"ROLE ID": "1229442539787128832",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Neo Tokyo", "Project": "Neo Tokyo",
"link": "https://twitter.com/NeoTokyoCode", "Twitter": "https://twitter.com/NeoTokyoCode",
"contract": "0xb9951b43802dcf3ef5b14567cb17adf367ed1c0f", "Contract": "0x4481507cc228fa19d203bd42110d679571f7912e",
"collection": "Neo Tokyo Citizens\r\n", "Collection name": "Neo Tokyo Outer Citizens",
"guild": "930002266868555827", "Supply": "3497",
"role": "1229442539787128832" "Floor Price": "1.2e",
"ROLE ID": "1229442539787128832",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Neo Tokyo", "Project": "Neo Tokyo",
"link": "", "Twitter": "https://twitter.com/NeoTokyoCode",
"contract": "0x4481507cc228fa19d203bd42110d679571f7912e", "Contract": "0xd37ea75dd3c499eda76304f538cbf356ed9e7ed9",
"collection": "Neo Tokyo Outer Citizens", "Collection name": "Staked ( citizen / outer)",
"guild": "930002266868555827", "Supply": "",
"role": "1229442539787128832" "Floor Price": "",
"ROLE ID": "1229442539787128832",
"TIER": "Tier 1"
}, },
{ {
"projectName": "Neo Tokyo", "Project": "Cheers Up",
"link": "", "Twitter": "https://twitter.com/CheersUP_NFT",
"contract": "0xd37ea75dd3c499eda76304f538cbf356ed9e7ed9", "Contract": "0x3113a3c04aebec2b77eb38eabf6a2257b580c54b",
"collection": "Staked ( citizen / outer)", "Collection name": "Cheers UP",
"Supply": "", "Supply": "3953",
"Floor Price": "", "Floor Price": "0.03e",
"guild": "930002266868555827", "ROLE ID": "1229442708561461268",
"role": "1229442539787128832" "TIER": "Tier 2"
}, },
{ {
"projectName": "Cheers Up", "Project": "Llamaverse",
"link": "https://twitter.com/CheersUP_NFT", "Twitter": "https://twitter.com/Llamaverse_",
"contract": "0x3113a3c04aebec2b77eb38eabf6a2257b580c54b", "Contract": "0x9df8aa7c681f33e442a0d57b838555da863504f3",
"collection": "Cheers UP", "Collection name": "Llamaverse Genesis",
"guild": "930002266868555827", "Supply": "4000",
"role": "1229442708561461268" "Floor Price": "0.07e",
"ROLE ID": "1229653356126011483",
"TIER": "Tier 2"
}, },
{ {
"projectName": "Llamaverse", "Project": "Weirdo Ghost Gang",
"link": "https://twitter.com/Llamaverse_", "Twitter": "https://twitter.com/WeirdoGhostGang",
"contract": "0x9df8aa7c681f33e442a0d57b838555da863504f3", "Contract": "0x9401518f4ebba857baa879d9f76e1cc8b31ed197",
"collection": "Llamaverse Genesis", "Collection name": "Weirdo Ghost Gang",
"guild": "930002266868555827", "Supply": "5556",
"role": "1229653356126011483" "Floor Price": "0.2",
"ROLE ID": "1229442751037177987",
"TIER": "Tier 2"
}, },
{ {
"projectName": "Weirdo Ghost Gang", "Project": "ZooVerse",
"link": "https://twitter.com/WeirdoGhostGang", "Twitter": "https://twitter.com/ZooVerseNFT",
"contract": "0x9401518f4ebba857baa879d9f76e1cc8b31ed197", "Contract": "0x73382b19fe136907e9fd4cb1d55228237566324c",
"collection": "Weirdo Ghost Gang", "Collection name": "ZooVerse Genesis",
"guild": "930002266868555827", "Supply": "444",
"role": "1229442751037177987" "Floor Price": "0.27e",
"ROLE ID": "1229653380834525305",
"TIER": "Tier 2"
}, },
{ {
"projectName": "ZooVerse", "Project": "WolvesDAO",
"link": "https://twitter.com/ZooVerseNFT", "Twitter": "https://twitter.com/WolvesDAO",
"contract": "0x73382b19fe136907e9fd4cb1d55228237566324c", "Contract": "0x0433882c60ada1077a9f652ca2d1d36422c62c6c",
"collection": "ZooVerse Genesis", "Collection name": "Carv Membership",
"guild": "930002266868555827", "Supply": "156",
"role": "1229653380834525305" "Floor Price": "SBT",
"ROLE ID": "1230052718224347146",
"TIER": "Tier 1"
}, },
{ {
"projectName": "WolvesDAO", "Project": "Mofu Mofu",
"link": "https://twitter.com/WolvesDAO", "Twitter": "https://twitter.com/MofuMofuMC",
"contract": "0x0433882c60ada1077a9f652ca2d1d36422c62c6c", "Contract": "0x6276eC64Ed808C76594f682cdFA8Ce83963Ee17f",
"collection": "Carv Membership", "Collection name": "Mofu Mofu Music Caravan",
"guild": "930002266868555827", "Supply": "500",
"role": "1230052718224347146" "Floor Price": "0.2",
}, "ROLE ID": "1230052932817518644",
{ "TIER": "Tier 2"
"projectName": "Mofu Mofu",
"link": "https://twitter.com/MofuMofuMC",
"contract": "0x6276eC64Ed808C76594f682cdFA8Ce83963Ee17f",
"collection": "Mofu Mofu Music Caravan",
"guild": "930002266868555827",
"role": "1230052932817518644"
} }
] ]

View File

@ -65,3 +65,6 @@ export const RECAPTCHA_MIN_SCORE = 0.5
export const RANK_SCORE_SCALE = 100 export const RANK_SCORE_SCALE = 100
export const BASE52_ALPHABET = '3fBCM8j17XNA9xYun4wmLWep2oHFlhPcgyEJskqOz6GK0UtV5ZRaDSvrTbidQI' export const BASE52_ALPHABET = '3fBCM8j17XNA9xYun4wmLWep2oHFlhPcgyEJskqOz6GK0UtV5ZRaDSvrTbidQI'
// 检查role时默认的工会id
export const DEFAULT_GUILD = '930002266868555827'

View File

@ -1,3 +1,4 @@
import { DEFAULT_GUILD } from 'common/Constants'
import logger from 'logger/logger' import logger from 'logger/logger'
import { ChestStatusEnum } from 'models/ActivityChest' import { ChestStatusEnum } from 'models/ActivityChest'
import { NFTHolderRecord } from 'models/NFTHodlerRecord' import { NFTHolderRecord } from 'models/NFTHodlerRecord'
@ -6,7 +7,18 @@ import { generateChestLevel, generateNewChest } from 'services/game.svr'
import { checkDiscordRole } from 'services/oauth.svr' import { checkDiscordRole } from 'services/oauth.svr'
import { SyncLocker, BaseController, router, role, ROLE_ANON, ZError } from 'zutils' import { SyncLocker, BaseController, router, role, ROLE_ANON, ZError } from 'zutils'
const nftList = require('../../configs/partner_nft_list.json') const sourceList = require('../../configs/partner_nft_list.json')
const nftList = sourceList.map(o => {
return {
contract: o['Contract'],
projectName: o['Project'],
link: o['Twitter'],
collection: o['Collection name'],
guild: o['SERVER ID'] || DEFAULT_GUILD,
role: o['ROLE ID'],
tier: o['TIER'] == 'Tier 2' ? 2 : 1,
}
})
const nftListStr = JSON.stringify(nftList) const nftListStr = JSON.stringify(nftList)
const nftMap = new Map() const nftMap = new Map()
nftList.forEach(o => nftMap.set(o.contract.toLowerCase(), o)) nftList.forEach(o => nftMap.set(o.contract.toLowerCase(), o))
@ -19,7 +31,7 @@ class NftController extends BaseController {
*/ */
@role(ROLE_ANON) @role(ROLE_ANON)
@router('get /api/partner/nfts') @router('get /api/partner/nfts')
async nftList(req) { async fetchNftList(req) {
const user = req.user const user = req.user
let list = JSON.parse(nftListStr) let list = JSON.parse(nftListStr)
list.forEach(o => { list.forEach(o => {
@ -86,27 +98,28 @@ class NftController extends BaseController {
} }
let { contract } = req.params let { contract } = req.params
if (!contract) { if (!contract) {
throw new ZError(11, 'contract not found') throw new ZError(11, 'params error')
} }
contract = contract.toLowerCase() contract = contract.toLowerCase()
if (!nftMap.has(contract)) { if (!nftMap.has(contract)) {
throw new ZError(12, 'contract not found') throw new ZError(12, 'cfg not found')
} }
let record = await NFTHolderRecord.findOne({ user: user.id, contract }) let record = await NFTHolderRecord.findOne({ user: user.id, contract })
if (record) { if (record) {
throw new ZError(13, 'already claimed') throw new ZError(13, 'already claimed')
} }
const cfg = nftMap.get(contract) const cfg = nftMap.get(contract)
let rpcRes = await checkDiscordRole(user.address.toLowerCase(), cfg.guild, cfg.role) const guild = cfg.guild || DEFAULT_GUILD
let rpcRes = await checkDiscordRole(user.address.toLowerCase(), guild, cfg.role)
console.log('check result:', rpcRes) console.log('check result:', rpcRes)
if (rpcRes.errcode) { if (rpcRes.errcode) {
throw new ZError(20, `check error: ${rpcRes.errmsg}`) throw new ZError(rpcRes.errcode, `rpcRes.errmsg`)
} }
if (!rpcRes.data.result) { if (!rpcRes.data.result) {
throw new ZError(14, 'not match claim condition') throw new ZError(14, 'had no role')
} }
let randomLevel = generateChestLevel() let chestLevel = cfg.tier || 1
let chest = generateNewChest(user.id, user.activity, randomLevel, ChestStatusEnum.NORMAL) let chest = generateNewChest(user.id, user.activity, chestLevel, ChestStatusEnum.NORMAL)
await chest.save() await chest.save()
let recordNew = new NFTHolderRecord({ let recordNew = new NFTHolderRecord({
user: user.id, user: user.id,