Skip to content

Instantly share code, notes, and snippets.

View rayeaster's full-sized avatar
💭
{@coding#//;}

Camotelli rayeaster

💭
{@coding#//;}
View GitHub Profile
@rayeaster
rayeaster / redemption.md
Last active November 7, 2023 10:07
redemption reseach

Recent redemption stats in Liquity over past 31 days (in October):

  • Average redemption fee is 0.7632% (52% higher than minimum floor rate of 0.5%)
  • Total 696 redemptions (current active total CDP is around 1100 as shown in https://liquity.defiexplore.com/)
  • Total redemption value is around $46.38Million with maximum single redeemed size is around $1.68Million
  • ICR redeemed ranges from [110.32%, 228.74%] with average at 188.38%
  • Current TCR is around 290% and recommended "safe" ICR is above 240% as shown in https://dune.com/queries/3140919/5238495

Liquity team recap on an earlier depeg event in mid August

@rayeaster
rayeaster / read_twap_quote.js
Last active October 11, 2022 14:40
PRICER-TWAP
const hre = require("hardhat");
require("@nomiclabs/hardhat-ethers");
const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
const vusd = "0x677ddbd918637E5F2c79e164D402454dE7dA8619"
const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
const uniswap_v3_usdc_eth_5 = '0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640';
const uniswap_v3_usdc_vusd_5 = '0x8dDE0A1481b4A14bC1015A5a8b260ef059E9FD89';
const eth_deployer = "0xE78388b4CE79068e89Bf8aA7f218eF6b9AB0e9d0";
@rayeaster
rayeaster / univ3-twap-manipulation.js
Last active September 26, 2022 15:13
hardhat-based test for uniswap v3 twap oracle manipulation
const hre = require("hardhat");
// const { expect, assert } = require("chai");
// const { BigNumber, utils } = ethers;
require("@nomiclabs/hardhat-ethers");
const weth = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
const looks = "0xf4d2888d29D722226FafA5d9B24F9164c092421E";
const wbtc = "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599";
const vusd = "0x677ddbd918637E5F2c79e164D402454dE7dA8619"
[{
"type": "constructor",
"stateMutability": "nonpayable",
"inputs": [{
"type": "address",
"name": "_token",
"internalType": "address"
}]
}, {
"type": "event",
@rayeaster
rayeaster / BptPricing.sol
Last active June 21, 2022 08:33
Balancer Pool Token pricing
pragma solidity 0.8.10;
pragma experimental ABIEncoderV2;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
pragma solidity 0.6.12;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
more readable format
pragma solidity ^0.4.24;
interface FoMo3DlongInterface {
function airDropTracker_() external returns (uint256);
function airDropPot_() external returns (uint256);
function withdraw() external;
}
@rayeaster
rayeaster / ProxyFactory.sol
Created July 12, 2018 11:03 — forked from GNSPS/ProxyFactory.sol
Improved `delegatecall` proxy contract factory (Solidity) [v0.0.4]
/***
* Shoutouts:
*
* Bytecode origin https://www.reddit.com/r/ethereum/comments/6ic49q/any_assembly_programmers_willing_to_write_a/dj5ceuw/
* Modified version of Vitalik's https://www.reddit.com/r/ethereum/comments/6c1jui/delegatecall_forwarders_how_to_save_5098_on/
* Credits to Jorge Izquierdo (@izqui) for coming up with this design here: https://gist.github.com/izqui/7f904443e6d19c1ab52ec7f5ad46b3a8
* Credits to Stefan George (@Georgi87) for inspiration for many of the improvements from Gnosis Safe: https://github.com/gnosis/gnosis-safe-contracts
*
* This version has many improvements over the original @izqui's library like using REVERT instead of THROWing on failed calls.
* It also implements the awesome design pattern for initializing code as seen in Gnosis Safe Factory: https://github.com/gnosis/gnosis-safe-contracts/blob/master/contracts/ProxyFactory.sol