Skip to content

Instantly share code, notes, and snippets.

Yoichi Hirai pirapira

Block or report user

Report or block pirapira

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View deploy.sh
#private_key=/Users/admin/xud-eth/blkchain1/keystore/UTC--2019-02-04T14-57-25.251612000Z--b9a2c5e9cd48a5284698a1aff76b0b20b5757305
#/home/offerm/xud-eth/chaindata/keystore/UTC--2019-01-07T17-32-09.575657568Z--15beaee1233557a83110cc5d7be956e4e3658e7a
source ~/.virtualenvs/offerm-script/bin/activate
version="0.10.1" #"" #"0.4.0" #"0.3._"
provider="http://127.0.0.1:8545"
View 0.10.1deployment.txt
kovan
export KOVAN=http://localhost:8545
export KOPRIV=/home/yoichi/import/parity/keys/kovan/UTC--2019-01-08T17-09-24Z--fcf0e5e3-7d74-7abc-773e-a2ccab085547
export MAX_UINT256=115792089237316195423570985008687907853269984665640564039457584007913129639935
python -m raiden_contracts.deploy raiden --rpc-provider $KOVAN --private-key $KOPRIV --gas-price 11 --gas-limit 6000000 --max-token-networks $MAX_UINT256
"TokenNetworkRegistry": "0x980e5c79780198FcCFE5c937452abF0a1716411f"
View gist:d838d902db9df127c8ea972ae08013fd
pragma solidity ^0.5.2;
/// @title Utils
/// @notice Utils contract for various helpers used by the Raiden Network smart
/// contracts.
contract Utils {
string constant public contract_version = "0.5.0";
/// @notice Check if a contract exists
/// @param contract_address The address to check whether a contract is
@pirapira
pirapira / raiden-debug_2018-12-19T10:15:06.632144.log
Last active Dec 19, 2018
raiden-debug_2018-12-19T10:15:06.632144.log
View raiden-debug_2018-12-19T10:15:06.632144.log
{"raiden": "0.19.1.dev44+gaf0eaa6f", "python_implementation": "CPython", "python_version": "3.6.7", "system": "Linux 64bit_ELF 4.15.0-42-generic x86_64", "distribution": "bundled", "event": "Starting Raiden", "logger": "raiden.ui.runners", "level": "info", "timestamp": "2018-12-19 10:15:06.886954"}
@pirapira
pirapira / add.txt
Created May 25, 2018
evm code that adds two numbers from the storage and writes the result to storage
View add.txt
~/src/solidity/build((v0.4.21)) $ lllc/lllc < ../../cpp-ethereum/build-tsan/add-storage.lll
60015460005401600255
~/src/solidity/build((v0.4.21)) $ cat ../../cpp-ethereum/build-tsan/add-storage.lll
(sstore 2 (+ (sload 0) (sload 1)))
View gist:111de0b0d4f6c29c2d2b40c456d8dc75
$ make
<snip>
eval $(opam config env) \
&& /home/yh/tmp/evm-semantics/.build/k/k-distribution/target/release/k/bin/kompile --debug --main-module ETHEREUM-SIMULATION \
--syntax-module ETHEREUM-SIMULATION .build/ocaml/driver.k --directory .build/ocaml \
--hook-namespaces KRYPTO --gen-ml-only -O3 --non-strict \
&& ocamlfind opt -c .build/ocaml/driver-kompiled/constants.ml -package gmp -package zarith \
&& ocamlfind opt -c -I .build/ocaml/driver-kompiled KRYPTO.ml -package cryptokit -package secp256k1 -package bn128 \
&& ocamlfind opt -a -o semantics.cmxa KRYPTO.cmx \
&& ocamlfind remove ethereum-semantics-plugin \
View gist:1dd72a668905a2e109f82417524211e4
~/src/evm-semantics(exception-checker) $ ./kevm bugcheck tests/interactive/bug-checker/invalid-opcode.evm
== bug-checking: tests/interactive/bug-checker/invalid-opcode.evm
(error "line 12 column 35: Sorts Int and KItem are incompatible")
(error "line 12 column 35: Sorts Int and KItem are incompatible")
(error "line 13 column 35: Sorts Int and KItem are incompatible")
(error "line 13 column 35: Sorts Int and KItem are incompatible")
(error "line 13 column 35: Sorts Int and KItem are incompatible")
#accountExists ( V0 ) ==K true #And
Result ==K <generatedTop>
<k>
View 201503110226PYTHON_DUP6Filler.json
{
"201503110226PYTHON_DUP6" : {
"_info" : {
"comment" : "This test used to be a VM test and it once failed in python client some day. Since the test contains a BALANCE instruction (which must be mocked), it's moved to GeneralSateTest https://github.com/ethereum/tests/pull/445/files#r17\
9426325"
},
"env" : {
"currentCoinbase" : "2adc25665018aa1fe0e6bc666dac8fc2697ff9ba",
"currentDifficulty" : "115792089237316195423570985008687907853269984665640564039457584007913129639935",
"currentGasLimit" : "1000000",
View vault.bbo
// Based on http://www.blunderingcode.com/ether-vaults/
contract Vault(address hotwallet, address vaultKey, address recoveryKey) {
case(void unvault(uint256 amount)) {
if (sender(msg) != vaultKey) abort;
uint256 unvaultPeriod = 60 * 60 * 24 * 7 * 2; // two weeks
if (now(block) + unvaultPeriod < now(block)) abort;
return then become UnVaulting(now(block) + unvaultPeriod, amount, hotwallet, vaultKey, recoveryKey);
}
case(void recover(address _newHotWallet)) {
View refactored_vault.bbo
// This code does not compile yet.
// Should Bamboo support this kind of nesting contracts, which represent substates and a superstate?
contract Alive(address hotWallet, address vaultKey, address recoveryKey) {
case(void destroy()) {
if (sender(msg) != recoveryKey) abort;
return then become Destroyed();
}
case(void recover(address _newHotWallet)) {
if (sender(msg) != recoveryKey) abort;
You can’t perform that action at this time.