Skip to content

Instantly share code, notes, and snippets.

import
compiler/ast, compiler/modulegraphs,
compiler/idents, compiler/options,
compiler/modules
import json
import os
import ../eth_abi_utils
@jacqueswww
jacqueswww / u256_return.wasm
Created May 16, 2019 16:27
Return 1234 as uint256 on ewasm
(module
(type (;0;) (func (param i32 i32)))
(type (;1;) (func))
(import "ethereum" "finish" (func (;0;) (type 0)))
(func (;1;) (type 1))
(func (;2;) (type 0) (param i32 i32)
(local i32 i32 i32)
local.get 1
i64.const 0
i64.store align=1
@jacqueswww
jacqueswww / alternative_status_nodes.md
Last active April 15, 2019 12:44
Alternative Status.IM Mailserver & Bootnode

Why?

The folks at Status.im think they are funny and are switching off their servers on the 1st of April 2019.

I setup a node so not-so-technical users can join on the day, and least stay connected :)

Bootnode

Go to Profile -> uncollapse "Advanced" right at the bottom -> Select Bootnodes.
Then select + symbol in the top right hand corner. Under Specify Name enter any name.

@jacqueswww
jacqueswww / vyper_ast.py
Last active November 9, 2021 02:55
First VyperNode output
class VyperNode:
def __init__(source_code, pos):
self.source_code = source_code
self.lineno, self.col_offset = pos
class Name(VyperNode):
pass
@jacqueswww
jacqueswww / gist:3f3208e9f795798fa7f09821c6c07145
Created March 19, 2019 18:17
Pull all python ast.* classes you use in your codebase! 🐍
#!/usr/bin/env python3
# RUN using: ./find_ast_classes.py ./vyper
import argparse
import ast
import os
import inspect
from ast import NodeVisitor
0x600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a05260606123826101403934156100a757600080fd5b61014051600255610160516000556101805160015561236a56600035601c52740100000000000000000000000000000000000000006020526f7fffffffffffffffffffffffffffffff6040527fffffffffffffffffffffffffffffffff8000000000000000000000000000000060605274012a05f1fffffffffffffffffffffffffdabf41c006080527ffffffffffffffffffffffffed5fa0e000000000000000000000000000000000060a0526000156101d5575b61016052610140526018600860208206610220016000610140516020826101c0010152602081019050806101c0526101c090505182840111156100dd57600080fd5b602080610240826020602088068803016000610140516020826101c0010152602081019050806101c0526101c0905001600060046015f15050818152809050905090508051602001806102e0828460006004600a8704601201f1610140576000
@jacqueswww
jacqueswww / crowdfund.v.py
Created December 19, 2018 12:49
Vyper B6 Crowdfund example
# Setup private variables (only callable from within the contract)
struct Funder :
sender: address
value: wei_value
funders: map(int128, Funder)
nextFunderIndex: int128
beneficiary: address
@jacqueswww
jacqueswww / vyper.py
Last active December 11, 2018 11:29
Populus VyperBackend
import pprint
import os
from collections import OrderedDict
from populus.compilation.backends.base import BaseCompilerBackend
class VyperBackend(BaseCompilerBackend):
project_source_glob = ('*.v.py', '*.vy')
test_source_glob = ('test_*.v.py', 'test_*.vy')
_______________________________________________________________ test_struct_return_abi ________________________________________________________________
data_type = '(int128,bool)', data_value = (1, True)
def abi_sub_tree(data_type, data_value):
if data_type is None:
return ABITypedData([None, data_value])
try:
> base, sub, arrlist = data_type
[seq,
[return,
0,
[lll,
[seq,
[mstore, 28, [calldataload, 0]],
[mstore, 32, 1461501637330902918203684832716283019655932542976],
[mstore, 64, 170141183460469231731687303715884105727],
[mstore, 96, -170141183460469231731687303715884105728],
[mstore, 128, 1701411834604692317316873037158841057270000000000],