Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computing L1 + L2 fees on Base and Manta #4712

Open
zhanghuize-git opened this issue Apr 30, 2024 · 4 comments
Open

Computing L1 + L2 fees on Base and Manta #4712

zhanghuize-git opened this issue Apr 30, 2024 · 4 comments
Assignees
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6

Comments

@zhanghuize-git
Copy link

zhanghuize-git commented Apr 30, 2024

Ethers Version

6.11.1

Search Terms

yes

Describe the Problem

When I use the method getTransactionReceipt to fetch the transaction by hash, the value of the fee for the transaction is not the same as the value of the fee that I get when I look it up in the blockchain browser directly

For example 0x10674dff8d304e3b49e50a7a5dd43470d2fd782a9a297062be043ea74f519151 The fee for this transaction is 0.00000589436349832 ETH, but in the blockchain browser it is 0.000006060525121534 ETH

why is that? Is there a good solution?

Code Snippet

protected async getTransactionFee(
    transactionReceipt: TransactionReceipt,
  ): Promise<string> {
    return transactionReceipt.fee.toString(10);
  }


  const testTransaction = await rpcClient.getTransactionReceipt(
    '0x10674dff8d304e3b49e50a7a5dd43470d2fd782a9a297062be043ea74f519151',
  );
  console.log('testTransaction: ', testTransaction.fee.toString());

Contract ABI

No response

Errors

No response

Environment

node.js (v12 or newer)

Environment (Other)

No response

@zhanghuize-git zhanghuize-git added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Apr 30, 2024
@ricmoo
Copy link
Member

ricmoo commented Apr 30, 2024

What network is this tx on? So that I can compare myself… :)

@zhanghuize-git
Copy link
Author

What network is this tx on? So that I can compare myself… :)

It's Manta, the network. Base has the same problem.

@ricmoo
Copy link
Member

ricmoo commented May 1, 2024

Do you have a public endpoint I can use?

If it is similar to Base, my guess may be the discrepancy between L1 and L2 (and therefore L1 + L2) fees; since the .fee can only determine the native fees (in this case, that would be L2).

You can probably use the Ethers Optimism library to get the total fees, if it uses the same Oracle address. If it doesn't I can update the library to accept an Oracle address. Let me know.

@ricmoo ricmoo changed the title Add Bug Title Here Computing L1 + L2 fees on Base and Manta May 1, 2024
@zhanghuize-git
Copy link
Author

zhanghuize-git commented May 7, 2024

Yes,your guess is right, .fee get the L2 fees in this case,
image

So I'll just have to use the Ethers Optimism library to solve this problem? Thanks for the reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

2 participants