Skip to content

Commit

Permalink
Merge pull request #1141 from near-daos/feature/amp-32-fix-near-walle…
Browse files Browse the repository at this point in the history
…t-compatibility

feat(dev): fix votePolicy compatibility
  • Loading branch information
karpovdmitryod authored Jun 7, 2022
2 parents b2ce135 + 8e40b91 commit b90d4f8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const DaoGroupsForm: VFC = () => {
}))
: [
{ group: 'All', slug: 'all' },
{ group: 'Councils', slug: 'councils' },
{ group: 'Councils', slug: 'council' },
],
item => item.group
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type Props = {
getDataFromContext?: boolean;
};

const calculateQuorum = (threshold: number[] = [1, 2]): number =>
Math.floor((threshold[0] / threshold[1]) * 100);

export const UpdateGroupContent: FC<Props> = ({
groups,
getDataFromContext = false,
Expand Down Expand Up @@ -82,11 +85,12 @@ export const UpdateGroupContent: FC<Props> = ({
<p className={styles.contentValue}>
Group quorum is{' '}
<b>
{activeGroup.votePolicy.quorum ||
(
activeGroup.votePolicy?.changePolicy ||
activeGroup.votePolicy.defaultPolicy
).quorum}{' '}
{activeGroup.votePolicy?.quorum
? activeGroup.votePolicy?.quorum
: calculateQuorum(
activeGroup.votePolicy?.changePolicy?.threshold ||
activeGroup.votePolicy?.defaultPolicy?.threshold
)}{' '}
%
</b>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const ManageGroups: React.FC<Props> = ({
const validateGroup = (group: TLocalGroup): boolean => {
if (
BANNED_GROUP_NAMES.includes(group.name.toLowerCase()) &&
group.slug !== 'council'
!BANNED_GROUP_NAMES.includes(group.slug)
) {
return false;
}
Expand Down
1 change: 1 addition & 0 deletions types/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export type DaoVotePolicy = {
quorum: string;
kind: string;
ratio: number[];
threshold?: number[];
weight?: string;
};

Expand Down

0 comments on commit b90d4f8

Please sign in to comment.