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

snfoundry: Update dependencies #449

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 17 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@ jobs:
- name: Checkout
uses: actions/checkout@master

- name: Install scarb
run: curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh -s -- -v 2.9.2

- name: Install snfoundryup
run: curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh

- name: Install snforge
run: snfoundryup -v 0.35.1

- name: Run snforge tests
run: snforge test
working-directory: ./packages/snfoundry/contracts

- name: Setup node env
uses: actions/setup-node@v3
with:
Expand All @@ -49,6 +36,23 @@ jobs:
run: yarn install --immutable
working-directory: ./packages/nextjs

- name: Install scarb
uses: software-mansion/setup-scarb@v1
with:
tool-versions: ./.tool-versions
scarb-lock: ./packages/snfoundry/contracts/Scarb.lock

- name: Install snfoundryup
uses: foundry-rs/setup-snfoundry@v3
with:
tool-versions: ./.tool-versions

- name: Build Contracts
run: yarn compile

- name: Run smart contract tests
run: yarn test

- name: Check Code Format
run: yarn format:check

Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
scarb 2.9.2
starknet-foundry 0.35.1
scarb 2.9.4
starknet-foundry 0.37.0
starknet-devnet 0.2.3
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,34 +43,34 @@ If your local starknet-devnet version is not `0.2.3`, you need to install it.

### Scarb version

To ensure the proper functioning of scaffold-stark, your local `Scarb` version must be `2.9.2`. To accomplish this, first check your local Scarb version:
To ensure the proper functioning of scaffold-stark, your local `Scarb` version must be `2.9.4`. To accomplish this, first check your local Scarb version:

```sh
scarb --version
```

If your local Scarb version is not `2.9.2`, you need to install it.
If your local Scarb version is not `2.9.4`, you need to install it.

- Install Scarb `2.9.2` via `asdf` ([instructions](https://docs.swmansion.com/scarb/download.html#install-via-asdf)).
- Install Scarb `2.9.4` via `asdf` ([instructions](https://docs.swmansion.com/scarb/download.html#install-via-asdf)).

### Starknet Foundry version

To ensure the proper functioning of the tests on scaffold-stark, your Starknet Foundry version must be 0.35.1. To accomplish this, first check your Starknet Foundry version:
To ensure the proper functioning of the tests on scaffold-stark, your Starknet Foundry version must be 0.37.0. To accomplish this, first check your Starknet Foundry version:

```sh
snforge --version
```

If your Starknet Foundry version is not `0.35.1`, you need to install it.
If your Starknet Foundry version is not `0.37.0`, you need to install it.

- Install Starknet Foundry `0.35.1` via `asdf` ([instructions](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html#installation-via-asdf)).
- Install Starknet Foundry `0.37.0` via `asdf` ([instructions](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html#installation-via-asdf)).

## Compatible versions

- Starknet-devnet - v0.2.3
- Scarb - v2.9.2
- Snforge - v0.35.1
- Cairo - v2.9.2
- Scarb - v2.9.4
- Snforge - v0.37.0
- Cairo - v2.9.4
- Rpc - v0.7.1

## Requirements (Alternative Option with Docker)
Expand Down
29 changes: 15 additions & 14 deletions packages/snfoundry/contracts/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,35 @@ dependencies = [

[[package]]
name = "openzeppelin_access"
version = "0.20.0"
version = "1.0.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:7734901a0ca7a7065e69416fea615dd1dc586c8dc9e76c032f25ee62e8b2a06c"
checksum = "sha256:a39a4ea1582916c637bf7e3aee0832c3fe1ea3a3e39191955e8dc39d08327f9b"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_account"
version = "0.20.0"
version = "1.0.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:1aa3a71e2f40f66f98d96aa9bf9f361f53db0fd20fa83ef7df04426a3c3a926a"
checksum = "sha256:7e943a2de32ddca4d48e467e52790e380ab1f49c4daddbbbc4634dd930d0243f"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_introspection"
version = "0.20.0"
version = "1.0.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:13e04a2190684e6804229a77a6c56de7d033db8b9ef519e5e8dee400a70d8a3d"
checksum = "sha256:34e088ecf19e0b3012481a29f1fbb20e600540cb9a5db1c3002a97ebb7f5a32a"

[[package]]
name = "openzeppelin_token"
version = "0.20.0"
version = "1.0.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:4452f449dc6c1ea97cf69d1d9182749abd40e85bd826cd79652c06a627eafd91"
checksum = "sha256:33fcb84a1a76d2d3fff9302094ff564f78d45b743548fd7568c130b272473f66"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
Expand All @@ -50,21 +51,21 @@ dependencies = [

[[package]]
name = "openzeppelin_utils"
version = "0.20.0"
version = "1.0.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:44f32d242af1e43982decc49c563e613a9b67ade552f5c3d5cde504e92f74607"
checksum = "sha256:fd348b31c4a4407add33adc3c2b8f26dca71dbd7431faaf726168f37a91db0c1"

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

[[package]]
name = "snforge_std"
version = "0.35.1"
version = "0.37.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:e25cbeb9cbed6da8e14ab19ad0e7c1d888055dfee62978a845ce669cfaba5d93"
checksum = "sha256:f5702c4a6d54e3563b4aa78c834de6ddcf18ef8ca8fd35dc1bceb7ece58e9571"
dependencies = [
"snforge_scarb_plugin",
]
12 changes: 6 additions & 6 deletions packages/snfoundry/contracts/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "contracts"
version = "0.2.0"
edition = "2023_11"
edition = "2024_07"

# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html

[dependencies]
starknet = "2.9.2"
starknet = "2.9.4"
# Change to just "openzeppelin" to use full features
openzeppelin_access = "0.20.0"
openzeppelin_token = "0.20.0"
openzeppelin_access = "1.0.0"
openzeppelin_token = "1.0.0"

[dev-dependencies]
openzeppelin_utils = "0.20.0"
snforge_std = "0.35.1"
openzeppelin_utils = "1.0.0"
snforge_std = "0.37.0"

[[target.starknet-contract]]
casm = true
Expand Down
7 changes: 4 additions & 3 deletions packages/snfoundry/contracts/src/YourContract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ pub trait IYourContract<TContractState> {
mod YourContract {
use openzeppelin_access::ownable::OwnableComponent;
use openzeppelin_token::erc20::interface::{IERC20Dispatcher, IERC20DispatcherTrait};
use starknet::storage::Map;
use starknet::storage::{Map, StorageMapReadAccess, StorageMapWriteAccess};
use starknet::storage::{StoragePointerReadAccess, StoragePointerWriteAccess};
use starknet::{ContractAddress, contract_address_const};
use starknet::{get_caller_address, get_contract_address};
use super::{IYourContract};
Expand Down Expand Up @@ -73,8 +74,8 @@ mod YourContract {

match amount_eth {
Option::Some(amount_eth) => {
// In `Debug Contract` or UI implementation call `approve` on ETH contract
// before invoke fn set_greeting()
// In `Debug Contract` or UI implementation, call `approve` on ETH contract
// before invoking fn set_greeting()
let eth_contract_address = contract_address_const::<ETH_CONTRACT_ADDRESS>();
let eth_dispatcher = IERC20Dispatcher {
contract_address: eth_contract_address,
Expand Down
10 changes: 5 additions & 5 deletions packages/snfoundry/scripts-ts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
executeDeployCalls,
exportDeployments,
deployer,
} from './deploy-contract';
import { green } from './helpers/colorize-log';
} from "./deploy-contract";
import { green } from "./helpers/colorize-log";

/**
* Deploy a contract using the specified parameters.
Expand Down Expand Up @@ -43,7 +43,7 @@ import { green } from './helpers/colorize-log';
*/
const deployScript = async (): Promise<void> => {
await deployContract({
contract: 'YourContract',
contract: "YourContract",
constructorArgs: {
owner: deployer.address,
},
Expand All @@ -56,11 +56,11 @@ const main = async (): Promise<void> => {
await executeDeployCalls();
exportDeployments();

console.log(green('All Setup Done!'));
console.log(green("All Setup Done!"));
} catch (err) {
console.log(err);
process.exit(1); //exit with error so that non subsequent scripts are run
}
};

main();
main();
Loading