fix for the min collateral needed
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
e05fc99296
commit
7733a6cd3b
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ghost-dao-interface",
|
||||
"private": true,
|
||||
"version": "0.5.29",
|
||||
"version": "0.5.30",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@ -96,6 +96,7 @@ export const useMinQuorum = (chainId) => {
|
||||
|
||||
export const useProposalThreshold = (chainId, name) => {
|
||||
const decimals = getTokenDecimals(name);
|
||||
const { proposalCount } = useProposalCount(chainId);
|
||||
|
||||
const { data } = useReadContract({
|
||||
abi: GovernorStorageAbi,
|
||||
@ -113,19 +114,19 @@ export const useProposalThreshold = (chainId, name) => {
|
||||
chainId: chainId,
|
||||
});
|
||||
|
||||
const lastIndex = proposalCount === 0n ? 0n : proposalCount - 1n;
|
||||
const { proposalId } = useProposalDetailsAt(chainId, lastIndex, {
|
||||
enabled: proposalCount !== 0n
|
||||
});
|
||||
const { state } = useProposalState(chainId, proposalId, {
|
||||
enabled: proposalCount !== 0n && !!proposalId
|
||||
});
|
||||
|
||||
let threshold = new DecimalBigNumber(data ?? 0n, decimals);
|
||||
|
||||
const { proposalCount } = useProposalCount(chainId);
|
||||
|
||||
if (proposalCount !== 0n) {
|
||||
const lastIndex = proposalCount === 0n ? 0n : proposalCount - 1n
|
||||
const { proposalId } = useProposalDetailsAt(chainId, lastIndex);
|
||||
const { state } = useProposalState(chainId, proposalId);
|
||||
|
||||
if (state < 2) {
|
||||
if (proposalCount !== 0n && state !== undefined && state < 2) {
|
||||
threshold = new DecimalBigNumber(activeProposedLock ?? 0n, decimals);
|
||||
}
|
||||
}
|
||||
|
||||
return { threshold };
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user