MetaMask / MetaMask/metamask-extension

[Bug]: Contract call succeeds on Trust/Rabby/Binance wallets but fails on MetaMask with "Internal JSON-RPC error"

Open
#37,755 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bugs---Low-Priority INVALID-ISSUE-TEMPLATE needs-triage regression-prod-13.8.0 team-confirmations type-bug
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

Image

Describe the bug

This issue is not only affecting me, but also others, and it only occurs when using MetaMask. Other wallets work fine. On app.overlay.market, when you try to build or unwind the position with Metamask, you encounter the next issue:
Trade operation failed: Ln: The contract function "build" reverted with the following reason:
Internal JSON-RPC error.

MetaMask rejects the transaction with "Internal JSON-RPC error" before it reaches the blockchain, while other wallets successfully execute the same call.

Environment
Network: Binance Smart Chain (BSC)
Contract: 0xeB497c228F130BD91E7F13f81c312243961d894A (Overlay Market)
Function: build() - Opens leveraged trading position
MetaMask Version: 13.8
Browser: Chrome
User Address: 0x93cF46b09c17209f132F155494156f3C7491F1f9

Expected behavior

The transaction should succeed on MetaMask with the same success rate as Trust Wallet, Rabby Wallet, and Binance Wallet when using identical parameters.

Steps to reproduce

Navigate to https://app.overlay.market/
Connect the MetaMask wallet on the BSC network
Go to the Trade page
Select market: Counter-Strike 2 Skins (0x5ec437121a47b86b40fdf1ab4ef95806e60a9247)
Set trade parameters:
Position: Long (Buy)
Collateral: 1 OVL
Leverage: 5x
Click Trade to create a position
Confirm the transaction in the MetaMask popup
Transaction fails with error:
Internal JSON-RPC error:
The contract function "build" reverted.

Error messages or log output

Contract Call:
address: 0xeB497c228F130BD91E7F13f81c312243961d894A
function: build((address ovlMarket, uint32 brokerId, bool isLong, uint256 collateral, uint256 leverage, uint256 priceLimit))
args: ({"ovlMarket":"0x5ec437121a47b86b40fdf1ab4ef95806e60a9247","brokerId":0,"isLong":true,"collateral":"1000000000000000000","leverage":"5000000000000000000","priceLimit":"15461470493144808337092400"})
sender: 0x93cF46b09c17209f132F155494156f3C7491F1f9

Detection stage

In production (default)

Version

13.8.0

Build type

None

Browser

Chrome

Operating system

Linux

Additional context

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the build() call on BSC from app.overlay.market using the listed market, parameters, sender, and MetaMask version, then compare it with Trust, Rabby, or Binance Wallet. Done means the same build transaction succeeds in MetaMask without the Internal JSON-RPC error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.