Dissolve when all leases passed only (#4965)

This commit is contained in:
Jaco Greeff 2021-03-29 09:54:57 +03:00 committed by GitHub
parent 6894b2a183
commit e7b7c2a980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View File

@ -3,7 +3,7 @@
import type BN from 'bn.js';
import type { EventRecord, ParaId } from '@polkadot/types/interfaces';
import type { Campaign } from '../types';
import type { Campaign, LeasePeriod } from '../types';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
@ -20,6 +20,7 @@ interface Props {
bestNumber?: BN;
className?: string;
isOngoing?: boolean;
leasePeriod?: LeasePeriod;
value: Campaign;
}
@ -28,7 +29,7 @@ interface Contributions {
myAccounts?: string[];
}
function Fund ({ bestNumber, className, isOngoing, value: { childKey, info: { cap, depositor, end, firstSlot, lastSlot, raised, retiring }, isCapped, isEnded, isRetired, isWinner, paraId, retireEnd } }: Props): React.ReactElement<Props> {
function Fund ({ bestNumber, className, isOngoing, leasePeriod, value: { childKey, info: { cap, depositor, end, firstSlot, lastSlot, raised, retiring }, isCapped, isEnded, isRetired, isWinner, paraId, retireEnd } }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { api } = useApi();
const { allAccounts } = useAccounts();
@ -87,7 +88,7 @@ function Fund ({ bestNumber, className, isOngoing, value: { childKey, info: { ca
);
const canContribute = isOngoing && blocksLeft && !isCapped && !isWinner && retiring.isFalse;
const canDissolve = raised.isZero() || isRetired;
const canDissolve = raised.isZero() || (isRetired && (!isWinner || !leasePeriod || lastSlot.lt(leasePeriod.currentPeriod)));
return (
<tr className={className}>

View File

@ -87,6 +87,7 @@ function Funds ({ bestNumber, className, leasePeriod, value }: Props): React.Rea
<Fund
bestNumber={bestNumber}
key={fund.accountId}
leasePeriod={leasePeriod}
value={fund}
/>
))}