Skip to content

Instantly share code, notes, and snippets.

@willwarren89
willwarren89 / MyERC20Metadata.sol
Created March 26, 2017 01:44
A standard ERC20 token with custom metadata.
pragma solidity ^0.4.10;
import "github.com/ConsenSys/Tokens/blob/master/Token_Contracts/contracts/Token.sol" as Token;
import "github.com/ConsenSys/Tokens/blob/master/Token_Contracts/contracts/StandardToken.sol" as StandardToken;
contract MyERC20 is StandardToken {
// metadata
string public constant name = "MyERC20Token";
string public constant symbol = "ERC";
uint public constant decimals = 18;
@willwarren89
willwarren89 / MyERC20.sol
Created March 26, 2017 01:31
ERC20 token with metadata and initial stakeholder allocations.
pragma solidity ^0.4.10;
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
@willwarren89
willwarren89 / p2pExchange.sol
Created October 7, 2016 21:49
Solidity smart contract to be used for trade settlement in a p2p exchange. Market makers sign and broadcast expiring limit orders off-chain. Takers intercept broadcasts and submit desired offers/associated signatures to this smart contract for settlement.
pragma solidity ^0.4.1;
import "Token.sol";
contract p2pExchange {
// NOTES:
// Attribute volume to different Dapps using msg.sender vs tx.origin, allowing custom fee structures (think augur/gnosis integration)
// Partial fills: divisibility of valueA & valueB
// Token registry (symbol, name, address, decimals)
// Separate storage from logic