From aca445bd35c7527ae624060c4d3817928a87b143 Mon Sep 17 00:00:00 2001 From: Darlington Nnam Date: Wed, 24 Apr 2024 00:42:55 +0100 Subject: [PATCH] Revert "feat: deployment script for cairo contracts" --- contracts/Scarb.toml | 10 +----- contracts/scripts/lib/Scarb.toml | 25 -------------- .../scripts/lib/src/contract_script.cairo | 33 ------------------- contracts/scripts/lib/src/lib.cairo | 2 -- 4 files changed, 1 insertion(+), 69 deletions(-) delete mode 100644 contracts/scripts/lib/Scarb.toml delete mode 100644 contracts/scripts/lib/src/contract_script.cairo delete mode 100644 contracts/scripts/lib/src/lib.cairo diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index a1034b0..920a408 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -1,4 +1,3 @@ -yoo [package] name = "contracts" version = "0.1.0" @@ -6,13 +5,6 @@ version = "0.1.0" [dependencies] starknet = "2.6.3" -[workspace] -members = ["lib"] - -[workspace.scripts] -test = "snforge" - - [dependencies.openzeppelin] git = "https://github.com/OpenZeppelin/cairo-contracts.git" tag = "v0.11.0" @@ -29,4 +21,4 @@ sierra = true sort-module-level-items = false [tool.snforge] -exit_first = false \ No newline at end of file +exit_first = false diff --git a/contracts/scripts/lib/Scarb.toml b/contracts/scripts/lib/Scarb.toml deleted file mode 100644 index 86f7976..0000000 --- a/contracts/scripts/lib/Scarb.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -name = "contract_script" -version = "0.1.0" -edition = "2023_11" - -[scripts] -test.workspace = true - -# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html - -[dependencies] -sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.19.0" } -starknet = ">=2.5.4" -contract = { path = "../" } - -[lib] -sierra = true -casm = true - -[[target.starknet-contract]] -sierra = true -casm = true -build-external-contracts = [ - "contract::HelloStarknet" -] \ No newline at end of file diff --git a/contracts/scripts/lib/src/contract_script.cairo b/contracts/scripts/lib/src/contract_script.cairo deleted file mode 100644 index 1323ec7..0000000 --- a/contracts/scripts/lib/src/contract_script.cairo +++ /dev/null @@ -1,33 +0,0 @@ -use sncast_std::{ - declare, deploy, invoke, call, DeclareResult, DeployResult, InvokeResult, CallResult, get_nonce, DisplayContractAddress, DisplayClassHash -}; - -fn main() { - let max_fee = 99999999999999999; - let salt = 0x3; - - let declare_result = declare("HelloStarknet", Option::Some(max_fee), Option::None).expect('contract already declared'); - - let nonce = get_nonce('latest'); - let class_hash = declare_result.class_hash; - - println!("Class hash of the declared contract: {}", declare_result.class_hash); - - let deploy_result = deploy( - class_hash, ArrayTrait::new(), Option::Some(salt), true, Option::Some(max_fee), Option::Some(nonce) - ).expect('deploy failed'); - - println!("Deployed the contract to address: {}", deploy_result.contract_address); - - let invoke_nonce = get_nonce('pending'); - let invoke_result = invoke( - deploy_result.contract_address, selector!("put"), array![0x1, 0x2], Option::Some(max_fee), Option::Some(invoke_nonce) - ).expect('invoke failed'); - - println!("Invoke tx hash is: {}", invoke_result.transaction_hash); - - let call_result = call(deploy_result.contract_address, selector!("get"), array![0x1]).expect('call failed'); - - println!("Call result: {}", call_result); - assert(call_result.data == array![0x2], *call_result.data.at(0)); -} \ No newline at end of file diff --git a/contracts/scripts/lib/src/lib.cairo b/contracts/scripts/lib/src/lib.cairo deleted file mode 100644 index af4231f..0000000 --- a/contracts/scripts/lib/src/lib.cairo +++ /dev/null @@ -1,2 +0,0 @@ -mod lib; -mod contract_script; \ No newline at end of file