Skip to content

Instantly share code, notes, and snippets.

View jsvisa's full-sized avatar
🏠
Working from home

Delweng jsvisa

🏠
Working from home
View GitHub Profile
{
"name": "JSLayer",
"website": "https://github.com/jsvisa",
"description": "EigenLayer maintained by jsvisa",
"logo": "https://p.ipic.vip/632txr.png",
"twitter": "https://twitter.com/jsvisa"
}
@jsvisa
jsvisa / aptos_transfer.py
Created April 1, 2024 01:20
Aptos Coin Transfer From Tx
#!/usr/bin/env python3
import logging
logging.basicConfig(
format="[%(asctime)s] - %(levelname)s - %(message)s", level=logging.INFO
)
WITHDRAW_EVENT = "0x1::coin::WithdrawEvent"
DEPOSIT_EVENT = "0x1::coin::DepositEvent"

Keybase proof

I hereby claim:

  • I am jsvisa on github.
  • I am jsvisa (https://keybase.io/jsvisa) on keybase.
  • I have a public key ASAVPz_zjqcNy3wtqCqvBOwxxAhE_Ikrbtiy-QlzN0lRxwo

To claim this, I am signing this object:

@jsvisa
jsvisa / send_tx.py
Last active August 1, 2023 12:59
send gasPrice 0 tx
#!/usr/bin/env python
import argparse
import logging
from web3 import Web3, HTTPProvider
logging.basicConfig(
format="[%(asctime)s] - %(levelname)s - %(message)s", level=logging.INFO
)
@jsvisa
jsvisa / gist:99ce397a04089cc464b6086f56f546e3
Created April 16, 2023 13:52
issue_eth_subscribeFilterLogs_from_block

Understanding of the current problem

The problem is caused by the current design of the SubscribeXXX interface, which only processes data from the current block height onwards, and this processing is done in a goroutine serialized by the filter_system (handled in EventSystem.eventLoop). This means that SubscribeFilterLogs cannot separately process blocks between fromBlock and currentBlock, and what we want is to filter both historical and current data consistently with the FilterLogs interface semantics.

How to solve this problem

Minimize the cost of implementing this requirement:

If the fromBlock in SubscribeFilterLogs is a block height in history, we split this interface into two parts:

// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
@jsvisa
jsvisa / genesia-accounts.json
Created August 29, 2019 08:37
Ethereum genesis accounts
[
"000d836201318ec6899a67540690382780743280",
"001762430ea9c3a26e5749afdb70da5f78ddbb8c",
"001d14804b399c6ef80e64576f657660804fec0b",
"0032403587947b9f15622a68d104d54d33dbd1cd",
"00497e92cdc0e0b963d752b2296acb87da828b24",
"004bfbe1546bc6c65b5c7eaa55304b38bbfec6d3",
"005a9c03f69d17d66cbb8ad721008a9ebbb836fb",
"005d0ee8155ec0a6ff6808552ca5f16bb5be323a",
"007622d84a234bb8b078230fcf84b67ae9a8acae",
@jsvisa
jsvisa / bash-tutorial.md
Created January 11, 2019 02:39
bash tutorial #sh #bash

删除一个字符串中后面的字符

$ str=foo_bar:baz
$ echo "${str%%:*}"
foo_bar

删除一个字符串前面的字符

@jsvisa
jsvisa / gitconfig
Last active November 9, 2018 06:26
parse git branch in bash PS1
# ~/.gitconfig
[alias]
sm = smart-merge
sp = smart-pull
sl = smart-log
gs = status
co = checkout
st = status
ci = commit
cl = clone
@jsvisa
jsvisa / account-info.py
Last active September 17, 2018 09:12
Ethereum Gensis Account Information
import os
import numpy as np
import pandas as pd
import multiprocessing
import matplotlib.pyplot as plt
from multiprocessing import Queue
import web3
# import matplotlib.mlab as mlab
# import matplotlib.pyplot as plt