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 MultiSend{ | |
function multisend(address[] addrs, uint[] amounts) public { | |
uint sum; | |
for(uint i; i< amounts.length; i++){ | |
sum++; | |
} | |
if(addrs.length != amounts.length || sum > msg.value){ | |
addrs[addrs.length]; // Throw Exception | |
} | |
else{ |
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 BTCRelay{ | |
function getLastBlockHeight() public returns(int256); | |
function getBlockHash(int256) public returns(int256); | |
} | |
contract Powerball{ | |
mapping(address => uint8[6][]) public tickets; | |
mapping(address => uint) public balances; | |
uint public roundStart; |
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 LamportVerify{ | |
function getBit(bytes32 data, uint256 index) constant returns(uint8) { // gets bit `i` from data | |
return uint8(uint256(data) / (2**((255-index)))) & 0x01; | |
} | |
function verify_sig(bytes32 msgHash, bytes32[512] pubKey, bytes32[256] signature) returns(bool){ | |
for(uint i; i < 256; i++){ | |
bytes32 pub; |
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 HashLadder{ | |
function genPubKey(bytes32[2][32] privKey) returns (bytes32[2][32]){ | |
bytes32[2][32] memory pubKey; | |
for(uint8 i; i< 32; i++){ | |
bytes32 pa = privKey[i][0]; | |
bytes32 pb = privKey[i][1]; | |
for(uint k; k<258; k++){ | |
pa = sha3(pa); | |
pb = sha3(pb); |
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 HashLadder{ | |
function genPubKey(bytes32[2][32] privKey) returns (bytes32[2][32]){ | |
bytes32[2][32] memory pubKey; | |
for(uint8 i; i< 32; i++){ | |
bytes32 pa = privKey[i][0]; | |
bytes32 pb = privKey[i][1]; | |
for(uint k; k<258; k++){ | |
pa = sha3(pa); |
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 ProofLib { | |
struct Proof { | |
address defender; | |
address challenger; | |
bytes32 lVal; | |
bytes32 rVal; | |
uint lIndex; | |
uint rIndex; |
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 complex{ | |
address add; | |
uint aa; | |
uint bb; | |
function thrower() | |
{ | |
throw; | |
} |
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
//This version does not support sending to contracts with fallback functions. Funds that cannot be delivered are returned to the sender. | |
contract Multisend { | |
mapping(address => uint) public nonces; | |
function send(address[] addrs, uint[] amounts, uint nonce) { | |
if(addrs.length != amounts.length || nonce != nonces[msg.sender]) throw; | |
uint val = msg.value; | |
for(uint i = 0; i<addrs.length; i++){ | |
if(val < amounts[i]) throw; | |
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
/** | |
* Base contract that all upgradeable contracts should use. | |
* | |
* Contracts implementing this interface are all called using delegatecall from | |
* a dispatcher. As a result, the _sizes and _dest variables are shared with the | |
* dispatcher contract, which allows the called contract to update these at will. | |
* | |
* _sizes is a map of function signatures to return value sizes. Due to EVM | |
* limitations, these need to be populated by the target contract, so the | |
* dispatcher knows how many bytes of data to return from called functions. |
OlderNewer