Skip to main content
. 2020 Feb 11;22(2):203. doi: 10.3390/e22020203
Algorithm 2 Re-entrancy vulnerability example.
  • 1:
    contract Bob {
  • 2:
          bool sent = false;
  • 3:
          function foo(address c) {
  • 4:
               if (!sent) {
  • 5:
                      c.call.value(1)();
  • 6:
                      sent = true;
  • 7:
               }
  • 8:
          }
  • 9:
    }
  • 10:
    contract Alice {
  • 11:
          function(){
  • 12:
               Bob(msg.sender).foo(this);
  • 13:
          }
  • 14:
    }