ERC20 Smart Contract PUSH0 and Evm Failed

When I deploy my erc20 smart contract in Remix ide, I get PUSH0 evm error. I tried everything but I get the same error and the deployment fails.
Ekran görüntüsü 2023-11-15 170124
Currently pragma solidity 0.8.10. Thank you :slight_smile:

Change it to 0.8.20 or higher.

I tried all versions, but it still gives the same waiting error after 2 attempts.

1 Like

It worked, but now these combinations give.
Ekran görüntüsü 2023-11-15 183303

Can you sharet the compile tab of Remix? where we can see solidity version etc. Also share the code first lines so we can see the written pragma version

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.23;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

interface INonfungiblePositionManager {
    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }

    function mint(MintParams calldata params) external payable returns (
        uint256 tokenId,
        uint128 liquidity,
        uint256 amount0,
        uint256 amount1
    );

    function createAndInitializePoolIfNecessary(
        address token0,
        address token1,
        uint24 fee,
        uint160 sqrtPriceX96
    ) external payable returns (address pool);
}

contract ABC is ERC20 {
    INonfungiblePositionManager posMan;
    address constant weth = 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619; // Polygon wMatic
    uint supply = 8_000_000_000_000 * 10 ** decimals();
    uint24 constant fee = 300;
    uint160 constant sqrtPriceX96 = 79228162514264337593543950336; // ~ 1:1
    int24 minTick;
    int24 maxTick;
    address public pool;
    address token0;
    address token1;
    address public owner1;  // Declare owner addresses
    address public owner2;

    // Define the onlyOwners modifier
    modifier onlyOwners() {
        require(msg.sender == owner1 || msg.sender == owner2, "Not an owner");
        _;
    }

    constructor() ERC20("ABC", "ABC") {
        _mint(address(this), supply);
        fixOrdering();
        posMan = INonfungiblePositionManager(0xC36442b4a4522E871399CD717aBDD847Ab11FE88);
        pool = posMan.createAndInitializePoolIfNecessary(token0, token1, fee, sqrtPriceX96);
        // Assign owner addresses correctly
        owner1 = 0X0000000000000000000000000000000000000000;
        owner2 = 0x0000000000000000000000000000000000000000;

        // Call addLiquidity function during contract deployment
        addLiquidity();
    }

    function addLiquidity() private {
        uint256 desiredLiquidityAmount = 1 * 10 ** 18; // 1 Dolar
        uint256 amount0Desired = desiredLiquidityAmount / 2;
        uint256 amount1Desired = desiredLiquidityAmount / 2;

        IERC20(token0).approve(address(posMan), amount0Desired);
        IERC20(token1).approve(address(posMan), amount1Desired);

        posMan.mint(INonfungiblePositionManager.MintParams({
            token0: token0,
            token1: token1,
            fee: fee,
            tickLower: minTick,
            tickUpper: maxTick,
            amount0Desired: amount0Desired,
            amount1Desired: amount1Desired,
            amount0Min: 0,
            amount1Min: 0,
            recipient: address(this),
            deadline: block.timestamp + 1200
        }));
    }

    function fixOrdering() private {
        if (address(this) < weth) {
            token0 = address(this);
            token1 = weth;
            minTick = 0;
            maxTick = 887270;
        } else {
            token0 = weth;
            token1 = address(this);
            minTick = -887270;
            maxTick = 0;
        }
    }

    function distributeSupplyToOwners() external onlyOwners {
        uint256 totalSupply = totalSupply();
        uint256 distributionAmount = (totalSupply * 20) / 100; // %20 of total supply

        require(balanceOf(address(this)) >= distributionAmount, "Not enough tokens in the contract");

        transfer(owner1, distributionAmount / 2);
        transfer(owner2, distributionAmount / 2);
    }
}

It is a secret version of private information. (Gas Limit:3.000.000 wei:0 evm version:Istanbul)

You can't use that version if the chain doesn't support Shangai upgrade. Use 0.8.19