Skip to content

Commit

Permalink
Add Subscape realms by adddress not name
Browse files Browse the repository at this point in the history
  • Loading branch information
jagodarybacka committed Dec 12, 2023
1 parent e95a152 commit fd72f1e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
14 changes: 8 additions & 6 deletions background/services/island/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1930,12 +1930,14 @@ export const CLAIM_WITH_FRIENDS_ABI = [
},
] as const

export const STARTING_REALM_NAMES = [
"Creators",
"Defi",
"Educate",
"Social",
"Vampire",
export const STARTING_REALM_ADDRESSES = [
"0xa5853ca1eac56bf78213b8300b695e7cfa563b4a",
"0x06894597d381542a55d2946e20117c29dbae2351",
"0xc92AF0c1f3111254b73eea97D803155b1E542Ee3",
"0x42a0b5cab976d7a2a0038138dd1279b96b73f029",
"0x26770639eB1262cfA47A4C3Aa27902fa8FCA3465",
"0x6a3d1d9a7eb615be82b5c50bba8c6ecc7606afe6",
"0xdc053c0beed726ee6316d4d04135d755466522c8",
]

export function buildRealmContract(
Expand Down
18 changes: 6 additions & 12 deletions background/services/island/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import { sameNetwork } from "../../networks"
import {
ClaimWithFriends,
ISLAND_NETWORK,
STARTING_REALM_NAMES,
STARTING_REALM_ADDRESSES,
TESTNET_TAHO,
TestnetTahoDeployer,
buildRealmContract,
} from "./contracts"
import IndexingService from "../indexing"
Expand Down Expand Up @@ -108,16 +107,11 @@ export default class IslandService extends BaseService<Events> {
this.emitter.emit("monitoringTestnetAsset", TESTNET_TAHO)
}

const connectedDeployer = TestnetTahoDeployer.connect(islandProvider)
await Promise.all(
STARTING_REALM_NAMES.map(async (realmName) => {
const realmAddress =
await connectedDeployer.functions[
`${realmName.toUpperCase()}_REALM`
]()
const realmContract = buildRealmContract(realmAddress[0]).connect(
islandProvider,
)
STARTING_REALM_ADDRESSES.map(async (realmAddress) => {
const realmContract = buildRealmContract(
normalizeEVMAddress(realmAddress),
).connect(islandProvider)

const realmVeTahoAddress = (await realmContract.functions.veTaho())[0]
const realmVeAsset =
Expand All @@ -134,7 +128,7 @@ export default class IslandService extends BaseService<Events> {

if (realmXpAddress === ethers.constants.AddressZero) {
logger.debug(
`XP token for realm ${realmName} at ${realmAddress} is not yet set, throwing an error to retry tracking later.`,
`XP token for realm at ${realmAddress} is not yet set, throwing an error to retry tracking later.`,
)

throw new Error(`XP token does not exist for realm ${realmAddress}`)
Expand Down

0 comments on commit fd72f1e

Please sign in to comment.