From 4712b282b2d626afc3e3ebdd2027a0cc42043d3b Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Sat, 9 Nov 2024 02:37:38 -0500 Subject: [PATCH] added v2.6.0 contracts, and removed cosmos hub theta testnet --- apps/dapp/package.json | 16 +- apps/sda/package.json | 16 +- lerna.json | 2 +- package.json | 2 +- packages/config/package.json | 2 +- packages/dispatch/config.toml.example | 8 +- packages/dispatch/package.json | 10 +- packages/dispatch/scripts/deploy/config.ts | 41 +- packages/dispatch/scripts/deploy/run.ts | 66 ++- packages/email/package.json | 6 +- packages/i18n/package.json | 4 +- packages/math/package.json | 4 +- .../state/contracts/DaoRewardsDistributor.ts | 39 ++ packages/state/package.json | 10 +- packages/stateful/package.json | 18 +- .../ProposalExecutionMetadataEditor.tsx | 3 +- packages/stateless/package.json | 14 +- packages/storybook/package.json | 16 +- packages/types/chain.ts | 1 - .../types/contracts/DaoRewardsDistributor.ts | 6 + packages/types/package.json | 6 +- packages/utils/constants/chains.ts | 117 ++--- packages/utils/constants/codeIds.json | 467 +++++++++++++++++- packages/utils/package.json | 8 +- 24 files changed, 721 insertions(+), 161 deletions(-) diff --git a/apps/dapp/package.json b/apps/dapp/package.json index 29fe197d5..a4befe003 100644 --- a/apps/dapp/package.json +++ b/apps/dapp/package.json @@ -1,6 +1,6 @@ { "name": "@dao-dao/dapp", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "license": "AGPL-3.0-only", "scripts": { "postinstall": "cd ../../ && patch-package", @@ -21,12 +21,12 @@ "ts:watch": "ts --watch" }, "dependencies": { - "@dao-dao/i18n": "2.5.0-rc.3", - "@dao-dao/state": "2.5.0-rc.3", - "@dao-dao/stateful": "2.5.0-rc.3", - "@dao-dao/stateless": "2.5.0-rc.3", - "@dao-dao/types": "2.5.0-rc.3", - "@dao-dao/utils": "2.5.0-rc.3", + "@dao-dao/i18n": "2.6.0-rc.1", + "@dao-dao/state": "2.6.0-rc.1", + "@dao-dao/stateful": "2.6.0-rc.1", + "@dao-dao/stateless": "2.6.0-rc.1", + "@dao-dao/types": "2.6.0-rc.1", + "@dao-dao/utils": "2.6.0-rc.1", "@fontsource/inter": "^4.5.7", "@fontsource/jetbrains-mono": "^4.5.5", "@keplr-wallet/common": "^0.11.49", @@ -53,7 +53,7 @@ "sharp": "^0.31.1" }, "devDependencies": { - "@dao-dao/config": "2.5.0-rc.3", + "@dao-dao/config": "2.6.0-rc.1", "@next/bundle-analyzer": "^14.1.0", "@playwright/test": "^1.44.1", "@sentry/cli": "^2.21.3", diff --git a/apps/sda/package.json b/apps/sda/package.json index e97acc23b..ac30f8a18 100644 --- a/apps/sda/package.json +++ b/apps/sda/package.json @@ -1,6 +1,6 @@ { "name": "@dao-dao/sda", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "license": "AGPL-3.0-only", "scripts": { "postinstall": "cd ../../ && patch-package", @@ -18,12 +18,12 @@ "ts:watch": "ts --watch" }, "dependencies": { - "@dao-dao/i18n": "2.5.0-rc.3", - "@dao-dao/state": "2.5.0-rc.3", - "@dao-dao/stateful": "2.5.0-rc.3", - "@dao-dao/stateless": "2.5.0-rc.3", - "@dao-dao/types": "2.5.0-rc.3", - "@dao-dao/utils": "2.5.0-rc.3", + "@dao-dao/i18n": "2.6.0-rc.1", + "@dao-dao/state": "2.6.0-rc.1", + "@dao-dao/stateful": "2.6.0-rc.1", + "@dao-dao/stateless": "2.6.0-rc.1", + "@dao-dao/types": "2.6.0-rc.1", + "@dao-dao/utils": "2.6.0-rc.1", "@fontsource/inter": "^4.5.7", "@fontsource/jetbrains-mono": "^4.5.5", "@keplr-wallet/common": "^0.11.49", @@ -49,7 +49,7 @@ "sharp": "^0.31.1" }, "devDependencies": { - "@dao-dao/config": "2.5.0-rc.3", + "@dao-dao/config": "2.6.0-rc.1", "@next/bundle-analyzer": "^12.1.0", "@sentry/cli": "^2.21.3", "@solana/web3.js": "^1.75.0", diff --git a/lerna.json b/lerna.json index 915d8b811..1a9aa1a72 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { "$schema": "node_modules/lerna/schemas/lerna-schema.json", "useWorkspaces": true, - "version": "2.5.0-rc.3" + "version": "2.6.0-rc.1" } diff --git a/package.json b/package.json index 6c02263d2..2a7e27dba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dao-dao-ui", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "workspaces": [ "apps/*", "packages/*" diff --git a/packages/config/package.json b/packages/config/package.json index 3830c9b12..9ee063dc3 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@dao-dao/config", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "license": "BSD-3-Clause-Clear", "scripts": { "cwgen": "tsx ./scripts/cwgen.ts" diff --git a/packages/dispatch/config.toml.example b/packages/dispatch/config.toml.example index 208750cec..aa93c245d 100644 --- a/packages/dispatch/config.toml.example +++ b/packages/dispatch/config.toml.example @@ -1,5 +1,4 @@ -### The mnemonic to use for signing transactions. -mnemonic = "abc def ghi" +[default] ### The directories to look in for compiled contracts. contract_dirs = [ @@ -9,3 +8,8 @@ contract_dirs = [ ### The path to the ansible indexer group_vars folder in the ops repo. indexer_ansible_group_vars_path = "/Users/user/Developer/ops/ansible/group_vars" + +### The mnemonics to use for signing transactions. +[mnemonics] + +default = "abc def ghi" diff --git a/packages/dispatch/package.json b/packages/dispatch/package.json index 700259bb9..d473490aa 100644 --- a/packages/dispatch/package.json +++ b/packages/dispatch/package.json @@ -1,6 +1,6 @@ { "name": "@dao-dao/dispatch", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "license": "BSD-3-Clause-Clear", "private": true, "scripts": { @@ -11,10 +11,10 @@ }, "devDependencies": { "@confio/relayer": "^0.12.0", - "@dao-dao/config": "2.5.0-rc.3", - "@dao-dao/state": "2.5.0-rc.3", - "@dao-dao/types": "2.5.0-rc.3", - "@dao-dao/utils": "2.5.0-rc.3", + "@dao-dao/config": "2.6.0-rc.1", + "@dao-dao/state": "2.6.0-rc.1", + "@dao-dao/types": "2.6.0-rc.1", + "@dao-dao/utils": "2.6.0-rc.1", "@types/proper-lockfile": "^4.1.4", "chalk": "^4", "commander": "^11.0.0", diff --git a/packages/dispatch/scripts/deploy/config.ts b/packages/dispatch/scripts/deploy/config.ts index 85c579294..9c0fcdece 100644 --- a/packages/dispatch/scripts/deploy/config.ts +++ b/packages/dispatch/scripts/deploy/config.ts @@ -61,12 +61,20 @@ export const deploySets: DeploySet[] = [ contracts: ['cw1_whitelist', 'cw4_group'], }, + // the admin factory contract to deploy on all chains every time except Terra + // Classic since it doesn't support instantiate2 + { + name: 'admin factory', + type: 'always', + contracts: ['cw_admin_factory'], + skipChainIds: [ChainId.TerraClassicMainnet], + }, + // the core DAO contracts to deploy on all chains every time { name: 'core DAO stuff', type: 'always', contracts: [ - 'cw_admin_factory', 'cw_payroll_factory', 'cw_token_swap', 'dao_dao_core', @@ -222,7 +230,12 @@ export const deploySets: DeploySet[] = [ { name: 'token factory', type: 'always', - contracts: ['cw_tokenfactory_issuer'], + contracts: [ + { + file: 'cw_tokenfactory_issuer-osmosis', + alias: 'cw_tokenfactory_issuer', + }, + ], chainIds: [ ChainId.JunoMainnet, ChainId.JunoTestnet, @@ -273,7 +286,6 @@ export const deploySets: DeploySet[] = [ ChainId.BitsongTestnet, ChainId.CosmosHubMainnet, - ChainId.CosmosHubThetaTestnet, ChainId.CosmosHubProviderTestnet, ChainId.JunoMainnet, @@ -330,7 +342,6 @@ export const chainIdToIndexerGroupVarsName: Record = { [ChainId.BitsongTestnet]: 'bitsong_testnet', [ChainId.CosmosHubMainnet]: 'cosmosHub_mainnet', [ChainId.CosmosHubProviderTestnet]: 'cosmosHubProvider_testnet', - [ChainId.CosmosHubThetaTestnet]: 'cosmosHubTheta_testnet', [ChainId.JunoMainnet]: 'juno_mainnet', [ChainId.JunoTestnet]: 'juno_testnet', [ChainId.KujiraMainnet]: 'kujira_mainnet', @@ -349,3 +360,25 @@ export const chainIdToIndexerGroupVarsName: Record = { [ChainId.TerraMainnet]: 'terra_mainnet', [ChainId.TerraClassicMainnet]: 'terraClassic_mainnet', } + +/** + * Map chain ID to deployment argument overrides. + */ +export const chainIdToDeploymentArgs: Record> = { + [ChainId.StargazeMainnet]: { + authz: 'stars1565xc6aq0ycfx5zwusevpmwx6f5uzp93zuutfp', + }, + [ChainId.KujiraMainnet]: { + mnemonic: 'df_operator', + authz: 'kujira1ss7avjjlzrmnp2m3thges80vetpq4nr8tjk20f0arweke8r840ss58v6yh', + restrictInstantiation: true, + instantiateAdminFactory: false, + }, + [ChainId.OmniflixHubMainnet]: { + mnemonic: 'df_operator', + authz: 'omniflix1kr6t4gg33kfuc26rz4xxkv0ftlxq5j09pndcf9ndk450rrevgf8sy59urv', + }, + [ChainId.BitsongTestnet]: { + mnemonic: 'bitsong_testnet', + }, +} diff --git a/packages/dispatch/scripts/deploy/run.ts b/packages/dispatch/scripts/deploy/run.ts index c7b3b7eb4..0b1f908d8 100644 --- a/packages/dispatch/scripts/deploy/run.ts +++ b/packages/dispatch/scripts/deploy/run.ts @@ -27,7 +27,11 @@ import { import { instantiateContract } from '../utils' import { CodeIdConfig } from './CodeIdConfig' -import { DeploySetContract, deploySets } from './config' +import { + DeploySetContract, + chainIdToDeploymentArgs, + deploySets, +} from './config' const { log } = console @@ -50,16 +54,13 @@ try { } const { - mnemonic, - contract_dirs: contractDirs, - indexer_ansible_group_vars_path: indexerAnsibleGroupVarsPath, + default: { + contract_dirs: contractDirs, + indexer_ansible_group_vars_path: indexerAnsibleGroupVarsPath, + }, + mnemonics, } = config -if (!mnemonic) { - log(chalk.red('mnemonic not set')) - process.exit(1) -} - if (!indexerAnsibleGroupVarsPath) { log(chalk.red('indexer_ansible_group_vars_path not set')) process.exit(1) @@ -90,16 +91,53 @@ program.option( '-r, --restrict-instantiation', 'restrict instantiation to only the uploader; this must be used on some chains to upload contracts, like Kujira' ) +program.option( + '-p, --mnemonic ', + 'use this configured mnemonic name for signing transactions', + 'default' +) +program.option( + '--no-instantiate-admin-factory', + 'do not instantiate the admin factory' +) program.parse(process.argv) -const { +let { chain: chainId, mode, version, authz, restrictInstantiation, + mnemonic: mnemonicName, + instantiateAdminFactory, } = program.opts() +// Add deployment arguments if they exist. +const deploymentArgs = chainIdToDeploymentArgs[chainId] +if (deploymentArgs) { + if (deploymentArgs.mode !== undefined) { + mode = deploymentArgs.mode + } + if (deploymentArgs.authz !== undefined) { + authz = deploymentArgs.authz + } + if (deploymentArgs.restrictInstantiation !== undefined) { + restrictInstantiation = deploymentArgs.restrictInstantiation + } + if (deploymentArgs.mnemonic !== undefined) { + mnemonicName = deploymentArgs.mnemonic + } + if (deploymentArgs.instantiateAdminFactory !== undefined) { + instantiateAdminFactory = deploymentArgs.instantiateAdminFactory + } +} + +const mnemonic = mnemonics[mnemonicName] +if (!mnemonic) { + log(chalk.red(`Mnemonic with name "${mnemonicName}" not found in config.`)) + process.exit(1) +} + if (!Object.values(Mode).includes(mode)) { log( chalk.red('Invalid mode. Must be one of: ' + Object.values(Mode).join(', ')) @@ -218,7 +256,7 @@ const main = async () => { // Poll for TX. let events - let tries = 15 + let tries = 50 while (tries > 0) { try { events = (await client.getTx(transactionHash))?.events @@ -228,7 +266,7 @@ const main = async () => { } catch {} tries-- - await new Promise((resolve) => setTimeout(resolve, 200)) + await new Promise((resolve) => setTimeout(resolve, 300)) } if (!events) { @@ -476,7 +514,7 @@ const main = async () => { } const adminFactoryAddress = - cwAdminFactoryCodeId !== null + instantiateAdminFactory && cwAdminFactoryCodeId !== null ? await instantiateContract({ client, sender, @@ -512,7 +550,7 @@ const main = async () => { govProp: `https://${explorerUrlDomain}/${chainName}/gov/REPLACE`, wallet: `https://${explorerUrlDomain}/${chainName}/account/REPLACE`, }, - latestVersion: ContractVersion.Unknown, + latestVersion: version || ContractVersion.Unknown, } log(JSON.stringify(config, null, 2)) diff --git a/packages/email/package.json b/packages/email/package.json index 0abbc5f3d..625142c7c 100644 --- a/packages/email/package.json +++ b/packages/email/package.json @@ -1,6 +1,6 @@ { "name": "@dao-dao/email", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "license": "BSD-3-Clause-Clear", "scripts": { "format": "eslint . --fix", @@ -10,8 +10,8 @@ }, "devDependencies": { "@aws-sdk/client-ses": "^3.592.0", - "@dao-dao/config": "2.5.0-rc.3", - "@dao-dao/types": "2.5.0-rc.3", + "@dao-dao/config": "2.6.0-rc.1", + "@dao-dao/types": "2.6.0-rc.1", "@react-email/components": "^0.0.7", "@react-email/render": "0.0.7", "commander": "^11.0.0", diff --git a/packages/i18n/package.json b/packages/i18n/package.json index 564e78cc7..3022f3ccd 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@dao-dao/i18n", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "license": "BSD-3-Clause-Clear", "scripts": { "format": "eslint . --fix", @@ -17,7 +17,7 @@ "react-i18next": "^11.0.0" }, "devDependencies": { - "@dao-dao/config": "2.5.0-rc.3", + "@dao-dao/config": "2.6.0-rc.1", "eslint-plugin-i18n-json": "^3.1.0", "i18n-unused": "^0.10.0" }, diff --git a/packages/math/package.json b/packages/math/package.json index da8542580..6fded02fc 100644 --- a/packages/math/package.json +++ b/packages/math/package.json @@ -1,6 +1,6 @@ { "name": "@dao-dao/math", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "license": "BSD-3-Clause-Clear", "scripts": { "format": "eslint . --fix", @@ -11,7 +11,7 @@ "bignumber.js": "^9.1.2" }, "devDependencies": { - "@dao-dao/config": "2.5.0-rc.3", + "@dao-dao/config": "2.6.0-rc.1", "jest": "^29.1.1", "typescript": "5.3.3" }, diff --git a/packages/state/contracts/DaoRewardsDistributor.ts b/packages/state/contracts/DaoRewardsDistributor.ts index 2daf76dac..2bf0f0733 100644 --- a/packages/state/contracts/DaoRewardsDistributor.ts +++ b/packages/state/contracts/DaoRewardsDistributor.ts @@ -237,6 +237,18 @@ export interface DaoRewardsDistributorInterface memo?: string, _funds?: Coin[] ) => Promise + unsafeForceWithdraw: ( + { + amount, + denom, + }: { + amount: Uint128 + denom: UncheckedDenom + }, + fee?: number | StdFee | 'auto', + memo?: string, + _funds?: Coin[] + ) => Promise updateOwnership: ( action: Action, fee?: number | StdFee | 'auto', @@ -270,6 +282,7 @@ export class DaoRewardsDistributorClient this.fundLatest = this.fundLatest.bind(this) this.claim = this.claim.bind(this) this.withdraw = this.withdraw.bind(this) + this.unsafeForceWithdraw = this.unsafeForceWithdraw.bind(this) this.updateOwnership = this.updateOwnership.bind(this) } memberChangedHook = async ( @@ -519,6 +532,32 @@ export class DaoRewardsDistributorClient _funds ) } + unsafeForceWithdraw = async ( + { + amount, + denom, + }: { + amount: Uint128 + denom: UncheckedDenom + }, + fee: number | StdFee | 'auto' = CHAIN_GAS_MULTIPLIER, + memo?: string, + _funds?: Coin[] + ): Promise => { + return await this.client.execute( + this.sender, + this.contractAddress, + { + unsafe_force_withdraw: { + amount, + denom, + }, + }, + fee, + memo, + _funds + ) + } updateOwnership = async ( action: Action, fee: number | StdFee | 'auto' = CHAIN_GAS_MULTIPLIER, diff --git a/packages/state/package.json b/packages/state/package.json index 991672047..6045fa845 100644 --- a/packages/state/package.json +++ b/packages/state/package.json @@ -1,6 +1,6 @@ { "name": "@dao-dao/state", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "license": "BSD-3-Clause-Clear", "scripts": { "build": "tsc && npm run build:gql", @@ -17,8 +17,8 @@ "@cosmjs/proto-signing": "^0.32.3", "@cosmjs/stargate": "^0.32.3", "@cosmjs/tendermint-rpc": "^0.32.3", - "@dao-dao/math": "2.5.0-rc.3", - "@dao-dao/utils": "2.5.0-rc.3", + "@dao-dao/math": "2.6.0-rc.1", + "@dao-dao/utils": "2.6.0-rc.1", "@tanstack/react-query": "^5.40.0", "graphql": "^16.8.1", "json5": "^2.2.0", @@ -30,8 +30,8 @@ }, "devDependencies": { "@chain-registry/types": "0.45.86", - "@dao-dao/config": "2.5.0-rc.3", - "@dao-dao/types": "2.5.0-rc.3", + "@dao-dao/config": "2.6.0-rc.1", + "@dao-dao/types": "2.6.0-rc.1", "@graphql-codegen/cli": "^5.0.0", "@graphql-codegen/client-preset": "^4.1.0", "@graphql-typed-document-node/core": "^3.2.0", diff --git a/packages/stateful/package.json b/packages/stateful/package.json index d2ef2f62a..857d04bac 100644 --- a/packages/stateful/package.json +++ b/packages/stateful/package.json @@ -1,6 +1,6 @@ { "name": "@dao-dao/stateful", - "version": "2.5.0-rc.3", + "version": "2.6.0-rc.1", "license": "BSD-3-Clause-Clear", "scripts": { "build": "tsc", @@ -39,11 +39,11 @@ "@cosmos-kit/vectis": "^2.11.2", "@cosmos-kit/web3auth": "^2.11.0", "@cosmos-kit/xdefi": "^2.10.2", - "@dao-dao/i18n": "2.5.0-rc.3", - "@dao-dao/math": "2.5.0-rc.3", - "@dao-dao/state": "2.5.0-rc.3", - "@dao-dao/stateless": "2.5.0-rc.3", - "@dao-dao/utils": "2.5.0-rc.3", + "@dao-dao/i18n": "2.6.0-rc.1", + "@dao-dao/math": "2.6.0-rc.1", + "@dao-dao/state": "2.6.0-rc.1", + "@dao-dao/stateless": "2.6.0-rc.1", + "@dao-dao/utils": "2.6.0-rc.1", "@emotion/react": "^11.10.4", "@emotion/styled": "^11.10.4", "@mui/icons-material": "^5.10.3", @@ -80,9 +80,9 @@ "devDependencies": { "@chain-registry/types": "0.45.86", "@cosmjs/amino": "^0.32.3", - "@dao-dao/config": "2.5.0-rc.3", + "@dao-dao/config": "2.6.0-rc.1", "@dao-dao/cosmiframe": "0.1.0", - "@dao-dao/types": "2.5.0-rc.3", + "@dao-dao/types": "2.6.0-rc.1", "@storybook/react": "^6.5.10", "@types/file-saver": "^2.0.5", "@types/lodash.clonedeep": "^4.5.0", @@ -102,7 +102,7 @@ "typescript": "5.3.3" }, "peerDependencies": { - "@dao-dao/storybook": "2.5.0-rc.3", + "@dao-dao/storybook": "2.6.0-rc.1", "next": "^12 || ^13", "react": "^17 || ^18" }, diff --git a/packages/stateless/components/proposal/ProposalExecutionMetadataEditor.tsx b/packages/stateless/components/proposal/ProposalExecutionMetadataEditor.tsx index 10be41878..8fd4709fa 100644 --- a/packages/stateless/components/proposal/ProposalExecutionMetadataEditor.tsx +++ b/packages/stateless/components/proposal/ProposalExecutionMetadataEditor.tsx @@ -93,8 +93,7 @@ export const ProposalExecutionMetadataEditor = ({ {/* Gaia Metaprotocols Extension Data only supported on Cosmos Hub */} {(chainId === ChainId.CosmosHubMainnet || - chainId === ChainId.CosmosHubProviderTestnet || - chainId === ChainId.CosmosHubThetaTestnet) && ( + chainId === ChainId.CosmosHubProviderTestnet) && (