From c1e0ca94e9690033ca929b16af889dd8f829e3be Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Wed, 3 May 2023 16:20:21 -0600 Subject: [PATCH 01/11] adds field to track quorum at sponsor --- apps/moloch-v3-subgraph/schema.graphql | 8 ++++---- apps/moloch-v3-subgraph/src/baal-mapping.ts | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/moloch-v3-subgraph/schema.graphql b/apps/moloch-v3-subgraph/schema.graphql index d5fef8d0..3915fd57 100644 --- a/apps/moloch-v3-subgraph/schema.graphql +++ b/apps/moloch-v3-subgraph/schema.graphql @@ -171,10 +171,10 @@ type Proposal @entity { currentlyPassing: Boolean! "highest share+loot count during any individual yes vote" maxTotalSharesAndLootAtYesVote: BigInt! - "Snapshot of the quorum precent for the DAO when the proposal was executed" - quorumPercentAtExecution: BigInt - "Snapshot of the total shares for the DAO when the proposal was executed" - totalSharesAtExecution: BigInt + "highest share count during any individual yes vote" + maxTotalSharesAtYesVote: BigInt! + "Snapshot of the quorum precent for the DAO when the proposal was sponsored" + quorumPercentAtSponsor: BigInt "The following tribute fields will only have values if the proposal was submitted through the trbute minion contract. \n token address in tribute proposals." tributeToken: Bytes "amount of tribute token offered" diff --git a/apps/moloch-v3-subgraph/src/baal-mapping.ts b/apps/moloch-v3-subgraph/src/baal-mapping.ts index 75c0db85..ded14271 100644 --- a/apps/moloch-v3-subgraph/src/baal-mapping.ts +++ b/apps/moloch-v3-subgraph/src/baal-mapping.ts @@ -192,6 +192,7 @@ export function handleSubmitProposal(event: SubmitProposal): void { proposal.currentlyPassing = false; proposal.proposalOffering = event.transaction.value; proposal.maxTotalSharesAndLootAtYesVote = constants.BIGINT_ZERO; + proposal.maxTotalSharesAtYesVote = constants.BIGINT_ZERO; proposal.sponsored = event.params.selfSponsor; proposal.selfSponsor = event.params.selfSponsor; proposal.sponsorTxHash = event.params.selfSponsor @@ -202,6 +203,9 @@ export function handleSubmitProposal(event: SubmitProposal): void { : null; proposal.sponsor = event.params.selfSponsor ? event.transaction.from : null; proposal.sponsorMembership = event.params.selfSponsor ? proposerId : null; + proposal.quorumPercentAtSponsor = event.params.selfSponsor + ? dao.totalShares + : null; proposal.prevProposalId = event.params.selfSponsor ? dao.latestSponsoredProposalId : constants.BIGINT_ZERO; @@ -330,8 +334,6 @@ export function handleProcessProposal(event: ProcessProposal): void { proposal.processed = true; proposal.passed = event.params.passed; proposal.actionFailed = event.params.actionFailed; - proposal.quorumPercentAtExecution = dao.quorumPercent; - proposal.totalSharesAtExecution = dao.totalShares; proposal.save(); @@ -403,6 +405,7 @@ export function handleSubmitVote(event: SubmitVote): void { proposal.maxTotalSharesAndLootAtYesVote = dao.totalShares.plus( dao.totalLoot ); + proposal.maxTotalSharesAtYesVote = dao.totalShares; } else { proposal.noVotes = proposal.noVotes.plus(constants.BIGINT_ONE); proposal.noBalance = proposal.noBalance.plus(event.params.balance); From 995bb38a016f0a5b062afc1404aaa4eef987c833 Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Thu, 4 May 2023 09:32:48 -0600 Subject: [PATCH 02/11] adds field to give block number at execution --- apps/moloch-v3-subgraph/schema.graphql | 2 ++ apps/moloch-v3-subgraph/src/baal-mapping.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/apps/moloch-v3-subgraph/schema.graphql b/apps/moloch-v3-subgraph/schema.graphql index 3915fd57..a178d4e0 100644 --- a/apps/moloch-v3-subgraph/schema.graphql +++ b/apps/moloch-v3-subgraph/schema.graphql @@ -175,6 +175,8 @@ type Proposal @entity { maxTotalSharesAtYesVote: BigInt! "Snapshot of the quorum precent for the DAO when the proposal was sponsored" quorumPercentAtSponsor: BigInt + "the block number when the proposal was executed" + blockNumberAtExecution: BigInt "The following tribute fields will only have values if the proposal was submitted through the trbute minion contract. \n token address in tribute proposals." tributeToken: Bytes "amount of tribute token offered" diff --git a/apps/moloch-v3-subgraph/src/baal-mapping.ts b/apps/moloch-v3-subgraph/src/baal-mapping.ts index ded14271..94944073 100644 --- a/apps/moloch-v3-subgraph/src/baal-mapping.ts +++ b/apps/moloch-v3-subgraph/src/baal-mapping.ts @@ -334,6 +334,7 @@ export function handleProcessProposal(event: ProcessProposal): void { proposal.processed = true; proposal.passed = event.params.passed; proposal.actionFailed = event.params.actionFailed; + proposal.blockNumberAtExecution = event.block.number; proposal.save(); From 14f8714d534f2e2b908f8cce2c8bb92fea0c58cc Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Mon, 22 May 2023 10:08:14 -0600 Subject: [PATCH 03/11] set quorumPercentAtSponsor in one more spot --- apps/moloch-v3-subgraph/src/baal-mapping.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/moloch-v3-subgraph/src/baal-mapping.ts b/apps/moloch-v3-subgraph/src/baal-mapping.ts index 94944073..c98596ad 100644 --- a/apps/moloch-v3-subgraph/src/baal-mapping.ts +++ b/apps/moloch-v3-subgraph/src/baal-mapping.ts @@ -303,6 +303,7 @@ export function handleSponsorProposal(event: SponsorProposal): void { proposal.prevProposalId = dao.latestSponsoredProposalId; proposal.sponsorTxHash = event.transaction.hash; proposal.sponsorTxAt = event.block.timestamp; + proposal.quorumPercentAtSponsor = dao.totalShares; dao.latestSponsoredProposalId = event.params.proposal; From 0f4e1412862b18850edd7e00f80079a3185b99fb Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Mon, 22 May 2023 10:21:44 -0600 Subject: [PATCH 04/11] updates settings section in macro package --- apps/admin-new/src/pages/Settings.tsx | 7 +- .../DaoSettings/ContractSettings.tsx | 10 +- .../components/DaoSettings/DaoSettings.tsx | 54 +++-- .../DaoSettings/GovernanceSettings.tsx | 219 +++++++----------- .../DaoSettings/MetadataSettings.tsx | 7 +- .../components/DaoSettings/ShamanSettings.tsx | 50 ++-- .../components/DaoSettings/TokenSettings.tsx | 115 +++++++++ .../src/components/DaoSettings/index.ts | 1 + 8 files changed, 267 insertions(+), 196 deletions(-) create mode 100644 libs/moloch-v3-macro-ui/src/components/DaoSettings/TokenSettings.tsx diff --git a/apps/admin-new/src/pages/Settings.tsx b/apps/admin-new/src/pages/Settings.tsx index dc1dbbde..1138b91a 100644 --- a/apps/admin-new/src/pages/Settings.tsx +++ b/apps/admin-new/src/pages/Settings.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { useCurrentDao, useDaoData } from '@daohaus/moloch-v3-hooks'; import { SingleColumnLayout } from '@daohaus/ui'; -import { DaoSettings } from '@daohaus/moloch-v3-macro-ui'; +import { DaoSettings, GovernanceSettings } from '@daohaus/moloch-v3-macro-ui'; import { Keychain } from '@daohaus/keychain-utils'; export const Settings = () => { @@ -16,6 +16,11 @@ export const Settings = () => { daoId={dao.id} includeLinks={true} /> + // )} ); diff --git a/libs/moloch-v3-macro-ui/src/components/DaoSettings/ContractSettings.tsx b/libs/moloch-v3-macro-ui/src/components/DaoSettings/ContractSettings.tsx index 6c269f42..ccbddc10 100644 --- a/libs/moloch-v3-macro-ui/src/components/DaoSettings/ContractSettings.tsx +++ b/libs/moloch-v3-macro-ui/src/components/DaoSettings/ContractSettings.tsx @@ -8,7 +8,11 @@ import { import { Keychain, ValidNetwork } from '@daohaus/keychain-utils'; import { MolochV3Dao } from '@daohaus/moloch-v3-data'; -import { MetaCardHeader, MetaContent } from './DaoSettings.styles'; +import { + MetaCardHeader, + MetaContent, + SettingsContainer, +} from './DaoSettings.styles'; type ContractSettingsProps = { dao: MolochV3Dao; @@ -19,7 +23,7 @@ export const ContractSettings = ({ dao, daoChain }: ContractSettingsProps) => { const isMobile = useBreakpoint(widthQuery.sm); return ( - <> +

Contracts

@@ -61,6 +65,6 @@ export const ContractSettings = ({ dao, daoChain }: ContractSettingsProps) => { /> - +
); }; diff --git a/libs/moloch-v3-macro-ui/src/components/DaoSettings/DaoSettings.tsx b/libs/moloch-v3-macro-ui/src/components/DaoSettings/DaoSettings.tsx index 01aed5f3..c3508f41 100644 --- a/libs/moloch-v3-macro-ui/src/components/DaoSettings/DaoSettings.tsx +++ b/libs/moloch-v3-macro-ui/src/components/DaoSettings/DaoSettings.tsx @@ -6,7 +6,7 @@ import { ContractSettings } from './ContractSettings'; import { GovernanceSettings } from './GovernanceSettings'; import { ShamanSettings } from './ShamanSettings'; -import { SettingsContainer } from './DaoSettings.styles'; +import { TokenSettings } from './TokenSettings'; type DaoSettingsProps = { daoChain: ValidNetwork; @@ -31,33 +31,31 @@ export const DaoSettings = ({ return ( <> - - - - - - - - - - - - - - - + + + + + + + + + ); }; diff --git a/libs/moloch-v3-macro-ui/src/components/DaoSettings/GovernanceSettings.tsx b/libs/moloch-v3-macro-ui/src/components/DaoSettings/GovernanceSettings.tsx index d0444a6b..e96e5354 100644 --- a/libs/moloch-v3-macro-ui/src/components/DaoSettings/GovernanceSettings.tsx +++ b/libs/moloch-v3-macro-ui/src/components/DaoSettings/GovernanceSettings.tsx @@ -1,13 +1,11 @@ import { useMemo } from 'react'; -import { H3, H4, DataIndicator, ParSm } from '@daohaus/ui'; +import { H3, DataIndicator, ParSm } from '@daohaus/ui'; import { MolochV3Dao } from '@daohaus/moloch-v3-data'; import { - charLimit, formatPeriods, formatValueTo, fromWei, INFO_COPY, - lowerCaseLootToken, toWholeUnits, } from '@daohaus/utils'; @@ -16,9 +14,8 @@ import { DataGrid, GovernanceCardHeader, GovernanceContainer, + SettingsContainer, StyledLink, - TokenDataGrid, - TokensHeader, } from './DaoSettings.styles'; import { ButtonRouterLink } from '../Layout'; @@ -55,139 +52,83 @@ export const GovernanceSettings = ({ }, [dao]); return ( - - -

Governance Settings

- {includeLinks && ( - - Update DAO Settings - - )} -
-
- - - Review the documenation - {' '} - for additional details on governance settings. Updates to settings - will go through a proposal. - -
- - - - - - - - - - - -

DAO Tokens

- {includeLinks && ( - - Update Token Settings - - )} -
-

Voting

- - - - - - -

Non-Voting

- - - - - - -
+ + + +

Governance Settings

+ {includeLinks && ( + + Update Governance + + )} +
+
+ + + Review the documenation + {' '} + for additional details on governance settings. Updates to settings + will go through a proposal. + +
+ + + + + + + + + + +
+
); }; diff --git a/libs/moloch-v3-macro-ui/src/components/DaoSettings/MetadataSettings.tsx b/libs/moloch-v3-macro-ui/src/components/DaoSettings/MetadataSettings.tsx index a3828c06..ba679a59 100644 --- a/libs/moloch-v3-macro-ui/src/components/DaoSettings/MetadataSettings.tsx +++ b/libs/moloch-v3-macro-ui/src/components/DaoSettings/MetadataSettings.tsx @@ -20,6 +20,7 @@ import { DaoProfileAvatar, MetaCardHeader, MetaContent, + SettingsContainer, WarningContainer, } from './DaoSettings.styles'; import { useDHConnect } from '@daohaus/connect'; @@ -53,7 +54,7 @@ export const MetadataSettings = ({ const isMobile = useBreakpoint(widthQuery.sm); return ( - <> +

Metadata

{includeLinks && enableActions && ( @@ -61,7 +62,7 @@ export const MetadataSettings = ({ color="secondary" to={`/molochv3/${daoChain}/${dao.id}/settings/update`} > - Update Settings + Update Metadata )}
@@ -111,6 +112,6 @@ export const MetadataSettings = ({ )} - +
); }; diff --git a/libs/moloch-v3-macro-ui/src/components/DaoSettings/ShamanSettings.tsx b/libs/moloch-v3-macro-ui/src/components/DaoSettings/ShamanSettings.tsx index c4bae7b9..8a221efc 100644 --- a/libs/moloch-v3-macro-ui/src/components/DaoSettings/ShamanSettings.tsx +++ b/libs/moloch-v3-macro-ui/src/components/DaoSettings/ShamanSettings.tsx @@ -2,7 +2,11 @@ import { H3, ParSm } from '@daohaus/ui'; import { MolochV3Dao } from '@daohaus/moloch-v3-data'; import { ValidNetwork } from '@daohaus/keychain-utils'; -import { ShamanCardHeader, ShamanContainer } from './DaoSettings.styles'; +import { + SettingsContainer, + ShamanCardHeader, + ShamanContainer, +} from './DaoSettings.styles'; import { ShamanList } from './ShamanList'; type ShamanSettingsProps = { @@ -17,27 +21,29 @@ export const ShamanSettings = ({ includeLinks = false, }: ShamanSettingsProps) => { return ( - - -

Shamans

-
-
- - Shamans are contracts that can adjust governance settings, token - settings, and memberships without proposals. Because shamans can - affect the security of the DAO, be cautious when adding new shamans, - and remove any that are no longer needed. - -
+ + + +

Shamans

+
+
+ + Shamans are contracts that can adjust governance settings, token + settings, and memberships without proposals. Because shamans can + affect the security of the DAO, be cautious when adding new shamans, + and remove any that are no longer needed. + +
- {dao.shamen && dao.shamen.length > 0 && ( - - )} -
+ {dao.shamen && dao.shamen.length > 0 && ( + + )} +
+ ); }; diff --git a/libs/moloch-v3-macro-ui/src/components/DaoSettings/TokenSettings.tsx b/libs/moloch-v3-macro-ui/src/components/DaoSettings/TokenSettings.tsx new file mode 100644 index 00000000..02ffbeb9 --- /dev/null +++ b/libs/moloch-v3-macro-ui/src/components/DaoSettings/TokenSettings.tsx @@ -0,0 +1,115 @@ +import { useMemo } from 'react'; +import { H3, H4, DataIndicator } from '@daohaus/ui'; +import { MolochV3Dao } from '@daohaus/moloch-v3-data'; +import { + charLimit, + formatValueTo, + fromWei, + lowerCaseLootToken, + toWholeUnits, +} from '@daohaus/utils'; + +import { ValidNetwork } from '@daohaus/keychain-utils'; +import { + GovernanceContainer, + SettingsContainer, + TokenDataGrid, + TokensHeader, +} from './DaoSettings.styles'; +import { ButtonRouterLink } from '../Layout'; + +type TokenSettingsProps = { + dao: MolochV3Dao; + daoChain: ValidNetwork; + includeLinks?: boolean; +}; + +export const TokenSettings = ({ + dao, + daoChain, + includeLinks = false, +}: TokenSettingsProps) => { + const defaultValues = useMemo(() => { + if (!dao) return null; + return { + votingPeriod: dao.votingPeriod, + votingPeriodUnits: 'seconds', + gracePeriodUnits: 'seconds', + gracePeriod: dao.gracePeriod, + quorum: dao.quorumPercent, + minRetention: dao.minRetentionPercent, + sponsorThreshold: toWholeUnits(dao.sponsorThreshold), + newOffering: toWholeUnits(dao.proposalOffering), + vStake: dao.sharesPaused, + nvStake: dao.lootPaused, + }; + }, [dao]); + + return ( + + + +

DAO Tokens

+ {includeLinks && ( + + Update Tokens + + )} +
+

Voting

+ + + + + + +

Non-Voting

+ + + + + + +
+
+ ); +}; diff --git a/libs/moloch-v3-macro-ui/src/components/DaoSettings/index.ts b/libs/moloch-v3-macro-ui/src/components/DaoSettings/index.ts index e5ed9d1a..4b1c5053 100644 --- a/libs/moloch-v3-macro-ui/src/components/DaoSettings/index.ts +++ b/libs/moloch-v3-macro-ui/src/components/DaoSettings/index.ts @@ -4,3 +4,4 @@ export * from './GovernanceSettings'; export * from './MetadataSettings'; export * from './ShamanSettings'; export * from './ShamanList'; +export * from './TokenSettings'; From 755c2579587b93ba0c3819286e9279abdde64972 Mon Sep 17 00:00:00 2001 From: skuhlmann Date: Mon, 22 May 2023 10:29:53 -0600 Subject: [PATCH 05/11] enbales custom footer --- apps/admin-new/src/layout/DaoContainer.tsx | 2 ++ apps/admin-new/src/layout/HomeContainer.tsx | 2 ++ apps/admin/src/Routes.tsx | 2 ++ apps/admin/src/pages/Dao.tsx | 2 ++ libs/connect/src/components/DHLayout/DHLayout.tsx | 4 +++- 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/admin-new/src/layout/DaoContainer.tsx b/apps/admin-new/src/layout/DaoContainer.tsx index cdba097a..2e0466c0 100644 --- a/apps/admin-new/src/layout/DaoContainer.tsx +++ b/apps/admin-new/src/layout/DaoContainer.tsx @@ -3,6 +3,7 @@ import { Outlet, useLocation, useParams } from 'react-router-dom'; import { CurrentDaoProvider, useDaoData } from '@daohaus/moloch-v3-hooks'; import { ValidNetwork } from '@daohaus/keychain-utils'; import { TXBuilder } from '@daohaus/tx-builder'; +import { Footer } from '@daohaus/ui'; export const DaoContainer = () => { const { address, provider } = useDHConnect(); @@ -48,6 +49,7 @@ export const DaoContainer = () => { pathname={location.pathname} navLinks={navLinks} dropdownLinks={moreLinks} + footer={