Skip to content

Commit

Permalink
Merge branch 'master' into subgraph-beanstalk2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
soilking authored May 23, 2024
2 parents be2ac63 + 016cff5 commit 84ccd4c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions projects/ui/src/components/Silo/Actions/Withdraw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import TxnAccordion from '~/components/Common/TxnAccordion';
import useAccount from '~/hooks/ledger/useAccount';
import AdditionalTxnsAccordion from '~/components/Common/Form/FormTxn/AdditionalTxnsAccordion';
import useFarmerFormTxnsActions from '~/hooks/farmer/form-txn/useFarmerFormTxnActions';
import AddPlantTxnToggle from '~/components/Common/Form/FormTxn/AddPlantTxnToggle';
// import AddPlantTxnToggle from '~/components/Common/Form/FormTxn/AddPlantTxnToggle';
import FormTxnProvider from '~/components/Common/Form/FormTxnProvider';
import useFormTxnContext from '~/hooks/sdk/useFormTxnContext';
import { FormTxn, PlantAndDoX, WithdrawFarmStep } from '~/lib/Txn';
Expand Down Expand Up @@ -179,7 +179,8 @@ const WithdrawForm: FC<
const amount = sdk.tokens.BEAN.amount(
values.tokens[0]?.amount?.toString() || '0'
);
const crates = siloBalance?.deposits || [];
// FIXME: Restore geminating deposits
const crates = siloBalance?.convertibleDeposits || [];

if (!isUsingPlant && (amount.lte(0) || !crates.length)) return null;
if (isUsingPlant && plantAndDoX?.getAmount().lte(0)) return null;
Expand All @@ -198,7 +199,7 @@ const WithdrawForm: FC<
plantAndDoX,
sdk.silo.siloWithdraw,
season,
siloBalance?.deposits,
siloBalance?.convertibleDeposits,
values.tokens,
whitelistedToken,
]);
Expand Down Expand Up @@ -282,7 +283,9 @@ const WithdrawForm: FC<
/>
</>
</Stack>
<AddPlantTxnToggle plantAndDoX={plantAndDoX} actionText="Withdraw" />
{/*
<AddPlantTxnToggle plantAndDoX={plantAndDoX} actionText='Withdraw'/>
*/}
{isReady ? (
<Stack direction="column" gap={1}>
<TxnSeparator />
Expand Down Expand Up @@ -435,7 +438,7 @@ const WithdrawPropProvider: FC<{
try {
middleware.before();
if (!account) throw new Error('Missing signer');
if (!siloBalance?.deposits) {
if (!siloBalance?.convertibleDeposits) {
throw new Error('No balances found');
}

Expand Down Expand Up @@ -472,7 +475,8 @@ const WithdrawPropProvider: FC<{
}

const withdrawTxn = new WithdrawFarmStep(sdk, token, [
...siloBalance.deposits,
// FIXME: Restore geminating deposits
...siloBalance.convertibleDeposits,
]);

withdrawTxn.build(
Expand Down Expand Up @@ -541,7 +545,7 @@ const WithdrawPropProvider: FC<{
middleware,
txnBundler,
plantAndDoX,
siloBalance?.deposits,
siloBalance?.convertibleDeposits,
refetch,
refetchSilo,
]
Expand Down

0 comments on commit 84ccd4c

Please sign in to comment.