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",
|
"name": "ghost-dao-interface",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.5.29",
|
"version": "0.5.30",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@ -96,6 +96,7 @@ export const useMinQuorum = (chainId) => {
|
|||||||
|
|
||||||
export const useProposalThreshold = (chainId, name) => {
|
export const useProposalThreshold = (chainId, name) => {
|
||||||
const decimals = getTokenDecimals(name);
|
const decimals = getTokenDecimals(name);
|
||||||
|
const { proposalCount } = useProposalCount(chainId);
|
||||||
|
|
||||||
const { data } = useReadContract({
|
const { data } = useReadContract({
|
||||||
abi: GovernorStorageAbi,
|
abi: GovernorStorageAbi,
|
||||||
@ -113,18 +114,18 @@ export const useProposalThreshold = (chainId, name) => {
|
|||||||
chainId: chainId,
|
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);
|
let threshold = new DecimalBigNumber(data ?? 0n, decimals);
|
||||||
|
|
||||||
const { proposalCount } = useProposalCount(chainId);
|
if (proposalCount !== 0n && state !== undefined && state < 2) {
|
||||||
|
threshold = new DecimalBigNumber(activeProposedLock ?? 0n, decimals);
|
||||||
if (proposalCount !== 0n) {
|
|
||||||
const lastIndex = proposalCount === 0n ? 0n : proposalCount - 1n
|
|
||||||
const { proposalId } = useProposalDetailsAt(chainId, lastIndex);
|
|
||||||
const { state } = useProposalState(chainId, proposalId);
|
|
||||||
|
|
||||||
if (state < 2) {
|
|
||||||
threshold = new DecimalBigNumber(activeProposedLock ?? 0n, decimals);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return { threshold };
|
return { threshold };
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user