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 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 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 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. |
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 characters
| contract SplitFunds { | |
| function split(address[] addrs){ | |
| if(!addrs[uint(block.blockhash(block.number-1)) % addrs.length].send(msg.value)) throw; | |
| } | |
| } |
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 characters
| library LinkedList { | |
| struct data { | |
| uint80 head; | |
| uint80 last; | |
| uint80 count; | |
| Item[] items; | |
| } | |
| uint80 constant None = uint80(0); | |
| struct Item { | |
| uint80 prev; |
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 characters
| contract StringStore { | |
| mapping(uint => string) public myStrings; | |
| function storeString(string str, uint i) public { | |
| myStrings[i] = str; | |
| } | |
| } | |
| contract GetString { | |
| function getString(address store, uint i) constant returns (string s, uint l){ | |
| bytes4 sig = bytes4(sha3("myStrings(uint256)")); |
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 characters
| rom Crypto.Cipher import AES | |
| from SocketServer import ThreadingMixIn | |
| from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
| import sys | |
| class Hasher: | |
| def __init__(self): | |
| self.aes = AES.new('\x00'*16) | |
| def reset(self): |
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 characters
| function disasm(code) { | |
| if (!code) | |
| return code; | |
| var codes = code.match(/(..?)/g); | |
| var dis = ""; | |
| for(var i = 1; i < codes.length; i++) { | |
| var opcode = opcodes[codes[i]]; | |
| dis += i+". " + codes[i]+": " | |
| if (!opcode) { |
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 characters
| #include <gtest/gtest.h> | |
| #include <gadgetlib2/gadget.hpp> | |
| #include "gadgetlib2/adapters.hpp" | |
| #include "gadgetlib2/integration.hpp" | |
| #include "relations/constraint_satisfaction_problems/r1cs/examples/r1cs_examples.hpp" | |
| #include "gadgetlib2/examples/simple_example.hpp" | |
| #include "zk_proof_systems/ppzksnark/r1cs_ppzksnark/examples/run_r1cs_ppzksnark.hpp" | |
| using namespace libsnark; |
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 characters
| contract MultiProxy{ | |
| //Data schema: [from: 32 bytes, to: 32 bytes, value: 32 bytes, data_length: 32 bytes, data: data_length bytes] | |
| function forward(bytes32[]) external payable { | |
| assembly { | |
| function next_tx (c) -> n { | |
| let data_size := calldataload(add(c, 96)) | |
| n := add(c, add(128, mul(div(data_size, 32), 32))) | |
| switch mod(data_size, 32) | |
| case 0 { |
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 characters
| 0x6384f6b34b7f14a551fe2d94e21ac79637eded25 |