0

I have a smart contract that tries to perform a swap in a given liquidity pool. First, i transfer the tokens i have to give for the ones that i want to get and then call the swap function. The transferring part works fine but then i get this error when calling the swap function "Error Reason:invalid opcode: MCOPY". I used remix to write the code in solidity. When I want to send a transaction i get a warning "Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending? Returned error: invalid opcode: MCOPY [object Object] The EVM version used by the selected environment is not compatible with the compiler EVM version. " If i send it anyway i get the error i told previuosly. It also consumes all the gas up to the gas limit, doesn't matter what i set it to. I am working on the BSC chain and i deployed the contract using the Injected Provider - Metamask.

1
  • 1
    Sounds like using too new a version of solidity for the evm fork BSC are using. Try compile with an older version that is supported on BSC. soliditylang.org/blog/2024/01/26/…
    – Maka
    Commented Apr 30 at 13:30

1 Answer 1

0

According to my understanding, you are encountering an "invalid opcode: MCOPY" error when calling your swap function on BSC due to version and environement mismatch so ensure compilerEVM version and environement compatibility with BSC's.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.