Skip to content

Instantly share code, notes, and snippets.

@WormholeOracle
WormholeOracle / SdolaRateCalc.vy
Created June 13, 2025 04:09
Rate calculator for sDOLA
# @version 0.3.10
"""
@title SDOLA Rate Calculator
@notice Provides a per-second yield rate for sDOLA, based on previous week rewards
@author Curve.fi
"""
interface IDolaVault:
def totalAssets() -> uint256: view
def weeklyRevenue(epoch: uint256) -> uint256: view
@WormholeOracle
WormholeOracle / FxSaveRateCalc.vy
Created June 12, 2025 19:43
Rate calculator for fxSAVE
# @version 0.3.10
"""
@title fxSAVE Rate Calculator
@notice Calculates a per-second yield rate based on wstETH rewards using Curve's crvUSD oracle for price.
"""
interface IFxUSDBasePool:
def nav() -> uint256: view
def balanceOf(account: address) -> uint256: view
@WormholeOracle
WormholeOracle / SfraxusdMonetaryPolicy.vy
Created May 16, 2025 01:46
Secondary MonPol modified for use with sfrxUSD
# @version 0.3.10
"""
@title SfrxusdMonetaryPolicy
@notice Based on SecondaryMonetaryPolicy, however following EMA of sfrxUSD yield rate
@author Curve.fi
@license Copyright (c) Curve.Fi, 2020-2024 - all rights reserved
"""
from vyper.interfaces import ERC20
@WormholeOracle
WormholeOracle / OracleProxy.vy
Last active April 28, 2025 16:33
Proxy oracle allowing admin to change oracle contract in LlamaLend markets
# @version 0.3.10
"""
@title OracleProxy
@notice Oracle proxy allowing LlamaLend factory admin to set price oracle contract after deployment
@author Curve.Fi
@license MIT
"""
interface Factory:
def admin() -> address: view
@WormholeOracle
WormholeOracle / CryptoFromPoolsVaultWAgg.vy
Last active April 16, 2025 04:27
LlamaLend oracle for multiple pools including vault and aggregated price of crvUSD
# @version 0.3.10
"""
@title CryptoFromPoolsVaultWAgg
@notice Price oracle for chained pools (up to 8) combining crypto/crvUSD pricing and vault redemption rate.
It also references aggregated USD, so works for mint markets.
Only suitable for vaults which cannot be affected by donation attack (like sFRAX)
@author Curve.Fi
@license MIT
"""
# @version 0.3.10
"""
@title SemiLog monetary policy
@notice Monetary policy to calculate borrow rates in lending markets depending on utilization.
Unlike "core" policies, it does not depend on crvUSD price.
Calculated as:
log(rate) = utilization * (log(rate_max) - log(rate_min)) + log(rate_min)
e.g.
rate = rate_min * (rate_max / rate_min)**utilization
@author Curve.fi
@WormholeOracle
WormholeOracle / xgov_vote.py
Created September 13, 2024 19:52
An example Curve xgov vote (Arbitrum) using Brownie
import json
import os
import warnings
import requests
from brownie import Contract, accounts, chain, web3
from eth_abi import encode_single
warnings.filterwarnings("ignore")
@WormholeOracle
WormholeOracle / crv_loan_migration.py
Last active December 30, 2023 17:18
A script that uses BrownieSafe to multisend a gnosis safe tx that borrows crvUSD from silo and repays USDC on Aave
from brownie import Contract
from brownie_safe import BrownieSafe
def silo_deposit_borrow():
DEPOSIT_AMOUNT = 4_000_000e18
BORROW_AMOUNT = 200_000e18
safe = BrownieSafe('0xc420C9d507D0E038BD76383AaADCAd576ed0073c')
crv = safe.contract('0xD533a949740bb3306d119CC777fa900bA034cd52')
crv_usd = safe.contract('0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E')
@WormholeOracle
WormholeOracle / curve_dao_vote_ape.py
Created December 26, 2023 09:36
Curve DAO vote script ported to Ape Framework
import json
import os
import warnings
import requests
from ape import Contract, accounts, chain
warnings.filterwarnings("ignore")
# this script is used to prepare, simulate and broadcast votes within Curve's DAO