Skip to content

Instantly share code, notes, and snippets.

View mempirate's full-sized avatar
🏃
Sprinting

Jonas Bostoen mempirate

🏃
Sprinting
View GitHub Profile
#!/usr/bin/env bash
# Generate a 1MB file of random data
dd if=/dev/urandom of=upload.bin bs=1M count=1 > /dev/null 2>&1
REGION=${REGION:-us}
N=${N:-50}
FILE=upload.bin
DEBUG=${DEBUG:-0}
@mempirate
mempirate / haproxy.cfg.diff
Last active November 27, 2025 16:34
HAProxy diff
diff --git a/haproxy.cfg b/haproxy.cfg
--- a/haproxy.cfg
+++ b/haproxy.cfg
@@ -52,6 +52,7 @@
frontend system
bind *:5544 ssl crt /usr/local/etc/haproxy/certs/ strict-sni
+ http-request return status 200 content-type application/json string '{"system_api_port": 5554}' if { path /infoz }
default_backend system_of
frontend prometheus
@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";