Skip to content

Instantly share code, notes, and snippets.

View bh2smith's full-sized avatar
🤘

Benjamin Smith bh2smith

🤘
View GitHub Profile

Runtime Arguments vs. Environment Variables

Runtime Arguments:

  • Definition: These are parameters passed to a program at the time it is executed. They are typically specified in the command line.
  • Usage:
    • Directly affect the program's behavior for a specific run.
    • Ideal for options or configurations that might change frequently.
    • Example: If you have a script that processes files, you might pass the filename as a runtime argument (python process_file.py input.txt).
@bh2smith
bh2smith / safe-sdk.md
Last active June 28, 2024 13:25
Safe SDK Feedback
@bh2smith
bh2smith / mpc-relayer-manual.md
Created June 11, 2024 13:37
Multichain Gas Relayer Manual Interactions
@bh2smith
bh2smith / near-contract-monorepo.md
Created June 3, 2024 14:44
Near Contract Monorepo Archetecture

The following guide was coppied from ChatGPT 4o:

When managing multiple NEAR smart contracts within a single repository, it's common to structure the repository to facilitate organization, compilation, and deployment. Here’s a pattern you can follow for a multi-contract NEAR project in Rust:

Directory Structure

  1. root directory: Contains common configuration files.
  2. contracts: A directory containing individual subdirectories for each contract.
  3. scripts: Contains scripts for building, testing, and deploying contracts.
  4. tests: Contains integration tests that might involve multiple contracts.
@bh2smith
bh2smith / blocks.sh
Last active March 1, 2024 11:35
BlockTimes.sh
#!/bin/bash
# Space separated Array of Ethereum block numbers to fetch timestamps for
blockNumbers=(18562256 18562257)
ethRpc="https://rpc.ankr.com/eth"
for blockNumber in "${blockNumbers[@]}"
do
data="{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x$(printf '%x\n' $blockNumber)\", false],\"id\":1}"
@bh2smith
bh2smith / run_arak.md
Last active September 18, 2023 19:07
Run Arak Quickstart

Arak Quickstart

Arak is a very simple ethereum log indexing program found on github at: https://github.com/cowprotocol/arak

Create Postgres Instance

docker pull postgres

docker run --name erc721 -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres -d postgres
@bh2smith
bh2smith / EVM.RPC.Examples.md
Last active July 5, 2023 18:25
Elementary EVM RPC Requests

Curl Requests made as follows JSON files will be provided per section

 export ARCHIVE_NODE_URL=
 export JSON_FILE_PATH=
curl $ARCHIVE_NODE_URL -X POST -H "Content-Type: application/json" --data $JSON_FILE_PATH | jq
@bh2smith
bh2smith / internal_batches.md
Created January 13, 2023 12:50
Orderbook Uninternalized Batches
with solutions as (
  select 
    (json -> 'solutions' ->> -1)::jsonb as winning_solution
  from solver_competitions
  where id >= 4929771  -- The first batch containing the field `uninternalizedCallData`
)

select 100.0 * sum(case when winning_solution -> 'uninternalizedCallData' is null then 1 else 0 end) / count(*) as proportion_uninternalized
from solutions
@bh2smith
bh2smith / CommunityTableSchema.sql
Last active December 12, 2022 11:51
Dune Community Sources Schema
-- Dune Query for relevant views (postgres): https://dune.com/queries/1582621
-- Below is a HiveSQL (pseudo code) schema with corresponding postgres types:
-- TABLE 1: Order Rewards
-- Update schedule: hourly
-- Size: Currently 20k records this table will have approximately the same dimensions as number of trades on cow_prococol.
-- The first three columns are on-chain verifyable,
-- the json data field contains data from our orderbook DB.

0x064523df9bf2d9b907f20bbec50150d2ddd5721e66bd751c1f42447e96421bab