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 Answer
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.