Skip to content

Instantly share code, notes, and snippets.

View alexvandesande's full-sized avatar
🤖
Preventing human machine conflicts

Alex Van de Sande alexvandesande

🤖
Preventing human machine conflicts
View GitHub Profile
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_
}
function transferOwnership(address newOwner) onlyOwner {
var base10 = $('input[id="base10"]').numeric({ negative: false });
function syllable(n){
consonants = 'bcdfghjklmnprstvwz'; // consonants except hard to speak ones
vowels = 'aeiou'; // vowels
all = consonants + vowels; // all
text = '';
syllableStr = "";
if (n<90) {
@alexvandesande
alexvandesande / proposal.sol
Created June 4, 2016 21:02
Proposal Framework
/*
This file is part of the DAO.
The DAO is free software: you can redistribute it and/or modify
it under the terms of the GNU lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The DAO is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@alexvandesande
alexvandesande / Proposal.js
Last active April 5, 2022 08:05
Proposal Framework for The DAO
/*
The contract is free software: you can redistribute it and/or modify
it under the terms of the GNU lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The contract is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@alexvandesande
alexvandesande / Refund.js
Last active June 21, 2016 19:33
A refund contract for the DAO, to be voted on by a updateContract (no hard fork required)
/*
CODE TO MAKE THE DAO INTO AN AUTOMATIC REFUND
*/
// A generic token contract
contract token {
mapping (address => uint256) public balanceOf;
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function mintToken(address target, uint256 mintedAmount);
/*
GENERIC TOKEN CONTRACT
THIS IS NOT THE REFUND CODE
*/
contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
contract owned {
[ { "constant": true, "inputs": [ { "name": "", "type": "uint256" } ], "name": "proposals", "outputs": [ { "name": "recipient", "type": "address", "value": "0x0000000000000000000000000000000000000000" }, { "name": "amount", "type": "uint256", "value": "0" }, { "name": "description", "type": "string", "value": "" }, { "name": "votingDeadline", "type": "uint256", "value": "0" }, { "name": "open", "type": "bool", "value": false }, { "name": "proposalPassed", "type": "bool", "value": false }, { "name": "proposalHash", "type": "bytes32", "value": "0x0000000000000000000000000000000000000000000000000000000000000000" }, { "name": "proposalDeposit", "type": "uint256", "value": "0" }, { "name": "newCurator", "type": "bool", "value": false }, { "name": "yea", "type": "uint256", "value": "0" }, { "name": "nay", "type": "uint256", "value": "0" }, { "name": "creator", "type": "address", "value": "0x0000000000000000000000000000000000000000" } ], "type": "function" }, { "constant": false, "inputs": [ { "name": "_spender", "t
@alexvandesande
alexvandesande / forkvote.js
Last active June 24, 2016 20:49
Hard Fork Stake Vote
contract HardForkVote {
/*
There is a very important debate on the Ethereum Community on either
contracts should be truly immutable, or if there should be a social
consensus that allows some to be changed on extreme circunstances.
This contract allows the network to signal support for the decision
by having those in favor of a change commit not to move any funds
for a year, to prove their long term commitment to the project.
*/
contract VoteRegistration {
// stores the information about the current node.
// This variable can only be changed via a hard fork
bytes32 public forkHash = sha3('');
// stores the array of all registered voters
mapping (address => address) public voteContracts;
// checks if the lock is active
bool public active = false;
contract ethExchange {
address public public ethClassicWithdrawer;
address public public ethForkWithdrawer;
bool public accepted;
address public refundContract = '0xbf4ed7b27f1d666546e30d74d50d173d20bca754';
function ethExchange(uint amountToExchange) {
ethClassicWithdrawer = msg.sender;
}