Skip to content

Instantly share code, notes, and snippets.

View mempirate's full-sized avatar
🏃
Sprinting

Jonas Bostoen mempirate

🏃
Sprinting
  • Chainbound
  • Antwerp, Belgium
  • 01:46 (UTC +02:00)
  • X @mempirate
View GitHub Profile
@mempirate
mempirate / explorer-schema.md
Created January 30, 2025 15:50
Bolt Explorer Schema

Context

We need to redesign the data indexer with the following in mind:

  • Correct indexing for measuring network health
  • Correct indexing for attributing faults (liveness, safety, timeliness)
  • Correct indexing for finding bugs (local & remote error responses, tracking confirmations)
  • Enough metadata for all of the above

With this in mind, this is what the Clickhouse tables will look like:

raw_transaction_requests

Symbol Number of Deposits
bathUSDC 400
bathOP 246
bathETH 175
bathDAI 38
bathUSDT 38
bathSNX 30
nukenke 5
bathWBTC 4
Symbol Number of Deposits
imUSD 2124
wapGHST 1845
LOL 20
eVault 18
LOLt 14
svUSDC 10
swMATIC 4
LOLT 3
Symbol Number of Deposits
vTHOR 2289
xMPL 435
uCVX 115
fei3crvCVX 111
d3CVX 58
imUSD 47
cvxCRVCRV 41
cvxFXSFXS 38
Symbol First_occurence Total_deposits Tx_hash
d3CVX 2022-02-14 58 0x3bde42aef1d795ec11a2fdec2508fca880a4a73b4818e743790e6a14b2850b26
fei3crvCVX 2022-02-23 111 0xb7d0cc8597c00bdee0363c1a69db236e50e247403315650f8e5c6d76d18720e1
tricryptoCVX 2022-02-24 13 0xa116b76522fcf8a5efad14cf8ed4817c2ee6b5bc884b16cf752c6f18b2fc015d
d3convex 2022-02-24 14 0x3be7f2ce5ddf77d923ed56b5dd4ddbde64a622e4075984be0a5727e417ec462b
fei3crvConvex 2022-02-24 5 0x64dab869db30d6b1f817b09bb8c0b4fd8b89f617f075cf2a86b743768c9a5d5b
alusd3crvConvex 2022-02-25 4 0xc06d393589da3f911912b97f879c95ed22c345bb1aa208c039b477b4db16912b
FRX3CRVCVX 2022-02-25
start_time = format_date("02-01-2006 15:04", "01-02-2022 00:00")
end_time = now
loop {
items = ["ethereum", "polygon", "arbitrum", "optimism"]
query "erc4626_deposits" {
chain = item
event "Deposit" {
abstract contract IERC4626 is ERC20 {
// Emitted every time someone deposits
event Deposit(address indexed sender, address indexed receiver, uint256 assets, uint256 shares);
// Emitted every time someone withdraws
event Withdraw(address indexed sender, address indexed receiver, uint256 assets, uint256 shares);
// Returns the address of the underlying token
function asset() external view virtual returns (address asset);
@mempirate
mempirate / uniswap-v3-example.sol
Created August 2, 2021 08:43
Simple example on how to swap on UniswapV3 with the SwapRouter
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@uniswap/v2-periphery/contracts/interfaces/IWETH.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-core/contracts/libraries/LowGasSafeMath.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
async function checkBlocks(start, end) {
for (let i = start; i < end; i++) {
let block = await web3.eth.getBlock(i)
console.log(`[*] Searching block ${ i }`)
if (block && block.transactions) {
for (let txHash of block.transactions) {
let tx = await web3.eth.getTransaction(txHash)
if (account === tx.to.toLowerCase()) {
console.log(`[+] Transaction found on block ${ lastBlockNumber }`)
console.log({ address: tx.from, value: web3.utils.fromWei(tx.value, 'ether'), timestamp: new Date() })
@mempirate
mempirate / index.js
Last active November 22, 2019 08:37
'use strict'
const Web3 = require('web3')
const BuildTransactionChecker = require('./transactionChecker')
const CreateClient = require('./ethClient')
const web3 = CreateClient(Web3)
const checkBlock = BuildTransactionChecker(web3)