scaffold-eth / se-2-challenges Goto Github PK
View Code? Open in Web Editor NEWSpeedRunEthereum challenges (Powered by Scaffold-ETH 2)
Home Page: https://speedrunethereum.com
License: MIT License
SpeedRunEthereum challenges (Powered by Scaffold-ETH 2)
Home Page: https://speedrunethereum.com
License: MIT License
We need to remove ethers.getContractAt
approach and use ethers.getContractFactory
also add let contractArtifact
variable :
Checkout https://github.com/scaffold-eth/se-2-challenges/pull/137/files for reference
TODO:
Add a section after the "Quest Journal", showcasing the most interesting technical points of the Challenge. Like we had in the Multisig-break-down
TODO :
Currently in Checkpoint 4, the testing file is not checking the Guru's balance when testing the withdrawEarnings()
function. It is only tracking the contract balance. If that function withdraws the funds to a different account, it still passes the test file. It would be beneficial for the Auto-grader if it made sure the funds were being sent to the correct address.
GM maintainers
The DEX challenge inspired me to implement some basic user experience improvements and I'm curious if you might be open to my creating a pull request to implement them on the official branch. You can test drive here
Currently, we are storing the backend state in a variable kind of hacky, I think it will be great if we use JSON file as DB.
This won't make much of a difference while doing the challenge locally, but we are planning to connect this repo's challenge 6 backend-local
to our box where the prod server will live and it's good to have some kind of persistent storage there.
Some helper libraries :
We are currently using a basic .js
in backend-local
maybe we convert it to TS just for overall consistency, not super important
In the top challenge explanations under the banner, challenges 1,2, and 5 are using the '>' vertical line for each paragraph. The others are not and it looks a little better.
Challenge 5 has a "We Will:" section under the explanation that the other challenges do not have. Not sure we need to take any action here as it does work well for that challenge to sum that up beforehand.
This line is inconsistent between challenges, which is better? (It's also not in challenge 0 at all, should it be?)
👩💻 Rerun yarn deploy --reset whenever you want to deploy new contracts to the frontend, update your current contracts with changes, or re-deploy it to get a fresh contract address.
👩💻 Rerun yarn deploy whenever you want to deploy new contracts to the frontend (run yarn deploy --reset for a completely fresh deploy if you have made no contract changes).
yarn generate
and yarn account
are flipped in challenges 2 and 5 and the wording is inconsistent between all challenges.
Is the 'All Staking Events' screenshot necessary in the Deploy checkpoint in Challenge 1?
yarn deploy
to deploy..." line.Contract Verification varies between challenges.
Get all challenges consistent.
Make sure all challenge have this at the end: 👉 Search this address on Etherscan to get the URL you submit to 🏃♀️SpeedRunEthereum.com.
Add the '>' format in the "Problems, question...' line in challenges 2,4, and both lines in 0. Update emoji in challenge 0.
index.tsx has a few linting and prettier errors/warnings that cause the yarn vercel command to fail unless ignored.
When we created se-2-challenges repo at that time SE-2 didn't have Wagmi V1 & Viem.
So basically in SE-2 on frontend side we are no more using ethers
instead we are using viem
. Also there are some minor api changes.
As I see people don't focus on the frontend in initial challenges, so it's kind of ok to have it a bit outdated but I think we should start slowly migrating to the latest changes of SE-2 at least till Wagmi V1 & Viem (also in se-2-challenges we are also kind of pushing them toward frontend a bit).
Because incase of curiosity if people go to wagmi docs they will be seeing V1 docs, also same for daisyUI docs it will take them to V3 docs and in challenges we are using v2 docs (Not that big deal for daisyUI).
Regarding MultiSig Challenge #19 and SVG NFT #20 challenge I think these challenges must for sure use the latest SE-2 changes at least with Wagmi v1, viem, and daisui V3 because at this challenges people start understanding/exploring the scaffold-eth frontend more.
Since we are currently doing write transaction using contract instance and not using useTransactor
we should show some UI toast / notfication while doing transaction similar to how we get when we use useScaffoldContractWrite
Maybe tweak useTransactor
to incorporate contract instances write? (We might also solve this at SE-2 main
repo level)
When scaffold-eth/scaffold-eth-2#867 is merged and stable on Scaffold-ETH 2, we should migrate the challenges to Foundry, so the new devs we onboard are already familiar with it.
TODO :
While we work on #3 let's update the README with all the things that need to be done when creating new challenges
E.g.
The ethToToken, Deposit, and Withdraw inputs will only allow a '.' if you first type in a 0. We should allow them to type something like '.5' instead of forcing '0.5'.
The tokenToEth input throws the following error when anything other than a number is entered, including a '.'
This should behave in the same way the other inputs do where if you type a non number or decimal it omits it.
When you click an action button and change the web browser tab before letting it update. That fires the transaction but when you go back to the tab, the screen is still the old one.
In most cases (or all of them) it solves doing a refresh on the web browser tab.
Can check this video:
https://www.loom.com/share/f8a5ad7853534cc7bd2b68372a4e4226?source=embed_watch_on_loom_cta
the data in Stake Events
tab isn't loading correctly after making some staking transactions and I'm not finding any helpful errors in dev console
Any ideas on this?
to base-template and all the challenges
I noticed that the provided solution code for the deposit
function is transferring the $BAL tokens after updating the liquidity mapping. I think this may make the contract vulnerable to a reentrancy attack where a user could deposit ETH to be given liquidity without sending any $BAL. The malicious actor could then call the withdraw
function and drain liquidity from the pool
We need to rewrite test files of migrated challenges to viem too
Currently when a user is calling deposit, if the ratio of ETH:Balloons isn't 1:1 the amount that needs to be approved is unclear. I believe this has been solved in the past by just approving a large number to get past it.
If we want to include it there are a couple options:
At the moment it lets you create proposals with "New Nº" empty or 0. When you try to exec the transaction at the Pool, it throws a transaction error.
Ran into a weird error I'm not sure how to fix when i ran yarn vercel
with the defaults
seems to be related to the react-json-view package getting a "ReferenceError: document is not defined"
Sorry to paste so much of the build logs here but are the warnings from [00:38:03.439] - [00:38:57.472] are all normal?
Any ideas on how i can fix this build?
[00:37:56.563] Running build in Washington, D.C., USA (East) – iad1 (Hive)
[00:37:56.660] Retrieving list of deployment files...
[00:37:57.281] Downloading 110 deployment files...
[00:37:57.293] Previous build caches not available
[00:37:57.831] Running "vercel build"
[00:37:58.357] Vercel CLI 32.2.5
[00:37:58.646] Installing dependencies...
[00:37:58.994] yarn install v1.22.17
[00:37:59.072] info No lockfile found.
[00:37:59.077] [1/4] Resolving packages...
[00:38:03.439] warning kubo-rpc-client > [email protected]: js-IPFS has been deprecated in favour of Helia - please see ipfs/js-ipfs#4336 for details
[00:38:03.766] warning kubo-rpc-client > ipfs-core-utils > [email protected]: js-IPFS has been deprecated in favour of Helia - please see ipfs/js-ipfs#4336 for details
[00:38:17.459] warning vercel > @vercel/remix-builder > @remix-run/dev > cacache > @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
[00:38:17.705] warning vercel > @vercel/remix-builder > @remix-run/dev > @esbuild-plugins/node-modules-polyfill > rollup-plugin-node-polyfills > [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
[00:38:18.212] warning vercel > @vercel/remix-builder > @remix-run/dev > @esbuild-plugins/node-modules-polyfill > rollup-plugin-node-polyfills > rollup-plugin-inject > magic-string > [email protected]: Please use @jridgewell/sourcemap-codec instead
[00:38:18.241] warning vercel > @vercel/remix-builder > @remix-run/dev > proxy-agent > pac-proxy-agent > pac-resolver > degenerator > [email protected]: The library contains critical security issues and should not be used for production! The maintenance of the project has been discontinued. Consider migrating your code to isolated-vm.
[00:38:18.565] [2/4] Fetching packages...
[00:38:57.431] [3/4] Linking dependencies...
[00:38:57.436] warning "react-hot-toast > [email protected]" has unmet peer dependency "csstype@^3.0.10".
[00:38:57.436] warning " > [email protected]" has incorrect peer dependency "react@^17.0.0 || ^16.3.0 || ^15.5.4".
[00:38:57.437] warning " > [email protected]" has incorrect peer dependency "react-dom@^17.0.0 || ^16.3.0 || ^15.5.4".
[00:38:57.437] warning "react-json-view > [email protected]" has incorrect peer dependency "react@^15.0.2 || ^16.0.0 || ^17.0.0".
[00:38:57.437] warning " > [email protected]" has incorrect peer dependency "typescript@>=5.0.4".
[00:38:57.437] warning "viem > [email protected]" has incorrect peer dependency "typescript@>=5.0.4".
[00:38:57.439] warning " > @typescript-eslint/[email protected]" has unmet peer dependency "@typescript-eslint/parser@^5.0.0".
[00:38:57.472] warning Workspaces can only be enabled in private projects.
[00:39:10.806] [4/4] Building fresh packages...
[00:39:15.603] success Saved lockfile.
[00:39:15.607] Done in 76.62s.
[00:39:15.687] Detected Next.js version: 13.5.1
[00:39:15.689] Running "yarn run build"
[00:39:15.886] yarn run v1.22.17
[00:39:15.910] $ next build
[00:39:16.465] Attention: Next.js now collects completely anonymous telemetry regarding usage.
[00:39:16.465] This information is used to shape Next.js' roadmap and prioritize features.
[00:39:16.466] You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
[00:39:16.466] https://nextjs.org/telemetry
[00:39:16.466]
[00:39:16.556] Skipping validation of types
[00:39:16.556] Skipping linting
[00:39:16.976] Creating an optimized production build...
[00:39:35.195]
[00:39:35.195] �[35m🌼 daisyUI 3.7.6�[0m �[0mhttps://daisyui.com
[00:39:35.379] ╰╮
[00:39:35.380] ╰─ �[32m✔︎�[0m �[2m[ �[0m3�[2m ]�[0m themes are enabled. You can add more themes or make your own theme:
[00:39:35.380] https://daisyui.com/docs/themes
[00:39:35.381]
[00:39:35.383] �[32m ❤︎ Support daisyUI�[0m: https://opencollective.com/daisyui�[0m
[00:39:35.383]
[00:39:46.738] ✓ Compiled successfully
[00:39:46.739] Collecting page data...
[00:39:47.839] [DEPRECATED] Default export is deprecated. Instead use import { create } from 'zustand'
.
[00:39:47.900] [DEPRECATED] Default export is deprecated. Instead use import { create } from 'zustand'
.
[00:39:47.942] [DEPRECATED] Default export is deprecated. Instead use import { create } from 'zustand'
.
[00:39:49.494] /vercel/path0/node_modules/react-json-view/dist/main.js:1
[00:39:49.497] !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.reactJsonView=t(require("react")):e.reactJsonView=t(e.React)}(this,(function(e){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var r=t[a]={i:a,l:!1,exports:{}};return e[a].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(a,r,function(t){return e[t]}.bind(null,r));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=48)}([function(t,n){t.exports=e},function(e,t){var n=e.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},function(e,t,n){var a=n(26)("wks"),r=n(17),o=n(3).Symbol,i="function"==typeof o;(e.exports=function(e){return a[e]||(a[e]=i&&o[e]||(i?o:r)("Symbol."+e))}).store=a},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){e.exports=!n(8)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var a=n(7),r=n(16);e.exports=n(4)?function(e,t,n){return a.f(e,t,r(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var a=n(10),r=n(35),o=n(23),i=Object.defineProperty;t.f=n(4)?Object.defineProperty:function(e,t,n){if(a(e),t=o(t,!0),a(n),r)try{return i(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var a=n(40),r=n(22);e.exports=function(e){return a(r(e))}},function(e,t,n){var a=n(11);e.exports=function(e){if(!a(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports={}},function(e,t,n){var a=n(39),r=n(27);e.exports=Object.keys||function(e){return a(e,r)}},function(e,t){e.exports=!0},function(e,t,n){var a=n(3),r=n(1),o=n(53),i=n(6),s=n(5),c=function(e,t,n){var l,u,f,p=e&c.F,d=e&c.G,b=e&c.S,h=e&c.P,v=e&c.B,m=e&c.W,y=d?r:r[t]||(r[t]={}),g=y.prototype,E=d?a:b?a[t]:(a[t]||{}).prototype;for(l in d&&(n=t),n)(u=!p&&E&&void 0!==E[l])&&s(y,l)||(f=u?E[l]:n[l],y[l]=d&&"function"!=typeof E[l]?n[l]:v&&u?o(f,a):m&&E[l]==f?function(e){var t=function(t,n,a){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,a)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(f):h&&"function"==typeof f?o(Function.call,f):f,h&&((y.virtual||(y.virtual={}))[l]=f,e&c.R&&g&&!g[l]&&i(g,l,f)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,a=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+a).toString(36))}},function(e,t,n){var a=n(22);e.exports=function(e){return Object(a(e))}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";var a=n(52)(!0);n(34)(String,"String",(function(e){this._t=String(e),this._i=0}),(function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=a(t,n),this._i+=e.length,{value:e,done:!1})}))},functio
[00:39:49.500]
[00:39:49.500]
[00:39:49.500] ReferenceError: document is not defined
[00:39:49.501] at Module. (/vercel/path0/node_modules/react-json-view/dist/main.js:1:81443)
[00:39:49.501] at n (/vercel/path0/node_modules/react-json-view/dist/main.js:1:387)
[00:39:49.501] at Object. (/vercel/path0/node_modules/react-json-view/dist/main.js:1:18423)
[00:39:49.501] at n (/vercel/path0/node_modules/react-json-view/dist/main.js:1:387)
[00:39:49.501] at /vercel/path0/node_modules/react-json-view/dist/main.js:1:1186
[00:39:49.501] at /vercel/path0/node_modules/react-json-view/dist/main.js:1:1196
[00:39:49.501] at /vercel/path0/node_modules/react-json-view/dist/main.js:1:81
[00:39:49.501] at Object. (/vercel/path0/node_modules/react-json-view/dist/main.js:1:253)
[00:39:49.501] at Module._compile (node:internal/modules/cjs/loader:1256:14)
[00:39:49.501] at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
[00:39:49.501]
[00:39:49.501] Node.js v18.17.1
[00:39:49.554] Static worker unexpectedly exited with code: 1 and signal: null
I connected the GitHub repo to Vercel (through the Vercel UI) according to https://scaffold-eth-2-docs.vercel.app/deploying/deploy-nextjs-app.
And pushed commits to a challenge branch: challenge-2-token-vendor
.
Development fails like this:
No Next.js version could be detected in your project. Make sure "next" is installed in "dependencies" or "devDependencies
Could you please help me find out what I did wrong?
Thank you.
context #171 (comment)
Deploy it
, ship it
, verification
, flex
?, next steps
checkpoints differs almost in every challenge's readme. I believe it's better to do it same.
@ZakGriffith , @Pabl0cks , @technophile-04 what do you think?
It seems that the package we are using to show IPFS upload JSON data on UI seems not be maintained anymore and has some problem with SSR
We got away with the issue of SSR by using next/dynamic
import:
As it was suggested here -> mac-s-g/react-json-view#121 (comment)
But it seems that in the latest very next version it breaks #89
Alternative which I found : https://viewer.textea.io/ but tells you to add @mui/material @emotion/react @emotion/styled
as dependencies :( don't know if its worth it
We recently merge scaffold-eth/scaffold-eth-2#757, let backmerge it in all challenges also remove #91 from challenge 0
use _components
folder inside page folders or just components
folders.
context #178 (review)
packages/hardhat/test/YouContract.ts
is still the SE-2 default test file.
We need the real test file for challlenge 0 (which will be used by the autograder).
SE-1 challenge 0 test from the TS repo:
https://github.com/scaffold-eth/scaffold-eth-typescript-challenges/blob/challenge-0-simple-nft/packages/hardhat-ts/test/challenge_0.ts
Repro steps:
yarn chain
yarn deploy
eth_call
Contract call: DiceGame#<unrecognized-selector>
From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
To: 0x5fbdb2315678afecb367f032d93f642f64180aa3
Error: Transaction reverted: function selector was not recognized and there's no fallback function
at DiceGame.<unrecognized-selector> (contracts/DiceGame.sol:6)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async HardhatNode.runCall (/home/nenad/repos/speedrunethereum/challenge-3-dice-game/packages/hardhat/node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:713:20)
at async EthModule._callAction (/home/nenad/repos/speedrunethereum/challenge-3-dice-game/packages/hardhat/node_modules/hardhat/src/internal/hardhat-network/provider/modules/eth.ts:365:9)
at async HardhatNetworkProvider._sendWithLogging (/home/nenad/repos/speedrunethereum/challenge-3-dice-game/packages/hardhat/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:145:22)
at async HardhatNetworkProvider.request (/home/nenad/repos/speedrunethereum/challenge-3-dice-game/packages/hardhat/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:122:18)
at async JsonRpcHandler._handleRequest (/home/nenad/repos/speedrunethereum/challenge-3-dice-game/packages/hardhat/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:191:20)
at async JsonRpcHandler._handleSingleRequest (/home/nenad/repos/speedrunethereum/challenge-3-dice-game/packages/hardhat/node_modules/hardhat/src/internal/hardhat-network/jsonrpc/handler.ts:152:17)
Address 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
(from) seems to be the deployer address (created by hardhat as the Account #0
(it is also later used by the frontend as the faucet address).
Address 0x5fbdb2315678afecb367f032d93f642f64180aa3
is the address to which DiceGame
contract is deployed.
Liquidity Provided Events
and Liquidity Removed Events
tables have Amount of ETH
and Amount of Balloons
columns switched.
When setting the targetNetwork in packages/nextjs/scaffold.config.ts to sepolia, I started getting a front end error when clicking into the Token Vendor tab. When testing on localhost, below is the pop-up error received.
When switching the targetNetwork to hardhat or goerli, there was no pop-up or console errors.
After deploying to vercel an error remained but only in the browser console. The following is that error.
I am unsure if this is due to the sepolia RPC acting up or not.
Old tests relies to "monyo" erc20 token which we don't need currently
List of requests/bug findings from running challenge-1-decentralized-staking. These are not set in stone so feel free to discuss.
Feature Request
Is it possible to default the debug tab to land on the Staker.sol contract upon their initial visit?
Feature Request
This is more of a general SE-2 discussion. What about moving the Tx pop-up to be below the top tabs?
Feature Request
We need a more clear complete() process. Currently all that changes is the total staked on the Staker UI tab as seen in the screenshot. The old challenge had an atrocious bar that appeared at the top, so let's avoid it being that gross. Possibly something that appears above the main Staker UI box displaying the amount staked?
Hello,
In line 550 of the DEX challenge there is a link that takes you to a discussion on adding 1 wei for that especific calculation, however when I try to open the link it says that I'm not part of that group.
I'm already part of some telegram groups regarding SE-2 and the BuidlGuidl, what group should I join to open the link? or maybe is the link broken?
Thanks for your help
TODO :
Some users are reporting problems with IPFS requests, although we are implementing try/catch with #150 they may still have issues while minting.
Would be nice to have an alternative / workaround for those users to not get stuck through the challenge workflow.
Comments In the 00_deploy_streamer.ts file are messy and mention an incorrect checkpoint. Clean up the code and add extra comment slashes for easy block uncommenting.
In Streamer.sol, Checkpoint 4 comments: Remove the bit about sending money to the owner(). They need to send the money to the Guru, not the contract owner.
Let's branch from https://github.com/scaffold-eth/se-2-challenges/tree/base-challenge-template and create the Challenge 0 (contracts, UI, README)
SE-1 Challenge 0: https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-0-simple-nft.
This is the first time branching from the base-challenge-template, so let's keep and eye on things that might need to be back-merged into the "base-challenge-template".
TODO :
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.