Search code examples
soliditybinance-smart-chain

Warning! Error encountered during contract execution [execution reverted]


I am just learning about solidity, I got this code and when I deploy it I got this error can you help me how to fix it?

I don't know where the error exists.

I am using BSC Test-net

    constructor () {
    _rOwned[_msgSender()] = _rTotal; // assigning the max reflection token to owner's address  
    
    ISummitSwapRouter01 _summitSwapRouter = ISummitSwapRouter01(0x10ED43C718714eb63d5aA57B78B54704E256024E);
     // Create a summitswap pair for this new token
    summitSwapPair = ISummitSwapFactory(_summitSwapRouter.factory())
        .createPair(address(this), _summitSwapRouter.WETH());    
    
    //exclude owner and this contract from fee
    _isExcludedFromFee[owner()]             = true;
    _isExcludedFromFee[address(this)]       = true;
    _isExcludedFromFee[_CodradoLiquidityProviderAddress]   = true;


    //Exclude dead address from reflection
    _isExcludedFromReflection[address(0)] = true;
    _isExcludedFromReflection[0x000000000000000000000000000000000000dEaD] = true;
    
    emit Transfer(address(0), _msgSender(), _tTotal);
}

Solution

  • There's no contract on the 0x10ED... address on the BSC testnet.

    When your code is calling the .factory() function, it expects a response. But no response comes from the non-contract address, which causes the revert.