Giter VIP home page Giter VIP logo

scaffold-eth-challenges's Introduction

πŸ—πŸ‘·πŸΎ Scaffold-ETH Challenges

πŸŽ– We recommend you check the Scaffold-ETH 2 version of the challenges: https://github.com/scaffold-eth/scaffold-eth-2

Learn how to use πŸ— scaffold-eth to create decentralized applications on Ethereum. πŸš€


🚩 Challenge 0: 🎟 Simple NFT Example

🎫 Create a simple NFT to learn basics of πŸ— scaffold-eth. You'll use πŸ‘·β€β™€οΈ HardHat to compile and deploy smart contracts. Then, you'll use a template React app full of important Ethereum components and hooks. Finally, you'll deploy an NFT to a public network to share with friends! πŸš€

https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-0-simple-nft


🚩 Challenge 1: πŸ₯© Decentralized Staking App

🦸 A superpower of Ethereum is allowing you, the builder, to create a simple set of rules that an adversarial group of players can use to work together. In this challenge, you create a decentralized application where users can coordinate a group funding effort. If the users cooperate, the money is collected in a second smart contract. If they defect, the worst that can happen is everyone gets their money back. The users only have to trust the code.

https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-1-decentralized-staking


🚩 Challenge 2: 🏡 Token Vendor

πŸ€– Smart contracts are kind of like "always on" vending machines that anyone can access. Let's make a decentralized, digital currency. Then, let's build an unstoppable vending machine that will buy and sell the currency. We'll learn about the "approve" pattern for ERC20s and how contract to contract interactions work.

https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-2-token-vendor


🚩 Challenge 3: 🎲 Dice Game

🎰 Randomness is tricky on a public deterministic blockchain. In this challenge you will explore creating random numbers using block hash and how that may be exploitable. Attack the dice game with your own contract by predicting the randomness ahead of time to always roll a winner!

https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-3-dice-game


πŸŽ‰ Checkpoint: Eligible to join 🏰️ BuidlGuidl

The BuidlGuidl is a curated group of Ethereum builders creating products, prototypes, and tutorials to enrich the web3 ecosystem. A place to show off your builds and meet other builders. Start crafting your Web3 portfolio by submitting your DEX, Multisig or SVG NFT build.

https://buidlguidl.com/


βš–οΈ Build a DEX Challenge

πŸ’΅ Build an exchange that swaps ETH to tokens and tokens to ETH. πŸ’° This is possible because the smart contract holds reserves of both assets and has a price function based on the ratio of the reserves. Liquidity providers are issued a token that represents their share of the reserves and fees...

DEX Telegram Channel: https://t.me/+_NeUIJ664Tc1MzIx

https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-4-dex


πŸ“Ί State Channel Application Challenge

πŸ›£οΈ The Ethereum blockchain has great decentralization & security properties but these properties come at a price: transaction throughput is low, and transactions can be expensive. This makes many traditional web applications infeasible on a blockchain... or does it? State channels look to solve these problems by allowing participants to securely transact off-chain while keeping interaction with Ethereum Mainnet at a minimum.

State Channels Telegram Channel: https://t.me/+k0eUYngV2H0zYWUx

https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-9-state-channels


πŸ‘› Multisig Wallet Challenge

πŸ‘©β€πŸ‘©β€πŸ‘§β€πŸ‘§ Using a smart contract as a wallet we can secure assets by requiring multiple accounts to "vote" on transactions. The contract will keep track of transactions in an array of structs and owners will confirm or reject each one. Any transaction with enough confirmations can "execute".

Multisig Telegram Channel: https://t.me/+mkNNF_yHsK8yMTcx

https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-5-multi-sig


πŸ’Ž Diamond Challenge

The Diamond standard (EIP-2535) makes it easy to modularize, upgrade, and manage your smart contracts.

We will start with a basic crowdfunding contract that allows users to contribute and the owner to claim the funds any time they want.

😱 Seems like contributors will never be able to get their money back, your role is to fix this and set up some conditions and add some functionalities to your crowdfunding contract.

https://github.com/scaffold-eth/scaffold-eth-challenges/tree/diamond-challenge


🎁 SVG NFT 🎫 Building Cohort Challenge

πŸ§™ Tinker around with cutting edge smart contracts that render SVGs in Solidity. 🧫 We quickly discovered that the render function needs to be public... πŸ€” This allows NFTs that own other NFTs to render their stash. Just wait until you see an Optimistic Loogie and a Fancy Loogie swimming around in the same Loogie Tank!

SVG NFT Telegram Channel: https://t.me/+J9PRea84c1U0Mzkx

https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-6-svg-nft


πŸ’¬ Support Chat

Join the telegram support chat πŸ’¬ to ask questions and find others building with πŸ— scaffold-eth!


πŸ™ Please check out our Gitcoin grant too!

scaffold-eth-challenges's People

Contributors

0xsama avatar alifelivedfully avatar arturgontijo avatar austintgriffith avatar azf20 avatar btogzhan2000 avatar calvbore avatar carletex avatar changoman avatar clacladev avatar codenamejason avatar dantehemerson avatar forshtat avatar ghostffcode avatar hodlplus2021 avatar ironsoul0 avatar j2r5m3 avatar jacobwillemsma avatar pabloruiz55 avatar shravansunder avatar smartcontracts avatar swellander avatar taldenv avatar thesuperb1 avatar tomafc330 avatar tomafrench avatar xalava avatar xjjda22 avatar yutingzhao1991 avatar zakgriffith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scaffold-eth-challenges's Issues

Challenge 0 issue: hardhat.config.js instructions not correct

In "Checkpoint 3: Deploy it!", the hardhat.config.js file instruction does not show the correct explanation for changing to a different network. When changing the network to rinkeby, the correct code should read const defaultNetwork = 'rinkeby';

The image below shows what the current instructions on the site show - const defaultNetwork = 'NETWORKS.rinkeby'; which leads to an error in the console.

Screen Shot 2021-12-18 at 9 59 23 PM

Challenge 0: Invalid Etherscan API Key

Description

Branch: challenge-0-simple-nft

Checkpoint 5: πŸ“œ Contract Verification

When verifying a contract with a newly created API key from etherscan users might encounter the following error when running yarn verify since it can take roughly 5 minutes for the API key to become active.

contract YourCollectible failed to submit : "NOTOK" : "Invalid API Key" [object Object]

Steps to Reproduce

Note: The speed with which you complete these steps will impact the outcome.

  1. Create a new API key on etherscan
  2. Add the API key to the yarn verify script in packages/hardhat/package.json
  3. Run yarn verify (with the --network of your choice)
  4. The console logs an "Invalid API Key" error

Resolution

Perhaps a small note could be added to the Contract Verification section explaining that it might take a few minutes for the Etherscan API key to become active.

help me!

Can’t automatically merge. Don’t worry, you can still create the pull request.

Error HH100: Network georli doesn't exist

On the Checkpoint 3: πŸ’Ύ Deploy it! πŸ›° of 🚩 Challenge 0: 🎟 Simple NFT Example - TYPESCRIPT

When I'm running the command yarn run generate it throw error:

Error HH100: Network georli doesn't exist

image

evm_increaseTime in test function of challenge 1 is flaky

I have to update the test code to

        await network.provider.send("evm_increaseTime", [28])

to pass the test, otherwise, it generates error
ProviderError: Error: VM Exception while processing transaction: reverted with panic code 0x11 (Arithmetic operation underflowed or overflowed outside of an unchecked block)
at HttpProvider.request (node_modules/hardhat/src/internal/core/providers/http.ts:49:19)
at GanacheGasMultiplierProvider.request (node_modules/hardhat/src/internal/core/providers/gas-providers.ts:297:34)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Challenge 2 - Contract verification on etherscan fails

Code error : Failed to verify contract on Etherscan NomicLabsHardhatPluginError: The constru
ctor for contracts/Vendor.sol:Vendor has 1 parameters
but 0 arguments were provided instead.

Fix : await run("verify:verify", {
address: vendor.address,

    constructorArguments: [yourToken.address],
  });

replace contract arguments with constructor arguments

bug: deposit logic: incorrect check for the need for approval

Approval is needed if expected token amount exceeds allowance.

The current logic doesn't take into account the expected token amount. Instead it compares allowance to the ethValuePlusExtra:

Screenshot 2022-01-05 at 23 46 00
)

The expected token amount is
(ethValue.mul(dexTokenBalance).div(dexEthBalance)).add(1),
according to the smart contract logic:

Screenshot 2022-01-05 at 23 57 19

So we don't need ethValuePlusExtra at all, instead we should check for smth like

dexApproval.gte(expectedTokenAmount)

Cannot install - 404 error on URL

Tried installing challenge-1-decentralized-staking using yarn and then using npm, both failed

Yarn install fails.
Looks like it is the missing content at https://codeload.github.com/hugomrdias/concat-stream/tar.gz/057bc7b5d6d8df26c8cf00a3f151b6721a0a8034

Here are some details:

Yarn version:
1.22.19

Node version:
18.17.1

Platform:
linux x64

Trace:
Error: https://codeload.github.com/hugomrdias/concat-stream/tar.gz/057bc7b5d6d8df26c8cf00a3f151b6721a0a8034: Request failed "404 Not Found"
at ResponseError.ExtendableBuiltin (/<local_path>/.nvm/versions/node/v18.17.1/lib/node_modules/yarn/lib/cli.js:696:66)
at new ResponseError (/<local_path>/.nvm/versions/node/v18.17.1/lib/node_modules/yarn/lib/cli.js:802:124)
at Request. (<local_path>/.nvm/versions/node/v18.17.1/lib/node_modules/yarn/lib/cli.js:66215:16)
at Request.emit (node:events:514:28)
at module.exports.Request.onRequestResponse (<local_path>/.nvm/versions/node/v18.17.1/lib/node_modules/yarn/lib/cli.js:141767:10)
at ClientRequest.emit (node:events:514:28)
at HTTPParser.parserOnIncomingClient (node:_http_client:700:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:541:22)
at TLSSocket.emit (node:events:514:28)

npm fails
Here are the details:

/<local_path>/.npm/_logs/2023-08-31T13_14_33_660Z-debug-0.log

npm resolution error report

While resolving: @scaffold-eth/[email protected]
Found: @testing-library/[email protected]
node_modules/@testing-library/dom
dev @testing-library/dom@"^6.12.2" from @scaffold-eth/[email protected]
packages/react-app
@scaffold-eth/[email protected]
node_modules/@scaffold-eth/react-app
workspace packages/react-app from the root project

Could not resolve dependency:
peer @testing-library/dom@">=7.21.4" from @testing-library/[email protected]
node_modules/@testing-library/user-event
@testing-library/user-event@"^12.1.8" from @scaffold-eth/[email protected]
packages/react-app
@scaffold-eth/[email protected]
node_modules/@scaffold-eth/react-app
workspace packages/react-app from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

[Challenge 1] does the modifier notCompleted make sense?

In the it's a trap section:
image

is the notCompleted modifier really meant to protect execute and withdraw?
Don't we instead just want to protect stake to prevent more funds from being locked in?
Otherwise this seems to let people add in more funds, but then can't call execute nor withdraw anymore.

Challenge 2 - node module import errors

Problem

The vscode settings file is pointing to the wrong directory for the solidity node modules, right now it is "solidity.packageDefaultDependenciesDirectory": "packages/hardhat-ts/node_modules". The problem here is that the hardhat-ts folder does not exist.

Possible Solution

change "solidity.packageDefaultDependenciesDirectory": "packages/hardhat-ts/node_modules" to "solidity.packageDefaultDependenciesDirectory": "packages/hardhat/node_modules"

Error HH604: Error running JSON-RPC server: error:0308010C:digital envelope routines::unsupported

I get this error after run yarn chain and when i run yarn start

  • I got this error:
Logger.makeError
/home/arnaud/challenge-1-decentralized-staking/packages/src.ts/index.ts:213
Logger.throwError
/home/arnaud/challenge-1-decentralized-staking/packages/src.ts/index.ts:225
(anonymous function)
/home/arnaud/challenge-1-decentralized-staking/packages/src.ts/index.ts:234
rejected
http://localhost:3000/static/js/0.chunk.js:94577:32
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.  Click the 'X' or hit ESC to dismiss this message.```

Address Input Error

When you paste an address into the AddressInput you cannot delete and paste another or type one in.

[Challenge 0] Gitpod Ports and CORS don't like hardhat chain requests from the application

Description

The gitpod environment serves ports at specific urls, instead of on a single served URL. While this usually isn't an issue, because the react application is at a served port 3000, URL requests to a different port URL don't pass a CORs check. This causes breaks in the application when making requests to the localhost chain, making it unusable.

How to Reproduce

  1. Navigate to https://gitpod.id/#https://github.com/scaffold-eth/scaffold-eth-challenges/tree/challenge-0-simple-nft
  2. When the application and tasks are fully loaded, open the browser preview at port 3000. The application should appear.
  3. After a few seconds you should see the error seen in the screenshot below.

Error Information

Access to fetch at 'https://8545-amethyst-condor-919k7bwb.ws-us25.gitpod.io/' from origin 'https://3000-amethyst-condor-919k7bwb.ws-us25.gitpod.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Screen Shot 2022-01-10 at 9 57 52 PM

Considerations

  • This might be a security hole since the test application now has a public port open. I would recommend allowing it for users that want to get through the challenge, but make it clear its open in the README.
  • Is anyone really supporting gitpod?

Unhandled Rejection (Error): missing response

Hello, I recently followed the steps on this repository to run the Ethereum app for the NFT challenge. My problem comes after I run the command yarn start.
From the terminal, there is no error message, and the localhost page GUI loads successfully. However, after about 5 seconds, it crashes and shows me the following error:
Ethereum App Error screenshot

Even after the error, the terminal does not show anything wrong, but if I run yarn deploy from another window, it fails because it cannot connect to the network localhost.

It is worth noting that I run this code successfully just about 1 or two weeks ago. I did not change anything. I simply ran the same commands. I'm using Ubuntu 20.04 and Firefox. Additionally, I am not very familiar with internet communication protocols, which seem to be the problem here.
Is there a simple thing that I should pay attention to? It is confusing to me because this was working before and now it is not. Thanks for the help in advance.

Challenge 0: Open Sea Side Quest Import Instructions

Description

Branch: challenge-0-simple-nft

βš”οΈ Side Quests > 🐟 Open Sea

The user interface on the Open Sea collections page has been updated. The instructions and screenshots in the side quest no longer correspond with what is shown on the Open Sea website.

Steps to Reproduce

  1. Navigate to the opensea collections screen as instructed in the side quest
  2. Click the vertical ellipsis
  3. Validate that the "Import an existing smart contract" option is no longer available

Resolution

The side quest instructions and screenshots to create a collection for an existing smart contract on Open Sea should be updated to correspond with the new user interface.

Challenge 0: Unhandled rejection (Error)

Occasionally the app will crash and require the user to refresh the browser.

To recreate the Error:

Spin up challenge-0-simple-nft with yarn, wait, and the app should crash.

Error message:

Unhandled Rejection (Error): call revert exception (method="getReserves()", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.4.0)

Logger.makeError
/Users/mojo/projects/eth/challenge-0-simple-nft/packages/src.ts/index.ts:213
Logger.throwError
/Users/mojo/projects/eth/challenge-0-simple-nft/packages/src.ts/index.ts:225
Interface.decodeFunctionResult
/Users/mojo/projects/eth/challenge-0-simple-nft/packages/src.ts/interface.ts:425
422 | const value = values[index];
423 | if (param.indexed) {
424 | if (param.type === "string") {
> 425 | topics.push(id(value));
| ^ 426 | }
427 | else if (param.type === "bytes") {
428 | topics.push(keccak256(value));
View compiled
Contract.
/Users/mojo/projects/eth/challenge-0-simple-nft/packages/src.ts/index.ts:332
fulfilled
http://localhost:3000/static/js/0.chunk.js:78806:24

module keytar

During node install of challenge-0-simple-nft got error:

warning Error running install script for optional dependency: "/home/devl/gitcoin/scaffold-directory/challenge-0-simple-nft/node_modules/keytar: Command failed. Exit code: 1 Command: prebuild-install || node-gyp rebuild Arguments: Directory: /home/devl/gitcoin/scaffold-directory/challenge-0-simple-nft/node_modules/keytar Output: prebuild-install WARN install No prebuilt binaries found (target=16.13.1 runtime=node arch=x64 libc= platform=linux)

Node 16.13.1 Ubuntu 18.04.4

An optional dependency, but was a concern.

Installing Ubuntu module libsecret-1-dev apparently solves it.

Running yarn install reports an error

[4/4] Building fresh packages...
[-/21] ⠁ waiting...
[15/21] ⠁ ursa-optional
[16/21] ⠁ keytar
[-/21] ⠁ waiting...
warning Error running install script for optional dependency: "/root/challenge-1-decentralized-staking/node_modules/keytar: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments:
Directory: /root/challenge-1-decentralized-staking/node_modules/keytar
Output:
prebuild-install WARN install No prebuilt binaries found (target=16.17.0 runtime=node arch=x64 libc= platform=linux)
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/root/challenge-1-decentralized-staking/node_modules/keytar/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/root/.cache/node-gyp/16.17.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/16.17.0',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/16.17.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/root/challenge-1-decentralized-staking/node_modules/keytar',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
/bin/sh: 1: pkg-config: not found
gyp: Call to 'pkg-config --cflags libsecret-1' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:284:16)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Linux 4.19.0-20-amd64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/challenge-1-decentralized-staking/node_modules/keytar
success Saved lockfile.
Done in 399.39s.

Exit code: 9 with Yarn Start.

$ hardhat run scripts/publish.js
βœ… Published contracts to the subgraph package.
Done in 6.05s.
gitpod /workspace/scaffold-eth-challenges (challenge-0-simple-nft) $ yarn start
yarn run v1.22.19
$ yarn workspace @scaffold-eth/react-app start
warning package.json: No license field
$ node ./scripts/create_contracts.js
$ react-scripts --openssl-legacy-provider start
/home/gitpod/.nvm/versions/node/v16.19.0/bin/node: bad option: --openssl-legacy-provider
error Command failed with exit code 9.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 9
Command: /home/gitpod/.nvm/versions/node/v16.19.0/bin/node
Arguments: /home/gitpod/.nvm/versions/node/v16.19.0/lib/node_modules/yarn/lib/cli.js start
Directory: /workspace/scaffold-eth-challenges/packages/react-app
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 9.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I wasn't able to get through the first checkpoint with this error.

I tired on VS code on my machine and with gitpod.io

TypeError: `transferOwnership` is not a function in challenge 2

I was doint the challenge-2 and following the instructions. I came to transfer ownership step and uncommented the code at this line. I have provided my frontend address but somehow it's giving me this error:

yarn run v1.22.19
$ yarn workspace @scaffold-eth/hardhat deploy --reset
$ hardhat deploy --export-all ../react-app/src/contracts/hardhat_contracts.json --reset
Nothing to compile
deploying "YourToken" (tx: 0xe5375d58ee48aa8b33b3b97b79d503eb3d7a3c92b90ac312a2d386209a16ff1b)...: deployed at 0x5FbDB2315678afecb367f032d93F642f64180aa3 with 637479 gas
deploying "Vendor" (tx: 0x2df0779ea222307500ecc0e0201255f2bf84c3f53e9810c588b3aeb5b3b92ec0)...: deployed at 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 with 331303 gas

 🏡  Sending all 1000 tokens to the vendor...


    βœ… confirming...


 🀹  Sending ownership to frontend address...

An unexpected error occurred:

Error: ERROR processing /home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/deploy/01_deploy_vendor.js:
TypeError: vendor.transferOwnership is not a function
    at Object.module.exports [as func] (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/deploy/01_deploy_vendor.js:33:45)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at DeploymentsManager.executeDeployScripts (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1055:22)
    at DeploymentsManager.runDeploy (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:891:5)
    at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
    at Environment.run (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
    at SimpleTaskDefinition.action (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/index.ts:528:32)
    at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
    at Environment.run (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
    at SimpleTaskDefinition.action (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/index.ts:605:5)
    at DeploymentsManager.executeDeployScripts (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1058:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at DeploymentsManager.runDeploy (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/DeploymentsManager.ts:891:5)
    at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
    at Environment.run (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
    at SimpleTaskDefinition.action (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/index.ts:528:32)
    at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
    at Environment.run (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
    at SimpleTaskDefinition.action (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat-deploy/src/index.ts:605:5)
    at Environment._runTaskDefinition (/home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/bin/node
Arguments: /usr/lib/node_modules/yarn/lib/cli.js deploy --reset
Directory: /home/rishabh/Documents/practice/solidity-practice/challenge-2-token-vendor/packages/hardhat
Output:

info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I am struggling for two days to solve this issue but can't find any solution. May anyone look into this what's the issue. The Vendor contract is inheriting Ownable from openzepplin.

Error HH100: Network goerli doesn't exist

Getting error message, when I run npx hardhat run script/deploy.js --network goerli

Terminal error response:Error HH100: Network goerli doesn't exist

For more info go to https://hardhat.org/HH100 or run Hardhat with --show-stack-traces

require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();
require("@nomiclabs/hardhat-ethers");

/** @type import('hardhat/config').HardhatUserConfig */

module.exports = {
solidity: "0.8.7",
Network:{
hardhat: {
Goerli: {
url: process.env.RPC_URL,
account: [process.env.PRIVATE_KEY],
},
},
},
etherscan: {
apiKey: process.env.ETHERSCAN_KEY,
},
};

Challenge 3 - Dice Game - Roll unit test missing await keyword

The it("Should not call DiceGame for a roll greater than 2") test is missing an await in front an expect assertion.
Without it, when it fails, the test has a race condition that makes it look another test is causing the failure.

File location is: challenge-3-dice-game/packages/hardhat/test/challenge_3.js)

Fix needs to be:
await expect(riggedRoll.riggedRoll()).to.reverted;

Challenge 0: Getting Error on Yarn Deploy

I am getting this error when I run yarn deploy. I tried different solutions but not working.
does anyone also having this issue?

TypeError: ethers.getContract is not a function

image

Challenge 1: Call to stake being made from owner instead of secondAccount signer

There is a bug at line 114 where the the call to stake is being made from the owner signer instead of secondAccount.

const stakeResult = await stakerContract.stake({value: ethers.utils.parseEther("0.001")});

This line needs to be :

const stakeResult = await stakerContract.connect(secondAccount).stake({value: ethers.utils.parseEther("0.001")});

Without this change, the test case cannot pass since secondAccount's balance never changes and the assertion of equality on line 144 will never be true.

expect(endingBalance).to.equal(startingBalance.add(ethers.utils.parseEther("0.001")));

NOTE: This entire test case probably needs to be redone due to changes in the withdraw method signature included in #88. If withdraw is intended to work without specifying an address, the comparison on line 144 will have to account not only for the difference in the stake being returned after the call to withdraw but also the gas used in calling the transaction. The withdraw method would also have to be called on the contract returned from stakerContract.connect(secondAccount) also.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.