From fc95b16ebaad0f99ae661f63f048bf447af8d30b Mon Sep 17 00:00:00 2001 From: kkatusic Date: Tue, 21 Jan 2025 11:42:01 +0100 Subject: [PATCH 1/6] fixing 8 decimals --- .../donate/Recurring/ModifySuperToken/DepositSuperToken.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx b/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx index 07a26d23a9..c54e796dc5 100644 --- a/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx +++ b/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx @@ -135,7 +135,7 @@ export const DepositSuperToken: FC = ({ } else { superTokenAsset = await sf.loadWrapperSuperToken(superToken.id); } - if (token && token.decimals === 6) { + if (token && (token.decimals === 6 || token.decimals === 8)) { const divisor = BigInt(10 ** token.decimals); const currentAmount = Number(amount) / Number(divisor); newAmount = ethers.utils From 318d2c79a159b0a0baa977bb12a240797d41e481 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Tue, 21 Jan 2025 11:54:03 +0100 Subject: [PATCH 2/6] fixing 8 decimals deposit --- .../donate/Recurring/ModifySuperToken/DepositSuperToken.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx b/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx index c54e796dc5..e6e1b13646 100644 --- a/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx +++ b/src/components/views/donate/Recurring/ModifySuperToken/DepositSuperToken.tsx @@ -139,7 +139,7 @@ export const DepositSuperToken: FC = ({ const divisor = BigInt(10 ** token.decimals); const currentAmount = Number(amount) / Number(divisor); newAmount = ethers.utils - .parseUnits(currentAmount.toString(), 18) + .parseUnits(currentAmount.toFixed(8), 18) .toBigInt(); } const upgradeOperation = await superTokenAsset.upgrade({ From 4b02a86c38c7150c40ee33844987f649c1db60d0 Mon Sep 17 00:00:00 2001 From: Moe Shehab <52987806+mhmdksh@users.noreply.github.com> Date: Tue, 21 Jan 2025 18:16:15 +0400 Subject: [PATCH 3/6] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 5ba0e3cc89..c5d43391ad 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # The Giveth DApp - ### Build status: - Develop - [![build-develop](https://github.com/Giveth/giveth-dapps-v2/actions/workflows/Build.yml/badge.svg?branch=develop)](https://github.com/Giveth/giveth-dapps-v2/actions/workflows/Build.yml) - Main - [![build-main](https://github.com/Giveth/giveth-dapps-v2/actions/workflows/Build.yml/badge.svg?branch=main)](https://github.com/Giveth/giveth-dapps-v2/actions/workflows/Build.yml) From 4e48fde864c47ad76973c346b52bb2cb7f414875 Mon Sep 17 00:00:00 2001 From: Moe Shehab <52987806+mhmdksh@users.noreply.github.com> Date: Tue, 21 Jan 2025 18:58:42 +0400 Subject: [PATCH 4/6] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c5d43391ad..5ba0e3cc89 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # The Giveth DApp + ### Build status: - Develop - [![build-develop](https://github.com/Giveth/giveth-dapps-v2/actions/workflows/Build.yml/badge.svg?branch=develop)](https://github.com/Giveth/giveth-dapps-v2/actions/workflows/Build.yml) - Main - [![build-main](https://github.com/Giveth/giveth-dapps-v2/actions/workflows/Build.yml/badge.svg?branch=main)](https://github.com/Giveth/giveth-dapps-v2/actions/workflows/Build.yml) From d26bf42b07848128e3eb6ada5db3d5841604a0c9 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Thu, 23 Jan 2025 13:29:12 +0100 Subject: [PATCH 5/6] Fix/cbBTC values --- src/components/AmountInput/AmountInput.tsx | 4 ++-- .../Recurring/RecurringDonationCard.tsx | 24 ++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/AmountInput/AmountInput.tsx b/src/components/AmountInput/AmountInput.tsx index 32fa1f7b7e..8a7d3c05e1 100644 --- a/src/components/AmountInput/AmountInput.tsx +++ b/src/components/AmountInput/AmountInput.tsx @@ -52,7 +52,7 @@ export const AmountInput: FC = ({ const isZero = regex.test(displayAmount); if (amount === 0n && isZero) return; - const maxDecimals = decimals === 8 ? 8 : decimals / 3; + const maxDecimals = decimals === 8 ? 6 : decimals / 3; const _displayAmount = truncateToDecimalPlaces( formatUnits(amount, decimals), @@ -80,7 +80,7 @@ export const AmountInput: FC = ({ // Allow more decimals if token has 8 decimals if (decimals === 8) { - if (_decimals?.length > 8) return; // Limit to 8 decimals + if (_decimals?.length > 6) return; // Limit to 8 decimals } else { if (_decimals?.length > decimals / 3) return; // Limit to 6 or 2 decimals for other tokens } diff --git a/src/components/views/donate/Recurring/RecurringDonationCard.tsx b/src/components/views/donate/Recurring/RecurringDonationCard.tsx index aae0670c0c..bae140a0f4 100644 --- a/src/components/views/donate/Recurring/RecurringDonationCard.tsx +++ b/src/components/views/donate/Recurring/RecurringDonationCard.tsx @@ -157,7 +157,7 @@ export const RecurringDonationCard = () => { selectedRecurringToken?.token.decimals === 6 ? 10000n : selectedRecurringToken?.token.decimals === 8 - ? 100n + ? 1000000n : 1n; // total means project + giveth @@ -360,13 +360,21 @@ export const RecurringDonationCard = () => { id: 'label.available', })} :{' '} - {truncateToDecimalPlaces( - formatUnits( - balance.value, - balance.decimals, - ), - balance.decimals / 3, - )} + {balance.decimals === 8 + ? truncateToDecimalPlaces( + formatUnits( + balance.value, + balance.decimals, + ), + 18 / 3, + ) + : truncateToDecimalPlaces( + formatUnits( + balance.value, + balance.decimals, + ), + balance.decimals / 3, + )} !isRefetching && refetch()} From 5040e3dc251dc544ba0a6faafa1970c0fb9e2234 Mon Sep 17 00:00:00 2001 From: kkatusic Date: Fri, 24 Jan 2025 13:32:24 +0100 Subject: [PATCH 6/6] fixing ending recurring donation --- .../donationsTab/recurringTab/EndStreamModal.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/views/userProfile/donationsTab/recurringTab/EndStreamModal.tsx b/src/components/views/userProfile/donationsTab/recurringTab/EndStreamModal.tsx index e2f86d091e..5cd6dcb96d 100644 --- a/src/components/views/userProfile/donationsTab/recurringTab/EndStreamModal.tsx +++ b/src/components/views/userProfile/donationsTab/recurringTab/EndStreamModal.tsx @@ -117,9 +117,13 @@ const EndStreamInnerModal: FC = ({ superToken = await sf.loadWrapperSuperToken(_superToken.id); } + const matchingContract = donation.project.anchorContracts.find( + contract => contract.networkId === recurringNetworkId, + ); + const deleteOp = superToken.deleteFlow({ sender: address, - receiver: donation.project.anchorContracts[0].address, + receiver: matchingContract?.address || '', }); const tx = await deleteOp.exec(signer);