BuidlGuidl / eth-tech-tree-challenges

This repository houses the many challenges of the Ethereum Development Tech Tree
MIT License
3 stars 9 forks source link

Initial Challenge Setup - Multisend #3

Closed escottalexander closed 1 month ago

escottalexander commented 2 months ago

The setup is like this; eth-tech-tree is a CLI for downloading, submitting and managing which challenges a user has completed. The repo that houses all the challenges in called eth-tech-tree-challenges. Each challenge is a new branch on that repo.

Follow the example left by the Token Wrapper WETH challenge and see how that challenge is configured in the challenges.json file in the eth-tech-tree repo.

{
    "type": "challenge",
    "level": 1,
    "name": "token-wrapper-weth", // Branch name
    "label": "Token Wrapper - WETH",
    "repo": "https://github.com/escottalexander/scaffold-eth-2",
    "testHash":"cdef2b9c0051c45a8ce2c1ec14a7446419496a018a6dc114735cce9de3a4f249",
    "testFileName":"WrappedETH.t.sol",
    "tags": ["DeFi"]
  },

Here are the steps for adding a new challenge:

Creating a new challenge

  1. Fork and download the eth-tech-tree-challenges repo
  2. Create a new branch based on the main branch (which is set up to be a template for any challenge) with the name of the challenge e.g. 'multisend'
  3. Write out a solution to the challenge in solidity using best industry standards as generically as possible by editing Challenge.sol and changing it's name to match the challenge
  4. Write tests that cover the most common pitfalls and guarantee the contract operates as expected (Challenge.t.sol) - change it's name to match the contract
  5. Update README in your challenge to give the user clarity about what they must accomplish and also any helpful resources (see the token-wrapper-weth challenge for an example)
  6. Commit and push your changes to your remote repo, creating a new branch on your remote git push
  7. Submit a PR to the main eth-tech-tree-challenges repo pointed to the branch that matches your challenge name e.g. 'multisend'

Adding the new challenge to eth-tech-tree CLI app

  1. Edit challenges.json (in eth-tech-tree) to have proper values for each property
    • name: should match your branch name
    • repo: should be your repository
    • testName: should be the name of the test file
    • testHash: should be the hash of the test file. Use console.log to get this when taking the "submit challenge" action on your challenge when running eth-tech-tree CLI
  2. Test downloading and submitting the challenge using the eth-tech-tree CLI yarn build && yarn cli
  3. Commit and push changes to the eth-tech-tree in your own fork and branch called 'adding-[challenge branch name]' and submit a PR to the main repo 🎉

Later, in another task, we will erase your specific solution code from the git history for your new branch in eth-tech-tree-challenges.


Multisend challenge specifics

This challenge will require the user to build a contract that is capable of sending tokens or ETH to multiple provided addresses. I would go about this by creating two separate methods, one for sending ETH and one for sending any ERC20 token. Each method will be provided an array of addresses and an array of amounts. The ERC20 method will also receive the token address. Let me know if you have any questions or ideas to make this more instructional for the end user.

It already has an object in challenges.json which has the name field 'multisend'.

steve0xp commented 1 month ago

I can take a crack at this. I will likely have clarification questions but can start with stubbing out a solidity contract with pseudo code. I'm thinking of taking on #2, #5, or #6 as well.

steve0xp commented 1 month ago

PR #31 closes this issue :)