From afe032553f3eff650ff32088b63f55046991a397 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 26 Aug 2024 11:14:38 -0500 Subject: [PATCH 01/19] start declare script --- packages/presets/scripts/Scarb.lock | 71 +++++++++++++++++++ packages/presets/scripts/Scarb.toml | 23 ++++++ .../presets/scripts/src/declare_presets.cairo | 1 + .../src/declare_presets/declare_presets.cairo | 47 ++++++++++++ packages/presets/scripts/src/lib.cairo | 1 + 5 files changed, 143 insertions(+) create mode 100644 packages/presets/scripts/Scarb.lock create mode 100644 packages/presets/scripts/Scarb.toml create mode 100644 packages/presets/scripts/src/declare_presets.cairo create mode 100644 packages/presets/scripts/src/declare_presets/declare_presets.cairo create mode 100644 packages/presets/scripts/src/lib.cairo diff --git a/packages/presets/scripts/Scarb.lock b/packages/presets/scripts/Scarb.lock new file mode 100644 index 000000000..c53c62e7a --- /dev/null +++ b/packages/presets/scripts/Scarb.lock @@ -0,0 +1,71 @@ +# Code generated by scarb DO NOT EDIT. +version = 1 + +[[package]] +name = "declare_presets" +version = "0.15.1" +dependencies = [ + "openzeppelin_presets", + "sncast_std", +] + +[[package]] +name = "openzeppelin_access" +version = "0.15.1" +dependencies = [ + "openzeppelin_introspection", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_account" +version = "0.15.1" +dependencies = [ + "openzeppelin_introspection", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_governance" +version = "0.15.1" +dependencies = [ + "openzeppelin_access", + "openzeppelin_introspection", +] + +[[package]] +name = "openzeppelin_introspection" +version = "0.15.1" + +[[package]] +name = "openzeppelin_presets" +version = "0.15.1" +dependencies = [ + "openzeppelin_access", + "openzeppelin_account", + "openzeppelin_introspection", + "openzeppelin_token", + "openzeppelin_upgrades", +] + +[[package]] +name = "openzeppelin_token" +version = "0.15.1" +dependencies = [ + "openzeppelin_account", + "openzeppelin_governance", + "openzeppelin_introspection", +] + +[[package]] +name = "openzeppelin_upgrades" +version = "0.15.1" + +[[package]] +name = "openzeppelin_utils" +version = "0.15.1" + +[[package]] +name = "sncast_std" +version = "0.27.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de" diff --git a/packages/presets/scripts/Scarb.toml b/packages/presets/scripts/Scarb.toml new file mode 100644 index 000000000..5e8344872 --- /dev/null +++ b/packages/presets/scripts/Scarb.toml @@ -0,0 +1,23 @@ +[package] +name = "declare_presets" +version = "0.15.1" + +[dependencies] +starknet = "2.7.1" +sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } +openzeppelin_presets = { path = "../" } + +[lib] +sierra = true +casm = true + +[[target.starknet-contract]] +sierra = true +casm = true +build-external-contracts = [ + "openzeppelin_presets::account::AccountUpgradeable", + "openzeppelin_presets::erc20::ERC20Upgradeable", + "openzeppelin_presets::erc721::ERC721Upgradeable", + "openzeppelin_presets::erc1155::ERC1155Upgradeable", + "openzeppelin_presets::eth_account::EthAccountUpgradeable", +] diff --git a/packages/presets/scripts/src/declare_presets.cairo b/packages/presets/scripts/src/declare_presets.cairo new file mode 100644 index 000000000..b62967d68 --- /dev/null +++ b/packages/presets/scripts/src/declare_presets.cairo @@ -0,0 +1 @@ +mod declare_presets; diff --git a/packages/presets/scripts/src/declare_presets/declare_presets.cairo b/packages/presets/scripts/src/declare_presets/declare_presets.cairo new file mode 100644 index 000000000..f8ca48c5c --- /dev/null +++ b/packages/presets/scripts/src/declare_presets/declare_presets.cairo @@ -0,0 +1,47 @@ +use sncast_std::{declare, DeclareResult, get_nonce, + DisplayClassHash, FeeSettings, EthFeeSettings +}; +use sncast_std::{ScriptCommandError, ProviderError, StarknetError}; +use sncast_std::StarknetError::{ClassAlreadyDeclared}; +use sncast_std::ProviderError::{UnknownError}; +use sncast_std::ErrorData; + +fn main() { + let max_fee = 99999999999999999; + let nonce = get_nonce('latest'); + + let account_res = declare( + "AccountUpgradeable", + FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), + Option::Some(nonce) + ).unwrap_err(); + println!("{:?}", account_res); + + let erc20_res = declare( + "ERC20Upgradeable", + FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), + Option::Some(nonce) + ).unwrap_err(); + println!("{:?}", erc20_res); + + let erc721_res = declare( + "ERC721Upgradeable", + FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), + Option::Some(nonce) + ).unwrap_err(); + println!("{:?}", erc721_res); + + let erc1155_res = declare( + "ERC1155Upgradeable", + FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), + Option::Some(nonce) + ).unwrap_err(); + println!("{:?}", erc1155_res); + + let eth_account_res = declare( + "EthAccountUpgradeable", + FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), + Option::Some(nonce) + ).unwrap_err(); + println!("{:?}", eth_account_res); +} \ No newline at end of file diff --git a/packages/presets/scripts/src/lib.cairo b/packages/presets/scripts/src/lib.cairo new file mode 100644 index 000000000..3db3c6b1f --- /dev/null +++ b/packages/presets/scripts/src/lib.cairo @@ -0,0 +1 @@ +mod declare_presets; \ No newline at end of file From 448e326b220fe2bfd7cf5a7349cf97cf29e76780 Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 26 Aug 2024 18:25:13 -0500 Subject: [PATCH 02/19] fix fmt --- .../src/declare_presets/declare_presets.cairo | 27 ++++++++++--------- packages/presets/scripts/src/lib.cairo | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/presets/scripts/src/declare_presets/declare_presets.cairo b/packages/presets/scripts/src/declare_presets/declare_presets.cairo index f8ca48c5c..b688051de 100644 --- a/packages/presets/scripts/src/declare_presets/declare_presets.cairo +++ b/packages/presets/scripts/src/declare_presets/declare_presets.cairo @@ -1,10 +1,8 @@ -use sncast_std::{declare, DeclareResult, get_nonce, - DisplayClassHash, FeeSettings, EthFeeSettings -}; -use sncast_std::{ScriptCommandError, ProviderError, StarknetError}; -use sncast_std::StarknetError::{ClassAlreadyDeclared}; -use sncast_std::ProviderError::{UnknownError}; use sncast_std::ErrorData; +use sncast_std::ProviderError::{UnknownError}; +use sncast_std::StarknetError::{ClassAlreadyDeclared}; +use sncast_std::{declare, DeclareResult, get_nonce, DisplayClassHash, FeeSettings, EthFeeSettings}; +use sncast_std::{ScriptCommandError, ProviderError, StarknetError}; fn main() { let max_fee = 99999999999999999; @@ -14,34 +12,39 @@ fn main() { "AccountUpgradeable", FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), Option::Some(nonce) - ).unwrap_err(); + ) + .unwrap_err(); println!("{:?}", account_res); let erc20_res = declare( "ERC20Upgradeable", FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), Option::Some(nonce) - ).unwrap_err(); + ) + .unwrap_err(); println!("{:?}", erc20_res); let erc721_res = declare( "ERC721Upgradeable", FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), Option::Some(nonce) - ).unwrap_err(); + ) + .unwrap_err(); println!("{:?}", erc721_res); let erc1155_res = declare( "ERC1155Upgradeable", FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), Option::Some(nonce) - ).unwrap_err(); + ) + .unwrap_err(); println!("{:?}", erc1155_res); let eth_account_res = declare( "EthAccountUpgradeable", FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), Option::Some(nonce) - ).unwrap_err(); + ) + .unwrap_err(); println!("{:?}", eth_account_res); -} \ No newline at end of file +} diff --git a/packages/presets/scripts/src/lib.cairo b/packages/presets/scripts/src/lib.cairo index 3db3c6b1f..b62967d68 100644 --- a/packages/presets/scripts/src/lib.cairo +++ b/packages/presets/scripts/src/lib.cairo @@ -1 +1 @@ -mod declare_presets; \ No newline at end of file +mod declare_presets; From 3c57b5956c96eddeea391a0a481dbde8720341fc Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 26 Aug 2024 20:17:07 -0500 Subject: [PATCH 03/19] fix fmt --- .../presets/scripts/src/declare_presets/declare_presets.cairo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/presets/scripts/src/declare_presets/declare_presets.cairo b/packages/presets/scripts/src/declare_presets/declare_presets.cairo index b688051de..fe9fb1ef8 100644 --- a/packages/presets/scripts/src/declare_presets/declare_presets.cairo +++ b/packages/presets/scripts/src/declare_presets/declare_presets.cairo @@ -1,8 +1,8 @@ use sncast_std::ErrorData; use sncast_std::ProviderError::{UnknownError}; use sncast_std::StarknetError::{ClassAlreadyDeclared}; -use sncast_std::{declare, DeclareResult, get_nonce, DisplayClassHash, FeeSettings, EthFeeSettings}; use sncast_std::{ScriptCommandError, ProviderError, StarknetError}; +use sncast_std::{declare, DeclareResult, get_nonce, DisplayClassHash, FeeSettings, EthFeeSettings}; fn main() { let max_fee = 99999999999999999; From d9cacfa9742745497a96d9450d638ef11222e396 Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 22 Sep 2024 13:57:18 -0500 Subject: [PATCH 04/19] update Scarb --- packages/presets/scripts/Scarb.lock | 45 ++++++++++++++++++++++------- packages/presets/scripts/Scarb.toml | 7 +++-- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/packages/presets/scripts/Scarb.lock b/packages/presets/scripts/Scarb.lock index c53c62e7a..e6be49301 100644 --- a/packages/presets/scripts/Scarb.lock +++ b/packages/presets/scripts/Scarb.lock @@ -3,15 +3,16 @@ version = 1 [[package]] name = "declare_presets" -version = "0.15.1" +version = "0.16.0" dependencies = [ "openzeppelin_presets", + "openzeppelin_testing", "sncast_std", ] [[package]] name = "openzeppelin_access" -version = "0.15.1" +version = "0.16.0" dependencies = [ "openzeppelin_introspection", "openzeppelin_utils", @@ -19,7 +20,7 @@ dependencies = [ [[package]] name = "openzeppelin_account" -version = "0.15.1" +version = "0.16.0" dependencies = [ "openzeppelin_introspection", "openzeppelin_utils", @@ -27,7 +28,7 @@ dependencies = [ [[package]] name = "openzeppelin_governance" -version = "0.15.1" +version = "0.16.0" dependencies = [ "openzeppelin_access", "openzeppelin_introspection", @@ -35,11 +36,11 @@ dependencies = [ [[package]] name = "openzeppelin_introspection" -version = "0.15.1" +version = "0.16.0" [[package]] name = "openzeppelin_presets" -version = "0.15.1" +version = "0.16.0" dependencies = [ "openzeppelin_access", "openzeppelin_account", @@ -48,9 +49,16 @@ dependencies = [ "openzeppelin_upgrades", ] +[[package]] +name = "openzeppelin_testing" +version = "0.16.0" +dependencies = [ + "snforge_std", +] + [[package]] name = "openzeppelin_token" -version = "0.15.1" +version = "0.16.0" dependencies = [ "openzeppelin_account", "openzeppelin_governance", @@ -59,13 +67,28 @@ dependencies = [ [[package]] name = "openzeppelin_upgrades" -version = "0.15.1" +version = "0.16.0" [[package]] name = "openzeppelin_utils" -version = "0.15.1" +version = "0.16.0" [[package]] name = "sncast_std" -version = "0.27.0" -source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de" +version = "0.30.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.30.0#196f06b251926697c3d66800f2a93ae595e76496" + +[[package]] +name = "snforge_scarb_plugin" +version = "0.2.0" +source = "registry+https://scarbs.xyz/" +checksum = "sha256:2e4ce3ebe3f49548bd26908391b5d78537a765d827df0d96c32aeb88941d0d67" + +[[package]] +name = "snforge_std" +version = "0.30.0" +source = "registry+https://scarbs.xyz/" +checksum = "sha256:2f3c4846881813ac0f5d1460981249c9f5e2a6831e752beedf9b70975495b4ec" +dependencies = [ + "snforge_scarb_plugin", +] diff --git a/packages/presets/scripts/Scarb.toml b/packages/presets/scripts/Scarb.toml index 5e8344872..177961812 100644 --- a/packages/presets/scripts/Scarb.toml +++ b/packages/presets/scripts/Scarb.toml @@ -1,11 +1,12 @@ [package] name = "declare_presets" -version = "0.15.1" +version = "0.16.0" [dependencies] -starknet = "2.7.1" -sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } +starknet = "2.8.2" +sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.30.0" } openzeppelin_presets = { path = "../" } +openzeppelin_testing = { path = "../" } [lib] sierra = true From 3c2d97c0f0710b87a06698f609ba28839e9665c9 Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 22 Sep 2024 13:58:01 -0500 Subject: [PATCH 05/19] finish declare script --- .../src/declare_presets/declare_presets.cairo | 75 +++++++++---------- 1 file changed, 35 insertions(+), 40 deletions(-) diff --git a/packages/presets/scripts/src/declare_presets/declare_presets.cairo b/packages/presets/scripts/src/declare_presets/declare_presets.cairo index fe9fb1ef8..7c78467a1 100644 --- a/packages/presets/scripts/src/declare_presets/declare_presets.cairo +++ b/packages/presets/scripts/src/declare_presets/declare_presets.cairo @@ -1,50 +1,45 @@ -use sncast_std::ErrorData; -use sncast_std::ProviderError::{UnknownError}; -use sncast_std::StarknetError::{ClassAlreadyDeclared}; -use sncast_std::{ScriptCommandError, ProviderError, StarknetError}; -use sncast_std::{declare, DeclareResult, get_nonce, DisplayClassHash, FeeSettings, EthFeeSettings}; +use sncast_std::{declare, get_nonce, FeeSettings, EthFeeSettings}; +use openzeppelin_testing::common::IntoBase16String; fn main() { - let max_fee = 99999999999999999; - let nonce = get_nonce('latest'); - - let account_res = declare( + let contracts: Array = array![ "AccountUpgradeable", - FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), - Option::Some(nonce) - ) - .unwrap_err(); - println!("{:?}", account_res); - - let erc20_res = declare( "ERC20Upgradeable", - FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), - Option::Some(nonce) - ) - .unwrap_err(); - println!("{:?}", erc20_res); - - let erc721_res = declare( "ERC721Upgradeable", - FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), - Option::Some(nonce) - ) - .unwrap_err(); - println!("{:?}", erc721_res); - - let erc1155_res = declare( "ERC1155Upgradeable", - FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), - Option::Some(nonce) - ) - .unwrap_err(); - println!("{:?}", erc1155_res); + "EthAccountUpgradeable" + ]; + + let mut consume_latest_nonce = false; + let mut nonce = get_nonce('latest'); + + for contract in contracts { + if (!consume_latest_nonce) { + consume_latest_nonce = true; + } else { + nonce = get_nonce('pending'); + } + + declare_preset(contract, nonce); + }; - let eth_account_res = declare( - "EthAccountUpgradeable", + println!(""); +} + +fn declare_preset(contract: ByteArray, nonce: felt252) { + println!("\nDeclaring {contract}:"); + + let max_fee = 99999999999999999; + let declare_result = declare( + contract, FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), Option::Some(nonce) - ) - .unwrap_err(); - println!("{:?}", eth_account_res); + ); + + // Print output + // Note that the tx hash will already display from the declaration + match declare_result { + Result::Ok(r) => println!("Class hash = {}", r.class_hash.into_base_16_string()), + Result::Err(r) => println!("{:?}", r) + } } From cb9cb735d15bad21b8486d9de779ad4b674b8b5e Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 22 Sep 2024 15:22:52 -0500 Subject: [PATCH 06/19] fix fmt --- .../presets/scripts/src/declare_presets/declare_presets.cairo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/presets/scripts/src/declare_presets/declare_presets.cairo b/packages/presets/scripts/src/declare_presets/declare_presets.cairo index 7c78467a1..2ccc11c2a 100644 --- a/packages/presets/scripts/src/declare_presets/declare_presets.cairo +++ b/packages/presets/scripts/src/declare_presets/declare_presets.cairo @@ -1,5 +1,5 @@ -use sncast_std::{declare, get_nonce, FeeSettings, EthFeeSettings}; use openzeppelin_testing::common::IntoBase16String; +use sncast_std::{declare, get_nonce, FeeSettings, EthFeeSettings}; fn main() { let contracts: Array = array![ From 26d79d99d40dca4314d2eda0b5461060aeb5ed10 Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 22 Sep 2024 20:17:09 -0500 Subject: [PATCH 07/19] update scarb --- packages/presets/scripts/Scarb.lock | 12 +++++++++++- packages/presets/scripts/Scarb.toml | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/presets/scripts/Scarb.lock b/packages/presets/scripts/Scarb.lock index e6be49301..eda928429 100644 --- a/packages/presets/scripts/Scarb.lock +++ b/packages/presets/scripts/Scarb.lock @@ -26,6 +26,14 @@ dependencies = [ "openzeppelin_utils", ] +[[package]] +name = "openzeppelin_finance" +version = "0.16.0" +dependencies = [ + "openzeppelin_access", + "openzeppelin_token", +] + [[package]] name = "openzeppelin_governance" version = "0.16.0" @@ -44,6 +52,7 @@ version = "0.16.0" dependencies = [ "openzeppelin_access", "openzeppelin_account", + "openzeppelin_finance", "openzeppelin_introspection", "openzeppelin_token", "openzeppelin_upgrades", @@ -76,7 +85,8 @@ version = "0.16.0" [[package]] name = "sncast_std" version = "0.30.0" -source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.30.0#196f06b251926697c3d66800f2a93ae595e76496" +source = "registry+https://scarbs.xyz/" +checksum = "sha256:cfd7c73a6f9984880249babfa8664b69c5f7209c737b1081156a284061ccd41a" [[package]] name = "snforge_scarb_plugin" diff --git a/packages/presets/scripts/Scarb.toml b/packages/presets/scripts/Scarb.toml index 177961812..6bb7c38a8 100644 --- a/packages/presets/scripts/Scarb.toml +++ b/packages/presets/scripts/Scarb.toml @@ -4,7 +4,7 @@ version = "0.16.0" [dependencies] starknet = "2.8.2" -sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.30.0" } +sncast_std = "0.30.0" openzeppelin_presets = { path = "../" } openzeppelin_testing = { path = "../" } From 20404e5209a2608ddf8104cc62d94289cfa3c1ef Mon Sep 17 00:00:00 2001 From: andrew Date: Sun, 22 Sep 2024 20:17:30 -0500 Subject: [PATCH 08/19] move max_fee to const --- .../presets/scripts/src/declare_presets/declare_presets.cairo | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/presets/scripts/src/declare_presets/declare_presets.cairo b/packages/presets/scripts/src/declare_presets/declare_presets.cairo index 2ccc11c2a..82db3a3a6 100644 --- a/packages/presets/scripts/src/declare_presets/declare_presets.cairo +++ b/packages/presets/scripts/src/declare_presets/declare_presets.cairo @@ -1,6 +1,8 @@ use openzeppelin_testing::common::IntoBase16String; use sncast_std::{declare, get_nonce, FeeSettings, EthFeeSettings}; +const max_fee: felt252 = 99999999999999999; + fn main() { let contracts: Array = array![ "AccountUpgradeable", @@ -29,7 +31,6 @@ fn main() { fn declare_preset(contract: ByteArray, nonce: felt252) { println!("\nDeclaring {contract}:"); - let max_fee = 99999999999999999; let declare_result = declare( contract, FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), From 5faafd180eb7a2b1499824498f8558d1c091ae1f Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 23 Sep 2024 20:45:18 -0500 Subject: [PATCH 09/19] fix const --- .../presets/scripts/src/declare_presets/declare_presets.cairo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/presets/scripts/src/declare_presets/declare_presets.cairo b/packages/presets/scripts/src/declare_presets/declare_presets.cairo index 82db3a3a6..3279c34d0 100644 --- a/packages/presets/scripts/src/declare_presets/declare_presets.cairo +++ b/packages/presets/scripts/src/declare_presets/declare_presets.cairo @@ -1,7 +1,7 @@ use openzeppelin_testing::common::IntoBase16String; use sncast_std::{declare, get_nonce, FeeSettings, EthFeeSettings}; -const max_fee: felt252 = 99999999999999999; +const MAX_FEE: felt252 = 99999999999999999; fn main() { let contracts: Array = array![ @@ -33,7 +33,7 @@ fn declare_preset(contract: ByteArray, nonce: felt252) { let declare_result = declare( contract, - FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }), + FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(MAX_FEE) }), Option::Some(nonce) ); From 5bf86a5069a24870012ddc19f8ff1f712f1b9dec Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 24 Sep 2024 02:10:35 -0500 Subject: [PATCH 10/19] add readme to declare script --- packages/presets/scripts/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 packages/presets/scripts/README.md diff --git a/packages/presets/scripts/README.md b/packages/presets/scripts/README.md new file mode 100644 index 000000000..ecb8b9b66 --- /dev/null +++ b/packages/presets/scripts/README.md @@ -0,0 +1,21 @@ +# Declare Presets + +This crate provides a script to declare all presets from the Contracts for Cairo library. + +## Prerequisites + +This crate is meant to deploy on the sepolia network, so a deployed account contract with funds is required. +This crate can also be tested with [starknet-devnet](https://github.com/0xSpaceShard/starknet-devnet-rs). + +## Usage + +`cd` into the `scripts/` directory and run the script through Starknet Foundry's [scripting feature](https://foundry-rs.github.io/starknet-foundry/starknet/script.html). +Here's the command using a starkli-style account: + +```bash +sncast \ +--account path/to/account.json \ +--keystore path/to/key.json \ +script run declare_presets \ +--url http://127.0.0.1:5050 +``` From ccc83f414edcacef94e6246b95261a864dae6aed Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 24 Sep 2024 02:11:58 -0500 Subject: [PATCH 11/19] tidy up --- packages/presets/scripts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/presets/scripts/README.md b/packages/presets/scripts/README.md index ecb8b9b66..3e1e751c7 100644 --- a/packages/presets/scripts/README.md +++ b/packages/presets/scripts/README.md @@ -4,7 +4,7 @@ This crate provides a script to declare all presets from the Contracts for Cairo ## Prerequisites -This crate is meant to deploy on the sepolia network, so a deployed account contract with funds is required. +This crate is meant to execute on the sepolia network, so a deployed account contract with funds is required. This crate can also be tested with [starknet-devnet](https://github.com/0xSpaceShard/starknet-devnet-rs). ## Usage From dda57e5fc315538adc3e1cf8e027c62242156511 Mon Sep 17 00:00:00 2001 From: andrew Date: Tue, 24 Sep 2024 02:18:55 -0500 Subject: [PATCH 12/19] bump version --- packages/presets/scripts/Scarb.lock | 2 +- packages/presets/scripts/Scarb.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/presets/scripts/Scarb.lock b/packages/presets/scripts/Scarb.lock index eda928429..d89875f2a 100644 --- a/packages/presets/scripts/Scarb.lock +++ b/packages/presets/scripts/Scarb.lock @@ -3,7 +3,7 @@ version = 1 [[package]] name = "declare_presets" -version = "0.16.0" +version = "0.17.0" dependencies = [ "openzeppelin_presets", "openzeppelin_testing", diff --git a/packages/presets/scripts/Scarb.toml b/packages/presets/scripts/Scarb.toml index 6bb7c38a8..a057cb5bd 100644 --- a/packages/presets/scripts/Scarb.toml +++ b/packages/presets/scripts/Scarb.toml @@ -1,6 +1,6 @@ [package] name = "declare_presets" -version = "0.16.0" +version = "0.17.0" [dependencies] starknet = "2.8.2" From 0be5f15aea35166257170eb76712d86092bb7916 Mon Sep 17 00:00:00 2001 From: andrew Date: Wed, 25 Sep 2024 00:11:49 -0500 Subject: [PATCH 13/19] move scripts to root --- packages/presets/scripts/README.md | 21 ------------ sncast_scripts/README.md | 32 +++++++++++++++++++ .../scripts => sncast_scripts}/Scarb.lock | 18 +++++------ .../scripts => sncast_scripts}/Scarb.toml | 3 +- .../src/declare_presets.cairo | 0 .../src/declare_presets/declare_presets.cairo | 3 +- .../scripts => sncast_scripts}/src/lib.cairo | 0 7 files changed, 45 insertions(+), 32 deletions(-) delete mode 100644 packages/presets/scripts/README.md create mode 100644 sncast_scripts/README.md rename {packages/presets/scripts => sncast_scripts}/Scarb.lock (98%) rename {packages/presets/scripts => sncast_scripts}/Scarb.toml (88%) rename {packages/presets/scripts => sncast_scripts}/src/declare_presets.cairo (100%) rename {packages/presets/scripts => sncast_scripts}/src/declare_presets/declare_presets.cairo (95%) rename {packages/presets/scripts => sncast_scripts}/src/lib.cairo (100%) diff --git a/packages/presets/scripts/README.md b/packages/presets/scripts/README.md deleted file mode 100644 index 3e1e751c7..000000000 --- a/packages/presets/scripts/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Declare Presets - -This crate provides a script to declare all presets from the Contracts for Cairo library. - -## Prerequisites - -This crate is meant to execute on the sepolia network, so a deployed account contract with funds is required. -This crate can also be tested with [starknet-devnet](https://github.com/0xSpaceShard/starknet-devnet-rs). - -## Usage - -`cd` into the `scripts/` directory and run the script through Starknet Foundry's [scripting feature](https://foundry-rs.github.io/starknet-foundry/starknet/script.html). -Here's the command using a starkli-style account: - -```bash -sncast \ ---account path/to/account.json \ ---keystore path/to/key.json \ -script run declare_presets \ ---url http://127.0.0.1:5050 -``` diff --git a/sncast_scripts/README.md b/sncast_scripts/README.md new file mode 100644 index 000000000..5c8b496b2 --- /dev/null +++ b/sncast_scripts/README.md @@ -0,0 +1,32 @@ +# Starknet Foundry Cast Scripts + +This crate provides scripts using Starknet Foundry's Cast package. + +## Prerequisites + +Running these scripts will likely require an already-deployed account with funds to execute. +This crate can also be tested with [starknet-devnet](https://github.com/0xSpaceShard/starknet-devnet-rs). + +## Usage + +`cd` into the `sncast_scripts/` directory. +Run the command: + +```bash +sncast script run