Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Account preset #803

Merged
merged 36 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
331844d
fix: link (#545)
ericnordelo Jan 20, 2023
2e7758e
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts
ericnordelo Oct 6, 2023
77cca2d
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts
ericnordelo Oct 10, 2023
4fc9be5
feat: update logic
ericnordelo Oct 10, 2023
ce91ed0
feat: add mocks
ericnordelo Oct 10, 2023
4a90358
docs: update
ericnordelo Oct 11, 2023
7f74150
feat: update docs
ericnordelo Oct 11, 2023
bff9179
Update src/account/account.cairo
ericnordelo Oct 18, 2023
4415191
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo Oct 18, 2023
100c483
feat: apply review updates
ericnordelo Oct 18, 2023
b3e2106
Merge branch 'feat/migrate-account-to-component' of github.com:ericno…
ericnordelo Oct 18, 2023
0570e44
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo Oct 18, 2023
52df8b1
feat: update overview
ericnordelo Oct 18, 2023
9705ce7
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Oct 23, 2023
feeac44
feat: apply review updates
ericnordelo Oct 23, 2023
0f64992
Merge branch 'feat/migrate-account-to-component' of github.com:ericno…
ericnordelo Oct 23, 2023
f9ce9eb
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo Oct 24, 2023
fcdcdf7
feat: flatten events
ericnordelo Oct 24, 2023
d12a610
feat: add account preset
ericnordelo Oct 25, 2023
66c3fd7
feat: apply review updates
ericnordelo Oct 30, 2023
daa9d68
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo Oct 30, 2023
495ff94
feat: apply review updates
ericnordelo Oct 30, 2023
472b04c
feat: remove preset
ericnordelo Oct 30, 2023
ce3ef47
Revert "feat: remove preset"
ericnordelo Oct 30, 2023
2b32a3e
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo Nov 3, 2023
5e03f4c
fix: merge unresolved conflicts
ericnordelo Nov 3, 2023
e8d6d89
docs: update
ericnordelo Nov 3, 2023
95dd1a6
Update src/presets/account.cairo
ericnordelo Nov 7, 2023
b6628ce
feat: apply review updates
ericnordelo Nov 7, 2023
70088ff
Merge branch 'feat/add-account-preset' of github.com:ericnordelo/cair…
ericnordelo Nov 7, 2023
26b7988
feat: add account preset section
ericnordelo Nov 7, 2023
4dc2a22
Update docs/modules/ROOT/pages/api/account.adoc
ericnordelo Nov 10, 2023
af26be2
Update src/presets/account.cairo
ericnordelo Nov 10, 2023
ba94871
Update src/presets/account.cairo
ericnordelo Nov 10, 2023
b36755f
feat: apply review updates
ericnordelo Nov 10, 2023
ed93269
Merge branch 'feat/add-account-preset' of github.com:ericnordelo/cair…
ericnordelo Nov 10, 2023
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
1 change: 1 addition & 0 deletions src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mod access;
mod account;
mod introspection;
mod presets;
mod security;
#[cfg(test)]
mod tests;
Expand Down
3 changes: 3 additions & 0 deletions src/presets.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mod account;

use account::Account;
55 changes: 55 additions & 0 deletions src/presets/account.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts for Cairo v0.7.0 (account/presets/account.cairo)
ericnordelo marked this conversation as resolved.
Show resolved Hide resolved

/// # Account Preset
///
/// Openzeppelin's account contract.
martriay marked this conversation as resolved.
Show resolved Hide resolved
#[starknet::contract]
mod Account {
use openzeppelin::account::AccountComponent;
use openzeppelin::introspection::src5::SRC5Component;

component!(path: AccountComponent, storage: account, event: AccountEvent);
component!(path: SRC5Component, storage: src5, event: SRC5Event);

// Account
#[abi(embed_v0)]
impl SRC6Impl = AccountComponent::SRC6Impl<ContractState>;
#[abi(embed_v0)]
impl SRC6CamelOnlyImpl = AccountComponent::SRC6CamelOnlyImpl<ContractState>;
#[abi(embed_v0)]
impl PublicKeyImpl = AccountComponent::PublicKeyImpl<ContractState>;
#[abi(embed_v0)]
impl PublicKeyCamelImpl = AccountComponent::PublicKeyCamelImpl<ContractState>;
#[abi(embed_v0)]
impl DeclarerImpl = AccountComponent::DeclarerImpl<ContractState>;
#[abi(embed_v0)]
impl DeployableImpl = AccountComponent::DeployableImpl<ContractState>;
impl AccountInternalImpl = AccountComponent::InternalImpl<ContractState>;
martriay marked this conversation as resolved.
Show resolved Hide resolved

// SRC5
#[abi(embed_v0)]
impl SRC5Impl = SRC5Component::SRC5Impl<ContractState>;

#[storage]
struct Storage {
#[substorage(v0)]
account: AccountComponent::Storage,
#[substorage(v0)]
src5: SRC5Component::Storage
}

#[event]
#[derive(Drop, starknet::Event)]
enum Event {
#[flat]
AccountEvent: AccountComponent::Event,
#[flat]
SRC5Event: SRC5Component::Event
}

#[constructor]
fn constructor(ref self: ContractState, public_key: felt252) {
self.account.initializer(public_key);
}
}
1 change: 1 addition & 0 deletions src/tests.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ mod access;
mod account;
mod introspection;
mod mocks;
mod presets;
mod security;
mod token;
mod upgrades;
Expand Down
1 change: 1 addition & 0 deletions src/tests/presets.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod test_account;
Loading