Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions content/contracts-cairo/4.x/accounts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -330,24 +330,25 @@ Next, create the account JSON with Starknet Foundry’s [custom account setup](h
The flag enables custom account variants.

<Callout>
The following examples use `sncast` [v0.23.0](https://github.com/foundry-rs/starknet-foundry/releases/tag/v0.23.0).
The following examples use `sncast` [v0.63.0](https://github.com/foundry-rs/starknet-foundry/releases/tag/v0.63.0).
</Callout>

```bash
$ sncast \
--url http://127.0.0.1:5050 \
account create \
--url http://127.0.0.1:5050 \
--name my-custom-account \
--type oz \
--class-hash 0x123456...
```

This command will output the precomputed contract address and the recommended `max-fee`.
To counterfactually deploy the account, send funds to the address and then deploy the custom account.
This command will output the precomputed contract address and the estimated deployment fee.
To counterfactually deploy the account, prefund the address and then deploy the custom account.

```bash
$ sncast \
--url http://127.0.0.1:5050 \
account deploy \
--url http://127.0.0.1:5050 \
--name my-custom-account
```

Expand All @@ -356,8 +357,8 @@ Once the account is deployed, set the `--account` flag with the custom account n
```bash
$ sncast \
--account my-custom-account \
--url http://127.0.0.1:5050 \
invoke \
--url http://127.0.0.1:5050 \
--contract-address 0x123... \
--function "some_function" \
--calldata 1 2 3
Expand Down Expand Up @@ -413,10 +414,6 @@ The following examples utilize the [StarknetJS](https://www.starknet-js.com/) li
Compile and declare the contract on the target network.
Next, precompute the EthAccount contract address using the declared class hash.

<Callout>
The following examples use unreleased features from StarknetJS (`starknetjs@next`) at commit [d002baea0abc1de3ac6e87a671f3dec3757437b3](https://github.com/starknet-io/starknet.js/commit/d002baea0abc1de3ac6e87a671f3dec3757437b3).
</Callout>

```javascript
import * as dotenv from 'dotenv';
import { CallData, EthSigner, hash } from 'starknet';
Expand Down
28 changes: 20 additions & 8 deletions content/contracts-cairo/4.x/api/access.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Requirements:
#### Events [!toc] [#IAccessControl-Events]

<APIItem
functionSignature="RoleAdminChanged(role: felt252, previous_admin_role: ContractAddress, new_admin_role: ContractAddress)"
functionSignature="RoleAdminChanged(role: felt252, previous_admin_role: felt252, new_admin_role: felt252)"
id="IAccessControl-RoleAdminChanged"
kind="event"
>
Expand Down Expand Up @@ -450,7 +450,13 @@ Emitted when a [pending\_default\_admin](#IAccessControlDefaultAdminRules-pendin
Emitted when a [default\_admin\_delay](#IAccessControlDefaultAdminRules-default_admin_delay) change is started.

Sets `new_delay` as the next delay to be applied between default admins transfers after `effect_schedule` has passed.
</APIItem>

<APIItem
functionSignature="DefaultAdminDelayChangeCanceled()"
id="IAccessControlDefaultAdminRules-DefaultAdminDelayChangeCanceled"
kind="event"
>
Emitted when a [pending\_default\_admin\_delay](#IAccessControlDefaultAdminRules-pending_default_admin_delay) is reset if its schedule didn’t pass.
</APIItem>

Expand Down Expand Up @@ -764,7 +770,7 @@ The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to grant and r
- [`AccessControlImpl`](#AccessControlComponent-Embeddable-Impls-AccessControlImpl)
- [`AccessControlCamelImpl`](#AccessControlComponent-Embeddable-Impls-AccessControlCamelImpl)
- [`AccessControlWithDelayImpl`](#AccessControlComponent-Embeddable-Impls-AccessControlWithDelayImpl)
- [`SRC5Impl`](./introspection#SRC5Component-Embeddable-Impls)
- [`SRC5Impl`](#AccessControlComponent-Embeddable-Impls-SRC5Impl)

Embeddable Implementations

Expand Down Expand Up @@ -878,7 +884,7 @@ Attempts to grant `role` to `account` with the specified activation delay.

Requirements:

- The caller must have \`role’s admin role.
- The caller must have `role`’s admin role.
- delay must be greater than 0.
- the `role` must not be already effective for `account`.

Expand Down Expand Up @@ -1083,7 +1089,7 @@ May emit a [RoleRevoked](#IAccessControl-RoleRevoked) event.
#### Events [!toc] [#AccessControlComponent-Events]

<APIItem
functionSignature="RoleAdminChanged(role: felt252, previous_admin_role: ContractAddress, new_admin_role: ContractAddress)"
functionSignature="RoleAdminChanged(role: felt252, previous_admin_role: felt252, new_admin_role: felt252)"
id="AccessControlComponent-RoleAdminChanged"
kind="event"
>
Expand Down Expand Up @@ -1146,7 +1152,7 @@ This contract implements the following risk mitigations on top of [AccessControl
- [`AccessControlImpl`](#AccessControlDefaultAdminRulesComponent-Embeddable-Impls-AccessControlImpl)
- [`AccessControlCamelImpl`](#AccessControlDefaultAdminRulesComponent-Embeddable-Impls-AccessControlCamelImpl)
- [`AccessControlWithDelayImpl`](#AccessControlDefaultAdminRulesComponent-Embeddable-Impls-AccessControlWithDelayImpl)
- [`SRC5Impl`](./introspection#SRC5Component-Embeddable-Impls)
- [`SRC5Impl`](#AccessControlDefaultAdminRulesComponent-Embeddable-Impls-SRC5Impl)

Embeddable Implementations

Expand Down Expand Up @@ -1452,7 +1458,7 @@ Attempts to grant `role` to `account` with the specified activation delay.

Requirements:

- The caller must have \`role’s admin role.
- The caller must have `role`’s admin role.
- delay must be greater than 0.
- the `role` must not be already effective for `account`.

Expand Down Expand Up @@ -1608,7 +1614,7 @@ The account may not be able to act as the role yet, if a delay was set and has n
id="AccessControlDefaultAdminRulesComponent-set_role_admin"
kind="external"
>
Sets `admin_role` as \`role’s admin role.
Sets `admin_role` as `role`’s admin role.

Internal function without access restriction.

Expand Down Expand Up @@ -1684,7 +1690,7 @@ May emit a DefaultAdminTransferCanceled event.
>
Setter of the tuple for pending delay and its schedule.

May emit a DefaultAdminDelayChangeCanceled event.
May emit a [DefaultAdminDelayChangeCanceled](#AccessControlDefaultAdminRulesComponent-DefaultAdminDelayChangeCanceled) event.
</APIItem>

<APIItem
Expand Down Expand Up @@ -1771,6 +1777,12 @@ Emitted when a [pending\_default\_admin](#AccessControlDefaultAdminRulesComponen
Emitted when a [default\_admin\_delay](#AccessControlDefaultAdminRulesComponent-default_admin_delay) change is started.

Sets `new_delay` as the next delay to be applied between default admins transfers after `effect_schedule` has passed.
</APIItem>

<APIItem
functionSignature="DefaultAdminDelayChangeCanceled()"
id="AccessControlDefaultAdminRulesComponent-DefaultAdminDelayChangeCanceled"
kind="event"
>
Emitted when a [pending\_default\_admin\_delay](#AccessControlDefaultAdminRulesComponent-pending_default_admin_delay) is reset if its schedule didn’t pass.
</APIItem>
12 changes: 6 additions & 6 deletions content/contracts-cairo/4.x/api/account.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Implementing [SRC5Component](./introspection#SRC5Component) is a requirement for
- [`PublicKeyImpl`](#AccountComponent-Embeddable-Impls-PublicKeyImpl)
- [`SRC6CamelOnlyImpl`](#AccountComponent-Embeddable-Impls-SRC6CamelOnlyImpl)
- [`PublicKeyCamelImpl`](#AccountComponent-Embeddable-Impls-PublicKeyCamelImpl)
- [`SRC5Impl`](./introspection#SRC5Component-Embeddable-Impls)
- [`SRC5Impl`](#AccountComponent-Embeddable-Impls-SRC5Impl)

Embeddable Implementations

Expand All @@ -160,7 +160,7 @@ Embeddable Implementations

#### DeployableImpl [!toc] [#AccountComponent-Embeddable-Impls-DeployableImpl]

- [`__validate_deploy__(self, hash, signature)`](#AccountComponent-__validate_deploy__)
- [`__validate_deploy__(self, class_hash, contract_address_salt, public_key)`](#AccountComponent-__validate_deploy__)

#### PublicKeyImpl [!toc] [#AccountComponent-Embeddable-Impls-PublicKeyImpl]

Expand Down Expand Up @@ -408,7 +408,7 @@ The `EthPublicKey` type is an alias for `starknet::secp256k1::Secp256k1Point`.
- [`PublicKeyImpl`](#EthAccountComponent-Embeddable-Impls-PublicKeyImpl)
- [`SRC6CamelOnlyImpl`](#EthAccountComponent-Embeddable-Impls-SRC6CamelOnlyImpl)
- [`PublicKeyCamelImpl`](#EthAccountComponent-Embeddable-Impls-PublicKeyCamelImpl)
- [`SRC5Impl`](./introspection#SRC5Component-Embeddable-Impls)
- [`SRC5Impl`](#EthAccountComponent-Embeddable-Impls-SRC5Impl)

Embeddable Implementations

Expand All @@ -424,7 +424,7 @@ Embeddable Implementations

#### DeployableImpl [!toc] [#EthAccountComponent-Embeddable-Impls-DeployableImpl]

- [`__validate_deploy__(self, hash, signature)`](#EthAccountComponent-__validate_deploy__)
- [`__validate_deploy__(self, class_hash, contract_address_salt, public_key)`](#EthAccountComponent-__validate_deploy__)

#### PublicKeyImpl [!toc] [#EthAccountComponent-Embeddable-Impls-PublicKeyImpl]

Expand Down Expand Up @@ -747,7 +747,7 @@ Embedded Implementations

AccountComponent

- [`AccountMixinImpl`](#AccountComponent-Embeddable-Mixin-Impl)
- [`AccountMixinImpl`](#AccountComponent-Embeddable-Impls-AccountMixinImpl)

SRC9Component

Expand Down Expand Up @@ -810,7 +810,7 @@ Embedded Implementations

EthAccountComponent

- [`EthAccountMixinImpl`](#EthAccountComponent-Embeddable-Mixin-Impl)
- [`EthAccountMixinImpl`](#EthAccountComponent-Embeddable-Impls-EthAccountMixinImpl)

SRC9Component

Expand Down
34 changes: 17 additions & 17 deletions content/contracts-cairo/4.x/api/erc1155.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This module provides interfaces, presets, and utilities related to ERC1155 contr

For an overview of ERC1155, read our [ERC1155 guide](../erc1155).

## [](#interfaces)Interfaces
## Interfaces [#interfaces]

<Callout type='info'>
The interfaces documented here are provided by the `openzeppelin_interfaces` package version `{{openzeppelin_interfaces_version}}`.
Expand Down Expand Up @@ -203,15 +203,15 @@ Functions
#### Functions [!toc] [#functions_3]

<APIItem
functionSignature="on_erc1155_received(operator: ContractAddress, from: ContractAddress, token_id: u256, value: u256, data Span<felt252>) -> felt252"
functionSignature="on_erc1155_received(operator: ContractAddress, from: ContractAddress, token_id: u256, value: u256, data: Span<felt252>) -> felt252"
id="IERC1155Receiver-on_erc1155_received"
kind="external"
>
This function is called whenever an ERC1155 `token_id` token is transferred to this `IERC1155Receiver` implementer via [IERC1155::safe\_transfer\_from](#IERC1155-safe_transfer_from) by `operator` from `from`.
</APIItem>

<APIItem
functionSignature="on_erc1155_batch_received(operator: ContractAddress, from: ContractAddress, token_ids: Span<u256>, values: Span<u256>, data Span<felt252>) -> felt252"
functionSignature="on_erc1155_batch_received(operator: ContractAddress, from: ContractAddress, token_ids: Span<u256>, values: Span<u256>, data: Span<felt252>) -> felt252"
id="IERC1155Receiver-on_erc1155_batch_received"
kind="external"
>
Expand Down Expand Up @@ -263,7 +263,7 @@ Returns the aggregate supply across all token IDs.
Returns whether the total supply of `token_id` is greater than zero.
</APIItem>

## [](#core)Core
## Core [#core]

### `ERC1155Component` [toc] [#ERC1155Component]

Expand Down Expand Up @@ -307,7 +307,7 @@ Defines `uri(self: @ComponentState, token_id: u256) → ByteArray`, which is use
use openzeppelin_token::erc1155::ERC1155TokenURIDefaultImpl;
```

Returns the component's common base URI for every token type. Clients replace the `\{id\}` substring according to the ERC1155 metadata substitution rules.
Returns the component's common base URI for every token type. Clients replace the `{id}` substring according to the ERC1155 metadata substitution rules.
</APIItem>

#### Hooks [!toc] [#ERC1155Component-Hooks]
Expand All @@ -324,7 +324,7 @@ Returns the component's common base URI for every token type. Clients replace th
- [`ERC1155Impl`](#ERC1155Component-Embeddable-Impls-ERC1155Impl)
- [`ERC1155MetadataURIImpl`](#ERC1155Component-Embeddable-Impls-ERC1155MetadataURIImpl)
- [`ERC1155CamelImpl`](#ERC1155Component-Embeddable-Impls-ERC1155CamelImpl)
- [`SRC5Impl`](./introspection#SRC5Component-Embeddable-Impls-SRC5Impl)
- [`SRC5Impl`](./introspection#SRC5Component-SRC5Impl)

Embeddable Implementations

Expand Down Expand Up @@ -488,7 +488,7 @@ Queries if `operator` is an authorized operator for `owner`.

This implementation returns the same URI for **all** token types. It relies on the token type ID substitution mechanism [specified in the EIP](https://eips.ethereum.org/EIPS/eip-1155#metadata).

Clients calling this function must replace the `id` substring with the actual token type ID.
Clients calling this function must replace the `{id}` substring with the actual token type ID.
</APIItem>

<APIItem
Expand Down Expand Up @@ -663,9 +663,9 @@ The ERC1155 acceptance check is not performed in this function. See [update\_wit
>
Sets a new URI for all token types, by relying on the token type ID substitution mechanism [specified in the EIP](https://eips.ethereum.org/EIPS/eip-1155#metadata).

By this mechanism, any occurrence of the `id` substring in either the URI or any of the values in the JSON file at said URI will be replaced by clients with the token type ID.
By this mechanism, any occurrence of the `{id}` substring in either the URI or any of the values in the JSON file at said URI will be replaced by clients with the token type ID.

For example, the `https://token-cdn-domain/\id\.json` URI would be interpreted by clients as `https://token-cdn-domain/000000000000...000000000000004cce0.json` for token type ID `0x4cce0`.
For example, the `https://token-cdn-domain/{id}.json` URI would be interpreted by clients as `https://token-cdn-domain/000000000000...000000000000004cce0.json` for token type ID `0x4cce0`.

Because these URIs cannot be meaningfully represented by the `URI` event, this function emits no events.
</APIItem>
Expand Down Expand Up @@ -726,7 +726,7 @@ Implementing [SRC5Component](./introspection#SRC5Component) is a requirement for

- [`ERC1155ReceiverImpl`](#ERC1155ReceiverComponent-Embeddable-Impls-ERC1155ReceiverImpl)
- [`ERC1155ReceiverCamelImpl`](#ERC1155ReceiverComponent-Embeddable-Impls-ERC1155ReceiverCamelImpl)
- [`SRC5Impl`](./introspection#SRC5Component-Embeddable-Impls-SRC5Impl)
- [`SRC5Impl`](./introspection#SRC5Component-SRC5Impl)

Embeddable Implementations

Expand All @@ -749,31 +749,31 @@ Internal Functions
#### Embeddable functions [!toc] [#embeddable_functions_2]

<APIItem
functionSignature="on_erc1155_received(self: @ContractState, operator: ContractAddress, from: ContractAddress, token_id: u256, value: u256, data Span<felt252>) -> felt252"
functionSignature="on_erc1155_received(self: @ContractState, operator: ContractAddress, from: ContractAddress, token_id: u256, value: u256, data: Span<felt252>) -> felt252"
id="ERC1155ReceiverComponent-on_erc1155_received"
kind="external"
>
Returns the `IERC1155Receiver` interface ID.
</APIItem>

<APIItem
functionSignature="on_erc1155_batch_received(self: @ContractState, operator: ContractAddress, from: ContractAddress, token_ids: Span<u256>, values: Span<u256>, data Span<felt252>) -> felt252"
functionSignature="on_erc1155_batch_received(self: @ContractState, operator: ContractAddress, from: ContractAddress, token_ids: Span<u256>, values: Span<u256>, data: Span<felt252>) -> felt252"
id="ERC1155ReceiverComponent-on_erc1155_batch_received"
kind="external"
>
Returns the `IERC1155Receiver` interface ID.
</APIItem>

<APIItem
functionSignature="onERC1155Received(self: @ContractState, operator: ContractAddress, from: ContractAddress, tokenId: u256, value: u256, data Span<felt252>) -> felt252"
functionSignature="onERC1155Received(self: @ContractState, operator: ContractAddress, from: ContractAddress, tokenId: u256, value: u256, data: Span<felt252>) -> felt252"
id="ERC1155ReceiverComponent-onERC1155Received"
kind="external"
>
See [ERC1155ReceiverComponent::on\_erc1155\_received](#ERC1155ReceiverComponent-on_erc1155_received).
</APIItem>

<APIItem
functionSignature="onERC1155BatchReceived(self: @ContractState, operator: ContractAddress, from: ContractAddress, tokenIds: Span<u256>, values: Span<u256>, data Span<felt252>) -> felt252"
functionSignature="onERC1155BatchReceived(self: @ContractState, operator: ContractAddress, from: ContractAddress, tokenIds: Span<u256>, values: Span<u256>, data: Span<felt252>) -> felt252"
id="ERC1155ReceiverComponent-onERC1155BatchReceived"
kind="external"
>
Expand Down Expand Up @@ -945,7 +945,7 @@ Stores `token_uri` as the token-specific suffix for `token_id` and emits the cor
Sets the base URI used when a token-specific suffix is present. This function emits no event.
</APIItem>

## [](#presets)Presets
## Presets [#presets]

### `ERC1155Upgradeable` [toc] [#ERC1155Upgradeable]

Expand Down Expand Up @@ -974,11 +974,11 @@ Embedded Implementations

ERC1155Component

- [`ERC1155MixinImpl`](#ERC1155Component-Embeddable-Mixin-Impl)
- [`ERC1155MixinImpl`](#ERC1155Component-Embeddable-Impls-ERC1155MixinImpl)

OwnableMixinImpl

- [`OwnableMixinImpl`](./access#OwnableComponent-Mixin-Impl)
- [`OwnableMixinImpl`](./access#OwnableComponent-Embeddable-Impls-OwnableMixinImpl)

External Functions

Expand Down
Loading
Loading