Skip to content

Instantly share code, notes, and snippets.

@Philogy
Philogy / Broken.s.sol
Created January 16, 2024 21:25
Unable to deploy because of simulation script
// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;
import {Script} from "forge-std/Script.sol";
import {Test} from "forge-std/Test.sol";
import {console2 as console} from "forge-std/console2.sol";
contract Counter {
uint256 public count;
@Philogy
Philogy / uniswap-v3-fees.py
Created January 17, 2024 20:05
Very simple model of Uniswap V3 Fees
from attrs import define
@define
class Tick:
fee_growth_outside: int
def cross(self, fee_growth_global: int):
self.fee_growth_outside = fee_growth_global - self.fee_growth_outside
@Philogy
Philogy / GolfBounty.sol
Last active March 15, 2024 02:38
Curta Golf Bounty Contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {ICurtaGolf} from "curta-golf/src/interfaces/ICurtaGolf.sol";
import {ICourse} from "curta-golf/src/interfaces/ICourse.sol";
import {IERC721} from "./interfaces/IERC721.sol";
import {SafeTransferLib} from "solady/utils/SafeTransferLib.sol";
import {SafeCastLib} from "solady/utils/SafeCastLib.sol";
/// @author philogy <https://github.com/philogy>
from math import sqrt
def dy(c: float, l: float, u: float) -> float:
if c < l:
return 0
if l <= c < u:
return sqrt(c) - sqrt(l)
return sqrt(u) - sqrt(l)