Skip to content

Commit

Permalink
add documentation to NFT
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcabot committed Aug 29, 2022
1 parent 29ddff6 commit 05ecb08
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 64 deletions.
28 changes: 28 additions & 0 deletions contracts/tokens/NFT.sol
Expand Up @@ -9,6 +9,13 @@ import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

/**
* @title NFT
* @author Non-fungible token
* @notice Non-fungible token is a token that is not fungible.
* @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard,
* that inherits from {ERC721Enumerable}, {Pausable}, {AccessControl} and {ERC721Burnable}.
*/
abstract contract NFT is
ERC721,
ERC721Enumerable,
Expand All @@ -25,6 +32,12 @@ abstract contract NFT is

string private _baseTokenURI;

/// @notice Creates a new NFT
/// @dev Creates a new Non-fungible token
/// @param owner Owner of the smart contract
/// @param name Name of the token
/// @param symbol Symbol of the token
/// @param baseTokenURI Base URI of the token
constructor(
address owner,
string memory name,
Expand All @@ -42,10 +55,14 @@ abstract contract NFT is
return _baseTokenURI;
}

/// @notice Pauses the operations in the smart contract
/// @dev Sets an emergency stop mechanism that can be triggered by an authorized account.
function pause() public onlyRole(PAUSER_ROLE) {
_pause();
}

/// @notice Unpauses the operations in the smart contract
/// @dev Unsets an emergency stop mechanism. It can be triggered by an authorized account.
function unpause() public onlyRole(PAUSER_ROLE) {
_unpause();
}
Expand All @@ -62,6 +79,12 @@ abstract contract NFT is
return tokenId;
}

/// @notice A distinct Uniform Resource Identifier (URI) for a given asset.
/// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC
/// 3986. The URI may point to a JSON file that conforms to the "ERC721
/// Metadata JSON Schema".
/// @param tokenId NFT to get the URI of
/// @return URI of the NFT
function tokenURI(uint256 tokenId)
public
view
Expand All @@ -88,6 +111,11 @@ abstract contract NFT is

// The following functions are overrides required by Solidity.

/// @notice Query if a contract implements an interface
/// @dev Interface identification is specified in ERC-165.
/// @param interfaceId The interface identifier, as specified in ERC-165
/// @return `true` if the contract implements `interfaceId` and
/// `interfaceId` is not 0xffffffff, `false` otherwise
function supportsInterface(bytes4 interfaceId)
public
view
Expand Down
24 changes: 12 additions & 12 deletions docs/SoulName.md
Expand Up @@ -376,9 +376,9 @@ function ownerOf(uint256 tokenId) external view returns (address)
function pause() external nonpayable
```

Pauses the operations in the smart contract



*Sets an emergency stop mechanism that can be triggered by an authorized account.*


### paused
Expand Down Expand Up @@ -525,21 +525,21 @@ function soulboundIdentityContract() external view returns (contract SoulboundId
function supportsInterface(bytes4 interfaceId) external view returns (bool)
```

Query if a contract implements an interface



*Interface identification is specified in ERC-165.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| interfaceId | bytes4 | undefined |
| interfaceId | bytes4 | The interface identifier, as specified in ERC-165 |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined |
| _0 | bool | `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise |

### symbol

Expand Down Expand Up @@ -609,21 +609,21 @@ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns
function tokenURI(uint256 tokenId) external view returns (string)
```

A distinct Uniform Resource Identifier (URI) for a given asset.


*See {IERC721Metadata-tokenURI}.*
*Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".*

#### Parameters

| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | undefined |
| tokenId | uint256 | NFT to get the URI of |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | string | undefined |
| _0 | string | URI of the NFT |

### totalSupply

Expand Down Expand Up @@ -666,9 +666,9 @@ function transferFrom(address from, address to, uint256 tokenId) external nonpay
function unpause() external nonpayable
```

Unpauses the operations in the smart contract



*Unsets an emergency stop mechanism. It can be triggered by an authorized account.*


### updateIdentityId
Expand Down
24 changes: 12 additions & 12 deletions docs/SoulboundCreditReport.md
Expand Up @@ -290,9 +290,9 @@ function ownerOf(uint256 tokenId) external view returns (address)
function pause() external nonpayable
```

Pauses the operations in the smart contract



*Sets an emergency stop mechanism that can be triggered by an authorized account.*


### paused
Expand Down Expand Up @@ -423,21 +423,21 @@ function soulLinker() external view returns (contract SoulLinker)
function supportsInterface(bytes4 interfaceId) external view returns (bool)
```

Query if a contract implements an interface



*Interface identification is specified in ERC-165.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| interfaceId | bytes4 | undefined |
| interfaceId | bytes4 | The interface identifier, as specified in ERC-165 |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined |
| _0 | bool | `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise |

### symbol

Expand Down Expand Up @@ -507,21 +507,21 @@ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns
function tokenURI(uint256 tokenId) external view returns (string)
```

A distinct Uniform Resource Identifier (URI) for a given asset.


*See {IERC721Metadata-tokenURI}.*
*Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".*

#### Parameters

| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | undefined |
| tokenId | uint256 | NFT to get the URI of |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | string | undefined |
| _0 | string | URI of the NFT |

### totalSupply

Expand Down Expand Up @@ -564,9 +564,9 @@ Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE TO CONFIRM THAT `_to`
function unpause() external nonpayable
```

Unpauses the operations in the smart contract



*Unsets an emergency stop mechanism. It can be triggered by an authorized account.*



Expand Down
24 changes: 12 additions & 12 deletions docs/SoulboundIdentity.md
Expand Up @@ -424,9 +424,9 @@ function ownerOf(string name) external view returns (address)
function pause() external nonpayable
```

Pauses the operations in the smart contract



*Sets an emergency stop mechanism that can be triggered by an authorized account.*


### paused
Expand Down Expand Up @@ -590,21 +590,21 @@ function soulNameContract() external view returns (contract SoulName)
function supportsInterface(bytes4 interfaceId) external view returns (bool)
```

Query if a contract implements an interface



*Interface identification is specified in ERC-165.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| interfaceId | bytes4 | undefined |
| interfaceId | bytes4 | The interface identifier, as specified in ERC-165 |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined |
| _0 | bool | `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise |

### symbol

Expand Down Expand Up @@ -740,21 +740,21 @@ function tokenURI(address owner) external view returns (string)
function tokenURI(uint256 tokenId) external view returns (string)
```

A distinct Uniform Resource Identifier (URI) for a given asset.


*See {IERC721Metadata-tokenURI}.*
*Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".*

#### Parameters

| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | undefined |
| tokenId | uint256 | NFT to get the URI of |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | string | undefined |
| _0 | string | URI of the NFT |

### totalSupply

Expand Down Expand Up @@ -797,9 +797,9 @@ Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE TO CONFIRM THAT `_to`
function unpause() external nonpayable
```

Unpauses the operations in the smart contract



*Unsets an emergency stop mechanism. It can be triggered by an authorized account.*



Expand Down
32 changes: 16 additions & 16 deletions docs/tokens/NFT.md
@@ -1,12 +1,12 @@
# NFT

*Non-fungible token*

> NFT
Non-fungible token is a token that is not fungible.





*Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, that inherits from {ERC721Enumerable}, {Pausable}, {AccessControl} and {ERC721Burnable}.*

## Methods

Expand Down Expand Up @@ -268,9 +268,9 @@ function ownerOf(uint256 tokenId) external view returns (address)
function pause() external nonpayable
```

Pauses the operations in the smart contract



*Sets an emergency stop mechanism that can be triggered by an authorized account.*


### paused
Expand Down Expand Up @@ -384,21 +384,21 @@ function setApprovalForAll(address operator, bool approved) external nonpayable
function supportsInterface(bytes4 interfaceId) external view returns (bool)
```

Query if a contract implements an interface



*Interface identification is specified in ERC-165.*

#### Parameters

| Name | Type | Description |
|---|---|---|
| interfaceId | bytes4 | undefined |
| interfaceId | bytes4 | The interface identifier, as specified in ERC-165 |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined |
| _0 | bool | `true` if the contract implements `interfaceId` and `interfaceId` is not 0xffffffff, `false` otherwise |

### symbol

Expand Down Expand Up @@ -468,21 +468,21 @@ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns
function tokenURI(uint256 tokenId) external view returns (string)
```

A distinct Uniform Resource Identifier (URI) for a given asset.


*See {IERC721Metadata-tokenURI}.*
*Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".*

#### Parameters

| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | undefined |
| tokenId | uint256 | NFT to get the URI of |

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | string | undefined |
| _0 | string | URI of the NFT |

### totalSupply

Expand Down Expand Up @@ -525,9 +525,9 @@ function transferFrom(address from, address to, uint256 tokenId) external nonpay
function unpause() external nonpayable
```

Unpauses the operations in the smart contract



*Unsets an emergency stop mechanism. It can be triggered by an authorized account.*



Expand Down

0 comments on commit 05ecb08

Please sign in to comment.