Skip to content

Commit 9a12d9e

Browse files
committed
feat: more fixes
1 parent cd47e49 commit 9a12d9e

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

content/contracts-cairo/components.mdx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ Starknet components are separate modules that contain storage, events, and imple
88
Components themselves cannot be declared or deployed.
99
Another way to think of components is that they are abstract modules that must be instantiated.
1010

11+
[shamans_post]: https://community.starknet.io/t/cairo-components/101136#components-1
12+
[cairo_book]: https://book.cairo-lang.org/ch103-02-00-composability-and-components.html
13+
1114
<Callout>
12-
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].
1316
</Callout>
1417

1518
## Building a contract
@@ -29,7 +32,7 @@ mod MyContract {
2932
}
3033
```
3134

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)).
3336
The `storage` and `event` arguments are the variable names that will be set in the `Storage` struct and `Event` enum, respectively.
3437
Note that even if the component doesn’t define any events, the compiler will still create an empty event enum inside the component module.
3538

@@ -57,7 +60,7 @@ mod MyContract {
5760

5861
The `#[substorage(v0)]` attribute must be included for each component in the `Storage` trait.
5962
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.
6164

6265
The `#[flat]` attribute for events in the `Event` enum, however, is not required.
6366
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
445448

446449
Hooks are entrypoints to the business logic of a token component that are accessible at the contract level.
447450
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).
449452

450453
All token components include a generic hooks trait that include empty default functions.
451454
When creating a token contract, the using contract must create an implementation of the hooks trait.

content/contracts-cairo/index.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ title: Contracts for Cairo
88

99

1010
**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)
1313
that facilitate testing with Starknet Foundry.
1414

1515
<Callout>
@@ -59,7 +59,7 @@ The `openzeppelin` package is an umbrella (meta) package that aggregates all lib
5959
versioned in lockstep—their versions always matched. Starting with v3.x, following the introduction of `openzeppelin_interfaces`, the umbrella is
6060
versioned independently from some of the subpackages.
6161

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.
6363

6464
</Callout>
6565

@@ -104,7 +104,7 @@ openzeppelin_utils = "{{openzeppelin_utils_version}}"
104104

105105
## Basic usage
106106

107-
This is how it looks to build an ERC20 contract using the [ERC20 component](erc20).
107+
This is how it looks to build an ERC20 contract using the [ERC20 component](/contracts-cairo/erc20).
108108
Copy the code into `src/lib.cairo`.
109109

110110
```rust

0 commit comments

Comments
 (0)