Skip to content

Instantly share code, notes, and snippets.

View WelToHackerLand's full-sized avatar

Trung.Ore WelToHackerLand

View GitHub Profile
  1. BasicERC20
  • Function transferFrom: forget to check the balance of _from
  • Function balanceOf: should assign balances = balances[_owner] instead of return balances[_owner]
  • Function allowance: should assign remaining = allowed[_owner][_spender] instead of return allowed[_owner][_spender]

Lottery

  • Function guessWithWeth, we haven’t checked “amount >= GUEST_COST“
  • Function withdrawGuess, user can withdraw without delete any their guesses (index can be out of array)
  • Function withdrawGuess, we haven’t checked guesser have no more guess before deleting the guesser
  • Line 163 won’t work as we expected ? We should shift the index to the end of array and pop it (delete the array’s element just set the value of element to 0) to save gas. But if we want to save the order, maybe we can do that, and use stakes function to check the “real” length of array