From 14710bce7063e4f23223974eba271761cd7d9157 Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Fri, 8 Nov 2024 18:01:22 -0500 Subject: [PATCH] replaced dao-core code ID key with dao-dao-core --- config-dev.json | 2 +- config.json.example | 2 +- docs/formulas.md | 2 +- docs/transformers.md | 7 +++++-- src/formulas/formulas/account/daos.ts | 2 +- src/formulas/formulas/contract/daoCore/base.ts | 2 +- src/formulas/formulas/contract/daoCore/juno.ts | 2 +- src/search/indexers/daos.ts | 4 ++-- src/server/test/indexer/computer/formulas/index.ts | 6 +++--- src/transformers/transformers/dao/daoCore.ts | 2 +- src/wasmCodeTrackers/trackers/neutron.ts | 2 +- 11 files changed, 18 insertions(+), 15 deletions(-) diff --git a/config-dev.json b/config-dev.json index a31d9d2c..f4b12898 100644 --- a/config-dev.json +++ b/config-dev.json @@ -24,7 +24,7 @@ }, "codeIds": { "cw20-stake": [155], - "dao-core": [163], + "dao-dao-core": [163], "dao-proposal-multiple": [170], "dao-proposal-single": [171], "dao-voting-cw20-staked": [172], diff --git a/config.json.example b/config.json.example index b2fd12ac..0c22bd87 100644 --- a/config.json.example +++ b/config.json.example @@ -26,7 +26,7 @@ }, "codeIds": { "cw20-stake": [155], - "dao-core": [163], + "dao-dao-core": [163], "dao-proposal-multiple": [170], "dao-proposal-single": [171], "dao-voting-cw20-staked": [172], diff --git a/docs/formulas.md b/docs/formulas.md index cf2b1935..7eaddf5b 100644 --- a/docs/formulas.md +++ b/docs/formulas.md @@ -238,7 +238,7 @@ formulas rely on more than just state. ## Examples This formula returns the config for a -[DAO](https://github.com/DA0-DA0/dao-contracts/tree/main/contracts/dao-core). +[DAO](https://github.com/DA0-DA0/dao-contracts/tree/main/contracts/dao-dao-core). You can see it supports both V1 and V2 of the contract, which happen to be stored under different state keys in the different versions of the contract. The indexer unifies the API and allows you to query the same formula for both diff --git a/docs/transformers.md b/docs/transformers.md index 60512320..2debaec5 100644 --- a/docs/transformers.md +++ b/docs/transformers.md @@ -120,7 +120,10 @@ For example, to unify the `config` from both v1 and v2 of the DAO core contract, this transformer merges them into a single `config` transformation. ```ts -const config = makeTransformer(['dao-core'], 'config', ['config_v2', 'config']) +const config = makeTransformer(['dao-dao-core'], 'config', [ + 'config_v2', + 'config', +]) ``` ### `makeTransformerForMap` @@ -131,7 +134,7 @@ This takes all items in the `sub_daos` state `Map` and saves them under a transformation with names that are prefixed with `subDao:`: ```ts -const subDaos = makeTransformerForMap(['dao-core'], 'subDao', 'sub_daos') +const subDaos = makeTransformerForMap(['dao-dao-core'], 'subDao', 'sub_daos') ``` In a formula, this map can be accessed with the following: diff --git a/src/formulas/formulas/account/daos.ts b/src/formulas/formulas/account/daos.ts index 3cee6c43..7b0db621 100644 --- a/src/formulas/formulas/account/daos.ts +++ b/src/formulas/formulas/account/daos.ts @@ -228,7 +228,7 @@ export const adminOf: AccountFormula = { undefined, 'admin', walletAddress, - getCodeIdsForKeys('dao-core') + getCodeIdsForKeys('dao-dao-core') ) return daoCoreContracts?.map(({ contractAddress }) => contractAddress) ?? [] diff --git a/src/formulas/formulas/contract/daoCore/base.ts b/src/formulas/formulas/contract/daoCore/base.ts index 33c34afd..c0a5a5f2 100644 --- a/src/formulas/formulas/contract/daoCore/base.ts +++ b/src/formulas/formulas/contract/daoCore/base.ts @@ -535,7 +535,7 @@ export const potentialSubDaos: ContractFormula< compute: async (env) => { const { contractAddress, getTransformationMatches, getCodeIdsForKeys } = env - const daoCodeIds = getCodeIdsForKeys('dao-core') + const daoCodeIds = getCodeIdsForKeys('dao-dao-core') const contractsWithAdmin = ( diff --git a/src/formulas/formulas/contract/daoCore/juno.ts b/src/formulas/formulas/contract/daoCore/juno.ts index b547246c..d18783dc 100644 --- a/src/formulas/formulas/contract/daoCore/juno.ts +++ b/src/formulas/formulas/contract/daoCore/juno.ts @@ -26,7 +26,7 @@ export const junoHomeMetadata: ContractFormula = { description: 'retrieves specific DAO metadata for the Juno website', }, filter: { - codeIdsKeys: ['dao-core'], + codeIdsKeys: ['dao-dao-core'], }, compute: async (env) => { const [config, cover, founded, proposalCount, lastActivity, memberCount] = diff --git a/src/search/indexers/daos.ts b/src/search/indexers/daos.ts index 43c9a27d..2019bb0f 100644 --- a/src/search/indexers/daos.ts +++ b/src/search/indexers/daos.ts @@ -27,7 +27,7 @@ export const daos: MeilisearchIndexer = { return } - let daoAddress = event.contract?.matchesCodeIdKeys('dao-core') + let daoAddress = event.contract?.matchesCodeIdKeys('dao-dao-core') ? event.contractAddress : undefined @@ -60,7 +60,7 @@ export const daos: MeilisearchIndexer = { }, getBulkUpdates: async () => { const codeIds = - WasmCodeService.getInstance().findWasmCodeIdsByKeys('dao-core') + WasmCodeService.getInstance().findWasmCodeIdsByKeys('dao-dao-core') if (!codeIds.length) { return [] } diff --git a/src/server/test/indexer/computer/formulas/index.ts b/src/server/test/indexer/computer/formulas/index.ts index 98e6c5f1..a735d344 100644 --- a/src/server/test/indexer/computer/formulas/index.ts +++ b/src/server/test/indexer/computer/formulas/index.ts @@ -23,12 +23,12 @@ export const loadFormulasTests = (options: ComputerTestOptions) => { it('filters contract by code IDs specified in formula', async () => { WasmCodeService.getInstance().addDefaultWasmCodes( - new WasmCode('dao-core', [1, 2]) + new WasmCode('dao-dao-core', [1, 2]) ) options.mockFormula({ filter: { - codeIdsKeys: ['not-dao-core'], + codeIdsKeys: ['not-dao-dao-core'], }, }) await request(app.callback()) @@ -41,7 +41,7 @@ export const loadFormulasTests = (options: ComputerTestOptions) => { options.mockFormula({ filter: { - codeIdsKeys: ['dao-core'], + codeIdsKeys: ['dao-dao-core'], }, }) const response = await request(app.callback()) diff --git a/src/transformers/transformers/dao/daoCore.ts b/src/transformers/transformers/dao/daoCore.ts index 486e9196..b16ed8c8 100644 --- a/src/transformers/transformers/dao/daoCore.ts +++ b/src/transformers/transformers/dao/daoCore.ts @@ -3,7 +3,7 @@ import { dbKeyToKeys } from '@/utils' import { makeTransformer, makeTransformerForMap } from '../../utils' -const CODE_IDS_KEYS = ['dao-core'] +const CODE_IDS_KEYS = ['dao-dao-core'] const config = makeTransformer(CODE_IDS_KEYS, 'config', ['config_v2', 'config']) const paused = makeTransformer(CODE_IDS_KEYS, 'paused') diff --git a/src/wasmCodeTrackers/trackers/neutron.ts b/src/wasmCodeTrackers/trackers/neutron.ts index 93191e65..cd81aa10 100644 --- a/src/wasmCodeTrackers/trackers/neutron.ts +++ b/src/wasmCodeTrackers/trackers/neutron.ts @@ -2,7 +2,7 @@ import { WasmCodeTracker } from '@/types' export const neutronDaoDaoCore: WasmCodeTracker = { chainId: 'neutron-1', - codeKey: 'dao-core', + codeKey: 'dao-dao-core', contractAddresses: new Set([ 'neutron1suhgf5svhu4usrurvxzlgn54ksxmn8gljarjtxqnapv8kjnp4nrstdxvff', ]),