Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EIP-1753: Move to draft #5872

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 29 additions & 20 deletions EIPS/eip-1753.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
eip: 1753
title: Smart Contract Interface for Licences
author: Lucas Cullen (@BitcoinBrisbane), Kai Yeung (@CivicKai), Anna Crowley <[email protected]>, Caroline Marshall <[email protected]>, Katrina Donaghy <[email protected]>
status: Stagnant
status: Draft
type: Standards Track
category: ERC
created: 2019-02-06
---

## Abstract

This Ethereum Improvement Proposal (EIP) proposes an Ethereum standard for the issuance of licences, permits and grants (Licences).
This Ethereum Improvement Proposal (EIP) proposes an Ethereum standard for the issuance of licences, permits and grants (Licences) as Non Transferable Tokens NTTs.

A Licence is a limited and temporary authority, granted to a natural (e.g. you) or legal person (e.g. a corporation), to do something that would otherwise be unlawful pursuant to a legal framework. A public Licence is granted by the government, directly (e.g. by the New South Wales Department of Primary Industries, Australia) or indirectly (e.g. by an agent operating under the government’s authority), and derives its authority from legislation, though this is often practically achieved via delegated legislation such as regulations. This can be contrasted to a private licence – for example, the licence you grant to a visitor who comes onto your property.

Expand All @@ -34,7 +34,7 @@ This EIP seeks to define a standard that will allow for the granting and/or mana
### Methods

**NOTES**:
- The following specifications use syntax from Solidity `0.4.17` (or above)
- The following specifications use syntax from Solidity `0.8.0` (or above)
- Callers MUST handle `false` from `returns (bool success)`. Callers MUST NOT assume that `false` is never returned!


Expand All @@ -43,55 +43,55 @@ This EIP seeks to define a standard that will allow for the granting and/or mana
Returns the name of the permit - e.g. `"MyPermit"`.

``` js
function name() public view returns (string);
function name() external view returns (string);
```

#### totalSupply

Returns the total permit supply.

``` js
function totalSupply() public view returns (uint256);
function totalSupply() external view returns (uint256);
```

#### grantAuthority

Adds an ethereum address to a white list of addresses that have authority to modify a permit.

``` js
function grantAuthority(address who) public;
function grantAuthority(address who) external;
```

#### revokeAuthority

Removes an ethereum address from a white list of addresses that have authority to modify a permit.

``` js
function revokeAuthority(address who) public;
function revokeAuthority(address who) external;
```

#### hasAuthority

Checks to see if the address has authority to grant or revoke permits.

``` js
function hasAuthority(address who) public view;
function hasAuthority(address who) external view;
```

#### issue

Issues an ethereum address a permit between the specified date range.

``` js
function issue(address who, uint256 validFrom, uint256 validTo) public;
function issue(address who, uint256 validFrom, uint256 validTo) external;
```

#### revoke

Revokes a permit from an ethereum address.

``` js
function revoke(address who) public;
function revoke(address who) external;
```

#### hasValid
Expand Down Expand Up @@ -166,6 +166,9 @@ Smart contracts can be used to embed regulatory requirements with respect to the

### Solidity Example
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface EIP1753 {

function grantAuthority(address who) external;
Expand All @@ -179,8 +182,6 @@ interface EIP1753 {
function purchase(uint256 validFrom, uint256 validTo) external payable;
}

pragma solidity ^0.5.3;

contract EIP is EIP1753 {

string public name = "Kakadu National Park Camping Permit";
Expand All @@ -196,28 +197,36 @@ contract EIP is EIP1753 {
uint256 validTo;
}

constructor() public {
constructor() {
_owner = msg.sender;
}

function grantAuthority(address who) public onlyOwner() {
function grantAuthority(address who) external onlyOwner() {
_authorities[who] = true;
}

function revokeAuthority(address who) public onlyOwner() {
function revokeAuthority(address who) external onlyOwner() {
delete _authorities[who];
}

function hasAuthority(address who) public view returns (bool) {
function hasAuthority(address who) external view returns (bool) {
return _hasAuthority(who);
}

function _hasAuthority(address who) private view returns (bool) {
return _authorities[who] == true;
}

function issue(address who, uint256 start, uint256 end) public onlyAuthority() {
function issue(address who, uint256 start, uint256 end) external onlyAuthority() {
_issue(who, start, end);
}

function _issue(address who, uint256 start, uint256 end) private onlyAuthority() {
_holders[who] = Permit(_owner, start, end);
totalSupply += 1;
}

function revoke(address who) public onlyAuthority() {
function revoke(address who) external onlyAuthority() {
delete _holders[who];
}

Expand All @@ -227,7 +236,7 @@ contract EIP is EIP1753 {

function purchase(uint256 validFrom, uint256 validTo) external payable {
require(msg.value == 1 ether, "Incorrect fee");
issue(msg.sender, validFrom, validTo);
_issue(msg.sender, validFrom, validTo);
}

modifier onlyOwner() {
Expand All @@ -236,7 +245,7 @@ contract EIP is EIP1753 {
}

modifier onlyAuthority() {
require(hasAuthority(msg.sender), "Only an authority can perform this function");
require(_hasAuthority(msg.sender), "Only an authority can perform this function");
_;
}
}
Expand Down