21 Matching Annotations
  1. Feb 2022
  2. ethernaut.openzeppelin.com ethernaut.openzeppelin.com
    1. require(msg.sender != tx.origin);

      tx.origin is the originator of a contract call, no matter how many contracts sit in between it and the final destination. msg.sender is the most recent sender of the call. We can handle this condition by creating 2 contracts.

  3. ethernaut.openzeppelin.com ethernaut.openzeppelin.com
  4. ethernaut.openzeppelin.com ethernaut.openzeppelin.com
    1. king.transfer(msg.value);

      This function violates the checks-effects-interact pattern by including a call to an external contract before state variables are changed.

  5. ethernaut.openzeppelin.com ethernaut.openzeppelin.com
    1. uint256(blockhash(block.number.sub(1)))

      get the previous block's number, get the hash of that block, and convert to uint256, then assign to the variable blockValue.

      If the placeholder lastHash is equal to blockValue, we are in the same block and the call to flip will revert.

      Otherwise, update lastHash to equal blockValue (thus storing the record of the block)

  6. ethernaut.openzeppelin.com ethernaut.openzeppelin.com
    1. modifier onlyOwner { require( msg.sender == owner, "caller is not the owner" ); _; }

      If a function is annotated with the onlyOwner modifier, the sender of the transaction must be the owner otherwise the tx will revert.

    2. receive() external payable { require(msg.value > 0 && contributions[msg.sender] > 0); owner = msg.sender; }

      By sending any amount of Ether to the contract once your contributions are more than 0, you will become the owner of the contract and can withdraw all of the tokens

  7. Feb 2019
    1. For that reason, “overuse” of the internet and social media today may not be such a bad thing. It is our primary way of exploring all of the potential of that cultural mode, and that mode will at some point be tamed and neutered, just as Baroque music composition is now dormant.

      I don't think that we can so easily equate a Baroque music fad with internet & social media addiction - it feels like a genuinely different mode of human interaction that is causing large, potentially negative changes in our societies at a core level.

    2. That would have some positive effects on gdp in the short run, but its major effects would be in the much longer run, namely the prevention of a very destructive war.

      As far as I understand most large, destructive wars have led to large jumps in technological prowess that has eventually 'trickled down' to the consumer market & society in general, raising GDP in the process (think the internet, jet propulsion, lasers, reconstructive surgery, etc)

  8. Sep 2018
    1. Broadly speaking, a setTimeout(0) doesn’t really run in zero milliseconds. Usually, it runs in 4.

      The 0 in a setTimeout(0) call is actually only a minimum amount of time - due to the Event Loop cycles the 0 call will usually run in no less than 4ms.