Skip to content

Instantly share code, notes, and snippets.

View 3esmit's full-sized avatar

Ricardo Guilherme Schmidt 3esmit

View GitHub Profile
pragma solidity ^0.4.11;
import "../token/MiniMeToken.sol";
/**
* @title DelegationProxy
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
* Create a delegation proxy to MiniMeTokens that store checkpoints from all changes and parent proxy to fall back in case of no delegation at this level.
*/
contract DelegationProxy {
pragma solidity ^0.4.15;
import "./DelegatedCall.sol";
//import "./LibraryReg.sol";
/**
* @title MultiSigStub
* Contract that delegates calls to a library to build a full MultiSigWallet that is cheap to create.
*/
@3esmit
3esmit / Cloner.sol
Last active August 11, 2017 02:54 — forked from holiman/Cloner.sol
A generic 'cloner' contract which clones other contract instances
pragma solidity ^0.4.4;
contract X{
uint myVar;
string junk;
function X(uint i){
myVar = i;
}
# This config should be placed in following path:
# %AppData%\Parity\Ethereum\config.toml
[parity]
# Parity syncs initially, then sleeps and wakes regularly to resync
mode = "passive"
# Auto-updates only to consensus/security updates.
auto_update = "critical"
[footprint]
@3esmit
3esmit / MultiChannel.sol
Last active August 30, 2018 07:15
Example of a ethereum Off chain Multi channel Token Bank ERC23 ERC20 ERC223 MiniMe
import "./TokenBank.sol";
pragma solidity ^0.4.9;
/**
* @title MultiChannel
* @author Ricardo Guilherme Schmidt <3esmit>
* MultiChannel is a ERC20 and ETH bank that allows multiple offchain transactions.
**/
contract MultiChannel is TokenBank {
0:00:00.00 [GitHubOracle] 2017-05-21 05:31:14.673256
0:00:00.00 [GitHubOracle] Started 'start ethereans/TheEtherian,develop
0:00:00.00 [GitHubOracle] Using Secret Mode
0:00:00.69 [GitHubOracle] API calls remaining: 4987
0:00:09.60 [GitHubOracle] Rule loaded user-agent: *
0:00:09.60 [GitHubOracle] Rule loaded reward-mode: words
0:00:09.60 [GitHubOracle] Loaded branch develop
0:00:10.28 [GitHubOracle] Loading from 39e20742756dca5c0cde0ab81f2280bb00761c78.
0:00:13.33 [GitHubOracle] page 1 contains 100 commits.
0:00:14.07 [GitHubOracle] 39e20742756dca5c0cde0ab81f2280bb00761c78: 3esmit +5
pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
contract GitHubAPITest is usingOraclize {
string public computationResult;
event newOraclizeQuery(string description);
event newResult(string result);

Contract Factory Library

Reason

There is no easy way to split contracts into deploys, currently this is the way I found:

  1. create interface of contract and interface of factory;
  2. move logic to a Factory;
  3. interface creation and return address of contract being created;
  4. add factory interface variable;
  5. add at constructor the assignment of that address;
  6. replace myContract = new MyContract(); to the logic exemplified in needNewExternalContract()
@3esmit
3esmit / githubissue.md
Last active March 17, 2017 18:00
GitHub Issue and Pull request smart contract specification

When open:

  1. accept bounties
  2. GitRepositoryToken claim to commits of pull request that closes it
  3. become closed when closed in oracle

When closed:

  • become open when are open in oracle

When issue releated commit claimed:

  • genereate bounty accept token for bounties accepted of latest opener

When bounties became accepted

  1. issue bounties are transfered to DonationBank
pragma solidity ^0.4.1;
contract JSONTools{
//try _extractString("[\"12345678\"]",0): gas usage 5192
function _extractString(bytes v, uint _start) constant returns (string val,uint i) {
uint start = 0;
uint end = 0;
for (i=0;v.length > i;i++) {
if (v[i] == '"'){ //quotation mark ---------> needed to break to reduce gas