From 63433b46a914cfcef54b12ca1c5d21f4b2ed6207 Mon Sep 17 00:00:00 2001 From: KillariDev Date: Wed, 29 Oct 2025 09:49:40 +0200 Subject: [PATCH] name universes instead of using a number --- .../testsuite/simulator/utils/deployments.ts | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/solidity/ts/testsuite/simulator/utils/deployments.ts b/solidity/ts/testsuite/simulator/utils/deployments.ts index d81f639..6bb6a79 100644 --- a/solidity/ts/testsuite/simulator/utils/deployments.ts +++ b/solidity/ts/testsuite/simulator/utils/deployments.ts @@ -7,26 +7,39 @@ import { getInfraContractAddresses, getSecurityPoolAddresses } from './deployPer import { getChildUniverseId, getRepTokenAddress } from './utilities.js' import { zeroAddress } from 'viem' +const getUniverseName = (universeId: bigint): string => { + const path: string[] = [] + let currentUniverseId = universeId + while (currentUniverseId > 0n) { + const branchIndex = Number(currentUniverseId & 0b11n) - 1 + const outcomeName = QuestionOutcome[branchIndex] as keyof typeof QuestionOutcome + path.push(outcomeName) + currentUniverseId = currentUniverseId >> 2n + } + if (path.length === 0) return 'U-Genesis' + return `U-Genesis-${ path.join('-') }` +} + const getDeploymentsForUniverse = (universeId: bigint, securityPoolAddress: `0x${ string }`, repTokenAddress: `0x${ string }`, priceOracleManagerAndOperatorQueuerAddress: `0x${ string }`, shareTokenAddress: `0x${ string }`, auction: `0x${ string }`): Deployment[] => [ { abi: ReputationToken_ReputationToken.abi, - deploymentName: `RepV2-U${ universeId }`, + deploymentName: `RepV2 ${ getUniverseName(universeId) }`, address: repTokenAddress }, { abi: peripherals_PriceOracleManagerAndOperatorQueuer_PriceOracleManagerAndOperatorQueuer.abi, - deploymentName: `PriceOracleManagerAndOperatorQueuer U${ universeId }`, + deploymentName: `PriceOracleManagerAndOperatorQueuer ${ getUniverseName(universeId) }`, address: priceOracleManagerAndOperatorQueuerAddress }, { abi: peripherals_SecurityPool_SecurityPool.abi, - deploymentName: `ETH SecurityPool U${ universeId }`, + deploymentName: `ETH SecurityPool ${ getUniverseName(universeId) }`, address: securityPoolAddress }, { abi: peripherals_tokens_ShareToken_ShareToken.abi, - deploymentName: `CompleteSet U${ universeId }`, + deploymentName: `CompleteSet ${ getUniverseName(universeId) }`, address: shareTokenAddress }, { abi: peripherals_Auction_Auction.abi, - deploymentName: `Truth Auction U${ universeId }`, + deploymentName: `Truth Auction ${ getUniverseName(universeId) }`, address: auction } ] as const @@ -100,7 +113,7 @@ export const getDeployments = (genesisUniverse: bigint, questionId: bigint, secu }, ...TEST_ADDRESSES.map((testAddress, index) => ({ abi: undefined, - deploymentName: `Test EOA(${ index + 1 })`, + deploymentName: `TEST_ADDRESSES[${ index }]`, address: addressString(testAddress) } as const)) ] as const).filter((entry) => BigInt(entry.address) !== 0n)