Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
RaaCT0R committed Dec 3, 2024
1 parent a742518 commit 8a09d20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/chains/evm/lib/EvmChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
}

const feeData = await this.network.getFeeData();
let requiredEth = 0n;
let requiredNativeToken = 0n;
let txFeeData;
if (this.evmTxType === 2) {
if (
Expand All @@ -143,7 +143,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
`Tx type is 2 but max fee variables are null`
);
}
requiredEth =
requiredNativeToken =
this.configs.gasLimitCap * BigInt(orders.length) * feeData.maxFeePerGas;
txFeeData = {
maxFeePerGas: feeData.maxFeePerGas,
Expand All @@ -153,7 +153,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
if (feeData.gasPrice === null) {
throw new ImpossibleBehavior(`Tx type is 0 but gas price is null`);
} else {
requiredEth =
requiredNativeToken =
this.configs.gasLimitCap * BigInt(orders.length) * feeData.gasPrice;
txFeeData = {
gasPrice: feeData.gasPrice,
Expand All @@ -171,7 +171,7 @@ abstract class EvmChain extends AbstractChain<Transaction> {
{
nativeToken: this.tokenMap.wrapAmount(
this.NATIVE_TOKEN_ID,
requiredEth,
requiredNativeToken,
this.CHAIN
).amount,
tokens: [],
Expand Down
3 changes: 2 additions & 1 deletion packages/chains/evm/tests/EvmChain.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ describe('EvmChain', () => {
* order
* - eventId should be properly in the transaction data
* - no extra data should be found in the transaction data
* - transaction must be of type 2 and has no blobs
* - transaction must be of type 0 and has no blobs
* - nonce must be the same as the next available nonce
* - gas limit should be as expected
* - gas price should be as expected
Expand Down Expand Up @@ -1311,6 +1311,7 @@ describe('EvmChain', () => {
// check returned value
expect(result).toEqual(false);
});

/**
* @target EvmChain.verifyTransactionFee should return true when
* gasPrice and gasLimit are set properly for a type 0 transaction
Expand Down

0 comments on commit 8a09d20

Please sign in to comment.