[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
Can not deploy source code (Flatter Solidity file which I copy from Etherscan) on Remix ! Any helps?
-
I am new with smart contract development, thank you in advance for any help– AntonioCommented 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 ♦Commented Apr 21, 2021 at 23:59
-
Thanks with your great suggest ! This error is " Cannot convert undefined or null to object "– AntonioCommented 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– AntonioCommented Apr 22, 2021 at 10:20
Add a comment
|
2 Answers
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);
}
-
-
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– AntonioCommented Apr 22, 2021 at 10:36
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
-
Actually, it is flattener solidity file, I have compiled it without error. only problem with deploy– AntonioCommented Apr 22, 2021 at 10:25
-