Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Working on "This Artwork Is Always On Sale".

Simon de la Rouviere simondlr

💭
Working on "This Artwork Is Always On Sale".
View GitHub Profile
View gist:2496c4d4dcee58f40017f4bc2e3c8ece
pragma solidity ^0.4.10;
import "./ETHUSDHandler.sol";
contract ETHUSDHandlerFactory {
mapping(address => address[]) public userToHandlers;
function createNewHandler (
address _beneficiary,
uint256 _initialPriceInUSD,
@simondlr
simondlr / gist:45f0c8024a88d8dc54f8
Last active Jan 16, 2018
Standard Token Contract on Ethereum
View gist:45f0c8024a88d8dc54f8
//Most, basic default, standardised Token contract.
//Based on standardised APIs & slightly extended. https://github.com/ethereum/wiki/wiki/Standardized_Contract_APIs
//adds AddressApproval & AddressApprovalOnce events
//approve & approveOnce works on premise that approved always takes precedence.
//adds unapprove to basic coin interface.
contract Coin {
function sendCoin(uint _value, address _to) returns (bool _success) {}
function sendCoinFrom(address _from, uint _value, address _to) returns (bool _success) {}
function coinBalance() constant returns (uint _r) {}
View Ujo Registry
pragma solidity 0.4.19;
import "./utils/strings.sol"; // github.com/Arachnid/solidity-stringutils/strings.sol
contract Registry {
using strings for *;
event LogPublish(address issuer, address subject, bytes32 action, bytes32 contentType, string cid);
function publish(address[] _subjects, bytes32[] _actions, bytes32[] _contentTypes, string _cids) public {
require(_subjects.length == _actions.length && _actions.length == _contentTypes.length);
View Handler
contract ETHUSDHandler {
function pay(string _cid,
address _oracle,
address _buyer, // this is for the case that someone else pays on your behalf
address[] _beneficiaries,
uint256[] _amounts,
address[] _notifiers) public payable {
require(_beneficiaries.length == _amounts.length);
@simondlr
simondlr / gist:48b77206b2483932f0f5
Last active Jun 30, 2021
Function hooks in Solidity
View gist:48b77206b2483932f0f5
contract Function_hook_example {
function Function_hook_example() {
owner = msg.sender;
}
modifier isOwner {
if (msg.sender == owner) {
_
}