Skip to content

Instantly share code, notes, and snippets.

View voith's full-sized avatar
👨‍🎓
Building on top of Ethereum

Voith voith

👨‍🎓
Building on top of Ethereum
View GitHub Profile
@voith
voith / IParaswapV6.sol
Created September 9, 2024 20:09
Paraswap contract interface
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.6.10;
pragma experimental ABIEncoderV2;
struct GenericData {
address srcToken;
address destToken;
uint256 fromAmount;
uint256 toAmount;
uint256 quotedAmount;
@voith
voith / tcap_raffle_winner.py
Last active January 27, 2025 16:12
Script to select a raffle winner using ethereum's block hash as a source of randomnness.
import hashlib
import random
def choose_weighted_winner(participants, points, block_hash):
"""
Selects a winner using a weighted random selection based on points and a block hash.
Args:
participants (list): List of participant names or IDs.
points (list): List of points corresponding to each participant.
@voith
voith / TestODOS.t.sol
Created March 19, 2025 21:23
ODOS aggregator integration
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.26;
import "forge-std/Test.sol";
import "forge-std/console.sol";
import {IERC20} from "@openzeppelin-contracts-5/contracts/token/ERC20/IERC20.sol";
//POST: https://api.odos.xyz/sor/quote/v2
//{