rae-ralston / lunyr-challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lunyr Coding Challenge

Applying to the front end developer position.

Personal Website | rachel@blockchaindevelopers.io | UI Design Portfolio | LinkedIn | twitter

Process Outline

  1. Read and understand the contract. Find all plainly obvious bugs (insecure-firstPassNotes.sol).
  2. Run the contract through the remix compiler and check their analysis (remix-compiler-notes.md). Resolve all bugs.
  3. Think through the problem: Where can you use modifiers to encapsulate code? Are you emitting events where you should be? Have you thought about as many security angles as you can?
  4. run it through the compiler again to catch any additional bugs.
  5. final version: insecure-final.sol

As I went back through the contract I:

  • added a struct to the shares map
  • added some modifiers to ensure that only authorized users could engage certain parts & to lock the contract against reentrance.
  • added more events to mark different locations of execution success or failure.
  • I wrapped parts of the execution in if/else statements to be more precise and to allow for both success and failure events.

The gas cost is a concern with the for loop in the dispense function. If there are enough shareholders the gas will run out.

About