From a9f93b5f3293f08331ced8fdfd6c8fefe1099c59 Mon Sep 17 00:00:00 2001 From: arthurgousset <46296830+arthurgousset@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:23:21 +0000 Subject: [PATCH 1/3] chore(database-helper): fixes fadeOutAmount bug when sending CELO --- apps/firebase/src/database-helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/firebase/src/database-helper.ts b/apps/firebase/src/database-helper.ts index deebcdbfd..8abb84339 100644 --- a/apps/firebase/src/database-helper.ts +++ b/apps/firebase/src/database-helper.ts @@ -243,7 +243,7 @@ async function sendGold( await snap.ref.update({ goldTxHash: 'skipped' }) return 'skipped' } - const goldTxHash = await sendCelo(celo, address, amount) + const goldTxHash = await sendCelo(celo, address, actualAmount.toFixed()) console.info(`req(${snap.key}): CELO Transaction Sent. txhash:${goldTxHash}`) await snap.ref.update({ goldTxHash }) return goldTxHash From b0583472b80836ea266ce0ea45ab2fc3ce88f5be Mon Sep 17 00:00:00 2001 From: arthurgousset <46296830+arthurgousset@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:24:03 +0000 Subject: [PATCH 2/3] nit(celo-adapter): fix typo in WEI --- apps/firebase/src/celo-adapter.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/firebase/src/celo-adapter.ts b/apps/firebase/src/celo-adapter.ts index 491f09152..fac1d30f0 100644 --- a/apps/firebase/src/celo-adapter.ts +++ b/apps/firebase/src/celo-adapter.ts @@ -288,19 +288,19 @@ export class CeloAdapter { return nextAmount } else if ( recipientBalance.isGreaterThan( - HUNDRED_IN_WIE.multipliedBy(75).dividedBy(100), + HUNDRED_IN_WEI.multipliedBy(75).dividedBy(100), ) ) { return new BigNumber(0) } else if ( recipientBalance.isGreaterThan( - HUNDRED_IN_WIE.multipliedBy(50).dividedBy(100), + HUNDRED_IN_WEI.multipliedBy(50).dividedBy(100), ) ) { return nextAmount.dividedBy(4) } else if ( recipientBalance.isGreaterThan( - HUNDRED_IN_WIE.multipliedBy(25).dividedBy(100), + HUNDRED_IN_WEI.multipliedBy(25).dividedBy(100), ) ) { return nextAmount.dividedBy(2) @@ -310,4 +310,4 @@ export class CeloAdapter { } } -const HUNDRED_IN_WIE = new BigNumber('100000000000000000000') +const HUNDRED_IN_WEI = new BigNumber('100000000000000000000') From 988394bad9b865cc8eff8e29b175803b23e3560f Mon Sep 17 00:00:00 2001 From: arthurgousset <46296830+arthurgousset@users.noreply.github.com> Date: Fri, 29 Mar 2024 13:32:40 +0000 Subject: [PATCH 3/3] chore(fadeOutAmount): update limits and leave TODO - No CELO if >20 CELO --- apps/firebase/src/celo-adapter.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/firebase/src/celo-adapter.ts b/apps/firebase/src/celo-adapter.ts index fac1d30f0..c6ac2fd0a 100644 --- a/apps/firebase/src/celo-adapter.ts +++ b/apps/firebase/src/celo-adapter.ts @@ -284,23 +284,26 @@ export class CeloAdapter { ) { const nextAmount = new BigNumber(amount) + // TODO(Arthur): + // Replace `HUNDRED_IN_WEI` with Web3.utils.toWei('20') + // Use a sliding scale instead of if-else statements if (useGivenAmount) { return nextAmount } else if ( recipientBalance.isGreaterThan( - HUNDRED_IN_WEI.multipliedBy(75).dividedBy(100), + HUNDRED_IN_WEI.multipliedBy(20).dividedBy(100), ) ) { return new BigNumber(0) } else if ( recipientBalance.isGreaterThan( - HUNDRED_IN_WEI.multipliedBy(50).dividedBy(100), + HUNDRED_IN_WEI.multipliedBy(10).dividedBy(100), ) ) { return nextAmount.dividedBy(4) } else if ( recipientBalance.isGreaterThan( - HUNDRED_IN_WEI.multipliedBy(25).dividedBy(100), + HUNDRED_IN_WEI.multipliedBy(5).dividedBy(100), ) ) { return nextAmount.dividedBy(2)