pragma solidity >=0.5.0 <0.6.0;
import 'openzeppelin-solidity/contracts/token/ERC20/ERC20.sol';
contract NautCoin is ERC20 {
// string public constant name = 'NautCoin';
// string public constant symbol = '0x0';
// uint public constant decimals = 18;
uint public timeLock = now + 1 days;
uint256 public INITIAL_SUPPLY;
address public player;
constructor(address _player)
public {
player = _player;
INITIAL_SUPPLY = 10000 * (uint256(decimals()));
// _totalSupply = INITIAL_SUPPLY;
// _balances[player] = INITIAL_SUPPLY;
_mint(player, INITIAL_SUPPLY);
emit Transfer(address(0), player, INITIAL_SUPPLY);
}
function transfer(address _to, uint256 _value) public returns(bool) {
super.transfer(_to, _value);
}
function approve(address _spender, uint256 _value) public returns(bool) {
super.approve(_spender, _value);
}
// Prevent the initial owner from transferring tokens until the timelock has passed
modifier lockTokens() {
if (msg.sender == player) {
require(now > timeLock);
_;
} else {
_;
}
}
} 如何解决此错误?
发布于 2020-12-06 13:33:50
我刚才做了一些奇怪的疑难解答。我在里米克斯复制了这份合同,开始绞尽脑汁想知道出了什么问题。
最后,在approve函数周围似乎存在一些编译器不喜欢的奇怪的空格字符。所以只要去掉这个函数和它周围的东西,用规则的空格重写它,它就能工作了。
https://ethereum.stackexchange.com/questions/90841
复制相似问题