Skip to content

Instantly share code, notes, and snippets.

View hayeah's full-sized avatar
🕳️
Focusing

blah blah hayeah

🕳️
Focusing
View GitHub Profile
@hayeah
hayeah / gclone.sh
Last active December 26, 2022 07:17
shortcut to clone git repo to a `user/repo` path
: <<COMMENT
# Clone the repository with the default repository name
gclone https://github.com/balancer-labs/balancer-v2-monorepo
# Clone the repository with a custom repository name
gclone https://github.com/balancer-labs/balancer-v2-monorepo my-custom-name
# Clone the repository without ".git" suffix
gclone https://github.com/balancer-labs/balancer-v2-monorepo.git my-custom-name
@hayeah
hayeah / lifepod.age
Created April 28, 2020 15:52
Life Pod
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNjcnlwdCA0RWZGbHRLZE5sbFVpUVRX
NFM4dnNRIDE4Cm94YW5nMTdSdjVjRVJhdlRNRDdPbVdySXRBRVhhT0FUMmhUTUtO
d0oveEUKLS0tIEYrQmVZbTNpSDc5S0VodjcwOWRlOXFLMXhoU3o0anZONDY2NXdy
b0tMdVUKTh5KSjzxdFrXWef3mgDJd7iJov2bqwqepm9W4U7G+I6axMtSn4rW3FoH
cbvF+bDXy3SpySSYT21Gz97oerPpsBtH3A9sxYJ3/wDeB0G27+mbl2v6mqtpdIAR
8j7rfwCDfRxg9Ot2FBTkg2f2ReRPw6ZEZ69gJJe1620Lj3WofaQp4gw6o3maDlPN
53fm7TbR5zVVGvOkYfNH2mbAhW0PKjOLRV+bBG254RW+RxToV4esb8IPXblX0mH/
2bsXl0M4kocNiK94UI/uGSlzmZNlRMMVrz9Mg/Km4Cz6cQALkqX45WY5W8mfQjb2
A7s/n/hui1Y7cf6SUmxhZxLsON0NgCc8JwdWVpnDFqrCj/WB5xIjQhhiQQOEhGI2
@hayeah
hayeah / gist:d312704cd62ef8d5ae5e8ca243128820
Created September 6, 2019 03:28
edgeware lock contract expire time
curl https://mainnet.infura.io/v3/$INFURA_TOKEN \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0","method":"eth_getStorageAt","params": ["'$CONTRACT_ADDRESS'", "0x01", "latest"],"id":1}'
@hayeah
hayeah / fomo.sol
Created August 6, 2018 07:30
fomo3d contract
pragma solidity ^0.4.24;
/**
* @title -FoMo-3D v0.7.1
* ┌┬┐┌─┐┌─┐┌┬┐ ╦╦ ╦╔═╗╔╦╗ ┌─┐┬─┐┌─┐┌─┐┌─┐┌┐┌┌┬┐┌─┐
* │ ├┤ ├─┤│││ ║║ ║╚═╗ ║ ├─┘├┬┘├┤ └─┐├┤ │││ │ └─┐
* ┴ └─┘┴ ┴┴ ┴ ╚╝╚═╝╚═╝ ╩ ┴ ┴└─└─┘└─┘└─┘┘└┘ ┴ └─┘
* _____ _____
* (, / /) /) /) (, / /) /)
* ┌─┐ / _ (/_ // // / _ // _ __ _(/
* ├─┤ ___/___(/_/(__(_/_(/_(/_ ___/__/_)_(/_(_(_/ (_(_(_
@hayeah
hayeah / 4.3.md
Created January 25, 2018 01:55
yellopaper rewritten with source code references

4.3 The Block

The block in Ethereum is the collection of relevant pieces of information (known as the block header), together with information corresponding to the comprised transactions, and a set of other block headers that are known to have a parent equal to the present block’s parent’s parent (such blocks are known as uncles).

https://sourcegraph.com/github.com/ethereum/go-ethereum@479aa61f11724560c63a7b56084259552892819d/-/blob/core/types/block.go#L139

type Block struct {
	header       *Header
	uncles []*Header
@hayeah
hayeah / evmlog.json
Created January 6, 2018 11:41
EVM Log Example
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x507e86b11541bcb1f3fe200b2f10ed8fd9413bd0",
"topics": [],
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0x179097",
"transactionHash": "0x0e88c5281bb38290ae2e9cd8588cd979bc92755605021e78550fbc4d130053d1",

Keybase proof

I hereby claim:

  • I am hayeah on github.
  • I am hayeah (https://keybase.io/hayeah) on keybase.
  • I have a public key ASBpckIkqnmmb21RzMBwBtJT7cVFiT3Ao2II38VBl2wrTwo

To claim this, I am signing this object:

@hayeah
hayeah / c-create-contract.sol.asm
Created October 17, 2017 09:15
c-create-contract.sol.asm
======= c-create-contract.sol:FooFactory =======
EVM assembly:
/* "c-create-contract.sol":44:150 contract FooFactory {... */
mstore(0x40, 0x60)
jumpi(tag_1, iszero(callvalue))
0x0
dup1
revert
tag_1:
tag_2:
@hayeah
hayeah / HODL.sol
Last active September 24, 2017 05:16
contract HODL {
uint256 amount;
uint releaseAt;
uint createdAt;
address owner;
modifier canRelease() {
// 当前时间超过了 HODL 期限即可取款
// 或者 7 天内后悔了
require(now > releaseAt || (now - createdAt < 7 days));
0x00 0 STOP
0x01 3 ADD
0x02 5 MUL
0x03 3 SUB
0x04 5 DIV
0x05 5 SDIV
0x06 5 MOD
0x07 5 SMOD
0x08 8 ADDMOD
0x09 8 MULMOD