Skip to content

Commit

Permalink
Merge branch 'dev' into community-and-pools-metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin authored Jan 13, 2025
2 parents 1430d5a + 3a40334 commit 860c0a1
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions apps/web/app/(app)/gardens/[chain]/[garden]/[community]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default function Page({
strategies,
communityFee,
registerStakeAmount,
protocolFee,
} = registryCommunity ?? {};

const { data: isMemberResult } = useSubgraphQuery<isMemberQuery>({
Expand Down Expand Up @@ -267,20 +268,17 @@ export default function Page({
] as Dnum;

const getTotalRegistrationCost = () => {
if (registerStakeAmount) {
// using == for type coercion because communityFee is actually a string
if (communityFee == 0 || communityFee === undefined) {
return BigInt(registerStakeAmount);
} else {
return (
BigInt(registerStakeAmount) +
BigInt(registerStakeAmount) /
(BigInt(SCALE_PRECISION) / BigInt(communityFee))
);
}
} else {
return 0n;
if (registerStakeAmount == undefined) {
registerStakeAmount = 0;
}
const res =
BigInt(registerStakeAmount) + // Min stake
(+communityFee ?
BigInt(registerStakeAmount) /
(BigInt(SCALE_PRECISION) / BigInt(communityFee))
: BigInt(0)) + // Commuity fee as % of min stake
(+communityFee ? BigInt(+protocolFee) : BigInt(0)); // Protocol fee as extra
return res;
};

return (
Expand Down

0 comments on commit 860c0a1

Please sign in to comment.