-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert
katana/contracts
into a Scarb workspace (#2523)
- Loading branch information
Showing
15 changed files
with
220 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
target/ | ||
.snfoundry_cache/ |
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 @@ | ||
scarb 2.8.3 |
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 @@ | ||
Contract classes used in Katana |
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,115 @@ | ||
# Code generated by scarb DO NOT EDIT. | ||
version = 1 | ||
|
||
[[package]] | ||
name = "katana_account" | ||
version = "0.1.0" | ||
dependencies = [ | ||
"openzeppelin", | ||
] | ||
|
||
[[package]] | ||
name = "katana_messaging" | ||
version = "0.1.0" | ||
|
||
[[package]] | ||
name = "openzeppelin" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
dependencies = [ | ||
"openzeppelin_access", | ||
"openzeppelin_account", | ||
"openzeppelin_finance", | ||
"openzeppelin_governance", | ||
"openzeppelin_introspection", | ||
"openzeppelin_merkle_tree", | ||
"openzeppelin_presets", | ||
"openzeppelin_security", | ||
"openzeppelin_token", | ||
"openzeppelin_upgrades", | ||
"openzeppelin_utils", | ||
] | ||
|
||
[[package]] | ||
name = "openzeppelin_access" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
dependencies = [ | ||
"openzeppelin_introspection", | ||
"openzeppelin_utils", | ||
] | ||
|
||
[[package]] | ||
name = "openzeppelin_account" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
dependencies = [ | ||
"openzeppelin_introspection", | ||
"openzeppelin_utils", | ||
] | ||
|
||
[[package]] | ||
name = "openzeppelin_finance" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
dependencies = [ | ||
"openzeppelin_access", | ||
"openzeppelin_token", | ||
] | ||
|
||
[[package]] | ||
name = "openzeppelin_governance" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
dependencies = [ | ||
"openzeppelin_access", | ||
"openzeppelin_introspection", | ||
] | ||
|
||
[[package]] | ||
name = "openzeppelin_introspection" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
|
||
[[package]] | ||
name = "openzeppelin_merkle_tree" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
|
||
[[package]] | ||
name = "openzeppelin_presets" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
dependencies = [ | ||
"openzeppelin_access", | ||
"openzeppelin_account", | ||
"openzeppelin_finance", | ||
"openzeppelin_introspection", | ||
"openzeppelin_token", | ||
"openzeppelin_upgrades", | ||
] | ||
|
||
[[package]] | ||
name = "openzeppelin_security" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
|
||
[[package]] | ||
name = "openzeppelin_token" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
dependencies = [ | ||
"openzeppelin_account", | ||
"openzeppelin_governance", | ||
"openzeppelin_introspection", | ||
] | ||
|
||
[[package]] | ||
name = "openzeppelin_upgrades" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" | ||
|
||
[[package]] | ||
name = "openzeppelin_utils" | ||
version = "0.17.0" | ||
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289" |
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,14 @@ | ||
[workspace] | ||
members = [ "account", "messaging/cairo" ] | ||
|
||
[workspace.package] | ||
version = "0.1.0" | ||
edition = "2023_11" | ||
|
||
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html | ||
|
||
[workspace.dependencies] | ||
starknet = "2.8.2" | ||
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.17.0" } | ||
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.31.0" } | ||
assert_macros = "2.8.2" |
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,13 @@ | ||
[package] | ||
name = "katana_account" | ||
version.workspace = true | ||
edition.workspace = true | ||
|
||
# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html | ||
|
||
[dependencies] | ||
starknet.workspace = true | ||
openzeppelin.workspace = true | ||
|
||
[[target.starknet-contract]] | ||
sierra = true |
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,62 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts for Cairo v0.17.0 (presets/account.cairo) | ||
|
||
/// # Account Preset | ||
/// | ||
/// OpenZeppelin's upgradeable account which can change its public key and declare, deploy, or call | ||
/// contracts. | ||
#[starknet::contract(account)] | ||
pub mod Account { | ||
use openzeppelin_account::AccountComponent; | ||
use openzeppelin_introspection::src5::SRC5Component; | ||
use openzeppelin_upgrades::UpgradeableComponent; | ||
use openzeppelin_upgrades::interface::IUpgradeable; | ||
use starknet::ClassHash; | ||
|
||
component!(path: AccountComponent, storage: account, event: AccountEvent); | ||
component!(path: SRC5Component, storage: src5, event: SRC5Event); | ||
component!(path: UpgradeableComponent, storage: upgradeable, event: UpgradeableEvent); | ||
|
||
// Account Mixin | ||
#[abi(embed_v0)] | ||
pub(crate) impl AccountMixinImpl = | ||
AccountComponent::AccountMixinImpl<ContractState>; | ||
impl AccountInternalImpl = AccountComponent::InternalImpl<ContractState>; | ||
|
||
// Upgradeable | ||
impl UpgradeableInternalImpl = UpgradeableComponent::InternalImpl<ContractState>; | ||
|
||
#[storage] | ||
pub struct Storage { | ||
#[substorage(v0)] | ||
pub account: AccountComponent::Storage, | ||
#[substorage(v0)] | ||
pub src5: SRC5Component::Storage, | ||
#[substorage(v0)] | ||
pub upgradeable: UpgradeableComponent::Storage | ||
} | ||
|
||
#[event] | ||
#[derive(Drop, starknet::Event)] | ||
enum Event { | ||
#[flat] | ||
AccountEvent: AccountComponent::Event, | ||
#[flat] | ||
SRC5Event: SRC5Component::Event, | ||
#[flat] | ||
UpgradeableEvent: UpgradeableComponent::Event | ||
} | ||
|
||
#[constructor] | ||
pub fn constructor(ref self: ContractState, public_key: felt252) { | ||
self.account.initializer(public_key); | ||
} | ||
|
||
#[abi(embed_v0)] | ||
impl UpgradeableImpl of IUpgradeable<ContractState> { | ||
fn upgrade(ref self: ContractState, new_class_hash: ClassHash) { | ||
self.account.assert_only_self(); | ||
self.upgradeable.upgrade(new_class_hash); | ||
} | ||
} | ||
} |
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 @@ | ||
Legacy (Cairo 0) contracts. Not compilable as they are mainly used as references. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
# Visit https://foundry-rs.github.io/starknet-foundry/appendix/snfoundry-toml.html for more information | ||
|
||
# [sncast.myprofile1] # Define a profile name | ||
# url = "http://127.0.0.1:5050/" # Url of the RPC provider | ||
# accounts_file = "../account-file" # Path to the file with the account data | ||
# account = "mainuser" # Account from `accounts_file` or default account file that will be used for the transactions | ||
# keystore = "~/keystore" # Path to the keystore file | ||
# wait_params = { timeout = 500, retry_interval = 10 } # Wait for submitted transaction parameters | ||
# block_explorer = "StarkScan" # Block explorer service used to display links to transaction details |