Skip to content

Remove fund restriction #3616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
178 changes: 78 additions & 100 deletions packages/round-manager/src/features/round/FundContract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -461,119 +461,97 @@ export default function FundContract(props: {
<p className="text-sm">{props.round.roundFeePercentage ?? 0}%</p>
</div>
<hr className="mt-6 mb-6" />
{!props.round.payoutStrategy.isReadyForPayout ? (
<>
<div className="flex flex-row justify-start mt-6">
<p className="text-sm w-1/3">Amount funded:</p>
<p className="text-sm">
{amountFundedInUnits} {matchingFundPayoutToken?.code}{" "}
{tokenBalanceInUSD && Number(tokenBalanceInUSD) > 0 ? (
<span className="text-sm text-slate-400 ml-2">
${tokenBalanceInUSD.toFixed(2)} USD
</span>
) : null}
</p>
</div>
<div className="flex flex-row justify-start mt-6">
<p className="text-sm w-1/3">Amount left to fund:</p>
<p className="text-sm">
{" "}
{totalAmountLeftToFund
?.toLocaleString(undefined, {
minimumFractionDigits: 5,
})
.replace(/\.?0+$/, "")}{" "}
{matchingFundPayoutToken?.code}{" "}
{amountLeftToFundInUSD !== undefined &&
amountLeftToFundInUSD > 0 ? (
<span className="text-sm text-slate-400 ml-2">
${amountLeftToFundInUSD.toFixed(2)} USD
</span>
) : null}
</p>
</div>
<div className="flex flex-row justify-start mt-6">
<p className="text-sm w-1/3 py-3">Amount to fund:</p>
{/* todo: update input with a max selector at right of input */}
<input
disabled={fundContractDisabled}
className="border border-gray-300 rounded-md p-2 w-1/2"
placeholder={`${
fundContractDisabled
? "Contract is fully funded"
: "Enter the amount you wish to fund"
}`}
value={amountToFund}
onChange={(e) => setAmountToFund(e.target.value)}
/>
</div>
<div className="flex flex-row justify-start mt-6">
<button
disabled={fundContractDisabled}
className={classNames(
`bg-violet-400 hover:bg-violet-700 text-white py-2 px-4 rounded ${
fundContractDisabled
? "cursor-not-allowed"
: "cursor-pointer"
}`
)}
data-testid="fund-contract-btn"
onClick={() => handleFundContract()}
>
Fund Contract
</button>
{props.round.tags?.includes("allo-v1") && (
<button
className="bg-white hover:text-violet-700 hover:border-violet-700 text-gray py-2 px-4 rounded border border-gray ml-4"
data-testid="view-contract-btn"
onClick={() =>
window.open(
getTxExplorerForContract(
chainId!,
props.roundId as string
),
"_blank"
)
}
>
View Contract
</button>
)}
</div>
{insufficientBalance && (
<div
data-testid="insufficientBalance"
className="rounded-md bg-red-50 py-2 text-pink-500 flex justify-center my-4 text-sm"
>
<InformationCircleIcon className="w-4 h-4 mr-1 mt-0.5" />
<span>
You do not have enough funds for funding the matching pool.
<>
<div className="flex flex-row justify-start mt-6">
<p className="text-sm w-1/3">Amount funded:</p>
<p className="text-sm">
{amountFundedInUnits} {matchingFundPayoutToken?.code}{" "}
{tokenBalanceInUSD && Number(tokenBalanceInUSD) > 0 ? (
<span className="text-sm text-slate-400 ml-2">
${tokenBalanceInUSD.toFixed(2)} USD
</span>
</div>
)}
<FundContractModals />
</>
) : (
<div>
<p className="text-sm text-grey-400 mb-4">
) : null}
</p>
</div>
<div className="flex flex-row justify-start mt-6">
<p className="text-sm w-1/3">Amount left to fund:</p>
<p className="text-sm">
{" "}
Round has been finalized and funds have been moved to the payout
contract.
{totalAmountLeftToFund
?.toLocaleString(undefined, {
minimumFractionDigits: 5,
})
.replace(/\.?0+$/, "")}{" "}
{matchingFundPayoutToken?.code}{" "}
{amountLeftToFundInUSD !== undefined &&
amountLeftToFundInUSD > 0 ? (
<span className="text-sm text-slate-400 ml-2">
${amountLeftToFundInUSD.toFixed(2)} USD
</span>
) : null}
</p>
</div>
<div className="flex flex-row justify-start mt-6">
<p className="text-sm w-1/3 py-3">Amount to fund:</p>
{/* todo: update input with a max selector at right of input */}
<input
disabled={fundContractDisabled}
className="border border-gray-300 rounded-md p-2 w-1/2"
placeholder={`${
fundContractDisabled
? "Contract is fully funded"
: "Enter the amount you wish to fund"
}`}
value={amountToFund}
onChange={(e) => setAmountToFund(e.target.value)}
/>
</div>
<div className="flex flex-row justify-start mt-6">
<button
disabled={fundContractDisabled}
className={classNames(
`${
fundContractDisabled ? "bg-violet-400" : "bg-violet-200"
} text-white py-2 px-4 rounded`
`bg-violet-400 hover:bg-violet-700 text-white py-2 px-4 rounded ${
fundContractDisabled
? "cursor-not-allowed"
: "cursor-pointer"
}`
)}
data-testid="fund-contract-btn"
onClick={() => handleFundContract()}
>
Fund Contract
</button>
{props.round.tags?.includes("allo-v1") && (
<button
className="bg-white hover:text-violet-700 hover:border-violet-700 text-gray py-2 px-4 rounded border border-gray ml-4"
data-testid="view-contract-btn"
onClick={() =>
window.open(
getTxExplorerForContract(
chainId!,
props.roundId as string
),
"_blank"
)
}
>
View Contract
</button>
)}
</div>
)}
{insufficientBalance && (
<div
data-testid="insufficientBalance"
className="rounded-md bg-red-50 py-2 text-pink-500 flex justify-center my-4 text-sm"
>
<InformationCircleIcon className="w-4 h-4 mr-1 mt-0.5" />
<span>
You do not have enough funds for funding the matching pool.
</span>
</div>
)}
<FundContractModals />
</>
</div>
</div>
);
Expand Down
Loading