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 - Payment Split Contract #36

Open escottalexander opened 1 month ago

escottalexander commented 1 month 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. 'percentage-payment-splitter'
  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. 'percentage-payment-splitter'

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


Percentage Payment Splitter challenge specifics

This challenge is a direct descendant of the multisend challenge so you might consider inheriting some design choices from that challenge: https://github.com/BuidlGuidl/eth-tech-tree-challenges/tree/multisend

This challenge will require users to learn the gotchas of splitting payments by percentages in a contract. They should be forced to think about precision and overflow errors. I envision that the contract will receive a request to send ETH or tokens along with an array of recipients and an array of uints that specify the percentage that goes to each recipient. Feel free to re-imagine things if you feel that it serves the purpose better.

Feel free to ask any questions or express any ideas that will help the end user learn through this challenge.

blahkheart commented 1 month ago

I'll take this on