Skip to content

Instantly share code, notes, and snippets.

View 3esmit's full-sized avatar

Ricardo Guilherme Schmidt 3esmit

View GitHub Profile
@3esmit
3esmit / color-eth-address.css
Created April 9, 2019 04:59
Color(ful) Eth Address React Component
.eth-address {
padding: 3px;
border-radius: 8px;
position: relative;
display: inline-grid;
box-shadow: 1px 1px 1px 1px #CCCC;
border-top: solid 1px #FFFC;
border-left: solid 1px #FFFC;
}
@3esmit
3esmit / embark_install.sh
Last active January 8, 2019 18:35
embark (ethereum development framework) install snippet for ubuntu 18.10
#!/usr/bin/env bash
NVM_LINK="https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh"
GETH_LINK="https://gethstore.blob.core.windows.net/builds/geth-alltools-linux-amd64-1.8.20-24d727b6.tar.gz"
IPFS_LINK="https://dist.ipfs.io/go-ipfs/v0.4.18/go-ipfs_v0.4.18_linux-amd64.tar.gz"
# Install NVM
wget -qO- $NVM_LINK | bash
source ~/.bashrc
@3esmit
3esmit / PaymentChannel.sol
Last active December 10, 2018 00:39
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.1+commit.c8a2cb62.js&optimize=false&gist=fce237c187d1f54eacb2c434553b2dd2
pragma solidity >=0.5.0 <0.6.0;
interface Token {
function approve(address _spender, uint256 _value) external returns (bool success);
function allowance(address _owner, address _spender) external view returns (uint256 remaining);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
}
interface PaymentChannel {}
import "LIBSNARK/sha256packed"
def hash(field[16] deck) -> (field[2]):
field res = 0
for field i in 0..16 do
res = res + deck[i] * (2**(4*i))
endfor
h0, h1 = sha256packed(0, 0, 0, res)
return [h0, h1]
@3esmit
3esmit / Bar.sol
Last active November 21, 2018 07:06
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.0-nightly.2018.11.13+commit.ac980fb8.js&optimize=true&gist=8954425d2ed0322505245803d6c045e4
contract Bar {
event FooChanged(uint8 num);
uint256 public foo;
constructor() public {
reset();
}
function testAssert(bool _fail) external {
pragma solidity ^0.4.24;
/**
* @title MerkleProof
* @dev Merkle proof verification based on
* https://github.com/ameensol/merkle-tree-solidity/blob/master/src/MerkleProof.sol
*/
library MerkleProof {
/**
@3esmit
3esmit / GCDLCMCache.sol
Last active October 5, 2018 22:55
hacky gcd lcm solidity with cache
pragma solidity ^0.4.21;
contract GCDLCMCache {
mapping (bytes32 => uint256) public cache;
enum CacheType { GCD, LCM }
function gcd(uint256[] input)
@3esmit
3esmit / MultiSig.sol
Last active February 14, 2018 21:53
MultiSigPreSigned.sol
pragma solidity ^0.4.17;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net> & Ricardo Guilherme Schmidt <ricardo3@status.im>
contract MultiSig {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
@3esmit
3esmit / ERC725.sol
Last active June 29, 2020 04:24
Ethereum ERC725 ERC735 ERC745
pragma solidity ^0.4.15;
contract ERC725 {
uint256 constant MANAGEMENT_KEY = 1;
uint256 constant ACTION_KEY = 2;
uint256 constant CLAIM_SIGNER_KEY = 3;
uint256 constant ENCRYPTION_KEY = 4;
event KeyAdded(address indexed key, uint256 indexed keyType);
const DelegationProxy = artifacts.require("DelegationProxy.sol")
const MiniMeTokenFactory = artifacts.require("MiniMeTokenFactory.sol")
const MiniMeToken = artifacts.require("MiniMeToken.sol")
const TestUtils = require("./TestUtils.js")
/**
*
0x0000a5f7a9669e0db02a4294bf289e009710705d,0x000e3c6b3464fde97576340146675e1842fcb2f9,0x003063d3ab7b2b90654ce4041cca2b15fa8d2f65,0x003f93dafb3338dd7aaade51d595f63195a7f51f,0x004e21f0fb982434cfe8b4e96a71f73278319708,0x005bab06189b79583a9aa152fb17b9f072ace79a,0x006a3edf9855bb26bec23b52a158ba0ac14aaafa,0x0078ffa5da34554b5eec74ddad291466a26b0f11,0x00a329c0648769a73afac7f9381e08fb43dbea72,0x00c9c5cb7096de7262b09202867cacdb5fb2793c,0x00ce5d959c1a0501bf9caaf98ac2d6d9d3c00cd1,0x00d994ef966d2f3c2459acb968a344ef1dcd2629
*/