Solidity
無法在 Remix 上部署原始碼(我從 Etherscan 複製的 Flatter Solidity 文件)!有什麼幫助嗎?
$$ The IPFS link to see source code $$( http://dweb.link/ipfs/QmVcFrLDPrEY8sveEdXnib6etMtes8z12GsNo21vbfdtiv ) 我在嘗試部署 SAFEMARS 合約時遇到的錯誤:創建 SAFEMARS 時出錯:無法將未定義或 null 轉換為對象 Solidity 版本:^0.6.12
我看到你的程式碼和合約 SAFEMARS 依賴於地址 0x05fF2B0DB69458A0750badebc4f9e13aDd608C7F 的 IUniswapV2Router02 合約。我想也許你應該先創建 IUniswapV2Router02 合約,然後部署這個 SAFEMARS 合約。
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); }
建議您使用solidity flattener或hardhat flattener,然後從remix編譯和部署文件,如果沒有編譯錯誤,應該可以工作