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

feat: sierra explanation #264

Open
wants to merge 9 commits into
base: dev
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
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Checklist:**
- Using the correct tooling versions, from https://github.com/NethermindEth/StarknetByExample/blob/dev/.tool-versions
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: Suggest an idea of example or concept to showcase
title: ''
labels: enhancement
assignees: ''

---

**Describe the concept/idea you would like to see**

**Is it a new example or a modification/extension of a current one**
If you consider editing some content, explain exactly why and what.

**Additional context**
Add any other context or screenshots about the request here.
2 changes: 1 addition & 1 deletion .github/workflows/verify_cairo_programs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Verify Cairo programs compilation
on:
pull_request:
branches:
- main
- dev
workflow_dispatch:

jobs:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ src/**/*.md

node_modules


# windsurf rules
.windsurfrules
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scarb 2.8.2
starknet-foundry 0.30.0
scarb 2.9.2
starknet-foundry 0.35.0
83 changes: 54 additions & 29 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -128,105 +128,130 @@ dependencies = [

[[package]]
name = "openzeppelin"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:5dc87a71f0f5d045e02e5bc5ea7a9b0360bbbc3f388b846006280d266feac192"
checksum = "sha256:05fd9365be85a4a3e878135d5c52229f760b3861ce4ed314cb1e75b178b553da"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_merkle_tree",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
]

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

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

[[package]]
name = "openzeppelin_finance"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:f0c507fbff955e4180ea3fa17949c0ff85518c40101f4948948d9d9a74143d6c"
dependencies = [
"openzeppelin_access",
"openzeppelin_token",
]

[[package]]
name = "openzeppelin_governance"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:a9d9c983cfd4369e7bbb69433fb264edf376805ed873b1f70a287825a6bd1eaf"
checksum = "sha256:c0fb60fad716413d537fabd5fcbb2c499ca6beb95af5f0d1699955ecec4c6f63"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_introspection"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:312bc2e531f036480ad7392dbb31042c38d875ef9dbb5578ea8de5c05e35b7d8"
checksum = "sha256:13e04a2190684e6804229a77a6c56de7d033db8b9ef519e5e8dee400a70d8a3d"

[[package]]
name = "openzeppelin_merkle_tree"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:8e264c8d5f0591262a235a445b8ca78dd5580c251707b218b829b6b4d6f84a34"
checksum = "sha256:039608900e92f3dcf479bf53a49a1fd76452acd97eb86e390d1eb92cacdaf3af"

[[package]]
name = "openzeppelin_presets"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:7bc9db7563e434535ebd06c7598ba0f8494e791c5f80401389b356a3ebd65a08"
checksum = "sha256:5c07a8de32e5d9abe33988c7927eaa8b5f83bc29dc77302d9c8c44c898611042"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_security"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:b7497f5e55c6d9f1d7606ad0d12719e3c04765e266fb91fb72740e0af41d03f3"
checksum = "sha256:27155597019ecf971c48d7bfb07fa58cdc146d5297745570071732abca17f19f"

[[package]]
name = "openzeppelin_token"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:7074c23fbc300b3cccff1037264dfdbe976fb11ae42ce687f4a8ce469adc552a"
checksum = "sha256:4452f449dc6c1ea97cf69d1d9182749abd40e85bd826cd79652c06a627eafd91"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_upgrades"
version = "0.16.0"
version = "0.20.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:4de95a7fb8955e63711f34bb954676f6cef127b44b570c0535d7781297821b44"
checksum = "sha256:15fdd63f6b50a0fda7b3f8f434120aaf7637bcdfe6fd8d275ad57343d5ede5e1"

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

[[package]]
name = "pragma_lib"
version = "1.0.0"
source = "git+https://github.com/astraly-labs/pragma-lib#86d7ccdc15b349b8b48d9796fc8464c947bea6e1"
source = "git+https://github.com/astraly-labs/pragma-lib?tag=2.9.1#ee1f3f7e9276cf64e19e267832de380d84c04d28"

[[package]]
name = "sierra_ir"
version = "0.1.0"

[[package]]
name = "simple_account"
Expand All @@ -248,15 +273,15 @@ dependencies = [

[[package]]
name = "snforge_scarb_plugin"
version = "0.2.0"
version = "0.35.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:2e4ce3ebe3f49548bd26908391b5d78537a765d827df0d96c32aeb88941d0d67"
checksum = "sha256:20bd6a488fda7201ce2a5fd680d8e715b10e3545147b276747ad079c96c3d5d2"

[[package]]
name = "snforge_std"
version = "0.30.0"
version = "0.35.0"
source = "registry+https://scarbs.xyz/"
checksum = "sha256:2f3c4846881813ac0f5d1460981249c9f5e2a6831e752beedf9b70975495b4ec"
checksum = "sha256:fe4e1b1526c815441183baed7f93e73bc76a6393d23e1f9c34fbe227bfaedfd6"
dependencies = [
"snforge_scarb_plugin",
]
Expand Down
12 changes: 6 additions & 6 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ test = "$(git rev-parse --show-toplevel)/scripts/test_resolver.sh"
[workspace.tool.snforge]

[workspace.dependencies]
starknet = "2.8.2"
cairo_test = "2.8.2"
assert_macros = "2.8.2"
snforge_std = "0.30.0"
openzeppelin = "0.16.0"
starknet = "2.9.2"
cairo_test = "2.9.2"
assert_macros = "2.9.2"
snforge_std = "0.35.0"
openzeppelin = "0.20.0"
components = { path = "listings/applications/components" }
pragma_lib = { git = "https://github.com/astraly-labs/pragma-lib" }
pragma_lib = { git = "https://github.com/astraly-labs/pragma-lib", tag = "2.9.1" }

[workspace.package]
description = "Collection of examples of how to use the Cairo programming language to create smart contracts on Starknet."
Expand Down
27 changes: 27 additions & 0 deletions components/ThemeImage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { useEffect, useState } from "react";
import { useTheme } from "./useTheme";

export const ThemeImage = ({
light,
dark,
alt,
...props
}: {
light: string;
dark: string;
alt: string;
[key: string]: any;
}) => {
const [mounted, setMounted] = useState(false);
const theme = useTheme();

useEffect(() => {
setMounted(true);
}, []);
if (!mounted) {
return <img src={light} alt={alt} {...props} />;
}

// Client-side rendering after hydrating
return <img src={theme === "light" ? light : dark} alt={alt} {...props} />;
};
32 changes: 32 additions & 0 deletions components/useTheme.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { useEffect, useState } from "react";

export function useTheme() {
const [theme, setTheme] = useState<"dark" | "light">(() => {
if (typeof window === "undefined") return "light";
return document.documentElement.classList.contains("dark")
? "dark"
: "light";
});

useEffect(() => {
const handleThemeChange = () => {
const newTheme = document.documentElement.classList.contains("dark")
? "dark"
: "light";
setTheme(newTheme);
};

// Watch for class changes on documentElement
const observer = new MutationObserver(handleThemeChange);
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ["class"],
});

return () => {
observer.disconnect();
};
}, []);

return theme;
}
2 changes: 1 addition & 1 deletion footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default function Footer() {
return (
<div className="flex flex-col items-center pb-2 gap-2 opacity-50 hover:opacity-70 transition-opacity duration-500 ease-in-out">
<div className="flex flex-col items-center pb-4 gap-2 opacity-50 hover:opacity-70 transition-opacity duration-500 ease-in-out">
<img
className="w-40"
src="/collaborators/PoweredByNethermind.svg"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ pub mod CommitmentRevealTraits {

#[cfg(test)]
mod tests {
use starknet::SyscallResultTrait;
use super::{
CommitmentRevealTraits, ICommitmentRevealTraitDispatcher,
ICommitmentRevealTraitDispatcherTrait
ICommitmentRevealTraitDispatcherTrait,
};

use core::hash::HashStateTrait;
Expand All @@ -44,9 +43,9 @@ mod tests {

fn deploy() -> ICommitmentRevealTraitDispatcher {
let (contract_address, _) = deploy_syscall(
CommitmentRevealTraits::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false
CommitmentRevealTraits::TEST_CLASS_HASH.try_into().unwrap(), 0, array![].span(), false,
)
.unwrap_syscall();
.unwrap();
ICommitmentRevealTraitDispatcher { contract_address }
}

Expand Down
Loading