Skip to content

Instantly share code, notes, and snippets.

View karlfloersch's full-sized avatar
🐹
dogeeeeee

Karl Floersch karlfloersch

🐹
dogeeeeee
View GitHub Profile
pragma solidity ^0.4.7;
contract CommitRevealElection {
// The two choices for your vote
string public choice1;
string public choice2;
// Information about the current status of the vote
uint public votesForChoice1;
uint public votesForChoice2;
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="http://openlayers.org/en/v3.5.0/css/ol.css" type="text/css">
<style>
.map {
height: 400px;
width: 100%;
}
</style>
pragma solidity ^0.7.0;
contract EOAProxy {
address implementation = DEFAULT_IMPL_ADDR;
function _eoaUpgrade(address _newImplementation) external {
require(msg.sender == address(this));
implementation = _newImplementation;
}
fallback() external {
address impl = implementation;
pragma solidity ^0.5.0;
/* Interface Imports */
import { ICrossDomainMessenger } from "./interfaces/CrossDomainMessenger.interface.sol";
/**
* @title BaseCrossDomainMessenger
*/
contract BaseCrossDomainMessenger is ICrossDomainMessenger {
[{'name': '__init__', 'outputs': [], 'inputs': [{'type': 'int128', 'name': '_epoch_length'}, {'type': 'int128', 'name': '_withdrawal_delay'}, {'type': 'address', 'name': '_owner'}, {'type': 'address', 'name': '_sighasher'}, {'type': 'address', 'name': '_purity_checker'}, {'type': 'decimal10', 'name': '_base_interest_factor'}, {'type': 'decimal10', 'name': '_base_penalty_factor'}, {'type': 'int128', 'name': '_min_deposit_size'}], 'constant': False, 'payable': False, 'type': 'constructor'}, {'name': 'get_main_hash_voted_frac', 'outputs': [{'type': 'decimal10', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function'}, {'name': 'get_deposit_size', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [{'type': 'int128', 'name': 'validator_index'}], 'constant': True, 'payable': False, 'type': 'function'}, {'name': 'get_total_curdyn_deposits', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function'}, {'name': 'get_total_p
@karlfloersch
karlfloersch / casper_chat_log.txt
Created December 13, 2017 16:42
Chat log from this Casper presentation: https://youtu.be/uQ3IqLDf-oo
09:08:37 From Joseph Chow : (Time 1 seems dangling in these slides)
09:09:01 From jonchoi : +1
09:10:04 From lanerettig : BTC POW currently burns as much energy as Ecuador… not a tiny country
09:11:18 From jonchoi : yep also worth mentioning PoS uses potential value at loss as the incentive as opposed to realized opex in PoW
09:12:04 From lanerettig : what does “finality” really mean in a world where someone can disagree, rewind, and fork anyway?
09:12:30 From @M : I think it means they can’t rewind and fork?
09:12:46 From danny : it would require manual intervention
09:12:53 From danny : can always fork :)
09:16:09 From @M : Is Phil’s question presenting a difference between a “protocol changing fork”, and a reorganization which just rewinds and builds on a previous block?
09:19:53 From aparnakrishnan : Is there any reason for choosing 50 blocks to be the epoch?
pragma solidity ^0.4.4;
contract Lotto {
uint constant public maxTickets = 5;
uint public currentTickets = 0;
mapping(uint=>address) participants;
event logString(string x);
@karlfloersch
karlfloersch / index.html
Last active August 15, 2016 21:31
A basic web3 starter. It requires some work, it's intended use is for the Lotto contract
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello World</title>
</head>
<body>
<script>
if (typeof web3 !== 'undefined') {

Terms:

  • Web3.js: A Javascript library letting you interact with any Ethereum node using the RPC network protocol.
  • Geth: A heavyweight Ethereum node
  • Testrpc: A Ethereum node simulator (fast and good for development)
  • Pudding: A library wrapping web3.js providing a nicer interface for interacting with the node/sending transactions.
  • Truffle: A framework good for JS developers who want to build prototypes and don't mind the restrictions it imposes. For more customization, just use plain JS, web3.js, and pudding.
  • Solc: The Solidity compiler

Tips:

@karlfloersch
karlfloersch / eth-arch.md
Created May 1, 2016 20:27
A dockerized Ethereum Dapp architecture

Test