Skip to content

Commit

Permalink
Migrate to multiple packages (workspace) (#1065)
Browse files Browse the repository at this point in the history
* Migrate erc20 tests (#1022)

* feat: migrate event tests

* feat: update workflow

* feat: add foundry utils

* feat: finish erc20 and erc20votes migration

* feat: remove dual case tests

* refactor: format files

* refactor: variable name

* Update src/tests/token.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/token/erc20.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/utils/foundry.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/token/erc20/test_erc20_votes.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* feat: apply review updates

---------

Co-authored-by: Andrew Fleming <[email protected]>

* Snforge utils and some common changes (#1030)

* Update gitignore with snfoundry cache dir

* Delete foundry utils file

* Add snfoundry-related test utils, comment out previous utils

* Update ERC20 event helpers

* Update ERC20 tests

* Update ERC20Votes tests

* Run linter

* Add util function to drop single event

* Fix review issues

* Make Github workflow run on every PR

* Fix review issues

* Bump snforge version

* Support snforge 0.26 in test utils

* Update ERC20 tests to support snforge upgrade

* Run linter

* Re-add dual20 tests (#1028)

* feat: migrate event tests

* feat: update workflow

* feat: add foundry utils

* feat: finish erc20 and erc20votes migration

* feat: remove dual case tests

* refactor: format files

* refactor: variable name

* Update src/tests/token.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/token/erc20.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/utils/foundry.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/token/erc20/test_erc20_votes.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* feat: apply review updates

* feat: readd dual20 tests

* refactor: remove unnecessary import

* feat: add dual20 import

---------

Co-authored-by: Andrew Fleming <[email protected]>

* Migrate security tests (#1034)

* migrate pausable and initializable tests

* migrate reentrancy guard tests

* clean up tests

* fix fmt

* add event trait to pausable, fix tests

* Apply suggestions from code review

Co-authored-by: Eric Nordelo <[email protected]>

* fix fmt

---------

Co-authored-by: Eric Nordelo <[email protected]>

* refacto repo into packages

* fmt

* Migrate erc1155 tests (#1037)

* feat: update common module

* feat: migrate dual modules

* feat: finish component test migration

* refactor: remove unnecessary imports

* feat: apply review updates

* Migrate erc721 tests (#1027)

* feat: migrate event tests

* feat: update workflow

* feat: add foundry utils

* feat: finish erc20 and erc20votes migration

* feat: remove dual case tests

* refactor: format files

* refactor: variable name

* Update src/tests/token.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/token/erc20.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/utils/foundry.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/token/erc20/test_erc20_votes.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* feat: apply review updates

* feat: migrate erc721 components tests

* refactor: remove extra line

* feat: apply review updates

* feat: update utilities

* feat: apply review updates

* fix: ignore tests

---------

Co-authored-by: Andrew Fleming <[email protected]>

* Check ignored tests (#1049)

* test: check ignored tests and add reason

* feat: apply review updates

* Migrate Ownable tests (#1033)

* Update ERC20Votes tests

* Run linter

* Add test helpers for Ownable tests

* Migrate Ownable tests

* Migrate OwnableTwoStep tests

* Migrate Ownable Dual Dispatcher tests

* Support event changes in snforge 0.26

* Resolve review issues

* Address review comments

* Migrate Upgrades tests (#1051)

* Migrate Upgrades tests to Foundry

* Update src/tests/upgrades/test_upgradeable.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* Update src/tests/upgrades/test_upgradeable.cairo

Co-authored-by: Andrew Fleming <[email protected]>

---------

Co-authored-by: Eric Nordelo <[email protected]>
Co-authored-by: Andrew Fleming <[email protected]>

* Migrate erc20 preset tests (#1055)

* feat: include erc20 preset tests

* feat: tests updated

* feat: remove unused imports

* feat: add deployments

* Update src/tests/utils/common.cairo

Co-authored-by: Andrew Fleming <[email protected]>

* feat: apply review updates

---------

Co-authored-by: Andrew Fleming <[email protected]>

* feat: update ignored tests messages (#1056)

* Migrate erc1155 preset tests (#1057)

* feat: update tests

* refactor: remove unnecessary import

* Migrate cryptography and UDC tests (#1059)

* fix import name

* migrate cryptography tests

* migrate udc tests

* fix fmt

* fix impl name

* fix event assertions

* re-add class hash helper

* Migrate eth account tests (#1058)

* feat: update dual_eth_account tests

* feat: update eth_account tests

* refactor: remove unused helpers

* refactor: some inconsistencies

* Update src/tests/account/ethereum/test_eth_account.cairo

Co-authored-by: immrsd <[email protected]>

* feat: apply review updates

* refactor: format files

* Update src/tests/account/ethereum/test_eth_account.cairo

Co-authored-by: Andrew Fleming <[email protected]>

---------

Co-authored-by: immrsd <[email protected]>
Co-authored-by: Andrew Fleming <[email protected]>

* Migrate eth account preset tests (#1060)

* feat: update dual_eth_account tests

* feat: update eth_account tests

* refactor: remove unused helpers

* feat: update eth account preset tests

* Update src/tests/account/ethereum/test_eth_account.cairo

Co-authored-by: immrsd <[email protected]>

* Update src/tests/presets/test_eth_account.cairo

Co-authored-by: immrsd <[email protected]>

* feat: apply review updates

---------

Co-authored-by: immrsd <[email protected]>

* Migrate AccessControl Tests (#1044)

* Migrate AccessControl tests

* Migrate AccessControl Dual Dispatcher tests

* Fix imports

* Address review comments

* Update error messages

* Bring back separator line

* Fix ignore reasons in access module

* Fix review issues

* Migrate Starknet Account tests (#1050)

* Update test utils and helpers

* Update signature tests

* Update account tests

* Update dual account tests

* Run linter

* Run linter

* Fix review issues

* Update ignore reason messages

* Run linter

* Support eth account tests changes

* Run linter

* Improve setup functions, remove unused imports

* Remove unnecessary accept_ownership step, make use of serialized_sign fn

* feat: make contracts build

* feat: update packages Scarb.toml

* refactor: remove gitmodules file

* feat: refactor tests

* feat: update workflow

* feat: test utils

* feat: add missing tests

* fix: tests

* fix: remaining tests

* refactor: format files

* tmp: workflow update

* feat: add entry to CHANGELOG and update README

* doc: update imports

* Migrate Starknet Account Preset tests (#1069)

* Update test utils and helpers

* Update signature tests

* Update account tests

* Update dual account tests

* Run linter

* Run linter

* Fix review issues

* Update ignore reason messages

* Run linter

* Support eth account tests changes

* Run linter

* Improve setup functions, remove unused imports

* Remove unnecessary accept_ownership step, make use of serialized_sign fn

* Migrate Starknet Account Preset tests, make some code improvements

* Run linter

* Remove unnecessary clone

* Update the comment for assert_entrypoint_not_found_error function

* Minor review fixes

* Bump scarb, merge changes from main in snforge migration (#1076)

* Remove unnecessary `mut`, minor fixes (#1032)

* clean up code

* change array syntax

* fix fmt

* Improve SNIP12 examples (#1036)

* docs: improve examples

* refactor: remove empty line

* Update docs/modules/ROOT/pages/guides/snip12.adoc

Co-authored-by: Andrew Fleming <[email protected]>

---------

Co-authored-by: Andrew Fleming <[email protected]>

* Release v0.15.0-rc.0 (#1039)

* feat: update CHANGELOG

* Bump version to 0.15.0-rc.0

* docs: add missing header

* feat: apply review suggestions

---------

Co-authored-by: ericnordelo <[email protected]>

* Bump cairo to 2.7.0-rc.1 (#1025)

* feat: migrate modules

* feat: delete cairo_project.toml

* feat: update tests

* feat: apply review updates

* fix: remove extra line

* feat: add CHANGELOG entry

* fix: CHANGELOG

* Bump Scarb to 2.7.0-rc.2 (#1052)

* bump scarb to 2.7.0-rc.2

* add changelog entry

* update changelog entry

* bump scarb in installation page

* Add timelock component (#996)

* start timelock comp draft

* move timelock to own dir, finish drafting component

* tmp: add utility impls

* add timelock mock

* add test mod for timelock

* fix commnet

* add constructor to timelock mock

* set min_delay in initializer

* start tests

* fix fmt

* fix schedule assertion

* add schedule tests

* fix fmt

* remove unused import

* fix errs, _before_call

* start execute tests

* fix fmt

* fix after_call

* add execute tests

* add abi interface

* add reentrancy mock for timelock

* add tests for cancel and update_delay

* fix hash_op test

* add execute with predecessor test

* add timelock utils, add operation_state debug impl

* fix fmt

* improve imports

* improve _execute

* add basic mock for tests

* add tmp call struct

* add batch fns to interface

* add batch fns

* refactor tests to use dedicated mock, add batch tests

* fix fmt

* remove use clause

* add timelock mixin

* fix interface name

* improve event assertions

* fix execute and schedule events

* fix fmt

* add safe token transfer tests

* fix fmt

* tidy up code

* add descriptions to events

* clean up code

* inline CallPartialEq fns

* start fn descriptions

* remove comments

* remove comment

* fix fmt

* add changelog entries

* improve spacing

* add line break to hash test

* clean up tests

* clean up tests

* fix constants in attacker impl

* add initializer helper, register access control support

* add _before_call and _after_call tests

* fix reentrant batch mock call

* add _schedule and _execute tests

* add timelock description

* fix formatting

* fix comments

* fix comment

* fmt

* tidy up tests

* remove batch helper fn

* remove event from mocks

* Apply suggestions from code review

Co-authored-by: Eric Nordelo <[email protected]>

* update spdx

* remove token receiver support

* add additional cancel tests

* Apply suggestions from code review

Co-authored-by: Eric Nordelo <[email protected]>

* initializer: remove mut, use while loop

* fix fmt

* add assert_only_self fn

* fix getter comments re: pending/waiting

* add assert_only_role

* add specific op errors

* make event names consistent

* fix test

* remove serialization from HashCallImpl

* remove unused components from mock

* clean up code

* update to 2.7.0-rc.1

* fix fmt

* import Call from corelib

* update spdx

* fix fmt

* move OperationState, derive debug

* fix fmt

* fix hash impls

* add for loops

* fix PartialEq, add tests

* fix fmt

* simplify mixin fns

* switch Poseidon to Pedersen

* make admin a req in initializer

* update tests with admin

* fix fmt

* fix comment

* undo changes

* add no admin initializer test

---------

Co-authored-by: Eric Nordelo <[email protected]>

* bump scarb to 2.7.0-rc.4 (#1064)

* bump scarb to 2.7.0-rc.4

* add changelog

* bump scarb in installation page

* feat: update workflow and fix warning (#1066)

* Add actionlint (#1067)

* add actionlint for workflows

* remove codecov and gitmodules

* bump checkout to v4, add double quotes, fmt

* bump md lint

* re-add cairo version

* group redirects

* fix link in security

* add local actionlint matcher json

* re-add changelog entry

* add tmp usc install to ci

* fix ci

---------

Co-authored-by: Eric Nordelo <[email protected]>
Co-authored-by: ericnordelo <[email protected]>
Co-authored-by: JChoy <[email protected]>

* Migrate timelock tests (#1061)

* Remove unnecessary `mut`, minor fixes (#1032)

* clean up code

* change array syntax

* fix fmt

* Improve SNIP12 examples (#1036)

* docs: improve examples

* refactor: remove empty line

* Update docs/modules/ROOT/pages/guides/snip12.adoc

Co-authored-by: Andrew Fleming <[email protected]>

---------

Co-authored-by: Andrew Fleming <[email protected]>

* Release v0.15.0-rc.0 (#1039)

* feat: update CHANGELOG

* Bump version to 0.15.0-rc.0

* docs: add missing header

* feat: apply review suggestions

---------

Co-authored-by: ericnordelo <[email protected]>

* Bump cairo to 2.7.0-rc.1 (#1025)

* feat: migrate modules

* feat: delete cairo_project.toml

* feat: update tests

* feat: apply review updates

* fix: remove extra line

* feat: add CHANGELOG entry

* fix: CHANGELOG

* Bump Scarb to 2.7.0-rc.2 (#1052)

* bump scarb to 2.7.0-rc.2

* add changelog entry

* update changelog entry

* bump scarb in installation page

* Add timelock component (#996)

* start timelock comp draft

* move timelock to own dir, finish drafting component

* tmp: add utility impls

* add timelock mock

* add test mod for timelock

* fix commnet

* add constructor to timelock mock

* set min_delay in initializer

* start tests

* fix fmt

* fix schedule assertion

* add schedule tests

* fix fmt

* remove unused import

* fix errs, _before_call

* start execute tests

* fix fmt

* fix after_call

* add execute tests

* add abi interface

* add reentrancy mock for timelock

* add tests for cancel and update_delay

* fix hash_op test

* add execute with predecessor test

* add timelock utils, add operation_state debug impl

* fix fmt

* improve imports

* improve _execute

* add basic mock for tests

* add tmp call struct

* add batch fns to interface

* add batch fns

* refactor tests to use dedicated mock, add batch tests

* fix fmt

* remove use clause

* add timelock mixin

* fix interface name

* improve event assertions

* fix execute and schedule events

* fix fmt

* add safe token transfer tests

* fix fmt

* tidy up code

* add descriptions to events

* clean up code

* inline CallPartialEq fns

* start fn descriptions

* remove comments

* remove comment

* fix fmt

* add changelog entries

* improve spacing

* add line break to hash test

* clean up tests

* clean up tests

* fix constants in attacker impl

* add initializer helper, register access control support

* add _before_call and _after_call tests

* fix reentrant batch mock call

* add _schedule and _execute tests

* add timelock description

* fix formatting

* fix comments

* fix comment

* fmt

* tidy up tests

* remove batch helper fn

* remove event from mocks

* Apply suggestions from code review

Co-authored-by: Eric Nordelo <[email protected]>

* update spdx

* remove token receiver support

* add additional cancel tests

* Apply suggestions from code review

Co-authored-by: Eric Nordelo <[email protected]>

* initializer: remove mut, use while loop

* fix fmt

* add assert_only_self fn

* fix getter comments re: pending/waiting

* add assert_only_role

* add specific op errors

* make event names consistent

* fix test

* remove serialization from HashCallImpl

* remove unused components from mock

* clean up code

* update to 2.7.0-rc.1

* fix fmt

* import Call from corelib

* update spdx

* fix fmt

* move OperationState, derive debug

* fix fmt

* fix hash impls

* add for loops

* fix PartialEq, add tests

* fix fmt

* simplify mixin fns

* switch Poseidon to Pedersen

* make admin a req in initializer

* update tests with admin

* fix fmt

* fix comment

* undo changes

* add no admin initializer test

---------

Co-authored-by: Eric Nordelo <[email protected]>

* fix fmt

* bump scarb to 2.7.0-rc.4 (#1064)

* bump scarb to 2.7.0-rc.4

* add changelog

* bump scarb in installation page

* fix fmt

* feat: update workflow and fix warning (#1066)

* bump scarb

* add tmp usc install in ci

* fix changelog

---------

Co-authored-by: Eric Nordelo <[email protected]>
Co-authored-by: ericnordelo <[email protected]>
Co-authored-by: JChoy <[email protected]>

* Update docs/modules/ROOT/pages/components.adoc

Co-authored-by: Andrew Fleming <[email protected]>

* Update docs/modules/ROOT/pages/components.adoc

Co-authored-by: Andrew Fleming <[email protected]>

* feat: apply review updates

* feat: update governance package

* refactor: format files

* refactor: remove unused files

* fix: workflow

* refactor: remove warnings

* feat: remove old tests

---------

Co-authored-by: Andrew Fleming <[email protected]>
Co-authored-by: immrsd <[email protected]>
Co-authored-by: Andrew Fleming <[email protected]>
Co-authored-by: Alex Metelli <[email protected]>
Co-authored-by: ericnordelo <[email protected]>
Co-authored-by: JChoy <[email protected]>
  • Loading branch information
7 people authored Aug 2, 2024
1 parent 8561d75 commit 4f1d539
Show file tree
Hide file tree
Showing 215 changed files with 2,231 additions and 890 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
*.md
!PULL_REQUEST_TEMPLATE.md
- name: Cairo lint
run: scarb fmt --check
run: scarb fmt --check --workspace
- name: Temporary USC manually install
run: |
curl -L https://raw.githubusercontent.com/software-mansion/universal-sierra-compiler/master/scripts/install.sh | sh -s -- v2.2.0-rc.1
- name: Cairo test
run: snforge test
run: snforge test --workspace
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- TimelockController component (#996)
- HashCall implementation (#996)
- Separated package for each submodule (#1065)
- `openzeppelin_access`
- `openzeppelin_account`
- `openzeppelin_governance`
- `openzeppelin_introspection`
- `openzeppelin_presets`
- `openzeppelin_security`
- `openzeppelin_token`
- `openzeppelin_upgrades`
- `openzeppelin_utils`

### Changed

- Bump scarb to v2.7.0-rc.1 (#1025)
- Bump scarb to v2.7.0-rc.2 (#1052)
- Bump scarb to v2.7.0-rc.4 (#1064)
- Bump scarb to v2.7.0 (#1065)

## 0.15.0-rc.0 (2024-07-8)

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Edit `scarb.toml` and add:
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.0-rc.0" }
```

The previous example would import the entire library. we can also add each package as a separated dependency to improve the time for building by not including modules that won't be used:

```toml
[dependencies]
openzeppelin_token = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.0-rc.0" }
```

Build the project to download it:

```bash
Expand All @@ -65,6 +72,7 @@ For example, this is how to write an ERC20-compliant contract:
```cairo
#[starknet::contract]
mod MyToken {
// If only the token package was added as a dependency, use `openzeppelin_token::` instead
use openzeppelin::token::erc20::{ERC20Component, ERC20HooksEmptyImpl};
use starknet::ContractAddress;
Expand Down
90 changes: 90 additions & 0 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,96 @@ version = 1
[[package]]
name = "openzeppelin"
version = "0.15.0-rc.0"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
"snforge_std",
]

[[package]]
name = "openzeppelin_access"
version = "0.15.0-rc.0"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
"snforge_std",
]

[[package]]
name = "openzeppelin_account"
version = "0.15.0-rc.0"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_utils",
"snforge_std",
]

[[package]]
name = "openzeppelin_governance"
version = "0.15.0-rc.0"
dependencies = [
"openzeppelin_access",
"openzeppelin_introspection",
"openzeppelin_utils",
"snforge_std",
]

[[package]]
name = "openzeppelin_introspection"
version = "0.15.0-rc.0"
dependencies = [
"snforge_std",
]

[[package]]
name = "openzeppelin_presets"
version = "0.15.0-rc.0"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_upgrades",
"snforge_std",
]

[[package]]
name = "openzeppelin_security"
version = "0.15.0-rc.0"
dependencies = [
"openzeppelin_utils",
"snforge_std",
]

[[package]]
name = "openzeppelin_token"
version = "0.15.0-rc.0"
dependencies = [
"openzeppelin_account",
"openzeppelin_governance",
"openzeppelin_introspection",
"snforge_std",
]

[[package]]
name = "openzeppelin_upgrades"
version = "0.15.0-rc.0"
dependencies = [
"openzeppelin_utils",
"snforge_std",
]

[[package]]
name = "openzeppelin_utils"
version = "0.15.0-rc.0"
dependencies = [
"snforge_std",
]
Expand Down
53 changes: 47 additions & 6 deletions Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,68 @@
[workspace]
members = [
"packages/access",
"packages/account",
"packages/governance",
"packages/introspection",
"packages/presets",
"packages/security",
"packages/token",
"packages/upgrades",
"packages/utils",
]

[package]
name = "openzeppelin"
version.workspace = true

[workspace.package]
version = "0.15.0-rc.0"
edition = "2023_11"
cairo-version = "2.7.0-rc.3"
scarb-version = "2.7.0-rc.4"
cairo-version = "2.7.0"
scarb-version = "2.7.0"
authors = ["OpenZeppelin Community <[email protected]>"]
description = "OpenZeppelin Contracts written in Cairo for StarkNet, a decentralized ZK Rollup"
documentation = "https://docs.openzeppelin.com/contracts-cairo"
readme = "README.md"
repository = "https://github.com/OpenZeppelin/cairo-contracts"
license-file = "LICENSE"
keywords = ["openzeppelin", "starknet", "cairo", "contracts", "security", "standards"]
keywords = [
"openzeppelin",
"starknet",
"cairo",
"contracts",
"security",
"standards",
]

[dependencies]
starknet = "2.7.0-rc.3"
[workspace.dependencies]
starknet = "2.7.0"
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.26.0" }

[dependencies]
starknet.workspace = true
openzeppelin_access = { path = "packages/access" }
openzeppelin_account = { path = "packages/account" }
openzeppelin_governance = { path = "packages/governance" }
openzeppelin_introspection = { path = "packages/introspection" }
openzeppelin_presets = { path = "packages/presets" }
openzeppelin_security = { path = "packages/security" }
openzeppelin_token = { path = "packages/token" }
openzeppelin_upgrades = { path = "packages/upgrades" }
openzeppelin_utils = { path = "packages/utils" }

[dev-dependencies]
snforge_std.workspace = true

[lib]

[[target.starknet-contract]]
allowed-libfuncs-list.name = "experimental"
sierra = true
casm = false

[tool.fmt]
[workspace.tool.fmt]
sort-module-level-items = true

[tool]
fmt.workspace = true
12 changes: 6 additions & 6 deletions docs/modules/ROOT/pages/api/utilities.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:deploy_syscall: link:https://docs.starknet.io/documentation/architecture_and_concepts/Smart_Contracts/system-calls-cairo1/#deploy[deploy_syscall]

The following documentation provides reasoning and examples for functions and constants found in `openzeppelin::utils`
and `openzeppelin::tests::utils`.
and `use openzeppelin::utils::test_utils;`.

CAUTION: Expect this module to evolve (as it has already done).

Expand Down Expand Up @@ -387,7 +387,7 @@ xref:/guides/snip12.adoc[SNIP12 and Typed Messages] guide.
=== `++utils++`

```cairo
use openzeppelin::tests::utils;
use openzeppelin::utils::test_utils;
```

Module containing utilities for testing the library.
Expand Down Expand Up @@ -420,14 +420,14 @@ Usage example:

```cairo
use openzeppelin::presets::AccountUpgradeable;
use openzeppelin::tests::utils;
use openzeppelin::utils::test_utils;
use starknet::ContractAddress;

const PUBKEY: felt252 = 'PUBKEY';

fn deploy_test_contract() -> ContractAddress {
let calldata = array![PUBKEY];
utils::deploy(AccountUpgradeable::TEST_CLASS_HASH, calldata)
test_utils::deploy(AccountUpgradeable::TEST_CLASS_HASH, calldata)
}
```

Expand Down Expand Up @@ -459,15 +459,15 @@ Requirements:
Usage example:

```cairo
use openzeppelin::tests::utils;
use openzeppelin::utils::test_utils;
use openzeppelin::token::erc20::ERC20Component;
use openzeppelin::token::erc20::ERC20Component::Transfer;
use starknet::ContractAddress;

fn assert_emitted_event(
target: ContractAddress, from: ContractAddress, to: ContractAddress, value: u256
) {
let event = utils::pop_log::<ERC20Component::Event>(target).unwrap();
let event = test_utils::pop_log::<ERC20Component::Event>(target).unwrap();
let expected = ERC20Component::Event::Transfer(Transfer { from, to, value });
assert!(event == expected);
}
Expand Down
31 changes: 31 additions & 0 deletions packages/access/Scarb.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[package]
name = "openzeppelin_access"
version.workspace = true
edition.workspace = true
cairo-version.workspace = true
scarb-version.workspace = true
authors.workspace = true
description.workspace = true
documentation.workspace = true
readme.workspace = true
repository.workspace = true
license-file.workspace = true
keywords.workspace = true

[tool]
fmt.workspace = true

[dependencies]
starknet.workspace = true
openzeppelin_introspection = { path = "../introspection" }
openzeppelin_utils = { path = "../utils" }

[dev-dependencies]
snforge_std.workspace = true

[lib]

[[target.starknet-contract]]
allowed-libfuncs-list.name = "experimental"
sierra = true
casm = false
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
/// Roles are referred to by their `felt252` identifier.
#[starknet::component]
pub mod AccessControlComponent {
use openzeppelin::access::accesscontrol::interface;
use openzeppelin::introspection::src5::SRC5Component::InternalImpl as SRC5InternalImpl;
use openzeppelin::introspection::src5::SRC5Component::SRC5Impl;
use openzeppelin::introspection::src5::SRC5Component;
use openzeppelin_access::accesscontrol::interface;
use openzeppelin_introspection::src5::SRC5Component::InternalImpl as SRC5InternalImpl;
use openzeppelin_introspection::src5::SRC5Component::SRC5Impl;
use openzeppelin_introspection::src5::SRC5Component;
use starknet::ContractAddress;
use starknet::get_caller_address;
use starknet::storage::Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts for Cairo v0.15.0-rc.0 (access/accesscontrol/dual_accesscontrol.cairo)

use openzeppelin::utils::UnwrapAndCast;
use openzeppelin::utils::selectors;
use openzeppelin::utils::serde::SerializedAppend;
use openzeppelin::utils::try_selector_with_fallback;
use openzeppelin_utils::selectors;
use openzeppelin_utils::serde::SerializedAppend;
use openzeppelin_utils::try_selector_with_fallback;
use openzeppelin_utils::unwrap_and_cast::UnwrapAndCast;
use starknet::ContractAddress;
use starknet::SyscallResultTrait;
use starknet::syscalls::call_contract_syscall;
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/access.cairo → packages/access/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pub mod accesscontrol;
pub mod ownable;

pub mod tests;
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts for Cairo v0.15.0-rc.0 (access/ownable/dual_ownable.cairo)

use openzeppelin::utils::UnwrapAndCast;
use openzeppelin::utils::selectors;
use openzeppelin::utils::serde::SerializedAppend;
use openzeppelin::utils::try_selector_with_fallback;
use openzeppelin_utils::UnwrapAndCast;
use openzeppelin_utils::selectors;
use openzeppelin_utils::serde::SerializedAppend;
use openzeppelin_utils::try_selector_with_fallback;
use starknet::ContractAddress;
use starknet::SyscallResultTrait;
use starknet::syscalls::call_contract_syscall;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#[starknet::component]
pub mod OwnableComponent {
use core::num::traits::Zero;
use openzeppelin::access::ownable::interface::IOwnableTwoStep;
use openzeppelin::access::ownable::interface;
use openzeppelin_access::ownable::interface::IOwnableTwoStep;
use openzeppelin_access::ownable::interface;
use starknet::ContractAddress;
use starknet::get_caller_address;

Expand Down
8 changes: 7 additions & 1 deletion src/tests/access.cairo → packages/access/src/tests.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
pub(crate) mod common;
pub mod common;
pub(crate) mod mocks;

#[cfg(test)]
mod test_accesscontrol;
#[cfg(test)]
mod test_dual_accesscontrol;
#[cfg(test)]
mod test_dual_ownable;
#[cfg(test)]
mod test_ownable;
#[cfg(test)]
mod test_ownable_twostep;
Loading

0 comments on commit 4f1d539

Please sign in to comment.