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
pragma solidity ^0.4.19; | |
contract Account{ | |
/* struct account{ | |
string pubKey; | |
string priKey; | |
} */ | |
struct account_user{ | |
string pubKey; |
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
var a = eth.accounts[0] | |
web3.eth.defaultAccount = a; | |
// abi and bytecode generated from simplestorage.sol: | |
// > solcjs --bin --abi simplestorage.sol | |
var abi = <ABI>; | |
var Contract = web3.eth.contract(abi); |
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
{ | |
"config": { | |
"chainId": 1994, | |
"homesteadBlock": 0, | |
"eip155Block": 0, | |
"eip158Block": 0, | |
"byzantiumBlock": 0 | |
}, | |
"difficulty": "0x0", | |
"gasLimit": "0x8000000", |
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
contract EtherStore { | |
// initialise the mutex | |
bool reEntrancyMutex = false; | |
uint256 public withdrawalLimit = 1 ether; | |
mapping(address => uint256) public lastWithdrawTime; | |
mapping(address => uint256) public balances; | |
function depositFunds() public payable { | |
balances[msg.sender] += msg.value; | |
} |
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
contract EtherStore { | |
// initialise the mutex | |
bool reEntrancyMutex = false; | |
uint256 public withdrawalLimit = 1 ether; | |
mapping(address => uint256) public lastWithdrawTime; | |
mapping(address => uint256) public balances; | |
function depositFunds() public payable { | |
balances[msg.sender] += msg.value; | |
} |
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
pragma solidity ^0.4.18; | |
contract Token { | |
mapping(address => uint) balances; | |
uint public totalSupply; | |
function Token(uint _initialSupply) { | |
balances[msg.sender] = totalSupply = _initialSupply; | |
} | |
function transfer(address _to, uint _value) public returns (bool) { | |
require(balances[msg.sender] - _value >= 0); | |
balances[msg.sender] -= _value; |
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
library SafeMath { | |
function mul(uint256 a, uint256 b) internal pure returns (uint256) { | |
if (a == 0) { | |
return 0; | |
} | |
uint256 c = a * b; | |
assert(c / a == b); | |
return c; | |
} | |
function div(uint256 a, uint256 b) internal pure returns (uint256) { |
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
contract EtherGame { | |
uint public payoutMileStone1 = 3 ether; | |
uint public mileStone1Reward = 2 ether; | |
uint public payoutMileStone2 = 5 ether; | |
uint public mileStone2Reward = 3 ether; | |
uint public finalMileStone = 10 ether; | |
uint public finalReward = 5 ether; | |
mapping(address => uint) redeemableEther; |
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
// library contract - calculates fibonacci-like numbers; | |
contract FibonacciLib { | |
// initializing the standard fibonacci sequence; | |
uint public start; | |
uint public calculatedFibNumber; | |
// modify the zeroth number in the sequence | |
function setStart(uint _start) public { | |
start = _start; | |
} | |
function setFibonacci(uint n) public { |
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
contract FibonacciBalance { | |
address public fibonacciLibrary; | |
// the current fibonacci number to withdraw | |
uint public calculatedFibNumber; | |
// the starting fibonacci sequence number | |
uint public start = 3; | |
uint public withdrawalCounter; | |
// the fibonancci function selector | |
bytes4 constant fibSig = bytes4(sha3("setFibonacci(uint256)")); | |
OlderNewer