Skip to content

Commit

Permalink
replaced dao-core code ID key with dao-dao-core
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Nov 8, 2024
1 parent 1313d25 commit 14710bc
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion config-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion docs/formulas.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions docs/transformers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/formulas/formulas/account/daos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export const adminOf: AccountFormula<string[]> = {
undefined,
'admin',
walletAddress,
getCodeIdsForKeys('dao-core')
getCodeIdsForKeys('dao-dao-core')
)

return daoCoreContracts?.map(({ contractAddress }) => contractAddress) ?? []
Expand Down
2 changes: 1 addition & 1 deletion src/formulas/formulas/contract/daoCore/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
(
Expand Down
2 changes: 1 addition & 1 deletion src/formulas/formulas/contract/daoCore/juno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const junoHomeMetadata: ContractFormula<JunoHomeMetadata> = {
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] =
Expand Down
4 changes: 2 additions & 2 deletions src/search/indexers/daos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 []
}
Expand Down
6 changes: 3 additions & 3 deletions src/server/test/indexer/computer/formulas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion src/transformers/transformers/dao/daoCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion src/wasmCodeTrackers/trackers/neutron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]),
Expand Down

0 comments on commit 14710bc

Please sign in to comment.