interface EIP1753 { string public name; uint256 public totalSupply; function grantAuthority(address who); function revokeAuthority(address who); function hasAuthority(address who) pure public returns (bool); function issue(address who, uint256 from, uint256 to) public; function revoke(address who) public; function hasValid(address who) public view returns (boolean); function purchase(uint256 from, uint256 to) public payable; } pragma solidity ^0.5.3; contract EIP is EIP1753 { string public name = "Kakadu National Park Camping Permit"; uint256 public totalSupply; address private _owner; mapping(address => bool) private _authorities; mapping(address => Permit) private _holders; struct Permit { address issuer; uint256 start; uint256 end; } constructor() public { _owner = msg.sender; } function grantAuthority(address who) public onlyOwner() { _authorities[who] = true; } function revokeAuthority(address who) public onlyOwner() { delete _authorities[who]; } function hasAuthority(address who) public view returns (bool) { return _authorities[who] == true; } function issue(address who, uint256 start, uint256 end) public onlyAuthority() { _holders[who] = Permit(_owner, start, end); totalSupply += 1; } function revoke(address who) public onlyAuthority() { delete _holders[who]; } function hasValid(address who) public view returns (bool) { return _holders[who].start > now && _holders[who].end < now; } function purchase(uint256 from, uint256 to) public payable { require(msg.value == 1 ether, "Incorrect fee"); issue(msg.sender, from, to); } modifier onlyOwner() { require(msg.sender == _owner, "Only owner can perform this function"); _; } modifier onlyAuthority() { require(hasAuthority(msg.sender) == true, "Only an authority can perform this function"); _; } }
0.4.18