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
For more information on the construction and design of Starknet components, see the [Starknet Shamans post](https://community.starknet.io/t/cairo-components/101136#components-1) and the [Cairo book](https://book.cairo-lang.org/ch103-02-00-composability-and-components.html).
15
+
For more information on the construction and design of Starknet components, see the [Starknet Shamans post][shamans_post] and the [Cairo book][cairo_book].
13
16
</Callout>
14
17
15
18
## Building a contract
@@ -29,7 +32,7 @@ mod MyContract {
29
32
}
30
33
```
31
34
32
-
The `path` argument should be the imported component itself (in this case, [InitializableComponent](/security#initializable)).
35
+
The `path` argument should be the imported component itself (in this case, [InitializableComponent](/contracts-cairo/security#initializable)).
33
36
The `storage` and `event` arguments are the variable names that will be set in the `Storage` struct and `Event` enum, respectively.
34
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.
35
38
@@ -57,7 +60,7 @@ mod MyContract {
57
60
58
61
The `#[substorage(v0)]` attribute must be included for each component in the `Storage` trait.
59
62
This allows the contract to have indirect access to the component’s storage.
60
-
See [Accessing component storage](#accessing_component_storage) for more on this.
63
+
See [Accessing component storage](#accessing-component-storage) for more on this.
61
64
62
65
The `#[flat]` attribute for events in the `Event` enum, however, is not required.
63
66
For component events, the first key in the event log is the component ID.
@@ -445,7 +448,7 @@ Customizing implementations and accessing component storage can potentially corr
445
448
446
449
Hooks are entrypoints to the business logic of a token component that are accessible at the contract level.
447
450
This allows contracts to insert additional behaviors before and/or after token transfers (including mints and burns).
448
-
Prior to hooks, extending functionality required contracts to create [custom implementations](#custom_implementations).
451
+
Prior to hooks, extending functionality required contracts to create [custom implementations](#custom-implementations).
449
452
450
453
All token components include a generic hooks trait that include empty default functions.
451
454
When creating a token contract, the using contract must create an implementation of the hooks trait.
Copy file name to clipboardExpand all lines: content/contracts-cairo/index.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,8 @@ title: Contracts for Cairo
8
8
9
9
10
10
**A library for secure smart contract development** written in Cairo for [Starknet][starknet]. This library consists of a set of
11
-
[reusable components](/cairo-contracts/components) to build custom smart contracts, as well as ready-to-deploy [presets](/cairo-contracts/presets). You can also
12
-
find other [utilities](/cairo-contracts/api/utilities) including [interfaces and dispatchers](/cairo-contracts/interfaces) and [test utilities](/cairo-contracts/api/testing)
11
+
[reusable components](/contracts-cairo/components) to build custom smart contracts, as well as ready-to-deploy [presets](/contracts-cairo/presets). You can also
12
+
find other [utilities](/contracts-cairo/api/utilities) including [interfaces and dispatchers](/contracts-cairo/interfaces) and [test utilities](/contracts-cairo/api/testing)
13
13
that facilitate testing with Starknet Foundry.
14
14
15
15
<Callout>
@@ -59,7 +59,7 @@ The `openzeppelin` package is an umbrella (meta) package that aggregates all lib
59
59
versioned in lockstep—their versions always matched. Starting with v3.x, following the introduction of `openzeppelin_interfaces`, the umbrella is
60
60
versioned independently from some of the subpackages.
61
61
62
-
See the [Versioning of the sub-packages](/cairo-contracts#versioning-of-the-sub-packages) section for more information.
62
+
See the [Versioning of the sub-packages](/contracts-cairo#versioning-of-the-sub-packages) section for more information.
0 commit comments