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

[ISSUES#394]Update Snfoundry package to support starknet foundry script #426

Open
wants to merge 115 commits into
base: starknet-foundry
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 114 commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
1be995f
Fix/mobile navbar #283 (#299) [skip ci]
omsant02 Oct 2, 2024
a1b117e
feat: Add verification contract command (#298) [skip ci]
MPSxDev Oct 2, 2024
9705812
Update dApp sample, refactor contract (#305)
Buuh2511 Oct 3, 2024
cd6e31d
[FEAT] Move "Configure Contracts" to page bottom (#303)
Gianfranco99 Oct 3, 2024
a84e277
Update .tool-versions (#306)(skip ci)
Nadai2010 Oct 3, 2024
e5dc4bf
test: implement test for useAutoConnect.ts (#309)(skip ci)
martinvibes Oct 4, 2024
0865d93
Test: Add unit test for useScaffoldContract and useScaffoldReadContra…
CollinsC1O Oct 5, 2024
e37b20f
feat: set autoConnet() expiry time (#307)
Iwueseiter Oct 7, 2024
94327c7
test: create test for useScaffoldWriteContract hook (#316)
NueloSE Oct 7, 2024
6a8af0b
Remove unnecessary files (#317)[skip ci]
Nadai2010 Oct 9, 2024
2c9d168
Remove import unnecessary (#318) [skip ci]
Nadai2010 Oct 12, 2024
1a4abd0
Add yarn deploy --noreset and modify yarn deploy (#321) [skip ci]
Nadai2010 Oct 14, 2024
8c90f64
fix: wrong variables in scaffold write contract (#323) [skip ci]
metalboyrick Oct 15, 2024
bc26d24
hotfix: remove console log (#324) [skip ci]
metalboyrick Oct 15, 2024
5ae732f
fix: use read contract watch mode does not work (#325)[skip ci]
metalboyrick Oct 15, 2024
d258d60
fix: write hooks parser workaround (#329)
metalboyrick Oct 17, 2024
f343e25
Solution in event issue (#331)
Nadai2010 Oct 18, 2024
ed0f216
fix: `useScaffoldMultiWriteContract` just in time parsing to solve po…
metalboyrick Oct 18, 2024
d229d47
New Scaffold V3
Nadai2010 Oct 20, 2024
f95a0fa
Revert "New Scaffold V3"
gianalarcon Oct 20, 2024
7b0e55f
"Scaffold V3""
gianalarcon Oct 20, 2024
731903a
Revert commit
Nadai2010 Oct 20, 2024
3253cc8
fix: auto connect fix (#333)
metalboyrick Oct 23, 2024
4e9a63f
Add unit test to useScaffoldEventHistory & use starkjs to parse event…
iossocket Nov 3, 2024
e53fc15
Avoid export contracts when reverted (#336)
jrcarlos2000 Nov 6, 2024
260a00a
Update release-create-stark.yaml
0xquantum3labs Nov 6, 2024
cac2446
refactor(parser): use starknetjs parsers to encode decode data (#334)
metalboyrick Nov 6, 2024
59d4844
chore(release): 0.3.3 [skip ci]
github-actions[bot] Nov 6, 2024
d72f170
Refactoring parsing logic of contract response (#351)
iossocket Nov 13, 2024
935c0ca
chore(release): 0.3.4 [skip ci]
github-actions[bot] Nov 13, 2024
0585e32
Update demo.yaml
0xquantum3labs Nov 18, 2024
b96a778
Update small fixes (#355) [skip ci]
Nadai2010 Nov 18, 2024
50d3cc3
CORS policy issue when accessing coingecko in local environment & ref…
iossocket Nov 19, 2024
163d3a4
chore(release): 0.3.5 [skip ci]
github-actions[bot] Nov 19, 2024
04eb6fb
docs: readme (#356)[skip ci]
Olexandr88 Nov 20, 2024
5cd9299
upgrade starknet-react (#357)
iossocket Nov 21, 2024
1af0532
chore(release): 0.3.6 [skip ci]
github-actions[bot] Nov 21, 2024
f87d552
fix: double brackets issue (#362)[skip ci]
metalboyrick Nov 23, 2024
0759535
feat: add support for options and results (#348)
metalboyrick Nov 25, 2024
43fc444
chore(release): 0.3.7 [skip ci]
github-actions[bot] Nov 25, 2024
aa1a548
Support raw call useScaffoldMultiWriteContract (#360)
iossocket Dec 1, 2024
55e96bf
chore(release): 0.3.8 [skip ci]
github-actions[bot] Dec 1, 2024
f2df1d3
Fix burner wallet in forked network on UI (#320) [skip ci]
jrcarlos2000 Dec 1, 2024
b508265
fix : handle edge case for deployed contracts (#364)
0xquantum3labs Dec 3, 2024
1266242
chore(release): 0.3.9 [skip ci]
github-actions[bot] Dec 3, 2024
d8f3ae0
code optimizations (#365)
iossocket Dec 5, 2024
bf111aa
chore(release): 0.3.10 [skip ci]
github-actions[bot] Dec 5, 2024
17a1d55
Fix/configure contract (#350)
ngjupeng Dec 6, 2024
61f08d7
chore(release): 0.3.11 [skip ci]
github-actions[bot] Dec 6, 2024
07e8a56
fix(starknetid): fix issue where starknet ID does not resolve (#358)
metalboyrick Dec 8, 2024
5a3bf1a
chore(release): 0.3.12 [skip ci]
github-actions[bot] Dec 8, 2024
bbc5525
[CHORE] Bump versions (#383)
Jake1698 Dec 13, 2024
ee8034d
fix: converted somedata.toString(16) to feltToHex (#384) [skip ci]
abdegenius Dec 13, 2024
d710a0b
Added a placeholder if wallet not connected (#385) [skip-ci]
melnikga Dec 14, 2024
9739ec4
write test for utils/scaffold-stark/common.ts (#387)
Benjtalkshow Dec 15, 2024
abb9642
test: useTransactor hook (#388) [skip ci]
No-bodyq Dec 16, 2024
92ea3d5
fix: remove scrollbar produced when QR button is clicked (#392)
Kingsuite Dec 17, 2024
74235b0
feat: add starknet pfp resolution (#386)
JoE11-y Dec 18, 2024
037793f
tests: Add tests for useScaffoldStarkProfile (#393)
lauchaves Dec 19, 2024
8e3c0f1
feat: add unit test for types.ts (#397)
coxmars Dec 19, 2024
67ed378
fix: broken vercel deployments (#399) [skip ci]
metalboyrick Dec 19, 2024
aa08fc4
tests: unit tests for utils/scaffold-stark/contract.ts #373 (#391) [s…
od-hunter Dec 19, 2024
e6cb504
fix: useScaffoldContract write bug with external wallets #252 (#390)
ShantelPeters Dec 21, 2024
cfff51e
feat: Add isFork to the scaffold.config.ts (#401) [skip ci]
raizo07 Dec 22, 2024
bea975c
Create hook useDataTransaction (#396) [skip ci]
cidkagenow Dec 22, 2024
977dbc8
[CHORE] House Cleaning (#402) [skip ci]
BrunoAmbricca Dec 22, 2024
27938d4
test useTargetNetwork (#395)
Jemiiah Dec 22, 2024
ae3803b
Extract stark burner to a separate lib (#382)
iossocket Dec 27, 2024
e47c5e3
chore(release): 0.3.13 [skip ci]
github-actions[bot] Dec 27, 2024
f46ced0
Update Bug_0xblank (#398)
KevinMB0220 Dec 28, 2024
7a65992
Fix Vercel build & deployment issue (#405)
iossocket Dec 31, 2024
8ff9e3b
chore(release): 0.3.14 [skip ci]
github-actions[bot] Dec 31, 2024
83493d7
chore: remove `isFork` flag from `scaffold.config.ts` (#407) [skip ci]
metalboyrick Jan 2, 2025
d1fc936
fix: devnet matches sepolia (#410)
jrcarlos2000 Jan 4, 2025
44a8710
chore(release): 0.3.15 [skip ci]
github-actions[bot] Jan 4, 2025
127d742
chore: fix some typos in comment (#411)[skip ci]
forcedebug Jan 5, 2025
137be8d
format event data when needed (#408)
iossocket Jan 8, 2025
611313b
chore(release): 0.3.16 [skip ci]
github-actions[bot] Jan 8, 2025
24e49b0
fix: dispatcher error (#416)
metalboyrick Jan 15, 2025
7a0bf16
chore(release): 0.3.17 [skip ci]
github-actions[bot] Jan 15, 2025
dce9bc2
Event key filter (#414)
iossocket Jan 15, 2025
6e9eb83
chore(release): 0.3.18 [skip ci]
github-actions[bot] Jan 15, 2025
1f7e5fe
fix: yarn deploy network args (#419) [skip ci]
metalboyrick Jan 19, 2025
ffdb0b3
fix: correct address regex in AddressInput (#421)
kfastov Jan 19, 2025
2e2f220
Dev Container Integration (#423)
Nadai2010 Jan 19, 2025
16825c8
chore(release): 0.3.19 [skip ci]
github-actions[bot] Jan 19, 2025
edfd162
feat: test
847850277 Jan 20, 2025
5083c24
feat: test deploy
847850277 Jan 20, 2025
07b2713
feat: contract deploy script.
847850277 Jan 21, 2025
dfdf0fc
feat: contract deploy script.
847850277 Jan 21, 2025
03fc22c
feat: contract deploy script.
847850277 Jan 21, 2025
c4d5efd
feat: contract deploy script.
847850277 Jan 21, 2025
995c122
feat: contract deploy script.
847850277 Jan 21, 2025
8257222
Upgrade toast (#425)
Buuh2511 Jan 22, 2025
5af2fb3
chore(release): 0.3.20 [skip ci]
github-actions[bot] Jan 22, 2025
494fd3c
feat: contract deploy script.
847850277 Jan 22, 2025
10de039
feat: contract deploy script.
847850277 Jan 22, 2025
fbd7461
Merge branch 'main' into issues_394
847850277 Jan 22, 2025
5ac2e5e
feat: contract deploy script delete file.
847850277 Jan 22, 2025
232fd7a
feat: contract deploy script check style.
847850277 Jan 22, 2025
922f8ee
Option u256 is rendered as u256 in debug ui form (#429)
iossocket Jan 27, 2025
86aa1be
chore(release): 0.3.21 [skip ci]
github-actions[bot] Jan 27, 2025
06cf48e
chore(docs): fix incorrect Starknet Foundry version in documentation …
Oladayo-Ahmod Jan 28, 2025
5670537
Keplr connector (#427)
iossocket Jan 30, 2025
a850dca
chore(release): 0.3.22 [skip ci]
github-actions[bot] Jan 30, 2025
3fd4002
Cache getClassHash request and result (#433)
iossocket Feb 2, 2025
e554410
chore(release): 0.3.23 [skip ci]
github-actions[bot] Feb 2, 2025
cfa08df
Update release-create-stark.yaml
0xquantum3labs Feb 6, 2025
aa1d3ff
Merge branch 'main' into issues_394
847850277 Feb 8, 2025
6d18667
Improving Test Flow with SNFoundry (#431)
Nadai2010 Feb 8, 2025
2f4d99c
chore(release): 0.3.24 [skip ci]
github-actions[bot] Feb 8, 2025
7ab2a9b
fix: typos in documentation files (#435)
maximevtush Feb 10, 2025
6cbe572
Merge branch 'main' into issues_394
847850277 Feb 11, 2025
f821bd7
Merge branch 'starknet_foundry' into issues_394
847850277 Feb 11, 2025
1bfe300
feat: update.
847850277 Feb 12, 2025
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
15 changes: 5 additions & 10 deletions packages/snfoundry/.env.example
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should not change

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update.

Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
## Devnet
# PRIVATE_KEY_DEVNET=0x0000000000000000000000000000000071d7bb07b9a64f6f78ac4c816aff4da9
# ## Devnet
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary to change this flie?

# PRIVATE_KEY_DEVNET=0x57b2f8431c772e647712ae93cc616638
# RPC_URL_DEVNET=http://127.0.0.1:5050
# ## last staknet devnet account address
# ACCOUNT_ADDRESS_DEVNET=0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691
# ACCOUNT_ADDRESS_DEVNET=0x4b3f4ba8c00a02b66142a4b1dd41a4dfab4f92650922a3280977b0f03c75ee1

## Sepolia
## Sepolia
PRIVATE_KEY_SEPOLIA=
RPC_URL_SEPOLIA=https://starknet-sepolia.public.blastapi.io/rpc/v0_7
ACCOUNT_ADDRESS_SEPOLIA=

## Mainnet
PRIVATE_KEY_MAINNET=
RPC_URL_MAINNET=
ACCOUNT_ADDRESS_MAINNET=
ACCOUNT_ADDRESS_SEPOLIA=
6 changes: 3 additions & 3 deletions packages/snfoundry/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ snforge_std = "0.35.1"

[[target.starknet-contract]]
casm = true
sierra = true

[tool.fmt]
sort-module-level-items = true
Expand All @@ -26,8 +27,7 @@ name = "SEPOLIA_LATEST"
url = "https://starknet-sepolia.public.blastapi.io/rpc/v0_7"
block_id.tag = "latest"


[lib]
sierra = true
casm = true

[workspace]
members = ["scripts"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should keep the sricpt to point to the new scarb.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update.

2 changes: 2 additions & 0 deletions packages/snfoundry/contracts/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod YourContract;

3 changes: 1 addition & 2 deletions packages/snfoundry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"scripts": {
"chain": "starknet-devnet --seed 0 --account-class cairo1",
"deploy": "ts-node scripts-ts/helpers/deploy-wrapper.ts",
"deploy": "ts-node ./scripts-ts/helpers/command.ts deploy",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the main idea is to keep it in a branch snfoundry, wouldn't it be better to add it as a different deploy or adjust as you are doing

What do you think @jrcarlos2000 ?

"deploy:no-reset": "yarn workspace @ss-2/snfoundry deploy --no-reset",
"test": "cd contracts && snforge test",
"test-eslint": "node eslint-contract-name/eslint-plugin-contract-names.test.js",
Expand All @@ -26,7 +26,6 @@
},
"dependencies": {
"dotenv": "^16.3.1",
"dotenv-cli": "^7.4.2",
"envfile": "^6.18.0",
"prettier": "^2.8.8",
"starknet": "6.12.1",
Expand Down
20 changes: 6 additions & 14 deletions packages/snfoundry/scripts-ts/helpers/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,27 @@ function loadEnvVariables(filePath: string): void {
}
}

function generateNameString(length: number): string {
return crypto.randomBytes(length / 2).toString("hex");
}

function deploy(network: string = "devnet"): void {
const deployerName = generateNameString(8);

let command: string;
if (network === "sepolia") {
console.log("sepolia network specified. Running...");
command = `
sncast account add --url ${process.env.RPC_URL_SEPOLIA} --name "${deployerName}" --address ${process.env.ACCOUNT_ADDRESS_SEPOLIA} --private-key ${process.env.PRIVATE_KEY_SEPOLIA} --type oz --add-profile "${deployerName}" &&
sncast --account "${deployerName}" script run scripts --package scripts --url ${process.env.RPC_URL_SEPOLIA} &&
ts-node ./scripts-ts/helpers/parse-deployments.ts --network sepolia
sncast account import --url ${process.env.RPC_URL_SEPOLIA} --name "scaffold-sepolia-account-1" --address ${process.env.ACCOUNT_ADDRESS_SEPOLIA} --private-key ${process.env.PRIVATE_KEY_SEPOLIA} --type argent --add-profile "scaffold-sepolia-account-1" &&
pwd && cd scripts && sncast --account scaffold-sepolia-account-1 script run deploy_script --url ${process.env.RPC_URL_SEPOLIA}
`;
} else if (network === "devnet") {
console.log(
"No network specified. Running deployment on Devnet by default..."
);
command = `
sncast account add --url ${process.env.RPC_URL_DEVNET} --name "${deployerName}" --address ${process.env.ACCOUNT_ADDRESS_DEVNET} --private-key ${process.env.PRIVATE_KEY_DEVNET} --type oz --add-profile "${deployerName}" &&
sncast --account "${deployerName}" script run scripts --package scripts --url ${process.env.RPC_URL_DEVNET} &&
ts-node './scripts-ts/helpers/parse-deployments.ts'
sncast account import --url ${process.env.RPC_URL_DEVNET} --name "scaffold-devnet-account-1" --address ${process.env.ACCOUNT_ADDRESS_DEVNET} --private-key ${process.env.PRIVATE_KEY_DEVNET} --type oz --add-profile "scaffold-devnet-account-1" &&
pwd && cd scripts && sncast --account scaffold-devnet-account-1 script run deploy_script --url ${process.env.RPC_URL_DEVNET}
`;
} else if (network === "mainnet") {
console.log("mainnet specified. Running...");
command = `
sncast account add --url ${process.env.RPC_URL_MAINNET} --name "${deployerName}" --address ${process.env.ACCOUNT_ADDRESS_MAINNET} --private-key ${process.env.PRIVATE_KEY_MAINNET} --type oz --add-profile "${deployerName}" &&
sncast --account "${deployerName}" script run scripts --url ${process.env.RPC_URL_MAINNET} &&
sncast account import --url ${process.env.RPC_URL_MAINNET} --name "scaffold-mainnet-account-1" --address ${process.env.ACCOUNT_ADDRESS_MAINNET} --private-key ${process.env.PRIVATE_KEY_MAINNET} --type oz --add-profile "scaffold-mainnet-account-1" &&
sncast --account "scaffold-mainnet-account-1" script run scripts --url ${process.env.RPC_URL_MAINNET} &&
ts-node ./scripts-ts/helpers/parse-deployments.ts --network mainnet
`;
} else {
Expand Down
36 changes: 9 additions & 27 deletions packages/snfoundry/scripts/Scarb.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
# Code generated by scarb DO NOT EDIT.
version = 1

[[package]]
name = "scripts"
version = "0.1.0"
dependencies = [
"contracts",
"sncast_std",
"snforge_std",
]

[[package]]
name = "contracts"
version = "0.2.0"
dependencies = [
"openzeppelin_access",
"openzeppelin_token",
"openzeppelin_utils",
"snforge_std",
]

[[package]]
name = "deploy_script"
version = "0.1.0"
dependencies = [
"contracts",
"sncast_std",
]

[[package]]
Expand Down Expand Up @@ -63,22 +60,7 @@ version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:44f32d242af1e43982decc49c563e613a9b67ade552f5c3d5cde504e92f74607"

[[package]]
name = "snforge_scarb_plugin"
version = "0.35.1"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:1b6d50abc7f306a06abf90649bcd60a3bc1cdf6d0dc21a9725c71b014a334bab"

[[package]]
name = "sncast_std"
version = "0.27.0"
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de"

[[package]]
name = "snforge_std"
version = "0.35.1"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:e25cbeb9cbed6da8e14ab19ad0e7c1d888055dfee62978a845ce669cfaba5d93"
dependencies = [
"snforge_scarb_plugin",
]
source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a"
10 changes: 5 additions & 5 deletions packages/snfoundry/scripts/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "scripts"
name = "deploy_script"
version = "0.1.0"
edition = "2023_11"
edition = "2024_07"

# 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.31.0" }
starknet = "=2.8.2"
contracts = { path = "../" }
sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.35.1" }
starknet = ">=2.9.2"
contracts = { path = "../contracts" }

[lib]
sierra = true
Expand Down
158 changes: 158 additions & 0 deletions packages/snfoundry/scripts/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# about script

## how to run it

- dev

using `yarn deploy` to run. it will return this

```bash

No network specified. Running deployment on Devnet by default...
command: account import
error: Account with name = scaffold-devnet-account-1 already exists in network with chain_id = SN_SEPOLIA
/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry
warn: found duplicate packages named `addition v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `addition v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

warn: found duplicate packages named `fibonacci v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `fibonacci v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

warn: found duplicate packages named `hello_workspaces v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `hello_workspaces v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

Compiling lib(deploy_script) deploy_script v0.1.0 (/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry/scripts/Scarb.toml)
Compiling starknet-contract(deploy_script) deploy_script v0.1.0 (/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry/scripts/Scarb.toml)
Finished `dev` profile target(s) in 27 seconds
warn: found duplicate packages named `addition v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `addition v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

warn: found duplicate packages named `fibonacci v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `fibonacci v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

warn: found duplicate packages named `hello_workspaces v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `hello_workspaces v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

Compiling lib(deploy_script) deploy_script v0.1.0 (/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry/scripts/Scarb.toml)
Compiling starknet-contract(deploy_script) deploy_script v0.1.0 (/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry/scripts/Scarb.toml)
Finished `dev` profile target(s) in 28 seconds
Transaction hash: 0xedd4d2ff76d1de9a3110b9cf7aa020e50ff261613afd61ed62429e54c22424
declare result: class_hash: 2220056144819685874043888308841394761649577173077632235532171433250405236380, transaction_hash: 420211613070310794540196665175886258466526813601834003686575940845453845540
Transaction hash: 0x490873c5d820eac12c12e755f212fb895b12cd0fc0551a59c503218c764f191
Deployed the contract to address: contract_address: 152297156873262939265739539437283576539942821834396675633022867366606687161, transaction_hash: 2064610734862315252645720349992541243237703364262357271742237055097709588881
command: script run
status: success


```


- sepolia
using `yarn deploy --network sepolia` to run. it will return this

```bash
sepolia network specified. Running...
command: account import
error: Account with name = scaffold-sepolia-account-1 already exists in network with chain_id = SN_SEPOLIA
/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry
warn: found duplicate packages named `addition v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `addition v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

warn: found duplicate packages named `fibonacci v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `fibonacci v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

warn: found duplicate packages named `hello_workspaces v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `hello_workspaces v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

Compiling lib(deploy_script) deploy_script v0.1.0 (/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry/scripts/Scarb.toml)
Compiling starknet-contract(deploy_script) deploy_script v0.1.0 (/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry/scripts/Scarb.toml)
Finished `dev` profile target(s) in 89 seconds
warn: found duplicate packages named `addition v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `addition v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

warn: found duplicate packages named `fibonacci v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `fibonacci v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

warn: found duplicate packages named `hello_workspaces v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)`

Found locations:
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a
- git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a

Because of this, referencing package `hello_workspaces v0.1.0 (git+https://github.com/foundry-rs/starknet-foundry?tag=v0.35.1#089de2c7a391372a7aaa54ec2706b117f955d06a)` will fail.

Compiling lib(deploy_script) deploy_script v0.1.0 (/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry/scripts/Scarb.toml)
Compiling starknet-contract(deploy_script) deploy_script v0.1.0 (/Users/zhengpeng/Source/Code/Rust-Code/Github/scaffold-stark-2/packages/snfoundry/scripts/Scarb.toml)
Finished `dev` profile target(s) in 26 seconds
command: script run
message:
0x6465636c617265206661696c6564 ('declare failed')

status: script panicked


```


## current may Troubled problem
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one of the main problems when integrating in the main, we must have it under control, once it is solved we could revaluate

Copy link
Author

@847850277 847850277 Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! It must be resolved, otherwise using cairo's dacare&&deploy in already declared scenarios will block it.

but sncast_std seem not support return class_hash when declared exist.


cairo script declare not support ,if declare exist then retrun class_hash.
if the declare exist at the on-chain. the script will blocking.



48 changes: 48 additions & 0 deletions packages/snfoundry/scripts/src/deploy_script.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
use core::byte_array::ByteArray;
use sncast_std::{
declare, deploy, DeclareResultTrait,
get_nonce, FeeSettings, EthFeeSettings
};


// build the constructor calldata here
fn build_constructor_calldata() -> Array::<felt252> {
//constructor calldata goes here
// dev-network owner address argument goes here as an argument
//let owner = 0x127fd5f1fe78a71f8bcd1fec63e3fe2f0486b6ecd5c86a0466c3a21fa5cfcec;
// sepolia owner address argument goes here as an argument
let owner = 0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691;
array![owner.into()]
}

fn build_contract_name() -> ByteArray{
"YourContract"
}


fn main() {
let max_fee = 99999999999999999;
let salt = 0x3;
let declare_nonce = get_nonce('latest');
let contract_name = build_contract_name();
let declare_result = declare(
contract_name,
FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }),
Option::Some(declare_nonce)
).expect('declare failed');
let class_hash = declare_result.class_hash();
println!("declare result: {}", declare_result);

let constructor_calldata = build_constructor_calldata();
let deploy_nonce = get_nonce('pending');
let deploy_result = deploy(
*class_hash,
constructor_calldata,
Option::Some(salt),
true,
FeeSettings::Eth(EthFeeSettings { max_fee: Option::Some(max_fee) }),
Option::Some(deploy_nonce)
).expect('contract deploy failed');

println!("Deployed the contract to address: {}", deploy_result);
}
2 changes: 1 addition & 1 deletion packages/snfoundry/scripts/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod scripts;
mod deploy_script;
Loading