You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/core/solidity/README.md
+17-57Lines changed: 17 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,81 +24,42 @@ The following contract types are supported:
24
24
25
25
Note that `stablecoin` and `realWorldAsset` are experimental and may be subject to change.
26
26
27
-
Each contract type has functions/constants as defined below.
28
-
29
27
### Functions
30
28
29
+
Each contract type implements a common API with methods that take contract-specific options (e.g., `ERC20Options` for `erc20`, `ERC721Options` for `erc721`, etc.). This ensures type safety and allows for contract-specific features.
30
+
31
31
#### `print`
32
32
```js
33
-
functionprint(opts?:ERC20Options): string
34
-
```
35
-
```js
36
-
function print(opts?: ERC721Options): string
37
-
```
38
-
```js
39
-
function print(opts?: ERC1155Options): string
40
-
```
41
-
```js
42
-
function print(opts?: StablecoinOptions): string
43
-
```
44
-
```js
45
-
function print(opts?: AccountOptions): string
46
-
```
47
-
```js
48
-
function print(opts?: GovernorOptions): string
49
-
```
50
-
```js
51
-
function print(opts?: CustomOptions): string
33
+
functionprint(opts?:Options): string
52
34
```
53
35
Returns a string representation of a contract generated using the provided options. If `opts` is not provided, uses [`defaults`](#defaults).
54
36
55
-
#### `defaults`
56
-
```js
57
-
const defaults: Required<ERC20Options>
58
-
```
59
-
```js
60
-
const defaults: Required<ERC721Options>
61
-
```
62
-
```js
63
-
const defaults: Required<ERC1155Options>
64
-
```
65
-
```js
66
-
const defaults: Required<StablecoinOptions>
67
-
```
37
+
#### `getVersionedRemappings`
68
38
```js
69
-
const defaults: Required<AccountOptions>
39
+
function getVersionedRemappings(opts?: Options): string[]
70
40
```
41
+
Returns an array of remappings that map unversioned import prefixes to versioned import prefixes. For example:
If the contract options include upgradeability, the upgradeable remapping is included. If `opts` is not provided, uses [`defaults`](#defaults).
49
+
50
+
#### `defaults`
74
51
```js
75
-
const defaults: Required<CustomOptions>
52
+
const defaults: Required<Options>
76
53
```
77
-
The default options that are used for [`print`](#print).
54
+
The default options that are used for [`print`](#print) and [`getVersionedRemappings`](#getVersionedRemappings).
78
55
79
56
#### `isAccessControlRequired`
80
57
```js
81
-
function isAccessControlRequired(opts: Partial<ERC20Options>): boolean
82
-
```
83
-
```js
84
-
function isAccessControlRequired(opts: Partial<ERC721Options>): boolean
85
-
```
86
-
```js
87
-
function isAccessControlRequired(opts: Partial<ERC1155Options>): boolean
88
-
```
89
-
```js
90
-
function isAccessControlRequired(opts: Partial<StablecoinOptions>): boolean
91
-
```
92
-
```js
93
-
function isAccessControlRequired(opts: Partial<GovernorOptions>): boolean
94
-
```
95
-
```js
96
-
function isAccessControlRequired(opts: Partial<CustomOptions>): boolean
58
+
function isAccessControlRequired(opts: Partial<Options>): boolean
97
59
```
98
60
Whether any of the provided options require access control to be enabled. If this returns `true`, then calling `print` with the same options would cause the `access` option to default to `'ownable'` if it was `undefined` or `false`.
99
61
100
-
> Note that contracts such as `account`, have its own way of handling permissions and do not support the `access` option.
101
-
Thus, that type does not include `isAccessControlRequired`.
62
+
> Note that contracts such as `account` have their own way of handling permissions and do not support the `access` option. Thus, that type does not include `isAccessControlRequired`.
0 commit comments