diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 68330ba..d4f1a11 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -15,6 +15,7 @@ import { cn, formatBigNumber, isNotNullAndNumber } from '@/lib/utils';
import { article } from './article';
import YesIcon from '@/assets/icons/yes.svg?react';
import NoIcon from '@/assets/icons/no.svg?react';
+import ApprovedImg from '@/assets/images/approved.png';
import Countdown from './components/Countdown';
import dayjs from 'dayjs';
@@ -25,12 +26,22 @@ dayjs.extend(utc);
export default function Home() {
const navigate = useNavigate();
- const { isLoading, deadline, votes, yesVotesCount, votedPercent, votedStakeAmount } =
+ const { isLoading, deadline, votes, voteResult, yesVotesCount, votedPercent, votedStakeAmount } =
VoteContainer.useContainer();
const NEAR_ENV = config.proposalContractId?.split('.').pop() === 'near' ? 'mainnet' : 'testnet';
const renderVoteProgressStatus = () => {
+ if (voteResult) {
+ return (
+
+ {/*
+ {votedPercent}% of Stake Voted for YEA
+ */}
+
+
+ );
+ }
return
;
};
From 551f239301f1cd18b7d78efffe78fffa3b15d31f Mon Sep 17 00:00:00 2001
From: Linguists <95207870+linguists@users.noreply.github.com>
Date: Fri, 25 Jul 2025 12:11:36 +0800
Subject: [PATCH 14/23] feat: update voting instructions
---
src/pages/home/index.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 4c799a3..54113b5 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -254,8 +254,8 @@ export default function Home() {
'## Vote with
NEAR CLI \n' +
'Instructions for Validator Voting:\n' +
'- If you are a validator, please use the CLI commands shown below to vote. We do not support voting through wallet for security considerations. This page is only used to display voting results.\n' +
- '- You can vote **yes** or **no** for the proposal. You can change your vote before the voting ends.\n' +
- `- This voting ends when **2/3 of stake votes yes** or when **the deadline (${dayjs.utc(deadline).format('MM/DD/YYYY HH:mm:ss')} UTC) passes**.\n` +
+ `- You can vote **yes** or **no** for the proposal. You can change your vote before the deadline (**${dayjs.utc(deadline).format('MM/DD/YYYY HH:mm:ss')} UTC**).\n` +
+ '- This proposal will be approved when more than 1/3 of total stake joins the voting and more than 2/3 of stake participating in the voting is **yes**.\n' +
'- Replace **<validator-account-id>** and **<validator-owner-id>** in the commands below with your own account IDs.\n' +
"- [The indexer](https://thegraph.com/explorer/subgraphs/3EbPN5sxnMtSof4M8LuaSKLcNzvzDLrY3eyrRKBhVGaK?view=Query&chain=arbitrum-one) that tracks the voting results may have several minutes delay. If you don't see your vote in the details page, please refresh the page after a while.\n" +
'\n' +
From cef61ee4c48b593a62ac9f6a37726969c88a87de Mon Sep 17 00:00:00 2001
From: Linguists <95207870+linguists@users.noreply.github.com>
Date: Fri, 25 Jul 2025 12:13:33 +0800
Subject: [PATCH 15/23] feat: update voting instructions
---
src/pages/home/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 54113b5..2514aea 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -255,7 +255,7 @@ export default function Home() {
'Instructions for Validator Voting:\n' +
'- If you are a validator, please use the CLI commands shown below to vote. We do not support voting through wallet for security considerations. This page is only used to display voting results.\n' +
`- You can vote **yes** or **no** for the proposal. You can change your vote before the deadline (**${dayjs.utc(deadline).format('MM/DD/YYYY HH:mm:ss')} UTC**).\n` +
- '- This proposal will be approved when more than 1/3 of total stake joins the voting and more than 2/3 of stake participating in the voting is **yes**.\n' +
+ '- This proposal will be approved when more than **1/3 of total stake** joins the voting and more than **2/3 of stake participating in the voting** is **yes**.\n' +
'- Replace **<validator-account-id>** and **<validator-owner-id>** in the commands below with your own account IDs.\n' +
"- [The indexer](https://thegraph.com/explorer/subgraphs/3EbPN5sxnMtSof4M8LuaSKLcNzvzDLrY3eyrRKBhVGaK?view=Query&chain=arbitrum-one) that tracks the voting results may have several minutes delay. If you don't see your vote in the details page, please refresh the page after a while.\n" +
'\n' +
From e3d8b687798ef177d21fd227444ec0a51c4ee8ba Mon Sep 17 00:00:00 2001
From: Linguists <95207870+linguists@users.noreply.github.com>
Date: Fri, 25 Jul 2025 15:13:14 +0800
Subject: [PATCH 16/23] chore: change tesnet contract ID
---
src/config/testnet.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/config/testnet.ts b/src/config/testnet.ts
index b5a23c4..92a9f67 100644
--- a/src/config/testnet.ts
+++ b/src/config/testnet.ts
@@ -1,5 +1,5 @@
const config: App.AppConfig = {
- proposalContractId: 'mock-proposal-gamma.testnet',
+ proposalContractId: 'mock-proposal-delta.testnet',
validatorApi: 'https://validator-voting-api.linearprotocol.org',
near: {
network: {
From b97dafc23c8c4af2de2d969d13d409063bf3ae72 Mon Sep 17 00:00:00 2001
From: jin <57248516+chickick@users.noreply.github.com>
Date: Fri, 25 Jul 2025 16:40:56 +0800
Subject: [PATCH 17/23] chore: optimize codes
---
src/containers/vote/index.ts | 16 ++++++++--------
src/pages/details/index.tsx | 10 +++++-----
src/pages/home/index.tsx | 21 ++++++++++++---------
3 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/src/containers/vote/index.ts b/src/containers/vote/index.ts
index 2bdd356..7d9c64f 100644
--- a/src/containers/vote/index.ts
+++ b/src/containers/vote/index.ts
@@ -16,7 +16,7 @@ interface VoteState {
yesVotesCount: number | null;
votedYeaStakeAmount: Big.Big;
votedStakeAmount: Big.Big;
- totalVotedStakeAmount: Big.Big;
+ totalStakeAmount: Big.Big;
}
interface VoteComputed {
@@ -37,13 +37,13 @@ function useVoteContainer(): UseVoteContainer {
const [votes, setVotes] = useState
>({});
const [votedStakeAmount, setVotedStakeAmount] = useState(Big(0));
const [votedYeaStakeAmount, setVotedYeaStakeAmount] = useState(Big(0));
- const [totalVotedStakeAmount, setTotalVotedStakeAmount] = useState(Big(0));
+ const [totalStakeAmount, setTotalStakeAmount] = useState(Big(0));
const _votedPercent = useMemo(() => {
- if (!totalVotedStakeAmount) return '0';
- if (totalVotedStakeAmount.eq(0)) return '0';
- return votedStakeAmount.div(totalVotedStakeAmount).times(100).toFixed(2) || '0';
- }, [votedStakeAmount, totalVotedStakeAmount]);
+ if (!totalStakeAmount) return '0';
+ if (totalStakeAmount.eq(0)) return '0';
+ return votedStakeAmount.div(totalStakeAmount).times(100).toFixed(2) || '0';
+ }, [votedStakeAmount, totalStakeAmount]);
const votedPercent = useMemo(() => {
return _votedPercent;
@@ -61,7 +61,7 @@ function useVoteContainer(): UseVoteContainer {
}
setVotedYeaStakeAmount(Big(data[0]));
setVotedStakeAmount(Big(data[1]));
- setTotalVotedStakeAmount(Big(data[2]));
+ setTotalStakeAmount(Big(data[2]));
}, [viewFunction]);
const getResult = useCallback(async () => {
@@ -129,7 +129,7 @@ function useVoteContainer(): UseVoteContainer {
yesVotesCount,
votedStakeAmount,
votedYeaStakeAmount,
- totalVotedStakeAmount,
+ totalStakeAmount,
votedPercent,
progressList: PROGRESS,
};
diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx
index 9bc5d35..8f53364 100644
--- a/src/pages/details/index.tsx
+++ b/src/pages/details/index.tsx
@@ -33,7 +33,7 @@ interface VotingPowerItem {
export default function Details() {
const navigate = useNavigate();
- const { isLoading: voteDataLoading, votes, totalVotedStakeAmount } = VoteContainer.useContainer();
+ const { isLoading: voteDataLoading, votes, totalStakeAmount } = VoteContainer.useContainer();
const [loading, setLoading] = useState(false);
const [list, setList] = useState([]);
const [powerOrder, setPowerOrder] = useState<'asc' | 'desc' | undefined>();
@@ -81,11 +81,11 @@ export default function Details() {
const getPercent = useCallback(
(n: string | number) => {
- if (!totalVotedStakeAmount || !n) return '0';
- if (Big(totalVotedStakeAmount).eq(0)) return '0';
- return Big(n).div(totalVotedStakeAmount).times(100).toFixed(2);
+ if (!totalStakeAmount || !n) return '0';
+ if (Big(totalStakeAmount).eq(0)) return '0';
+ return Big(n).div(totalStakeAmount).times(100).toFixed(2);
},
- [totalVotedStakeAmount],
+ [totalStakeAmount],
);
const votingPowerMap: Record = useMemo(() => {
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 2514aea..b53977a 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -26,8 +26,15 @@ dayjs.extend(utc);
export default function Home() {
const navigate = useNavigate();
- const { isLoading, deadline, votes, voteResult, yesVotesCount, votedPercent, votedYeaStakeAmount } =
- VoteContainer.useContainer();
+ const {
+ isLoading,
+ deadline,
+ votes,
+ voteResult,
+ yesVotesCount,
+ votedPercent,
+ votedYeaStakeAmount,
+ } = VoteContainer.useContainer();
const NEAR_ENV = config.proposalContractId?.split('.').pop() === 'near' ? 'mainnet' : 'testnet';
@@ -53,7 +60,6 @@ export default function Home() {
const currentProgressPercent = passed
? 100
: Math.round((votedPercentNum / targetPercent) * 100);
- // const totalProgressPercentText = passed ? votedPercentNum : targetPercent;
const targetBadge = (
- {/*
@@ -145,14 +148,14 @@ export default function Home() {
{} as Record<'yes' | 'no', Big.Big>,
);
- const safeBig = (val: Big.Big | undefined): Big => val instanceof Big ? val : Big(val || 0);
+ const safeBig = (val: Big.Big | undefined): Big => (val instanceof Big ? val : Big(val || 0));
const yes = safeBig(voteData?.yes);
const no = safeBig(voteData?.no);
const voteTotal = yes.plus(no);
- const yesPercent = voteTotal.eq(0) ? "0.00" : yes.div(voteTotal).times(100).toFixed(2);
- const noPercent = voteTotal.eq(0) ? "0.00" : no.div(voteTotal).times(100).toFixed(2);
+ const yesPercent = voteTotal.eq(0) ? '0.00' : yes.div(voteTotal).times(100).toFixed(2);
+ const noPercent = voteTotal.eq(0) ? '0.00' : no.div(voteTotal).times(100).toFixed(2);
return (
From f3053a295036a35233309175968ec1bfb47e38e0 Mon Sep 17 00:00:00 2001
From: jin <57248516+chickick@users.noreply.github.com>
Date: Fri, 25 Jul 2025 16:53:51 +0800
Subject: [PATCH 18/23] chore: optimize codes
---
src/pages/details/index.tsx | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/src/pages/details/index.tsx b/src/pages/details/index.tsx
index 8f53364..fcac50c 100644
--- a/src/pages/details/index.tsx
+++ b/src/pages/details/index.tsx
@@ -46,18 +46,8 @@ export default function Details() {
// });
return list.sort((a, b) => {
- const aVote =
- a.vote === 'yes'
- ? votes[a.accountId]
- ? votes[a.accountId][1]
- : '0'
- : a.totalStakedBalance;
- const bVote =
- b.vote === 'yes'
- ? votes[b.accountId]
- ? votes[b.accountId][1]
- : '0'
- : b.totalStakedBalance;
+ const aVote = votes[a.accountId] ? votes[a.accountId][1] : '0';
+ const bVote = votes[b.accountId] ? votes[b.accountId][1] : '0';
const aDate = a.lastVoteTimestamp || 0;
const bDate = b.lastVoteTimestamp || 0;
@@ -92,11 +82,7 @@ export default function Details() {
const data: Record
= {};
tableList.forEach((item) => {
const isYesVote = item.vote === 'yes';
- let power = votes[item.accountId] ? votes[item.accountId][1] : '0';
- if (!isYesVote) {
- power = item.totalStakedBalance || '0';
- }
-
+ const power = votes[item.accountId] ? votes[item.accountId][1] : '0';
const formattedPower = power ? formatBigNumber(power, 24) : '0';
const percent = getPercent(power);
From d6f1755fdfcb57f33a17a39d5e8aea0aa0333db2 Mon Sep 17 00:00:00 2001
From: jin <57248516+chickick@users.noreply.github.com>
Date: Fri, 25 Jul 2025 18:12:20 +0800
Subject: [PATCH 19/23] chore: modify the number of decimal places
---
src/containers/vote/index.ts | 2 +-
src/pages/home/index.tsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/containers/vote/index.ts b/src/containers/vote/index.ts
index 7d9c64f..a1ce8ac 100644
--- a/src/containers/vote/index.ts
+++ b/src/containers/vote/index.ts
@@ -24,7 +24,7 @@ interface VoteComputed {
progressList: number[];
}
-const PROGRESS = [33.3];
+const PROGRESS = [33.33];
type UseVoteContainer = VoteState & VoteComputed;
const contractId = config.proposalContractId;
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index b53977a..813f659 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -54,7 +54,7 @@ export default function Home() {
const renderProgress = () => {
const votedPercentNum = Number(votedPercent);
- const targetPercent = 33.3;
+ const targetPercent = 33.33;
const passed = votedPercentNum >= targetPercent;
const currentProgressPercent = passed
From 22ffbee16aa7beafcf0c4dfaa3c4ca2e7836b59d Mon Sep 17 00:00:00 2001
From: jinmax2024 <57248516+chickick@users.noreply.github.com>
Date: Fri, 25 Jul 2025 18:14:52 +0800
Subject: [PATCH 20/23] chore: update testnet contract
---
src/config/testnet.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/config/testnet.ts b/src/config/testnet.ts
index 92a9f67..84574b1 100644
--- a/src/config/testnet.ts
+++ b/src/config/testnet.ts
@@ -1,5 +1,5 @@
const config: App.AppConfig = {
- proposalContractId: 'mock-proposal-delta.testnet',
+ proposalContractId: 'mock-proposal-alpha.testnet',
validatorApi: 'https://validator-voting-api.linearprotocol.org',
near: {
network: {
From 605d64e07793cfd346b9416e28abc3b1f7b25b03 Mon Sep 17 00:00:00 2001
From: Linguists <95207870+linguists@users.noreply.github.com>
Date: Fri, 25 Jul 2025 18:31:19 +0800
Subject: [PATCH 21/23] Update src/pages/home/index.tsx
---
src/pages/home/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 813f659..a8d39e9 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -258,7 +258,7 @@ export default function Home() {
'Instructions for Validator Voting:\n' +
'- If you are a validator, please use the CLI commands shown below to vote. We do not support voting through wallet for security considerations. This page is only used to display voting results.\n' +
`- You can vote **yes** or **no** for the proposal. You can change your vote before the deadline (**${dayjs.utc(deadline).format('MM/DD/YYYY HH:mm:ss')} UTC**).\n` +
- '- This proposal will be approved when more than **1/3 of total stake** joins the voting and more than **2/3 of stake participating in the voting** is **yes**.\n' +
+ '- This proposal will be approved if more than **1/3 of total stake** joins the voting and more than **2/3 of stake participating in the voting** is **yes** when the deadline is reached.\n' +
'- Replace **<validator-account-id>** and **<validator-owner-id>** in the commands below with your own account IDs.\n' +
"- [The indexer](https://thegraph.com/explorer/subgraphs/3EbPN5sxnMtSof4M8LuaSKLcNzvzDLrY3eyrRKBhVGaK?view=Query&chain=arbitrum-one) that tracks the voting results may have several minutes delay. If you don't see your vote in the details page, please refresh the page after a while.\n" +
'\n' +
From 566c3a7a39ed28393bd6d8744efc4ae2e300947a Mon Sep 17 00:00:00 2001
From: jin <57248516+chickick@users.noreply.github.com>
Date: Wed, 30 Jul 2025 13:22:51 +0800
Subject: [PATCH 22/23] feat: Modify progress bar
---
src/pages/home/index.tsx | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 813f659..b0501a8 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -55,11 +55,11 @@ export default function Home() {
const renderProgress = () => {
const votedPercentNum = Number(votedPercent);
const targetPercent = 33.33;
- const passed = votedPercentNum >= targetPercent;
-
- const currentProgressPercent = passed
+ const gt50Percent = votedPercentNum >= 50;
+ const totalPercent = gt50Percent ? votedPercentNum : 50;
+ const currentProgressPercent = gt50Percent
? 100
- : Math.round((votedPercentNum / targetPercent) * 100);
+ : Math.round((votedPercentNum / totalPercent) * 100);
const targetBadge = (
0%
- {passed ? (
- <>
-
- {targetPercent}%{targetBadge}
-
-
- >
- ) : (
-
- {targetPercent}%{targetBadge}
-
- )}
+
+ {targetPercent}%{targetBadge}
+
+
+
+ {!gt50Percent && 50%
}
);
From ec17c8647d9c20d0c7a52f93430174d28dbb6d74 Mon Sep 17 00:00:00 2001
From: jinmax2024 <57248516+chickick@users.noreply.github.com>
Date: Wed, 30 Jul 2025 13:58:02 +0800
Subject: [PATCH 23/23] chore: update text copy
---
src/pages/home/index.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 5d7d5f4..60e6bc6 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -67,7 +67,7 @@ export default function Home() {
'absolute flex items-center justify-center text-white w-[68px] h-[30px] left-1/2 -top-[70px] text-sm bg-app-black rounded-full -translate-x-1/2',
)}
>
- Target
+ Quorum