Skip to content

Instantly share code, notes, and snippets.

View elmariachi111's full-sized avatar
🦜
meow

Stefan Adolf elmariachi111

🦜
meow
View GitHub Profile
@elmariachi111
elmariachi111 / lit.ts
Last active June 5, 2025 08:29
Lit capacity credit delegation & session sig creation
import {
createSiweMessage,
generateAuthSig,
LitAbility,
LitAccessControlConditionResource,
newSessionCapabilityObject,
type AuthSig,
} from '@lit-protocol/auth-helpers'
import {
decryptToFile,
@elmariachi111
elmariachi111 / blind_attestation.md
Created June 2, 2025 13:13
blinded proof of participation

Proof of Study Participation

We enable users to prove that they participated in a clinical trial / study without the conducting service or company (RH) being aware of the "crypto" aspect of their user identity. On the other hand, the prover (us) shouldn't learn anything about the actual user. Welshare's protocol also neither publicy correlates any user ids or personally idenitifiable information.

To enable this blindfolded proof issuance, we require minimal action on the service company's (RH) side. To initiate the proof creation process, they must be able to

  • identify one user by an unique identifier (UID) that can be unique for a trial instance
  • store a random array of bytes ("nonce") per user, ideally using a crypograpically sufficiently safe RNG. The nonce helps deidentifying the user
  • display the UID & the indidual nonce to the user / allow them to request it
  • invite study participants by their preferred means of communication to a decentralized web application, hosted by welshare
@elmariachi111
elmariachi111 / predictL2Address.test.ts
Created May 16, 2025 15:57
predict ERC20 address on L2 when deployed via OptimismMintableERC20Factory
import { base, baseSepolia } from 'viem/chains'
import { describe, expect, it } from 'vitest'
import { predictL2TokenAddress } from './predictL2Address'
describe('Predict L2 Token Addresses', () => {
it('[BASE SEPOLIA] can predict an ERC20 token address created by the standard bridge on Base Sepolia', async () => {
expect.hasAssertions()
const expectedAddress = '0xDa8Df672aCfa4Ee1be95FBC1c2e0FA97d49F7BDe'
@elmariachi111
elmariachi111 / gase_price.1m.py
Created November 14, 2024 20:51
read gas price from etherscan
#!/usr/bin/env python3
import requests
import os
def get_gas_price():
"""
Gets current gas price using the Etherscan API
Returns price in gwei
"""
@elmariachi111
elmariachi111 / LaunchPage.tsx
Created August 28, 2024 20:19
smart contract wallet transaction preparation for Catalyst V2 spawns (Alchemy Account Kit & Gas Policiues / Privy Signer)
import { Button, Flex, Text, useToast } from '@chakra-ui/react'
import { useOnChange } from '@moleculexyz/common'
import { usePrivy } from '@privy-io/react-auth'
import { useRouter } from 'next/router'
import { useCallback, useMemo, useState } from 'react'
import { Address, Chain } from 'viem'
import { Alert } from '@/components/atoms/Alert'
import { BackButton } from '@/components/atoms/BackButton'
import { ContinueButton } from '@/components/atoms/ContinueButton'
export const DEFAULT_CACHE_SECONDS = 15
/**
* We're **not** using upstash or the Vercel KV SDK here to avoid package conflicts
* instead we're using vercel KV's REST API directly: https://vercel.com/docs/storage/vercel-kv/rest-api
*/
const createClient = <T>({ token, url }: { token: string; url: string }) => {
return {
get: async (key: string): Promise<T | null> => {
const result = await (
@elmariachi111
elmariachi111 / SomeStore.sol
Last active August 9, 2024 13:24
The simplest storage based Solana program thinkable.
contract SomeStore {
struct CatalystStorage {
uint64 x;
}
CatalystStorage public stg;
constructor() {
stg = CatalystStorage({x: 0});
}
@elmariachi111
elmariachi111 / INonfungiblePositionManager.sol
Created August 1, 2024 07:38
Provide UniV3 Liquidity between IPTs / ETH
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;
/// @title Creates and initializes V3 Pools
/// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that
/// require the pool to exist.
interface IPoolInitializer {
/// @notice Creates a new pool if it does not exist, then initializes if not initialized
/// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool
/// @param token0 The contract address of token0 of the pool
@elmariachi111
elmariachi111 / Bugbash.t.sol
Last active July 29, 2024 16:59
Catalyst Funding Session
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
import { Test } from "forge-std/Test.sol";
import "forge-std/console.sol";
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { LinearCurve } from "../../src/curves/LinearCurve.sol";
import { CurveParametersOutOfRange, TradeType } from "../../src/curves/IIPSeedCurve.sol";
import { CommonTest, Defaults } from "../helpers/CommonTest.sol";
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;
import { Test } from "forge-std/Test.sol";
import "forge-std/console.sol";
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { LinearCurve } from "../src/curves/LinearCurve.sol";
import { CurveParametersOutOfRange, TradeType } from "../src/curves/IIPSeedCurve.sol";
import { CommonTest, Defaults } from "./helpers/CommonTest.sol";