diff --git a/system-tests/test/deposit-redemption.test.ts b/system-tests/test/deposit-redemption.test.ts index 3c2b33197..2d9aa8b98 100644 --- a/system-tests/test/deposit-redemption.test.ts +++ b/system-tests/test/deposit-redemption.test.ts @@ -92,7 +92,7 @@ describe("System Test - Deposit and redemption", () => { tbtcTokenHandle = new EthereumTBTCToken({ address: deployedContracts.TBTC.address, - signerOrProvider: depositor + signerOrProvider: depositor, }) const bankDeploymentInfo = deployedContracts.Bank @@ -259,6 +259,14 @@ describe("System Test - Deposit and redemption", () => { systemTestsContext.depositor.address ) + // The `Bank` contract returns the balance in Satoshis. Here we convert + // the balance to the tBTC token precision because the + // `requestRedemption` function from tbtc-v2.ts lib requires the + // amount in tBTC token precision. + const requestAmountInTokenPrecision = BigNumber.from( + requestedAmount + ).mul(BigNumber.from(10).pow(10)) + // Request redemption to depositor's address. redeemerOutputScript = `0014${computeHash160( systemTestsContext.depositorBitcoinKeyPair.publicKey.compressed @@ -268,7 +276,7 @@ describe("System Test - Deposit and redemption", () => { systemTestsContext.walletBitcoinKeyPair.publicKey.compressed, sweepUtxo, redeemerOutputScript, - requestedAmount, + requestAmountInTokenPrecision, tbtcTokenHandle )