solidity - 为什么我从复制粘贴并尝试部署的合同中收到“应支付调用的函数”错误?
问题描述
我从这里复制粘贴了一份合同,并尝试使用 remix 部署到 BSC 测试网,但出现以下错误:
创建 AutoCoin 错误:VM 错误:还原。revert 事务已恢复到初始状态。注意:如果您发送值并且您发送的值应该小于您当前的余额,则调用的函数应该是应付的。调试事务以获取更多信息。
我认为它在这条线上失败了,因为那是调试器让我跳的地方:
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
我本来希望部署一个复制粘贴的合同没有任何问题,所以我认为我做错了什么。
完整的构造函数代码在这里:
constructor () {
_rOwned[owner()] = _rTotal;
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), owner(), _tTotal);
}
解决方案
推荐阅读
- typescript - 对象的类型为“未知” - forEach 和 map
- java - JMeter / Beanshell “调用 bsh 方法时出错:评估源文件:”
- ruby-on-rails - 如何使 recurring_select gem 与 Rails 6 和 Webpacker 一起使用
- reactjs - 警告:组件正在更改文件类型的受控输入
- reactjs - 如何获取 svg 来替换反应功能组件中的天气文本
- reactjs - 无法解析项目中已发布的 NPM 模块
- flutter - 如何让一个块构建器在它不在屏幕上时构建一个小部件?
- mysql - 使用 HAVING 子句、COUNT 聚合和 GROUP BY 同时使用 Sequelize 过滤数据
- javascript - 如何将带有子项的 react-bootstrap 组件导入 kotlin-js react app
- angular - 从数据集中获取值并填充到另一个数据集中