Now with 100% more Blockchain!

This commit is contained in:
2018-10-31 05:52:42 -04:00
parent 0f6ab43a44
commit 131d7d809d
44 changed files with 30046 additions and 15 deletions

23
contracts/Migrations.sol Normal file
View File

@@ -0,0 +1,23 @@
pragma solidity ^0.4.23;
contract Migrations {
address public owner;
uint public last_completed_migration;
constructor() public {
owner = msg.sender;
}
modifier restricted() {
if (msg.sender == owner) _;
}
function setCompleted(uint completed) public restricted {
last_completed_migration = completed;
}
function upgrade(address new_address) public restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}

42
contracts/Ownable.sol Normal file
View File

@@ -0,0 +1,42 @@
pragma solidity ^0.4.24;
contract Ownable {
// .d8888b. 888 888 d8b 888 888
// d88P Y88b 888 888 Y8P 888 888
// Y88b. 888 888 888 888
// "Y888b. 888888 8888b. 888888 .d88b. 888 888 8888b. 888d888 888 8888b. 88888b. 888 .d88b. .d8888b
// "Y88b. 888 "88b 888 d8P Y8b 888 888 "88b 888P" 888 "88b 888 "88b 888 d8P Y8b 88K
// "888 888 .d888888 888 88888888 Y88 88P .d888888 888 888 .d888888 888 888 888 88888888 "Y8888b.
// Y88b d88P Y88b. 888 888 Y88b. Y8b. Y8bd8P 888 888 888 888 888 888 888 d88P 888 Y8b. X88
// "Y8888P" "Y888 "Y888888 "Y888 "Y8888 Y88P "Y888888 888 888 "Y888888 88888P" 888 "Y8888 88888P'
address owner;
// 888b d888 888 d8b .d888 d8b
// 8888b d8888 888 Y8P d88P" Y8P
// 88888b.d88888 888 888
// 888Y88888P888 .d88b. .d88888 888 888888 888 .d88b. 888d888 .d8888b
// 888 Y888P 888 d88""88b d88" 888 888 888 888 d8P Y8b 888P" 88K
// 888 Y8P 888 888 888 888 888 888 888 888 88888888 888 "Y8888b.
// 888 " 888 Y88..88P Y88b 888 888 888 888 Y8b. 888 X88
// 888 888 "Y88P" "Y88888 888 888 888 "Y8888 888 88888P'
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
// 888 888
// 888 888
// 888 888
// .d8888b .d88b. 88888b. .d8888b 888888 888d888 888 888 .d8888b 888888 .d88b. 888d888
// d88P" d88""88b 888 "88b 88K 888 888P" 888 888 d88P" 888 d88""88b 888P"
// 888 888 888 888 888 "Y8888b. 888 888 888 888 888 888 888 888 888
// Y88b. Y88..88P 888 888 X88 Y88b. 888 Y88b 888 Y88b. Y88b. Y88..88P 888
// "Y8888P "Y88P" 888 888 88888P' "Y888 888 "Y88888 "Y8888P "Y888 "Y88P" 888
constructor() public {
owner = msg.sender;
}
}

37
contracts/Pong.sol Normal file
View File

@@ -0,0 +1,37 @@
/*
* -----------------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <miguel.astor@ciens.ucv.ve> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Miguel Angel Astor
* -----------------------------------------------------------------------------------
*/
pragma solidity ^0.4.24;
import "./Ownable.sol";
contract Pong is Ownable {
uint256 timesPlayed;
event CanPlayTheGame(address indexed player);
constructor() public {
timesPlayed = 0;
}
function kill() public onlyOwner {
selfdestruct(owner);
}
function howManytimesPlayed() public view returns (uint256) {
return timesPlayed;
}
function play() payable public {
require(msg.value == 1000000000000000000);
owner.transfer(msg.value);
timesPlayed += 1;
emit CanPlayTheGame(msg.sender);
}
}