https://github.com/ocdbytes/cairo-v1-starter
This repository hold the libs setup for starknet-foundry setup (for testing), scarb (for building), starkli (for declaring & deploying)
https://github.com/ocdbytes/cairo-v1-starter
cairo-lang cairo-v1 starknet
Last synced: about 1 month ago
JSON representation
This repository hold the libs setup for starknet-foundry setup (for testing), scarb (for building), starkli (for declaring & deploying)
- Host: GitHub
- URL: https://github.com/ocdbytes/cairo-v1-starter
- Owner: ocdbytes
- Created: 2023-11-19T20:15:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-19T20:16:22.000Z (about 2 years ago)
- Last Synced: 2024-04-14T10:46:07.763Z (almost 2 years ago)
- Topics: cairo-lang, cairo-v1, starknet
- Language: Cairo
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Cairo Lang
This repository hold the libs setup for starknet-foundry setup (for testing), scarb (for building), starkli (for declaring & deploying)
### Scarb.toml (basic)
```toml
[package]
name = "hello_starknet"
version = "0.1.0"
[[target.starknet-contract]]
sierra = true
# casm = true # needed for snforge
[dependencies]
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.7.1" }
starknet = ">=2.2.0"
[cairo]
sierra-replace-ids = true
```
### Protostar
```sh
# To declare the project
$ protostar init --minimal
$ protostar init
```
### Scarb
```sh
# To declare a project
$ scarb init
# To build a project
$ scarb build
# To run the scarb
$ scarb cairo-run
```
### Foundry
```sh
# installation in existing scarb project
$ scarb add snforge_std --git https://github.com/foundry-rs/starknet-foundry.git --tag v0.7.1
# To run test :
$ snforge test
```
Essential option (Scarb.toml) for running `snforge` test :
```toml
.......
[[target.starknet-contract]]
casm = true
.......
```
### Starkli
- Setup
```sh
$ export STARKNET_ACCOUNT=~/.starkli-wallets/deployer/account.json
$ export STARKNET_KEYSTORE=~/.starkli-wallets/deployer/keystore.json
$ export STARKNET_RPC=https://starknet-goerli.infura.io/v3/
```
- Setting up the account
```sh
# Setting up the wallet
$ starkli signer keystore from-key ~/.starkli-wallets/deployer/keystore.json
# O/P
Enter private key:
Enter password:
Created new encrypted keystore file: /home//.starkli-wallets/deployer/keystore.json
Public key:
# Fetching up the wallet config
$ starkli account fetch --output ~/.starkli-wallets/deployer/account.json
```
- Declaring & Deploying the smart contract
```sh
$ starkli declare target/dev/hello_starknet_Storage.contract_class.json
# O/P
Class hash:
0x05f0a5f0f8e14fba4c282c50a2b4e81393ce5e0812b1619542f5aa461d411219
$ starkli deploy
```
### Contract Details (Deployed)
```sh
Class Hash : 0x05f0a5f0f8e14fba4c282c50a2b4e81393ce5e0812b1619542f5aa461d411219
Contract Address : 0x0729c749170c14a07f25034a79962a7377b73fc3e9b68f580e3d35371c965a3c
Voyager Link : https://goerli.voyager.online/contract/0x0729c749170c14a07f25034a79962a7377b73fc3e9b68f580e3d35371c965a3c#transactions
```
### Resources :
- https://docs.starknet.io/documentation/quick_start/deploy_a_smart_contract/
- https://docs.starknet.io/documentation/quick_start/environment_setup/
- https://docs.swmansion.com/scarb/
- https://book.cairo-lang.org/ch00-00-introduction.html
- https://docs.swmansion.com/protostar/docs/cairo-1/introduction
- https://medium.com/starknet-edu/starkli-the-new-starknet-cli-86ea914a2933
- https://foundry-rs.github.io/starknet-foundry/
- https://github.com/shramee/starklings-cairo1