Skip to content

Commit 3d145bc

Browse files
authored
Add Auto-Generated NatSpec Docs (#16)
* Generate docs from NatSpec * Use primitive dodoc
1 parent 14656b2 commit 3d145bc

8 files changed

Lines changed: 1322 additions & 0 deletions

File tree

docs/Context.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Context
2+
3+
4+
5+
6+
7+
8+
9+
*Provides information about the current execution context, including the sender of the transaction and its data. While these are generally available via msg.sender and msg.data, they should not be accessed in such a direct manner, since when dealing with meta-transactions the account sending and paying for execution may not be the actual sender (as far as an application is concerned). This contract is only required for intermediate, library-like contracts.*
10+
11+
12+

docs/Ownable.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Ownable
2+
3+
4+
5+
6+
7+
8+
9+
*Contract module which provides a basic access control mechanism, where there is an account (an owner) that can be granted exclusive access to specific functions. By default, the owner account will be the one that deploys the contract. This can later be changed with {transferOwnership}. This module is used through inheritance. It will make available the modifier `onlyOwner`, which can be applied to your functions to restrict their use to the owner.*
10+
11+
## Methods
12+
13+
### owner
14+
15+
```solidity
16+
function owner() external view returns (address)
17+
```
18+
19+
20+
21+
*Returns the address of the current owner.*
22+
23+
24+
#### Returns
25+
26+
| Name | Type | Description |
27+
|---|---|---|
28+
| _0 | address | undefined
29+
30+
### renounceOwnership
31+
32+
```solidity
33+
function renounceOwnership() external nonpayable
34+
```
35+
36+
37+
38+
*Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.*
39+
40+
41+
### transferOwnership
42+
43+
```solidity
44+
function transferOwnership(address newOwner) external nonpayable
45+
```
46+
47+
48+
49+
*Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.*
50+
51+
#### Parameters
52+
53+
| Name | Type | Description |
54+
|---|---|---|
55+
| newOwner | address | undefined
56+
57+
58+
59+
## Events
60+
61+
### OwnershipTransferred
62+
63+
```solidity
64+
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
65+
```
66+
67+
68+
69+
70+
71+
#### Parameters
72+
73+
| Name | Type | Description |
74+
|---|---|---|
75+
| previousOwner `indexed` | address | undefined |
76+
| newOwner `indexed` | address | undefined |
77+
78+
79+

docs/UTF8Encoder.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# UTF8Encoder
2+
3+
*Devin Stein*
4+
5+
> A library for encoding UTF-8 strings
6+
7+
8+
9+
10+
11+
## Methods
12+
13+
### UTF8Encode
14+
15+
```solidity
16+
function UTF8Encode(uint32 self) external pure returns (string)
17+
```
18+
19+
Get the UTF-8 string for `self`
20+
21+
*UTF8Encode will error if the code point is not valid*
22+
23+
#### Parameters
24+
25+
| Name | Type | Description |
26+
|---|---|---|
27+
| self | uint32 | The code point to UTF-8 encode
28+
29+
#### Returns
30+
31+
| Name | Type | Description |
32+
|---|---|---|
33+
| _0 | string | The UTF-8 string for the given code point
34+
35+
36+
37+

docs/Unicode.md

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
# Unicode
2+
3+
*Devin Stein*
4+
5+
> A library for validating, parsing, and manipulating UTF-8 encoded Unicode strings
6+
7+
For character introspection or more complex transformations, checkout the UnicodeData contract.
8+
9+
*All external and public functions use self as their first parameter to allow "using Unicode for strings;". If you have ideas for new functions or improvements, please contribute!*
10+
11+
## Methods
12+
13+
### CHAR_NOT_FOUND
14+
15+
```solidity
16+
function CHAR_NOT_FOUND() external view returns (uint256)
17+
```
18+
19+
The return value of indexOf and bytesIndicesOf if the character is not found
20+
21+
*Use CHAR_NOT_FOUND to check if indexOf or bytesIndicesOf does not find the inputted character*
22+
23+
24+
#### Returns
25+
26+
| Name | Type | Description |
27+
|---|---|---|
28+
| _0 | uint256 | undefined
29+
30+
### bytesIndicesOf
31+
32+
```solidity
33+
function bytesIndicesOf(string self, string _of) external pure returns (uint256, uint256)
34+
```
35+
36+
Get the starting (inclusive) and ending (exclusive) bytes indices of character `_of` in string `self`
37+
38+
*bytesIndicesOf returns (CHAR_NOT_FOUND, CHAR_NOT_FOUND) if `_of` isn't found in `self`*
39+
40+
#### Parameters
41+
42+
| Name | Type | Description |
43+
|---|---|---|
44+
| self | string | The input string
45+
| _of | string | The character to find the bytes indices of
46+
47+
#### Returns
48+
49+
| Name | Type | Description |
50+
|---|---|---|
51+
| _0 | uint256 | The starting (inclusive) and ending (exclusive) indites the character in the bytes underlying the string
52+
| _1 | uint256 | undefined
53+
54+
### charAt
55+
56+
```solidity
57+
function charAt(string self, uint256 _idx) external pure returns (string)
58+
```
59+
60+
Get the UTF-8 character at `_idx` for `self`
61+
62+
*charAt will error if the idx is out of bounds*
63+
64+
#### Parameters
65+
66+
| Name | Type | Description |
67+
|---|---|---|
68+
| self | string | The input string
69+
| _idx | uint256 | The index of the character to get
70+
71+
#### Returns
72+
73+
| Name | Type | Description |
74+
|---|---|---|
75+
| _0 | string | The character at the given index
76+
77+
### codePointAt
78+
79+
```solidity
80+
function codePointAt(string self, uint256 _idx) external pure returns (uint32)
81+
```
82+
83+
Get the Unicode code point at `_idx` for `self`
84+
85+
*codePointAt requires a valid UTF-8 string*
86+
87+
#### Parameters
88+
89+
| Name | Type | Description |
90+
|---|---|---|
91+
| self | string | The input string
92+
| _idx | uint256 | The index of the code point to get
93+
94+
#### Returns
95+
96+
| Name | Type | Description |
97+
|---|---|---|
98+
| _0 | uint32 | The Unicode code point at the given index
99+
100+
### decode
101+
102+
```solidity
103+
function decode(string self) external pure returns (string[])
104+
```
105+
106+
Decode every UTF-8 characters in `self`
107+
108+
109+
110+
#### Parameters
111+
112+
| Name | Type | Description |
113+
|---|---|---|
114+
| self | string | The input string
115+
116+
#### Returns
117+
118+
| Name | Type | Description |
119+
|---|---|---|
120+
| _0 | string[] | An ordered array of all UTF-8 characters in `self`
121+
122+
### decodeChar
123+
124+
```solidity
125+
function decodeChar(string self, uint256 _cursor) external pure returns (string, uint256)
126+
```
127+
128+
Decode the next UTF-8 character in `self` given a starting position of `_cursor`
129+
130+
*decodeChar is useful for functions want to iterate over the string in one pass and check each category for a condition*
131+
132+
#### Parameters
133+
134+
| Name | Type | Description |
135+
|---|---|---|
136+
| self | string | The input string
137+
| _cursor | uint256 | The starting bytes position (inclusive) of the character
138+
139+
#### Returns
140+
141+
| Name | Type | Description |
142+
|---|---|---|
143+
| _0 | string | The next character as a string and the starting position of the next character.
144+
| _1 | uint256 | undefined
145+
146+
### indexOf
147+
148+
```solidity
149+
function indexOf(string self, string _of) external pure returns (uint256)
150+
```
151+
152+
Get the character index of `_of` in string `self`
153+
154+
*indexOf returns CHAR_NOT_FOUND if `_of` isn't found in `self`*
155+
156+
#### Parameters
157+
158+
| Name | Type | Description |
159+
|---|---|---|
160+
| self | string | The input string
161+
| _of | string | The character to find the index of
162+
163+
#### Returns
164+
165+
| Name | Type | Description |
166+
|---|---|---|
167+
| _0 | uint256 | The index of the character in the given string
168+
169+
### isASCII
170+
171+
```solidity
172+
function isASCII(string self) external pure returns (bool)
173+
```
174+
175+
Check if `self` contains only single byte ASCII characters (0-127)
176+
177+
*If a string is only ASCII, then it's safe to treat each byte as a character. This returns false for extended ASCII (128-255) because they are use two bytes in UTF-8.*
178+
179+
#### Parameters
180+
181+
| Name | Type | Description |
182+
|---|---|---|
183+
| self | string | The input string
184+
185+
#### Returns
186+
187+
| Name | Type | Description |
188+
|---|---|---|
189+
| _0 | bool | True if the `self` only contains ASCII
190+
191+
### isUTF8
192+
193+
```solidity
194+
function isUTF8(string self) external pure returns (bool)
195+
```
196+
197+
Check if `self` is valid UTF-8
198+
199+
200+
201+
#### Parameters
202+
203+
| Name | Type | Description |
204+
|---|---|---|
205+
| self | string | The input string
206+
207+
#### Returns
208+
209+
| Name | Type | Description |
210+
|---|---|---|
211+
| _0 | bool | True if the string is UTF-8 encoded
212+
213+
### length
214+
215+
```solidity
216+
function length(string self) external pure returns (uint256)
217+
```
218+
219+
Get length of `self`
220+
221+
*For efficiency, length assumes valid UTF-8 encoded input. It only does simple checks for bytes sequences*
222+
223+
#### Parameters
224+
225+
| Name | Type | Description |
226+
|---|---|---|
227+
| self | string | The input string
228+
229+
#### Returns
230+
231+
| Name | Type | Description |
232+
|---|---|---|
233+
| _0 | uint256 | The number of UTF-8 characters in `self`
234+
235+
### toCodePoint
236+
237+
```solidity
238+
function toCodePoint(string self) external pure returns (uint32)
239+
```
240+
241+
Get the code point of character: `self`
242+
243+
*This function requires a valid UTF-8 character*
244+
245+
#### Parameters
246+
247+
| Name | Type | Description |
248+
|---|---|---|
249+
| self | string | The input character
250+
251+
#### Returns
252+
253+
| Name | Type | Description |
254+
|---|---|---|
255+
| _0 | uint32 | The code point of `self`
256+
257+
258+
259+

0 commit comments

Comments
 (0)