-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: link (#545) * feat: update logic * feat: add mocks * docs: update * feat: update docs * Update src/account/account.cairo Co-authored-by: Andrew Fleming <[email protected]> * feat: apply review updates * feat: update overview * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <[email protected]> * feat: apply review updates * feat: flatten events * feat: add account preset * feat: apply review updates * feat: apply review updates * feat: remove preset * Revert "feat: remove preset" This reverts commit 472b04c. * fix: merge unresolved conflicts * docs: update * Update src/presets/account.cairo Co-authored-by: Andrew Fleming <[email protected]> * feat: apply review updates * feat: add account preset section * Update docs/modules/ROOT/pages/api/account.adoc Co-authored-by: Martín Triay <[email protected]> * Update src/presets/account.cairo Co-authored-by: Martín Triay <[email protected]> * Update src/presets/account.cairo Co-authored-by: Martín Triay <[email protected]> * feat: apply review updates --------- Co-authored-by: Andrew Fleming <[email protected]> Co-authored-by: Martín Triay <[email protected]>
- Loading branch information
1 parent
4eafccf
commit 7a8231a
Showing
9 changed files
with
564 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod account; | ||
|
||
use account::Account; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts for Cairo v0.8.0-beta.0 (presets/account.cairo) | ||
|
||
/// # Account Preset | ||
/// | ||
/// OpenZeppelin's basic account which can change its public key and declare, deploy, or call contracts. | ||
#[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>; | ||
|
||
// 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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod test_account; |
Oops, something went wrong.