Skip to content

Instantly share code, notes, and snippets.

View sambacha's full-sized avatar
:atom:

sam bacha sambacha

:atom:
View GitHub Profile
/* @source {@link https://piccalil.li/blog/a-more-modern-css-reset/}
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Prevent font size inflation */
html {

Mathematical Formalization of Prize-Linked Savings Accounts

1. Notation and Definitions

  • t: Time period (can be discrete, e.g., days, weeks, or continuous)
  • u: Index for user, u = 1, 2, ..., N, where N is the number of users
  • V(t): Total value of assets deposited in the underlying ERC-4626 Vault at time t
  • D_u(t): Deposit amount of user u at time t. We assume deposits are cumulative, so D_u(t) represents the total deposited amount by user u up to time t
  • S_u(t): Vault Shares (ERC-4626 tokens) held by user u at time t
TopLevelObject = 'object' '{' Code? ( Object | Data )* '}'
Object = 'object' StringLiteral '{' Code? ( Object | Data )* '}'
Code = 'code' Block
Data = 'data' StringLiteral HexLiteral
HexLiteral = 'hex' ('"' ([0-9a-fA-F]{2})* '"' | '\'' ([0-9a-fA-F]{2})* '\'')
StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"'
@sambacha
sambacha / main.go
Created February 24, 2025 04:34 — forked from mdehoog/main.go
Dump the transcation size + estimated compressed size from a geth database, and analyze using numpy
package main
import (
"bytes"
"compress/zlib"
"context"
"encoding/binary"
"fmt"
"log"
"math/big"
@sambacha
sambacha / tarun_airdrop_option.py
Created February 21, 2025 20:58
Chitra Airdrop Python script
import argparse
import numpy as np
from scipy.optimize import fsolve
def payoff(Pt, C, tau_s, r):
"""Calculates the payoff of the airdrop for a single user.
Args:
Pt: Asset price at time t.
C: Capital committed by the user at time tau_s.
bun create @knip/config
bun add --dev --exact @biomejs/biome
npm install --save-dev --save-exact @biomejs/biome
npm init @knip/config
npm install -D knip typescript @types/node
npx knip
knip --fix
@startuml
skinparam sequenceArrowThickness 2
skinparam roundCorner 20
skinparam maxMessageSize 80
skinparam sequenceParticipant underline
skinparam backgroundColor #ffffff
title Block Proposal
autonumber
Category Scope Foreground Color Font Style Description
Visibility Modifiers storage.type.modifier.keyword.solidity #84f56293 Underline Public, memory, etc. modifiers
External Visibility storage.type.modifier.keyword.extendedscope.solidity #f56262 Underline External scope modifiers
Control Keywords keyword.control.solidity #fffffff5 Bold Keywords like emit, new, delete
Functions entity.name.function.solidity #fae674d7 Normal Function names
Transaction Variables (Inconclusive) variable.language.transaction.solidity #ffc570 Bold Underline Transaction-related variables
Transaction Variables (Security) variable.language.transaction.security.solidity #f56262 Bold Underline Secure transaction variables
Transaction Functions (Security) support.function.transaction.security.solidity #f56262 Bold Underline
@sambacha
sambacha / safe_wallet_origin_search.py
Created February 2, 2025 21:57
Find out Safe Wallet address Origin for Transaction
#!/usr/bin/env python3
import requests
import json
import os
# Replace
# <$SAFE_WALLET_ADDRESS>
# With your address
#
@sambacha
sambacha / LibResult.ts
Created January 18, 2025 12:47
TypeScript implementation of the Result monad pattern
// SPDX-License-Identifier: UPL-1.0 OR BSD-3
/**
* @file LibResult.ts
* @version 1.0.0
* @packageDocumentation
*
* A TypeScript implementation of the Result monad pattern, providing a type-safe way
* to handle operations that might fail. This pattern helps eliminate null checks
* and provides a more functional approach to error handling.