Created
March 27, 2020 18:38
-
-
Save dionyziz/c4bb728ccae98fcf043b61548cc8359a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Bank { | |
constructor() { | |
this.attacker_balance = 1; | |
} | |
withdraw() { | |
if (this.attacker_balance == 1) { | |
console.log('Sending ' + this.attacker_balance + ' ETH to attacker'); | |
send_money_to_attacker(this.attacker_balance); | |
} | |
console.log('Setting balance to 0'); | |
this.attacker_balance = 0; | |
} | |
} | |
let bank = new Bank(); | |
let withdrawals = 0; | |
function send_money_to_attacker(money) { | |
console.log('Got ' + money + ' ETH'); | |
++withdrawals; | |
if (withdrawals < 10) { | |
bank.withdraw(); | |
} | |
} | |
bank.withdraw(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment