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

Update Challenge-dice-game last Version Scaffold Stark #104

Merged
merged 81 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
0623188
Update readme (#147)
GabrielaDelPilarR Jun 1, 2024
a74df72
add options for maxFee on deploy
jrcarlos2000 Jun 1, 2024
db2751b
Merge branch 'main' of github.com:Quantum3-Labs/scaffold-stark-2
jrcarlos2000 Jun 1, 2024
d62e9f2
add options for maxFee on deploy (#149)
jrcarlos2000 Jun 1, 2024
f905af0
Improve contracts and cairo test (#145)
gianalarcon Jun 2, 2024
8ff0803
Merge branch 'main' of github.com:Quantum3-Labs/scaffold-stark-2
jrcarlos2000 Jun 2, 2024
a4446f5
enh: cleanup unused code and files
jrcarlos2000 Jun 2, 2024
4dc40f8
Cleanup (#150)
jrcarlos2000 Jun 2, 2024
d5f572d
Merge branch 'main' of github.com:Quantum3-Labs/scaffold-stark-2
jrcarlos2000 Jun 2, 2024
1f2085e
chr: devnet as first network
0xquantum3labs Jun 3, 2024
19dcf0d
Fix/main network (#154)
0xquantum3labs Jun 3, 2024
9cf2954
Merge branch 'main' of github.com:Quantum3-Labs/scaffold-stark-2
0xquantum3labs Jun 4, 2024
f7bf304
add preset RPC in example env
0xquantum3labs Jun 4, 2024
c37b3e6
enh: instructions for RPC on nextjs app
0xquantum3labs Jun 4, 2024
bb59cf4
Stable rpc instructions (#155)
0xquantum3labs Jun 4, 2024
d8d956b
chore: randomize wallets (#152)
avimak Jun 4, 2024
96e21a1
Merge branch 'main' of github.com:Quantum3-Labs/scaffold-stark-2
0xquantum3labs Jun 5, 2024
5d6ab0c
update versions in the readme (#157)
GabrielaDelPilarR Jun 5, 2024
801d33c
Merge branch 'main' of github.com:Quantum3-Labs/scaffold-stark-2
0xquantum3labs Jun 6, 2024
b255f0e
fix : add abi functions (per_item)
0xquantum3labs Jun 7, 2024
56a86a4
feat: warning modal in devnet off (#161)
edulanasca Jun 7, 2024
eb641d2
Update readme (#162)
goofylfg Jun 8, 2024
4346e03
Merge branch 'main' of github.com:Quantum3-Labs/scaffold-stark-2
0xquantum3labs Jun 9, 2024
bb5a7e4
update debugContract page
0xquantum3labs Jun 9, 2024
a20de7f
Fix/debug contracts (#166)
0xquantum3labs Jun 9, 2024
26a9815
Merge branches 'main' and 'main' of github.com:Quantum3-Labs/scaffold…
0xquantum3labs Jun 10, 2024
358e59e
fix : set local-devnet to 0.5.1
0xquantum3labs Jun 11, 2024
3da8199
Test contract workflow (#173)
edulanasca Jun 13, 2024
17ae37d
feat: integrate starknetID (#169)
Marchand-Nicolas Jun 15, 2024
2247b20
Minor changes (#174)
gianalarcon Jun 17, 2024
aa0df5f
Update .env.example (#175)
jrcarlos2000 Jun 19, 2024
59881d0
Feature: Switching Accounts on Devnet from ConnectModal (#178)
egeaybars123 Jun 27, 2024
d45f634
Fix-abi-l1_handler (#179)
edulanasca Jul 1, 2024
148c855
Update Readme (#182)
gianalarcon Jul 4, 2024
1f18ba7
Generic types (#170)
edulanasca Jul 4, 2024
513b10c
fix : vercel deploy (#183)
0xquantum3labs Jul 5, 2024
d3b75e7
Add postinstall (#187)
jrcarlos2000 Jul 11, 2024
bf86a2e
feat: Add cyberpunk style (#181)
GabrielaDelPilarR Jul 12, 2024
0954e0a
Fix correctly display wallet connectors (#189)
danielcdz Jul 14, 2024
8659c38
Changes in styles (#191)
GabrielaDelPilarR Jul 16, 2024
1c9aa03
Add correctly display wallet connectors in new style (#192)
Nadai2010 Jul 17, 2024
fe7eaae
Removed all mention of Goerli and all associated packages (#193)
Ugo-X Jul 17, 2024
df5f867
Update README.md
GabrielaDelPilarR Jul 17, 2024
bb0c32e
workflow to update create-stark in every PR (#195)
edulanasca Jul 18, 2024
dcf1e5c
chore(release): 0.0.3 [skip ci]
github-actions[bot] Jul 18, 2024
051bec6
update: wallet not deployed in ui & deploy.ts (#196) [minor]
edulanasca Jul 19, 2024
0525ed0
chore(release): 0.1.0 [skip ci]
github-actions[bot] Jul 19, 2024
5c1b40e
devops(demo): support scaffol-stark-demo workflow (#199)
oceanlvr Jul 20, 2024
b51c207
Update CONTRIBUTING.md (#201)
0xquantum3labs Jul 21, 2024
ffeb461
chore(release): 0.1.1 [skip ci]
github-actions[bot] Jul 21, 2024
d1097a2
Fix botton Wallet Not Deployed (#203)
Nadai2010 Jul 23, 2024
cba6bc4
Update package.json (#204)
jrcarlos2000 Jul 23, 2024
5621fa2
chore(release): 0.1.2 [skip ci]
github-actions[bot] Jul 23, 2024
2ad3b6a
lint to validate deployContract (#198)
edulanasca Jul 23, 2024
ed0b2ba
chore(release): 0.1.3 [skip ci]
github-actions[bot] Jul 23, 2024
783a64e
Support for latest versions : v2 Release (#165) [minor]
0xquantum3labs Jul 28, 2024
f3b9656
chore(release): 0.2.0 [skip ci]
github-actions[bot] Jul 28, 2024
4a8d170
Update rpc (#206)
0xquantum3labs Jul 28, 2024
b12b6e9
chore(release): 0.2.1 [skip ci]
github-actions[bot] Jul 28, 2024
8ba39e2
chore : remove submodule (#207)
0xquantum3labs Jul 28, 2024
5fee13e
chore(release): 0.2.2 [skip ci]
github-actions[bot] Jul 28, 2024
63ccf8f
Update readme (#208)
0xquantum3labs Jul 28, 2024
7149cb4
chore(release): 0.2.3 [skip ci]
github-actions[bot] Jul 28, 2024
21a9edc
Update readme (#221)
GabrielaDelPilarR Jul 30, 2024
9f65b18
chore(release): 0.2.4 [skip ci]
github-actions[bot] Jul 30, 2024
57494b3
feat: improved faucet functionality and added sepolia faucets (#222)
Ayoazeez26 Jul 31, 2024
cd4ab1a
Feat/set and integrate blockexplorer (#225)
Ayoazeez26 Aug 1, 2024
3918641
Improve deploy function on deploy-contract.ts (#231)
ikemHood Aug 3, 2024
6bb817c
fix : format
jrcarlos2000 Aug 6, 2024
35efe94
feat: add support for STRK balance (#226) [skip ci]
raizo07 Aug 7, 2024
1b910bd
Update readme (#240) [skip ci]
gianalarcon Aug 8, 2024
77f50dc
chore(release): 0.2.5 [skip ci]
github-actions[bot] Aug 8, 2024
9265529
Added yarn deploy:reset script to reset deployments (#233)
josephchimebuka Aug 8, 2024
c222129
Improve contract (#242)
gianalarcon Aug 8, 2024
c436d25
chore(release): 0.2.6 [skip ci]
github-actions[bot] Aug 8, 2024
db0128d
Update lint.yml
jrcarlos2000 Aug 9, 2024
80f3d15
Added classHash to debug page (#232)
Jemiiah Aug 9, 2024
332cd1e
Update Challenge-dice-game last Version Scaffold Stark
Nadai2010 Aug 11, 2024
18ebed4
Merge branch 'dice-game' into nadai/dice-game-update
Nadai2010 Aug 11, 2024
9aa8594
Update format
Nadai2010 Aug 11, 2024
1cc67c6
Update testContract and new format
Nadai2010 Aug 12, 2024
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
64 changes: 64 additions & 0 deletions .github/workflows/demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: scaffold-stark-demo workflow

on:
pull_request:
types: [closed]
branches: [main]
paths:
- 'packages/nextjs/**'

jobs:
version-bump-nextjs:
runs-on: ubuntu-22.04
steps:

- name: Checkout Source Repository
uses: actions/checkout@v4
with:
repository: Quantum3-Labs/scaffold-stark-2
token: ${{ secrets.ORG_GITHUB_TOKEN }}
path: source_repo

- name: Modify scaffoldConfig in Source Repository
run: |
cd source_repo
sed -i 's/targetNetworks: \[chains.devnet\]/targetNetworks: \[chains.sepolia\]/' packages/nextjs/scaffold.config.ts
cat packages/nextjs/scaffold.config.ts

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: 'https://registry.yarnpkg.com'

- name: Deploy to vercel
if: success()
id: deploy
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
run: |
cd source_repo
yarn install
vercel link --yes --project $VERCEL_PROJECT_ID --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID
vercel --build-env NEXT_PUBLIC_IGNORE_BUILD_ERROR=true --prod --token $VERCEL_TOKEN --scope $VERCEL_ORG_ID

- name: Notify Slack on Success
if: success()
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: "GitHub deployed to vercel result: ${{ job.status }}\nRepository Name: ${{ github.repository }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Notify Slack on Failure
if: failure()
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: "GitHub deployed to vercel result: ${{ job.status }}\nRepository Name: ${{ github.repository }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

6 changes: 0 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ jobs:
run: yarn install --immutable
working-directory: ./packages/nextjs

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

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

- name: Run Next.js lint
run: yarn next:lint --max-warnings=0
working-directory: ./packages/nextjs
Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/release-create-stark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Version Bump and Notify

on:
pull_request:
types: [closed]
branches: [main]

jobs:
version-bump:
runs-on: ubuntu-22.04

steps:
- name: Checkout Source Repository
uses: actions/checkout@v4
with:
repository: Quantum3-Labs/scaffold-stark-2
token: ${{ secrets.ORG_GITHUB_TOKEN }}
path: source_repo

- name: Checkout Destination Repository
uses: actions/checkout@v4
with:
repository: Quantum3-Labs/create-stark
token: ${{ secrets.ORG_GITHUB_TOKEN }}
path: destination_repo

- name: Determine version bump type
id: version
run: |
cd source_repo
commit_message=$(git log -1 --pretty=%B)
if [[ "$commit_message" == *"[major]"* ]]; then
echo "type=major" >> "$GITHUB_ENV"
elif [[ "$commit_message" == *"[minor]"* ]]; then
echo "type=minor" >> "$GITHUB_ENV"
else
echo "type=patch" >> "$GITHUB_ENV"
fi

- name: Bump version in Source Repository
id: bump-version-source
run: |
cd source_repo
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
new_version=$(npm version ${{ env.type }} -m "chore(release): %s [skip ci]")
echo "NEW_VERSION=${new_version}" >> "$GITHUB_ENV"
git push origin main --follow-tags

- name: Copy Files to Destination Repository
run: |
rsync -av --delete --exclude='.git' source_repo/ destination_repo/templates/base
cd destination_repo
git add .
git commit -m "chore: sync files from scaffold-stark-2 [skip ci]"

- name: Format .gitignore files
run: |
find destination_repo/templates/base -type f -name ".gitignore" | while read -r gitignore_file; do
mjs_file="${gitignore_file%/*}/.gitignore.template.mjs"
gitignore_content=$(cat "$gitignore_file")
cat > "$mjs_file" <<-EOF
const contents = () =>
\`${gitignore_content}\`

export default contents;
EOF
rm "$gitignore_file"
done
cd destination_repo
git add .
git commit -m "Processed $gitignore_file into $mjs_file"

- name: Bump version in Destination Repository
id: bump-version-destination
run: |
cd destination_repo
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
new_version=$(npm version ${{ env.type }} -m "chore(release): %s [skip ci]")
git push origin main --follow-tags

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org/'

- name: Publish release
if: success()
id: publish-release
run: |
cd destination_repo
npm install && npm run build && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Notify Slack on Success
if: success()
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: "GitHub Action succeeded for version bump to ${{ env.NEW_VERSION }}."
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Notify Slack on Failure
if: failure()
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: "GitHub Action failed for version bump."
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ Before you begin, you need to install the following tools:

### Compatible versions

- Scarb - v2.5.4
- Snforge - v0.25
- Cairo - v2.5.4
- Scarb - v2.6.5
- Snforge - v0.27
- Cairo - v2.6.4

Make sure you have the compatible versions otherwise refer to [Scaffold-Stark Requirements](https://github.com/Quantum3-Labs/scaffold-stark-2?.tab=readme-ov-file#requirements)

Then download the challenge to your computer and install dependencies by running:

```sh

git clone https://github.com/Quantum3-Labs/speedrunstark.git --recurse-submodules dice-game
git clone https://github.com/Quantum3-Labs/speedrunstark.git dice-game
cd dice-game
git checkout dice-game

Expand Down Expand Up @@ -104,7 +104,7 @@ Next add a `riggedRoll()` function. This function should predict the randomness
- [ ] Uncomment the code in `packages/nextjs/app/dice/page.tsx` to show a riggedRoll button and contract balance on the main UI tab. Now you can test your function without switching tabs.
- [ ] Does your riggedRoll function only call `rollTheDice()` when it's going to be a winning roll? What happens when it does call `rollTheDice()`?

![RiggedLosingRoll](https://raw.githubusercontent.com/Quantum3-Labs/speedrunstark/gabi/dice-game/packages/nextjs/public/ch3-roll.png)
![RiggedLosingRoll](./packages/nextjs/public/ch3-roll.png)

---

Expand All @@ -125,7 +125,7 @@ You have beaten the game, but where is your money? Since the RiggedRoll contract

- [ ] Lock the withdraw function so it can only be called by the owner.

![WithdrawOnlyOwner](https://raw.githubusercontent.com/Quantum3-Labs/speedrunstark/gabi/dice-game/packages/nextjs/public/ch3-debug.png)
![WithdrawOnlyOwner](./packages/nextjs/public/ch3-debug.png)

> ⚠️ But wait, I am not the owner! You will want to set your front end address as the owner in `deploy.ts`. This will allow your front end address to call the withdraw function.

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ss-2",
"version": "0.2.3",
"version": "0.2.6",
"author": "Q3 Labs",
"license": "MIT",
"private": true,
Expand All @@ -13,6 +13,7 @@
"scripts": {
"chain": "yarn workspace @ss-2/snfoundry chain",
"deploy": "yarn workspace @ss-2/snfoundry deploy",
"deploy:reset": "yarn workspace @ss-2/snfoundry deploy:reset",
"test": "yarn workspace @ss-2/snfoundry test",
"compile": "yarn workspace @ss-2/snfoundry compile",
"start": "yarn workspace @ss-2/nextjs dev",
Expand Down
5 changes: 5 additions & 0 deletions packages/nextjs/app/debug/_components/contract/ContractUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useTargetNetwork } from "~~/hooks/scaffold-stark/useTargetNetwork";
import { ContractName } from "~~/utils/scaffold-stark/contract";
import { ContractVariables } from "./ContractVariables";
import { ContractWriteMethods } from "./ContractWriteMethods";
import { ClassHash } from "~~/components/scaffold-stark/ClassHash";

type ContractUIProps = {
contractName: ContractName;
Expand Down Expand Up @@ -58,6 +59,10 @@ export const ContractUI = ({
<div className="flex flex-col gap-1">
<span className="font-bold text-neutral">{contractName}</span>
<Address address={deployedContractData.address} />
<ClassHash
classHash={deployedContractData.classHash}
size="xs"
/>
<div className="flex gap-1 items-center">
<span className="font-bold text-sm">Balance:</span>
<Balance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export const ReadOnlyFunctionForm = ({
</div>
)}
</div>

<div
className={`flex ${
formErrorMessage &&
Expand Down
10 changes: 10 additions & 0 deletions packages/nextjs/app/debug/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ const Debug: NextPage = () => {
return (
<>
<DebugContracts />
{/* <div className="text-center mt-8 bg-secondary p-10">
<h1 className="text-4xl my-0">Debug Contracts</h1>
<p className="text-neutral">
You can debug & interact with your deployed contracts here.
<br /> Check{" "}
<code className="italic bg-base-300 text-base font-bold [word-spacing:-0.5rem] px-1">
packages / nextjs / app / debug / page.tsx
</code>{" "}
</p>
</div> */}
</>
);
};
Expand Down
Loading
Loading