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: content/contracts-cairo/api/access.mdx
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,12 @@ This crate provides ways to restrict who can access the functions of a contract
13
13
Starting from version `3.x.x`, the interfaces are no longer part of the `openzeppelin_access` package. The references documented here are contained in the `openzeppelin_interfaces` package version `v2.1.0`.
Copy file name to clipboardExpand all lines: content/contracts-cairo/components.mdx
+10-6Lines changed: 10 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ mod MyContract {
32
32
}
33
33
```
34
34
35
-
The `path` argument should be the imported component itself (in this case, [InitializableComponent](/contracts-cairo/security#initializable)).
35
+
The `path` argument should be the imported component itself (in this case, [InitializableComponent](security#initializable)).
36
36
The `storage` and `event` arguments are the variable names that will be set in the `Storage` struct and `Event` enum, respectively.
37
37
Note that even if the component doesn’t define any events, the compiler will still create an empty event enum inside the component module.
38
38
@@ -128,8 +128,7 @@ mod MyContract {
128
128
`InitializableImpl` defines the `is_initialized` method in the component.
129
129
By adding the embed attribute, `is_initialized` becomes a contract entrypoint for `MyContract`.
130
130
131
-
132
-
131
+
<Callouttype='info'>
133
132
Embeddable implementations, when available in this library’s components, are segregated from the internal component implementation which makes it easier to safely expose.
134
133
Components also separate granular implementations from [mixin](/contracts-cairo/components#mixins) implementations.
135
134
The API documentation design reflects these groupings.
@@ -139,6 +138,7 @@ See [ERC20Component](/contracts-cairo/api/erc20#erc20component) as an example wh
139
138
***Embeddable Implementations**
140
139
***Internal Implementations**
141
140
***Events**
141
+
</Callout>
142
142
143
143
144
144
### Mixins
@@ -232,13 +232,15 @@ mod Account {
232
232
233
233
<Callouttype='warn'>
234
234
Failing to use a component’s `initializer` can result in irreparable contract deployments.
235
+
236
+
Always read the API Reference documentation for each integrated component.
235
237
</Callout>
236
-
Always read the API documentation for each integrated component.
238
+
237
239
238
240
Some components require some sort of setup upon construction.
239
241
Usually, this would be a job for a constructor; however, components themselves cannot implement constructors.
240
242
Components instead offer ``initializer``s within their `InternalImpl` to call from the contract’s constructor.
241
-
Let’s look at how a contract would integrate [OwnableComponent](/contracts-cairo/api/access#ownablecomponent):
243
+
Let’s look at how a contract would integrate [OwnableComponent](/contracts-cairo/api/access#OwnableComponent):
242
244
243
245
```rust
244
246
#[starknet::contract]
@@ -441,8 +443,10 @@ mod MyContract {
441
443
442
444
<Callouttype='warn'>
443
445
Customizing implementations and accessing component storage can potentially corrupt the state, bypass security checks, and undermine the component logic.
444
-
</Callout>
446
+
445
447
**Exercise extreme caution**. See [Security](#security).
0 commit comments