mirror of
https://github.com/status-im/EIPs.git
synced 2025-02-22 11:48:19 +00:00
Update eip-1753.md (#3629)
The current example implementation is not compiling on Solidity because of some errors (1. interface does not support state variables nor functions that are not external, and 2. there were some mismatches between the names of the variables). This PR proposes a fix to these errors.
This commit is contained in:
parent
ec0756d128
commit
6854f0274c
@ -167,18 +167,16 @@ Smart contracts can be used to embed regulatory requirements with respect to the
|
||||
### Solidity Example
|
||||
```solidity
|
||||
interface EIP1753 {
|
||||
string public name;
|
||||
uint256 public totalSupply;
|
||||
|
||||
function grantAuthority(address who) public;
|
||||
function revokeAuthority(address who) public;
|
||||
function grantAuthority(address who) external;
|
||||
function revokeAuthority(address who) external;
|
||||
function hasAuthority(address who) external view returns (bool);
|
||||
|
||||
function issue(address who, uint256 from, uint256 to) external;
|
||||
function revoke(address who) public;
|
||||
function revoke(address who) external;
|
||||
|
||||
function hasValid(address who) external view returns (bool);
|
||||
function purchase(uint256 validFrom, uint256 validTo) public payable;
|
||||
function purchase(uint256 validFrom, uint256 validTo) external payable;
|
||||
}
|
||||
|
||||
pragma solidity ^0.5.3;
|
||||
@ -210,7 +208,7 @@ contract EIP is EIP1753 {
|
||||
delete _authorities[who];
|
||||
}
|
||||
|
||||
function hasAuthority(address who) external view returns (bool) {
|
||||
function hasAuthority(address who) public view returns (bool) {
|
||||
return _authorities[who] == true;
|
||||
}
|
||||
|
||||
@ -224,12 +222,12 @@ contract EIP is EIP1753 {
|
||||
}
|
||||
|
||||
function hasValid(address who) external view returns (bool) {
|
||||
return _holders[who].start > now && _holders[who].end < now;
|
||||
return _holders[who].validFrom > now && _holders[who].validTo < now;
|
||||
}
|
||||
|
||||
function purchase(uint256 validFrom, uint256 validTo) external payable {
|
||||
require(msg.value == 1 ether, "Incorrect fee");
|
||||
issue(msg.sender, from, to);
|
||||
issue(msg.sender, validFrom, validTo);
|
||||
}
|
||||
|
||||
modifier onlyOwner() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user