【问题标题】:"expected primary expression" error - Trying to compile a smart contract on remix - ethereum ide“预期的主要表达式”错误 - 尝试在 remix 上编译智能合约 - ethereum ide
【发布时间】:2021-12-20 21:30:43
【问题描述】:
【问题讨论】:
标签:
token
solidity
smartcontracts
remix
【解决方案1】:
链接的合约包含导致语法错误的函数。
constructor() public {
_name = {{TOKEN_NAME}};
_symbol = {{TOKEN_SYMBOL}};
_decimals = {{DECIMALS}};
_totalSupply = {{TOTAL_SUPPLY}};
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
我假设合同作者打算使用这些占位符来指出您可以在哪里填写自己的值。
将占位符替换为实际值后,合约编译成功。
constructor() public {
_name = "MyToken";
_symbol = "MyT";
_decimals = 18;
_totalSupply = 1000000000000000000;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}