Skip to content

Commit

Permalink
chore: apply small changes to the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antomor committed Feb 6, 2024
1 parent 0c8610a commit 7e71cbe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 6 additions & 6 deletions scripts/GasEstimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,22 @@ async function executeTransferEstimationWithoutRelay(token: UtilToken) {
const amountToMint = BigNumber.from(TOKEN_AMOUNT_TO_TRANSFER).add(1);
await token.mint(amountToMint, senderAccount.address);

const noRelayCall = await token.transfer(
const transferTx = await token.transfer(
receiverAccount.address,
TOKEN_AMOUNT_TO_TRANSFER,
{ from: senderAccount.address }
);

return await noRelayCall.wait();
return await transferTx.wait();
}

async function executeSwapEstimationWithoutRelay(swap: TestSwap) {
async function executeSwapWithoutRelay(swap: TestSwap) {
const [senderAccount] = (await ethers.getSigners()) as [
SignerWithAddress,
SignerWithAddress
];

const noRelayCall = await swap.claim(
const claimTx = await swap.claim(
constants.HashZero,
ethers.utils.parseEther('0.5'),
constants.AddressZero,
Expand All @@ -146,7 +146,7 @@ async function executeSwapEstimationWithoutRelay(swap: TestSwap) {
}
);

return await noRelayCall.wait();
return await claimTx.wait();
}

function printRelayGasAnalysis(
Expand Down Expand Up @@ -435,7 +435,7 @@ async function estimateDeployCostWithExecution(fees = '0', native = false) {

const txReceipt = await txResponse.wait();

const txReceiptWithoutRelay = await executeSwapEstimationWithoutRelay(swap);
const txReceiptWithoutRelay = await executeSwapWithoutRelay(swap);

printRelayGasAnalysis(txReceipt, txReceiptWithoutRelay);
}
Expand Down
7 changes: 5 additions & 2 deletions test/RelayHub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,7 @@ describe('RelayHub', function () {
let data: string;
let swap: TestSwap;
let boltzFactory: BoltzSmartWalletFactory;
let claimedValue: BigNumber;

beforeEach(async function () {
const smartWalletTemplate = await deployContract<BoltzSmartWallet>(
Expand All @@ -1000,9 +1001,11 @@ describe('RelayHub', function () {
to: swap.address,
value: ethers.utils.parseEther('1'),
});

claimedValue = ethers.utils.parseEther('0.5');
data = swap.interface.encodeFunctionData('claim', [
constants.HashZero,
ethers.utils.parseEther('0.5'),
claimedValue,
constants.AddressZero,
500,
]);
Expand Down Expand Up @@ -1076,7 +1079,7 @@ describe('RelayHub', function () {
index: nextWalletIndex.toString(),
to: swap.address,
data,
tokenAmount: ethers.utils.parseEther('1'),
tokenAmount: claimedValue.add(ethers.utils.parseEther('0.5')),
tokenContract: constants.AddressZero,
},
relayData: {
Expand Down

0 comments on commit 7e71cbe

Please sign in to comment.