diff --git a/apps/firebase/src/celo-adapter.ts b/apps/firebase/src/celo-adapter.ts index 491f09152..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_WIE.multipliedBy(75).dividedBy(100), + HUNDRED_IN_WEI.multipliedBy(20).dividedBy(100), ) ) { return new BigNumber(0) } else if ( recipientBalance.isGreaterThan( - HUNDRED_IN_WIE.multipliedBy(50).dividedBy(100), + HUNDRED_IN_WEI.multipliedBy(10).dividedBy(100), ) ) { return nextAmount.dividedBy(4) } else if ( recipientBalance.isGreaterThan( - HUNDRED_IN_WIE.multipliedBy(25).dividedBy(100), + HUNDRED_IN_WEI.multipliedBy(5).dividedBy(100), ) ) { return nextAmount.dividedBy(2) @@ -310,4 +313,4 @@ export class CeloAdapter { } } -const HUNDRED_IN_WIE = new BigNumber('100000000000000000000') +const HUNDRED_IN_WEI = new BigNumber('100000000000000000000') 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