Skip to content

Commit

Permalink
Renames constant
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-then authored and marcos-iov committed Dec 11, 2023
1 parent 925bb4d commit 4c055ef
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/01_06_53-2wp_version1_exceeding-lockingCap.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,20 @@ describe('Lock funds using peg-in protocol version 1', () => {
data.push(createPeginV1TxData(rskDestinationAddress, refundAddressInformation.address));

// Execute peg-in
const AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP = AMOUNT_TO_LOCK_IN_BTC + lockingCapInBtc;
await btcTxHelper.fundAddress(senderAddressInformation.address, AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP + btcTxHelper.getFee());
const AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP = AMOUNT_TO_LOCK_IN_BTC + lockingCapInBtc;
await btcTxHelper.fundAddress(senderAddressInformation.address, AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP + btcTxHelper.getFee());

const searchRejectedPeginEventFromBlock = await rskTxHelper.getBlockNumber();

const peginBtcTxHash = await sendPegin(rskTxHelper, btcTxHelper, senderAddressInformation, AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP, data);
const peginBtcTxHash = await sendPegin(rskTxHelper, btcTxHelper, senderAddressInformation, AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP, data);

await rskUtils.triggerRelease(rskTxHelpers, btcTxHelper);

// Assert
const finalSenderBalance = await btcTxHelper.getAddressBalance(senderAddressInformation.address);
const finalDestinationAddressBalance = await rskTxHelper.getBalance(rskDestinationAddress);
const finalRefundAddressBalance = await btcTxHelper.getAddressBalance(refundAddressInformation.address);
const refundAddressBalanceDifference = AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP - Number(finalRefundAddressBalance);
const refundAddressBalanceDifference = AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP - Number(finalRefundAddressBalance);

expect(Number(initialSenderBalance)).to.equal(0);
expect(Number(finalSenderBalance)).to.equal(0);
Expand Down Expand Up @@ -108,17 +108,17 @@ describe('Lock funds using peg-in protocol version 1', () => {
const initialSenderBalance = await btcTxHelper.getAddressBalance(senderAddressInformation.address);

// Execute peg-in
const AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP = AMOUNT_TO_LOCK_IN_BTC + lockingCapInBtc;
await btcTxHelper.fundAddress(senderAddressInformation.address, AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP + btcTxHelper.getFee());
const AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP = AMOUNT_TO_LOCK_IN_BTC + lockingCapInBtc;
await btcTxHelper.fundAddress(senderAddressInformation.address, AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP + btcTxHelper.getFee());

const searchRejectedPeginEventFromBlock = await rskTxHelper.getBlockNumber();

const peginBtcTxHash = await sendPegin(rskTxHelper, btcTxHelper, senderAddressInformation, AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP, null);
const peginBtcTxHash = await sendPegin(rskTxHelper, btcTxHelper, senderAddressInformation, AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP, null);
await rskUtils.triggerRelease(rskTxHelpers, btcTxHelper);

// Assert
const finalSenderBalance = await btcTxHelper.getAddressBalance(senderAddressInformation.address);
const senderBalanceDifference = AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP - Number(finalSenderBalance);
const senderBalanceDifference = AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP - Number(finalSenderBalance);

expect(Number(initialSenderBalance)).to.equal(0);
expect(Number(senderBalanceDifference)).to.be.at.most(btcTxHelper.getFee());
Expand Down Expand Up @@ -157,19 +157,19 @@ describe('Lock funds using peg-in protocol version 1', () => {
data.push(createPeginV1TxData(rskDestinationAddress));

// Execute peg-in
const AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP = AMOUNT_TO_LOCK_IN_BTC + lockingCapInBtc;
const AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP = AMOUNT_TO_LOCK_IN_BTC + lockingCapInBtc;

await btcTxHelper.fundAddress(senderAddressInformation.address, AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP + btcTxHelper.getFee());
await btcTxHelper.fundAddress(senderAddressInformation.address, AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP + btcTxHelper.getFee());

const searchRejectedPeginEventFromBlock = await rskTxHelper.getBlockNumber();

const peginBtcTxHash = await sendPegin(rskTxHelper, btcTxHelper, senderAddressInformation, AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP, data);
const peginBtcTxHash = await sendPegin(rskTxHelper, btcTxHelper, senderAddressInformation, AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP, data);
await rskUtils.triggerRelease(rskTxHelpers, btcTxHelper);

// Assert
const finalSenderBalance = await btcTxHelper.getAddressBalance(senderAddressInformation.address);
const finalDestinationAddressBalance = await rskTxHelper.getBalance(rskDestinationAddress);
const senderBalanceDifference = AMOUNT_TO_LOCK_EXCEEDING_LOCKIN_CAP - Number(finalSenderBalance);
const senderBalanceDifference = AMOUNT_TO_LOCK_EXCEEDING_LOCKING_CAP - Number(finalSenderBalance);

expect(Number(initialSenderBalance)).to.equal(0);
expect(Number(senderBalanceDifference)).to.be.at.most(btcTxHelper.getFee());
Expand Down

0 comments on commit 4c055ef

Please sign in to comment.