0

[The IPFS link to see source code] (http://dweb.link/ipfs/QmVcFrLDPrEY8sveEdXnib6etMtes8z12GsNo21vbfdtiv) The error I got when try to deploy SAFEMARS contract : creation of SAFEMARS errored: Cannot convert undefined or null to object Solidity version : ^0.6.12

4
  • I am new with smart contract development, thank you in advance for any help
    – Antonio
    Apr 21, 2021 at 21:15
  • What error did you get? Please add more details what was tried and failed, tools, or solidity versions used. Asking for help and just dumping code isn't nice.
    – Ismael
    Apr 21, 2021 at 23:59
  • Thanks with your great suggest ! This error is " Cannot convert undefined or null to object "
    – Antonio
    Apr 22, 2021 at 10:17
  • I tried to deploy a flatter solidity file with multiple contracts into single contract, but always got error like above
    – Antonio
    Apr 22, 2021 at 10:20

2 Answers 2

0

I see your code and the contract SAFEMARS depends on the IUniswapV2Router02 contract at the address 0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F. I guess maybe you should have to create the IUniswapV2Router02 contract first, then deploy this SAFEMARS contract.

    constructor () public {
    _rOwned[_msgSender()] = _rTotal;

    // maybe lack of this contract? i guess
    IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F);
    // Create a uniswap pair for this new token
    uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
    .createPair(address(this), _uniswapV2Router.WETH());

    // set the rest of the contract variables
    uniswapV2Router = _uniswapV2Router;

    //exclude owner and this contract from fee
    _isExcludedFromFee[owner()] = true;
    _isExcludedFromFee[address(this)] = true;

    emit Transfer(address(0), _msgSender(), _tTotal);
}
2
  • I am doing on it, thank you very much
    – Antonio
    Apr 22, 2021 at 10:26
  • I am doing on test net of binance smart chain, so this address "0x05fF2B0DB69458A0750badebc4f9e13aDd608C7 " is PancakeRouter on mainnet, so I changed it into this address "0xD99D1c33F9fC3444f8101754aBC46c52416550D1" - is PancakeRouter on test net of Binance Smart Chain. Still not works, sorry
    – Antonio
    Apr 22, 2021 at 10:36
0

Would suggest you to use solidity flattener or hardhat flattener, and then compile and deploy the file from remix for a start should work if there are no compilation errirs

2
  • Actually, it is flattener solidity file, I have compiled it without error. only problem with deploy
    – Antonio
    Apr 22, 2021 at 10:25
  • would recommend then you first try deploying through remix
    – viraj
    Apr 22, 2021 at 11:02

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.