Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xE61fDAF474Fac07063f2234Fb9e60C1163Cfa850
Balance 0 ETH
Nonce 1
Code Size 9611 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

9611 bytes
0x6080604052600436106101875763ffffffff60e060020a60003504166306fdde03811461018c5780630958a9f314610216578063095ea7b31461024757806309ea63e31461027f57806310840303146103595780631296830d1461038157806318160ddd146103f457806323b872dd1461041b578063313ce567146104455780633f45440614610470578063429b62e514610491578063476e492f146104b2578063617b390b14610514578063661884631461058757806370a08231146105ab57806370de43f1146105cc5780638be52783146105e45780638da5cb5b146106575780638e421f161461066c5780638f4ffcb1146106ce57806395d89b411461073e578063a59b3d4614610753578063a9059cbb1461076e578063a9a0b49514610792578063adb8249e14610829578063b15aa5b71461089c578063c8d4b389146108b4578063cae9ca511461096a578063d4acaf6c146109d3578063d73dd62314610a31578063dd62ed3e14610a55578063dfb6c46814610a7c578063f2fde38b14610a9d575b600080fd5b34801561019857600080fd5b506101a1610abe565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101db5781810151838201526020016101c3565b50505050905090810190601f1680156102085780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561022257600080fd5b5061022b610af5565b60408051600160a060020a039092168252519081900360200190f35b34801561025357600080fd5b5061026b600160a060020a0360043516602435610b04565b604080519115158252519081900360200190f35b34801561028b57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261022b94369492936024939284019190819084018382808284375050604080516020601f60608a01358b0180359182018390048302840183018552818452989b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff198b35169b600160a060020a03848d0135169b958601359a919950975060809094019550919350918201918190840183828082843750949750508435955050506020909201359150610b259050565b34801561036557600080fd5b5061037f600160a060020a03600435166024351515610b52565b005b34801561038d57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261026b94369492936024939284019190819084018382808284375094975050508335600160a060020a0316945050506020820135916040810135915060600135610bc4565b34801561040057600080fd5b50610409610e08565b60408051918252519081900360200190f35b34801561042757600080fd5b5061026b600160a060020a0360043581169060243516604435610e0e565b34801561045157600080fd5b5061045a610edc565b6040805160ff9092168252519081900360200190f35b34801561047c57600080fd5b5061037f600160a060020a0360043516610ee1565b34801561049d57600080fd5b5061026b600160a060020a0360043516611030565b3480156104be57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261022b9436949293602493928401919081908401838280828437509497505084359550505060209092013591506110459050565b34801561052057600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261026b94369492936024939284019190819084018382808284375094975050508335600160a060020a0316945050506020820135916040810135915060600135611065565b34801561059357600080fd5b5061026b600160a060020a03600435166024356111c9565b3480156105b757600080fd5b50610409600160a060020a03600435166111d6565b3480156105d857600080fd5b5061026b6004356111f1565b3480156105f057600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261026b94369492936024939284019190819084018382808284375094975050508335600160a060020a031694505050602082013591604081013591506060013561121b565b34801561066357600080fd5b5061022b61137f565b34801561067857600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261026b94369492936024939284019190819084018382808284375094975050843595505050602090920135915061138e9050565b3480156106da57600080fd5b50604080516020601f60643560048181013592830184900484028501840190955281845261037f94600160a060020a0381358116956024803596604435909316953695608494920191819084018382808284375094975061158a9650505050505050565b34801561074a57600080fd5b506101a161161d565b34801561075f57600080fd5b50610409600435602435611654565b34801561077a57600080fd5b5061026b600160a060020a036004351660243561171b565b34801561079e57600080fd5b50604080516020601f606435600481810135928301849004840285018401909552818452610409947bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1981351694600160a060020a0360248035919091169560443595369560849493019181908401838280828437509497505084359550505060209092013591506117289050565b34801561083557600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261026b94369492936024939284019190819084018382808284375094975050508335600160a060020a031694505050602082013591604081013591506060013561189f565b3480156108a857600080fd5b50610409600435611a03565b3480156108c057600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261026b94369492936024939284019190819084018382808284375050604080516020888301358a018035601f8101839004830284018301909452838352979a8935600160a060020a03169a8a8301359a91999098506060909101965091945090810192508190840183828082843750949750508435955050506020909201359150611aad9050565b34801561097657600080fd5b50604080516020600460443581810135601f810184900484028501840190955284845261026b948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750611dff9650505050505050565b3480156109df57600080fd5b5060408051602060046024803582810135601f810185900485028601850190965285855261022b958335953695604494919390910191908190840183828082843750949750611f1b9650505050505050565b348015610a3d57600080fd5b5061026b600160a060020a0360043516602435611ff0565b348015610a6157600080fd5b50610409600160a060020a0360043581169060243516611ffd565b348015610a8857600080fd5b5061037f600160a060020a0360043516612028565b348015610aa957600080fd5b5061037f600160a060020a0360043516612083565b60408051808201909152601281527f436f696e205574696c69747920546f6b656e0000000000000000000000000000602082015281565b600154600160a060020a031681565b6000610b11338484612117565b1515610b1c57600080fd5b50600192915050565b6000610b46610b40610b3b898989898989611728565b611a03565b89611f1b565b98975050505050505050565b600154600160a060020a03163314610b6957600080fd5b600160a060020a0382161515610b7e57600080fd5b600154600160a060020a0383811691161415610b9957600080fd5b600160a060020a03919091166000908152600260205260409020805460ff1916911515919091179055565b6000806000805a9250610bf68963a9059cbb60e060020a028a8a60206040519081016040528060008152508b8b610b25565b9150600160a060020a0382161515610c46576040805160e560020a62461bcd02815260206004820152601b6024820152600080516020612540833981519152604482015290519081900360640190fd5b610c6e63a9059cbb60e060020a02898960206040519081016040528060008152508a8a611728565b600160a060020a038316600090815260066020908152604080832084845290915290205490915060ff1615610cef576040805160e560020a62461bcd02815260206004820152602660248201526000805160206125008339815191526044820152600080516020612520833981519152606482015290519081900360840190fd5b600160a060020a03821660009081526006602090815260408083208484529091529020805460ff19166001179055610d28828989612182565b1515610d3357600080fd5b6000861115610dc357610d4d5a849063ffffffff61235e16565b6188b8019250610d6d8232610d68898763ffffffff61237016565b612182565b1515610dc3576040805160e560020a62461bcd02815260206004820152601b60248201527f47617320636f737420636f756c64206e6f7420626520706169642e0000000000604482015290519081900360640190fd5b604051600160a060020a0383169082907ff4a65fdaee7ca2336b6b5ea720055552af3fd371f7ebe46b8c83fa89d8c733f890600090a350600198975050505050505050565b60035490565b600160a060020a0383166000908152600460205260408120548211801590610e595750600160a060020a03841660009081526005602090815260408083203384529091529020548211155b1515610e6457600080fd5b600160a060020a0384166000908152600560209081526040808320338452909152902054610e98908363ffffffff61235e16565b600160a060020a0385166000908152600560209081526040808320338452909152902055610ec7848484612182565b1515610ed257600080fd5b5060019392505050565b601281565b600080548190600160a060020a03163314610efb57600080fd5b604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051849350600160a060020a038416916370a082319160248083019260209291908290030181600087803b158015610f5f57600080fd5b505af1158015610f73573d6000803e3d6000fd5b505050506040513d6020811015610f8957600080fd5b505160008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0392831660048201526024810185905290519394509085169263a9059cbb92604480840193602093929083900390910190829087803b158015610fff57600080fd5b505af1158015611013573d6000803e3d6000fd5b505050506040513d602081101561102957600080fd5b5050505050565b60026020526000908152604090205460ff1681565b600061105d611057610b3b8585611654565b85611f1b565b949350505050565b6000806000805a92506110978963095ea7b360e060020a028a8a60206040519081016040528060008152508b8b610b25565b9150600160a060020a03821615156110e7576040805160e560020a62461bcd02815260206004820152601b6024820152600080516020612540833981519152604482015290519081900360640190fd5b61110f63095ea7b360e060020a02898960206040519081016040528060008152508a8a611728565b600160a060020a038316600090815260066020908152604080832084845290915290205490915060ff1615611190576040805160e560020a62461bcd02815260206004820152602660248201526000805160206125008339815191526044820152600080516020612520833981519152606482015290519081900360840190fd5b600160a060020a03821660009081526006602090815260408083208484529091529020805460ff19166001179055610d28828989612117565b6000610b1133848461239b565b600160a060020a031660009081526004602052604090205490565b33600090815260066020908152604080832093835292905220805460ff1916600190811790915590565b6000806000805a925061124d89636618846360e060020a028a8a60206040519081016040528060008152508b8b610b25565b9150600160a060020a038216151561129d576040805160e560020a62461bcd02815260206004820152601b6024820152600080516020612540833981519152604482015290519081900360640190fd5b6112c5636618846360e060020a02898960206040519081016040528060008152508a8a611728565b600160a060020a038316600090815260066020908152604080832084845290915290205490915060ff1615611346576040805160e560020a62461bcd02815260206004820152602660248201526000805160206125008339815191526044820152600080516020612520833981519152606482015290519081900360840190fd5b600160a060020a03821660009081526006602090815260408083208484529091529020805460ff19166001179055610d2882898961239b565b600054600160a060020a031681565b6000806000805a92506113a2878787611045565b9150600160a060020a03821615156113f2576040805160e560020a62461bcd02815260206004820152601b6024820152600080516020612540833981519152604482015290519081900360640190fd5b6113fc8686611654565b600160a060020a038316600090815260066020908152604080832084845290915290205490915060ff161561147d576040805160e560020a62461bcd02815260206004820152602660248201526000805160206125008339815191526044820152600080516020612520833981519152606482015290519081900360840190fd5b600160a060020a03821660009081526006602090815260408083208484529091528082208054600160ff1991821681179092558984529183208054909216179055851115611547576114d65a849063ffffffff61235e16565b6188b80192506114f18232610d68888763ffffffff61237016565b1515611547576040805160e560020a62461bcd02815260206004820152601b60248201527f47617320636f737420636f756c64206e6f7420626520706169642e0000000000604482015290519081900360640190fd5b604051600160a060020a0383169082907ff4a65fdaee7ca2336b6b5ea720055552af3fd371f7ebe46b8c83fa89d8c733f890600090a35060019695505050505050565b3330141561159757600080fd5b30600160a060020a03168160405180828051906020019080838360005b838110156115cc5781810151838201526020016115b4565b50505050905090810190601f1680156115f95780820380516001836020036101000a031916815260200191505b50915050600060405180830381855af4915050151561161757600080fd5b50505050565b60408051808201909152600481527f434f494e00000000000000000000000000000000000000000000000000000000602082015281565b604080516c0100000000000000000000000030026020808301919091527f70de43f1000000000000000000000000000000000000000000000000000000006034830152603882018590526058808301859052835180840390910181526078909201928390528151600093918291908401908083835b602083106116e85780518252601f1990920191602091820191016116c9565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209695505050505050565b6000610b11338484612182565b6000308787878787876040516020018088600160a060020a0316600160a060020a03166c01000000000000000000000000028152601401877bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040186600160a060020a0316600160a060020a03166c0100000000000000000000000002815260140185815260200184805190602001908083835b602083106117fb5780518252601f1990920191602091820191016117dc565b51815160209384036101000a60001901801990921691161790529201948552508381019290925250604080518084038301815292810190819052825192975095508594508601925090508083835b602083106118685780518252601f199092019160209182019101611849565b5181516020939093036101000a600019018019909116921691909117905260405192018290039091209a9950505050505050505050565b6000806000805a92506118d18963d73dd62360e060020a028a8a60206040519081016040528060008152508b8b610b25565b9150600160a060020a0382161515611921576040805160e560020a62461bcd02815260206004820152601b6024820152600080516020612540833981519152604482015290519081900360640190fd5b61194963d73dd62360e060020a02898960206040519081016040528060008152508a8a611728565b600160a060020a038316600090815260066020908152604080832084845290915290205490915060ff16156119ca576040805160e560020a62461bcd02815260206004820152602660248201526000805160206125008339815191526044820152600080516020612520833981519152606482015290519081900360840190fd5b600160a060020a03821660009081526006602090815260408083208484529091529020805460ff19166001179055610d288289896124b8565b604080517f19457468657265756d205369676e6564204d6573736167653a0a333200000000602080830191909152603c80830185905283518084039091018152605c909201928390528151600093918291908401908083835b60208310611a7b5780518252601f199092019160209182019101611a5c565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b6000806000805a9250611ae58a7fcae9ca51000000000000000000000000000000000000000000000000000000008b8b8b8b8b610b25565b9150600160a060020a0382161515611b35576040805160e560020a62461bcd02815260206004820152601b6024820152600080516020612540833981519152604482015290519081900360640190fd5b611b637fcae9ca51000000000000000000000000000000000000000000000000000000008a8a8a8a8a611728565b600160a060020a038316600090815260066020908152604080832084845290915290205490915060ff1615611be4576040805160e560020a62461bcd02815260206004820152602660248201526000805160206125008339815191526044820152600080516020612520833981519152606482015290519081900360840190fd5b600160a060020a03821660009081526006602090815260408083208484529091528120805460ff19166001179055881115611c2f57611c24828a8a612117565b1515611c2f57600080fd5b88600160a060020a0316638f4ffcb1838a308b6040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611cc7578181015183820152602001611caf565b50505050905090810190601f168015611cf45780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611d1657600080fd5b505af1158015611d2a573d6000803e3d6000fd5b505050506000861115611db957611d485a849063ffffffff61235e16565b6188b8019250611d638232610d68898763ffffffff61237016565b1515611db9576040805160e560020a62461bcd02815260206004820152601b60248201527f47617320636f737420636f756c64206e6f7420626520706169642e0000000000604482015290519081900360640190fd5b604051600160a060020a0383169082907ff4a65fdaee7ca2336b6b5ea720055552af3fd371f7ebe46b8c83fa89d8c733f890600090a35060019998505050505050505050565b6000611e0c338585612117565b1515611e1757600080fd5b6040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018690523060448401819052608060648501908152865160848601528651600160a060020a038a1695638f4ffcb195948a94938a939192909160a490910190602085019080838360005b83811015611eaa578181015183820152602001611e92565b50505050905090810190601f168015611ed75780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015611ef957600080fd5b505af1158015611f0d573d6000803e3d6000fd5b506001979650505050505050565b60008060008084516041141515611f355760009350611fe7565b50505060208201516040830151606084015160001a601b60ff82161015611f5a57601b015b8060ff16601b14158015611f7257508060ff16601c14155b15611f805760009350611fe7565b60408051600080825260208083018085528a905260ff8516838501526060830187905260808301869052925160019360a0808501949193601f19840193928390039091019190865af1158015611fda573d6000803e3d6000fd5b5050506020604051035193505b50505092915050565b6000610b113384846124b8565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b600154600160a060020a0316331461203f57600080fd5b600160a060020a038116151561205457600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316331461209a57600080fd5b600160a060020a03811615156120af57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03808416600081815260056020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b6000600160a060020a038316151561220a576040805160e560020a62461bcd02815260206004820152602360248201527f496e76616c6964207472616e7366657220726563697069656e7420616464726560448201527f73732e0000000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a03841660009081526004602052604090205482111561229f576040805160e560020a62461bcd028152602060048201526024808201527f53656e64657220646f6573206e6f74206861766520656e6f7567682062616c6160448201527f6e63652e00000000000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b600160a060020a0384166000908152600460205260409020546122c8908363ffffffff61235e16565b600160a060020a0380861660009081526004602052604080822093909355908516815220546122fd908363ffffffff6124f016565b600160a060020a0380851660008181526004602090815260409182902094909455805186815290519193928816927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35060019392505050565b60008282111561236a57fe5b50900390565b600082820283158061238c575082848281151561238957fe5b04145b151561239457fe5b9392505050565b600160a060020a03808416600090815260056020908152604080832093861683529290529081205482106123f657600160a060020a038085166000908152600560209081526040808320938716835292905290812055612453565b600160a060020a0380851660009081526005602090815260408083209387168352929052205461242c908363ffffffff61235e16565b600160a060020a038086166000908152600560209081526040808320938816835292905220555b600160a060020a0384811660008181526005602090815260408083209488168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b600160a060020a03808416600090815260056020908152604080832093861683529290529081205461242c908363ffffffff6124f016565b60008282018381101561239457fe005472616e73616374696f6e2068617320616c7265616479206265656e2065786563757465642e0000000000000000000000000000000000000000000000000000496e76616c6964207369676e61747572652070726f76696465642e0000000000a165627a7a72305820c5f31889e3915aad670c448dac3aa2e66d2b27260024d48e62c2b7ab26b2697b0029

Verified Source Code Partial Match

Compiler: v0.4.24+commit.e67f0147 EVM: byzantium Optimization: Yes (200 runs)
CoinToken.sol 725 lines
pragma solidity ^0.4.24;

/**
 * @title SafeMath
 * @dev Math operations with safety checks that throw on error
 */
library SafeMathLib{
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a * b;
    assert(a == 0 || c / a == b);
    return c;
  }

  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return c;
  }

  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }
  
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    assert(c >= a);
    return c;
  }
}

/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;
  address public coinvest;
  mapping (address => bool) public admins;

  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor() public {
    owner = msg.sender;
    coinvest = msg.sender;
    admins[owner] = true;
    admins[coinvest] = true;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

  modifier onlyCoinvest() {
      require(msg.sender == coinvest);
      _;
  }

  modifier onlyAdmin() {
      require(admins[msg.sender]);
      _;
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) onlyOwner public {
    require(newOwner != address(0));
    emit OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }
  
  /**
   * @dev Changes the Coinvest wallet that will receive funds from investment contract.
   * @param _newCoinvest The address of the new wallet.
  **/
  function transferCoinvest(address _newCoinvest) 
    external
    onlyCoinvest
  {
    require(_newCoinvest != address(0));
    coinvest = _newCoinvest;
  }

  /**
   * @dev Used to add admins who are allowed to add funds to the investment contract.
   * @param _user The address of the admin to add or remove.
   * @param _status True to add the user, False to remove the user.
  **/
  function alterAdmin(address _user, bool _status)
    external
    onlyCoinvest
  {
    require(_user != address(0));
    require(_user != coinvest);
    admins[_user] = _status;
  }

}

/**
 * @dev Abstract contract for approveAndCall.
**/
contract ApproveAndCallFallBack {
    function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}

/**
 * @title Coin Utility Token
 * @dev ERC20 contract utilizing ERC865 structure (3esmit's implementation with alterations).
 * @dev to allow users to pay Ethereum fees in tokens.
 * @author Coin -- Robert M.C. Forster
**/
contract CoinToken is Ownable {
    using SafeMathLib for uint256;
    
    string public constant symbol = "COIN";
    string public constant name = "Coin Utility Token";
    
    uint8 public constant decimals = 18;
    uint256 private _totalSupply = 107142857 * (10 ** 18);
    
    // Function sigs to be used within contract for signature recovery.
    bytes4 internal constant transferSig = 0xa9059cbb;
    bytes4 internal constant approveSig = 0x095ea7b3;
    bytes4 internal constant increaseApprovalSig = 0xd73dd623;
    bytes4 internal constant decreaseApprovalSig = 0x66188463;
    bytes4 internal constant approveAndCallSig = 0xcae9ca51;
    bytes4 internal constant revokeHashSig = 0x70de43f1;

    // Balances for each account
    mapping(address => uint256) balances;

    // Owner of account approves the transfer of an amount to another account
    mapping(address => mapping (address => uint256)) allowed;
    
    // Mapping of past used hashes: true if already used.
    mapping(address => mapping (bytes32 => bool)) invalidHashes;

    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed from, address indexed spender, uint tokens);
    event HashRedeemed(bytes32 indexed txHash, address indexed from);

    /**
     * @dev Set owner and beginning balance.
    **/
    constructor()
      public
    {
        balances[msg.sender] = _totalSupply;
    }

    /**
     * @dev approveAndCall reception used primarily to pay gas with other tokens.
    **/
    function receiveApproval(address _from, uint256 _amount, address _token, bytes _data) 
      public
    {
        require(msg.sender != address(this));
        require(address(this).delegatecall(_data));
        _from; _amount; _token;
    }

/** ******************************** ERC20 ********************************* **/

    /**
     * @dev Transfers coins from one address to another.
     * @param _to The recipient of the transfer amount.
     * @param _amount The amount of tokens to transfer.
    **/
    function transfer(address _to, uint256 _amount) 
      public
    returns (bool success)
    {
        require(_transfer(msg.sender, _to, _amount));
        return true;
    }
    
    /**
     * @dev An allowed address can transfer tokens from another's address.
     * @param _from The owner of the tokens to be transferred.
     * @param _to The address to which the tokens will be transferred.
     * @param _amount The amount of tokens to be transferred.
    **/
    function transferFrom(address _from, address _to, uint _amount)
      public
    returns (bool success)
    {
        require(balances[_from] >= _amount && allowed[_from][msg.sender] >= _amount);

        allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
        require(_transfer(_from, _to, _amount));
        return true;
    }
    
    /**
     * @dev Approves a wallet to transfer tokens on one's behalf.
     * @param _spender The wallet approved to spend tokens.
     * @param _amount The amount of tokens approved to spend.
    **/
    function approve(address _spender, uint256 _amount) 
      public
    returns (bool success)
    {
        require(_approve(msg.sender, _spender, _amount));
        return true;
    }
    
    /**
     * @dev Increases the allowed amount for spender from msg.sender.
     * @param _spender The address to increase allowed amount for.
     * @param _amount The amount of tokens to increase allowed amount by.
    **/
    function increaseApproval(address _spender, uint256 _amount) 
      public
    returns (bool success)
    {
        require(_increaseApproval(msg.sender, _spender, _amount));
        return true;
    }
    
    /**
     * @dev Decreases the allowed amount for spender from msg.sender.
     * @param _spender The address to decrease allowed amount for.
     * @param _amount The amount of tokens to decrease allowed amount by.
    **/
    function decreaseApproval(address _spender, uint256 _amount) 
      public
    returns (bool success)
    {
        require(_decreaseApproval(msg.sender, _spender, _amount));
        return true;
    }
    
    /**
     * @dev Used to approve an address and call a function on it in the same transaction.
     * @dev _spender The address to be approved to spend COIN.
     * @dev _amount The amount of COIN to be approved to spend.
     * @dev _data The data to send to the called contract.
    **/
    function approveAndCall(address _spender, uint256 _amount, bytes _data) 
      public
    returns (bool success) 
    {
        require(_approve(msg.sender, _spender, _amount));
        ApproveAndCallFallBack(_spender).receiveApproval(msg.sender, _amount, address(this), _data);
        return true;
    }

/** ****************************** Internal ******************************** **/
    
    /**
     * @dev Internal transfer for all functions that transfer.
     * @param _from The address that is transferring coins.
     * @param _to The receiving address of the coins.
     * @param _amount The amount of coins being transferred.
    **/
    function _transfer(address _from, address _to, uint256 _amount)
      internal
    returns (bool success)
    {
        require (_to != address(0), "Invalid transfer recipient address.");
        require(balances[_from] >= _amount, "Sender does not have enough balance.");
        
        balances[_from] = balances[_from].sub(_amount);
        balances[_to] = balances[_to].add(_amount);
        
        emit Transfer(_from, _to, _amount);
        return true;
    }
    
    /**
     * @dev Internal approve for all functions that require an approve.
     * @param _owner The owner who is allowing spender to use their balance.
     * @param _spender The wallet approved to spend tokens.
     * @param _amount The amount of tokens approved to spend.
    **/
    function _approve(address _owner, address _spender, uint256 _amount) 
      internal
    returns (bool success)
    {
        allowed[_owner][_spender] = _amount;
        emit Approval(_owner, _spender, _amount);
        return true;
    }
    
    /**
     * @dev Increases the allowed by "_amount" for "_spender" from "owner"
     * @param _owner The address that tokens may be transferred from.
     * @param _spender The address that may transfer these tokens.
     * @param _amount The amount of tokens to transfer.
    **/
    function _increaseApproval(address _owner, address _spender, uint256 _amount)
      internal
    returns (bool success)
    {
        allowed[_owner][_spender] = allowed[_owner][_spender].add(_amount);
        emit Approval(_owner, _spender, allowed[_owner][_spender]);
        return true;
    }
    
    /**
     * @dev Decreases the allowed by "_amount" for "_spender" from "_owner"
     * @param _owner The owner of the tokens to decrease allowed for.
     * @param _spender The spender whose allowed will decrease.
     * @param _amount The amount of tokens to decrease allowed by.
    **/
    function _decreaseApproval(address _owner, address _spender, uint256 _amount)
      internal
    returns (bool success)
    {
        if (allowed[_owner][_spender] <= _amount) allowed[_owner][_spender] = 0;
        else allowed[_owner][_spender] = allowed[_owner][_spender].sub(_amount);
        
        emit Approval(_owner, _spender, allowed[_owner][_spender]);
        return true;
    }
    
/** ************************ Delegated Functions *************************** **/

    /**
     * @dev Called by delegate with a signed hash of the transaction data to allow a user
     * @dev to transfer tokens without paying gas in Ether (they pay in COIN instead).
     * @param _signature Signed hash of data for this transfer.
     * @param _to The address to transfer COIN to.
     * @param _value The amount of COIN to transfer.
     * @param _gasPrice Price (IN COIN) that will be paid per unit of gas by user to "delegate".
     * @param _nonce Nonce of the user's new transaction.
    **/
    function transferPreSigned(
        bytes _signature,
        address _to, 
        uint256 _value,
        uint256 _gasPrice, 
        uint256 _nonce) 
      public
    returns (bool) 
    {
        // Log starting gas left of transaction for later gas price calculations.
        uint256 gas = gasleft();
        
        // Recover signer address from signature; ensure address is valid.
        address from = recoverPreSigned(_signature, transferSig, _to, _value, "", _gasPrice, _nonce);
        require(from != address(0), "Invalid signature provided.");
        
        // Require the hash has not been used, declare it used.
        bytes32 txHash = getPreSignedHash(transferSig, _to, _value, "", _gasPrice, _nonce);
        require(!invalidHashes[from][txHash], "Transaction has already been executed.");
        invalidHashes[from][txHash] = true;

        // Internal transfer.
        require(_transfer(from, _to, _value));

        // If the delegate is charging, pay them for gas in COIN.
        if (_gasPrice > 0) {
            // 35000 because of base fee of 21000 and ~14000 for the fee transfer.
            gas = 35000 + gas.sub(gasleft());
            require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
        }
        
        emit HashRedeemed(txHash, from);
        return true;
    }
    
    /**
     * @dev Called by a delegate with signed hash to approve a transaction for user.
     * @dev All variables equivalent to transfer except _to:
     * @param _to The address that will be approved to transfer COIN from user's wallet.
    **/
    function approvePreSigned(
        bytes _signature,
        address _to, 
        uint256 _value,
        uint256 _gasPrice, 
        uint256 _nonce) 
      public
    returns (bool) 
    {
        uint256 gas = gasleft();
        address from = recoverPreSigned(_signature, approveSig, _to, _value, "", _gasPrice, _nonce);
        require(from != address(0), "Invalid signature provided.");

        bytes32 txHash = getPreSignedHash(approveSig, _to, _value, "", _gasPrice, _nonce);
        require(!invalidHashes[from][txHash], "Transaction has already been executed.");
        invalidHashes[from][txHash] = true;

        require(_approve(from, _to, _value));

        if (_gasPrice > 0) {
            gas = 35000 + gas.sub(gasleft());
            require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
        }

        emit HashRedeemed(txHash, from);
        return true;
    }
    
    /**
     * @dev Used to increase the amount allowed for "_to" to spend from "from"
     * @dev A bare approve allows potentially nasty race conditions when using a delegate.
    **/
    function increaseApprovalPreSigned(
        bytes _signature,
        address _to, 
        uint256 _value,
        uint256 _gasPrice, 
        uint256 _nonce)
      public
    returns (bool) 
    {
        uint256 gas = gasleft();
        address from = recoverPreSigned(_signature, increaseApprovalSig, _to, _value, "", _gasPrice, _nonce);
        require(from != address(0), "Invalid signature provided.");

        bytes32 txHash = getPreSignedHash(increaseApprovalSig, _to, _value, "", _gasPrice, _nonce);
        require(!invalidHashes[from][txHash], "Transaction has already been executed.");
        invalidHashes[from][txHash] = true;

        require(_increaseApproval(from, _to, _value));

        if (_gasPrice > 0) {
            gas = 35000 + gas.sub(gasleft());
            require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
        }
        
        emit HashRedeemed(txHash, from);
        return true;
    }
    
    /**
     * @dev Added for the same reason as increaseApproval. Decreases to 0 if "_value" is greater than allowed.
    **/
    function decreaseApprovalPreSigned(
        bytes _signature,
        address _to, 
        uint256 _value, 
        uint256 _gasPrice, 
        uint256 _nonce) 
      public
    returns (bool) 
    {
        uint256 gas = gasleft();
        address from = recoverPreSigned(_signature, decreaseApprovalSig, _to, _value, "", _gasPrice, _nonce);
        require(from != address(0), "Invalid signature provided.");

        bytes32 txHash = getPreSignedHash(decreaseApprovalSig, _to, _value, "", _gasPrice, _nonce);
        require(!invalidHashes[from][txHash], "Transaction has already been executed.");
        invalidHashes[from][txHash] = true;

        require(_decreaseApproval(from, _to, _value));

        if (_gasPrice > 0) {
            gas = 35000 + gas.sub(gasleft());
            require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
        }

        emit HashRedeemed(txHash, from);
        return true;
    }
    
    /**
     * @dev approveAndCallPreSigned allows a user to approve a contract and call a function on it
     * @dev in the same transaction. As with the other presigneds, a delegate calls this with signed data from user.
     * @dev This function is the big reason we're using gas price and calculating gas use.
     * @dev Using this with the investment contract can result in varying gas costs.
     * @param _extraData The data to send to the contract.
    **/
    function approveAndCallPreSigned(
        bytes _signature,
        address _to, 
        uint256 _value,
        bytes _extraData,
        uint256 _gasPrice,
        uint256 _nonce) 
      public
    returns (bool) 
    {
        uint256 gas = gasleft();
        address from = recoverPreSigned(_signature, approveAndCallSig, _to, _value, _extraData, _gasPrice, _nonce);
        require(from != address(0), "Invalid signature provided.");

        bytes32 txHash = getPreSignedHash(approveAndCallSig, _to, _value, _extraData, _gasPrice, _nonce);
        require(!invalidHashes[from][txHash], "Transaction has already been executed.");
        invalidHashes[from][txHash] = true;

        if (_value > 0) require(_approve(from, _to, _value));
        ApproveAndCallFallBack(_to).receiveApproval(from, _value, address(this), _extraData);

        if (_gasPrice > 0) {
            gas = 35000 + gas.sub(gasleft());
            require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
        }
        
        emit HashRedeemed(txHash, from);
        return true;
    }

/** *************************** Revoke PreSigned ************************** **/
    
    /**
     * @dev Revoke hash without going through a delegate.
     * @param _hashToRevoke The hash that you no longer want to be used.
    **/
    function revokeHash(bytes32 _hashToRevoke)
      public
    returns (bool)
    {
        invalidHashes[msg.sender][_hashToRevoke] = true;
        return true;
    }
    
    /**
     * @dev Revoke hash through a delegate.
     * @param _signature The signature allowing this revocation.
     * @param _hashToRevoke The hash that you would like revoked.
     * @param _gasPrice The amount of token wei to be paid for each uint of gas.
    **/
    function revokeHashPreSigned(
        bytes _signature,
        bytes32 _hashToRevoke,
        uint256 _gasPrice)
      public
    returns (bool)
    {
        uint256 gas = gasleft();
        address from = recoverRevokeHash(_signature, _hashToRevoke, _gasPrice);
        require(from != address(0), "Invalid signature provided.");
        
        bytes32 txHash = getRevokeHash(_hashToRevoke, _gasPrice);
        require(!invalidHashes[from][txHash], "Transaction has already been executed.");
        invalidHashes[from][txHash] = true;

        invalidHashes[from][_hashToRevoke] = true;
        
        if (_gasPrice > 0) {
            gas = 35000 + gas.sub(gasleft());
            require(_transfer(from, tx.origin, _gasPrice.mul(gas)), "Gas cost could not be paid.");
        }
        
        emit HashRedeemed(txHash, from);
        return true;
    }
    
    /**
     * @dev Get hash for a revocation.
     * @param _hashToRevoke The signature to be revoked.
     * @param _gasPrice The amount to be paid to delegate for sending this tx.
    **/
    function getRevokeHash(bytes32 _hashToRevoke, uint256 _gasPrice)
      public
      view
    returns (bytes32 txHash)
    {
        return keccak256(abi.encodePacked(address(this), revokeHashSig, _hashToRevoke, _gasPrice));
    }

    /**
     * @dev Recover the address from a revocation hash.
     * @param _hashToRevoke The hash to be revoked.
     * @param _signature The signature allowing this revocation.
     * @param _gasPrice The amount of token wei to be paid for each unit of gas.
    **/
    function recoverRevokeHash(bytes _signature, bytes32 _hashToRevoke, uint256 _gasPrice)
      public
      view
    returns (address from)
    {
        return ecrecoverFromSig(getSignHash(getRevokeHash(_hashToRevoke, _gasPrice)), _signature);
    }
    
/** ************************** PreSigned Constants ************************ **/

    /**
     * @dev Used in frontend and contract to get hashed data of any given pre-signed transaction.
     * @param _to The address to transfer COIN to.
     * @param _value The amount of COIN to be transferred.
     * @param _extraData Extra data of tx if needed. Transfers and approves will leave this null.
     * @param _function Function signature of the pre-signed function being used.
     * @param _gasPrice The agreed-upon amount of COIN to be paid per unit of gas.
     * @param _nonce The user's nonce of the new transaction.
    **/
    function getPreSignedHash(
        bytes4 _function,
        address _to, 
        uint256 _value,
        bytes _extraData,
        uint256 _gasPrice,
        uint256 _nonce)
      public
      view
    returns (bytes32 txHash) 
    {
        return keccak256(abi.encodePacked(address(this), _function, _to, _value, _extraData, _gasPrice, _nonce));
    }
    
    /**
     * @dev Recover an address from a signed pre-signed hash.
     * @param _sig The signed hash.
     * @param _function The function signature for function being called.
     * @param _to The address to transfer/approve/transferFrom/etc. tokens to.
     * @param _value The amont of tokens to transfer/approve/etc.
     * @param _extraData The extra data included in the transaction, if any.
     * @param _gasPrice The amount of token wei to be paid to the delegate for each unit of gas.
     * @param _nonce The user's nonce for this transaction.
    **/
    function recoverPreSigned(
        bytes _sig,
        bytes4 _function,
        address _to,
        uint256 _value,
        bytes _extraData,
        uint256 _gasPrice,
        uint256 _nonce) 
      public
      view
    returns (address recovered)
    {
        return ecrecoverFromSig(getSignHash(getPreSignedHash(_function, _to, _value, _extraData, _gasPrice, _nonce)), _sig);
    }
    
    /**
     * @dev Add signature prefix to hash for recovery à la ERC191.
     * @param _hash The hashed transaction to add signature prefix to.
    **/
    function getSignHash(bytes32 _hash)
      public
      pure
    returns (bytes32 signHash)
    {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _hash));
    }

    /**
     * @dev Helps to reduce stack depth problems for delegations. Thank you to Bokky for this!
     * @param hash The hash of signed data for the transaction.
     * @param sig Contains r, s, and v for recovery of address from the hash.
    **/
    function ecrecoverFromSig(bytes32 hash, bytes sig) 
      public 
      pure 
    returns (address recoveredAddress) 
    {
        bytes32 r;
        bytes32 s;
        uint8 v;
        if (sig.length != 65) return address(0);
        assembly {
            r := mload(add(sig, 32))
            s := mload(add(sig, 64))
            // Here we are loading the last 32 bytes. We exploit the fact that 'mload' will pad with zeroes if we overread.
            // There is no 'mload8' to do this, but that would be nicer.
            v := byte(0, mload(add(sig, 96)))
        }
        // Albeit non-transactional signatures are not specified by the YP, one would expect it to match the YP range of [27, 28]
        // geth uses [0, 1] and some clients have followed. This might change, see https://github.com/ethereum/go-ethereum/issues/2053
        if (v < 27) v += 27;
        if (v != 27 && v != 28) return address(0);
        return ecrecover(hash, v, r, s);
    }

/** ****************************** Constants ******************************* **/
    
    /**
     * @dev Return total supply of token.
    **/
    function totalSupply() 
      external
      view 
     returns (uint256)
    {
        return _totalSupply;
    }

    /**
     * @dev Return balance of a certain address.
     * @param _owner The address whose balance we want to check.
    **/
    function balanceOf(address _owner)
      external
      view 
    returns (uint256) 
    {
        return balances[_owner];
    }
    
    /**
     * @dev Allowed amount for a user to spend of another's tokens.
     * @param _owner The owner of the tokens approved to spend.
     * @param _spender The address of the user allowed to spend the tokens.
    **/
    function allowance(address _owner, address _spender) 
      external
      view 
    returns (uint256) 
    {
        return allowed[_owner][_spender];
    }
    
/** ****************************** onlyOwner ******************************* **/
    
    /**
     * @dev Allow the owner to take ERC20 tokens off of this contract if they are accidentally sent.
    **/
    function tokenEscape(address _tokenContract)
      external
      onlyOwner
    {
        CoinToken lostToken = CoinToken(_tokenContract);
        
        uint256 stuckTokens = lostToken.balanceOf(address(this));
        lostToken.transfer(owner, stuckTokens);
    }
    
}

Read Contract

admins 0x429b62e5 → bool
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
coinvest 0x0958a9f3 → address
decimals 0x313ce567 → uint8
ecrecoverFromSig 0xd4acaf6c → address
getPreSignedHash 0xa9a0b495 → bytes32
getRevokeHash 0xa59b3d46 → bytes32
getSignHash 0xb15aa5b7 → bytes32
name 0x06fdde03 → string
owner 0x8da5cb5b → address
recoverPreSigned 0x09ea63e3 → address
recoverRevokeHash 0x476e492f → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256

Write Contract 18 functions

These functions modify contract state and require a wallet transaction to execute.

alterAdmin 0x10840303
address _user
bool _status
approve 0x095ea7b3
address _spender
uint256 _amount
returns: bool
approveAndCall 0xcae9ca51
address _spender
uint256 _amount
bytes _data
returns: bool
approveAndCallPreSigned 0xc8d4b389
bytes _signature
address _to
uint256 _value
bytes _extraData
uint256 _gasPrice
uint256 _nonce
returns: bool
approvePreSigned 0x617b390b
bytes _signature
address _to
uint256 _value
uint256 _gasPrice
uint256 _nonce
returns: bool
decreaseApproval 0x66188463
address _spender
uint256 _amount
returns: bool
decreaseApprovalPreSigned 0x8be52783
bytes _signature
address _to
uint256 _value
uint256 _gasPrice
uint256 _nonce
returns: bool
increaseApproval 0xd73dd623
address _spender
uint256 _amount
returns: bool
increaseApprovalPreSigned 0xadb8249e
bytes _signature
address _to
uint256 _value
uint256 _gasPrice
uint256 _nonce
returns: bool
receiveApproval 0x8f4ffcb1
address _from
uint256 _amount
address _token
bytes _data
revokeHash 0x70de43f1
bytes32 _hashToRevoke
returns: bool
revokeHashPreSigned 0x8e421f16
bytes _signature
bytes32 _hashToRevoke
uint256 _gasPrice
returns: bool
tokenEscape 0x3f454406
address _tokenContract
transfer 0xa9059cbb
address _to
uint256 _amount
returns: bool
transferCoinvest 0xdfb6c468
address _newCoinvest
transferFrom 0x23b872dd
address _from
address _to
uint256 _amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
transferPreSigned 0x1296830d
bytes _signature
address _to
uint256 _value
uint256 _gasPrice
uint256 _nonce
returns: bool

Recent Transactions

No transactions found for this address