From 035e85fb50eb75183bd2799de6cba1eb66033f51 Mon Sep 17 00:00:00 2001 From: uncoolzero <107518216+uncoolzero@users.noreply.github.com> Date: Thu, 23 May 2024 10:46:02 -0300 Subject: [PATCH 1/2] germinating transfer error message --- .../ui/src/components/Silo/Actions/Transfer.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/projects/ui/src/components/Silo/Actions/Transfer.tsx b/projects/ui/src/components/Silo/Actions/Transfer.tsx index 45170f97aa..9389bb9515 100644 --- a/projects/ui/src/components/Silo/Actions/Transfer.tsx +++ b/projects/ui/src/components/Silo/Actions/Transfer.tsx @@ -513,7 +513,19 @@ const TransferPropProvider: FC<{ formActions.resetForm(); } catch (err) { if (txToast) { - txToast.error(err); + if (err instanceof Error) { + if (err.message.includes('SafeMath: subtraction overflow')) { + txToast.error({ + code: 'CALL_EXCEPTION', + message: + 'Germinating Bean Deposits currently cannot be Transferred. A fix is being implemented. In the meantime, you can Transfer in 2 Seasons once your Bean Deposits are no longer Germinating. See Discord for details.', + }); + } else { + txToast.error(err); + } + } else { + txToast.error(err); + } } else { const toast = new TransactionToast({}); toast.error(err); From 25440b4afd988f08feae2cb366faa1eef82f5b19 Mon Sep 17 00:00:00 2001 From: uncoolzero <107518216+uncoolzero@users.noreply.github.com> Date: Thu, 23 May 2024 11:00:22 -0300 Subject: [PATCH 2/2] use only non-germinating deposits for transfer --- .../ui/src/components/Silo/Actions/Transfer.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/ui/src/components/Silo/Actions/Transfer.tsx b/projects/ui/src/components/Silo/Actions/Transfer.tsx index 9389bb9515..a785aebadc 100644 --- a/projects/ui/src/components/Silo/Actions/Transfer.tsx +++ b/projects/ui/src/components/Silo/Actions/Transfer.tsx @@ -123,7 +123,8 @@ const TransferForm: FC< // Results const withdrawResult = useMemo(() => { const amount = BEAN.amount(values.tokens[0].amount?.toString() || '0'); - const deposits = siloBalance?.deposits || []; + // FIXME: Restore geminating deposits + const deposits = siloBalance?.convertibleDeposits || []; if (!isUsingPlant && (amount.lte(0) || !deposits.length)) return null; if (isUsingPlant && plantAndDoX?.getAmount().lte(0)) return null; @@ -142,7 +143,7 @@ const TransferForm: FC< plantAndDoX, sdk.silo.siloWithdraw, season, - siloBalance?.deposits, + siloBalance?.convertibleDeposits, values.tokens, whitelistedToken, ]); @@ -153,7 +154,8 @@ const TransferForm: FC< ); // derived - const depositedBalance = siloBalance?.amount; + //const depositedBalance = siloBalance?.amount; + const depositedBalance = siloBalance?.convertibleDeposits.reduce((total: TokenValue, deposit) => deposit.amount.add(total), TokenValue.ZERO); const isReady = withdrawResult && !withdrawResult.amount.lt(0); // Input props @@ -443,7 +445,7 @@ const TransferPropProvider: FC<{ throw new Error('Please enter a valid recipient address.'); } - if (!siloBalance?.deposits) { + if (!siloBalance?.convertibleDeposits) { throw new Error('No balances found'); } @@ -467,7 +469,7 @@ const TransferPropProvider: FC<{ if (totalAmount.lte(0)) throw new Error('Invalid amount.'); const transferTxn = new TransferFarmStep(sdk, token, account, [ - ...siloBalance.deposits, + ...siloBalance.convertibleDeposits, ]); transferTxn.build( @@ -536,7 +538,7 @@ const TransferPropProvider: FC<{ [ middleware, account, - siloBalance?.deposits, + siloBalance?.convertibleDeposits, token, sdk, season,