Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

fix: set fees after VAMM initialize #267

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
74 changes: 68 additions & 6 deletions poolConfigs/pool-configs/poolConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const poolConfigs: PoolConfigurations = {
lookbackWindowInSeconds: 12 * 24 * 60 * 60,
feeWad: "1000000000000000",
liquidatorRewardWad: "50000000000000000",
vammFeeProtocol: "0",
vammFeeProtocol: 0,
isAlpha: false,
lpMarginCap: "0",
termStartTimestamp: 1688061600,
Expand Down Expand Up @@ -44,7 +44,7 @@ const poolConfigs: PoolConfigurations = {
lookbackWindowInSeconds: 11 * 24 * 60 * 60,
feeWad: "1000000000000000",
liquidatorRewardWad: "50000000000000000",
vammFeeProtocol: "0",
vammFeeProtocol: 0,
isAlpha: false,
lpMarginCap: "0",
termStartTimestamp: 1688061600,
Expand All @@ -69,14 +69,45 @@ const poolConfigs: PoolConfigurations = {
},

arbitrum: {
// aUSDC borrow pools
borrow_av3USDC_30Jun23: {
rateOracle: "AaveV3BorrowRateOracle_USDC",
tickSpacing: 60,
cacheMaxAgeInSeconds: 21600,
lookbackWindowInSeconds: 13 * 24 * 60 * 60,
feeWad: "1000000000000000",
liquidatorRewardWad: "50000000000000000",
vammFeeProtocol: 0,
isAlpha: false,
lpMarginCap: "0",
termStartTimestamp: 1685523600,
termEndTimestamp: 1688126400, // Fri Jun 30 2023 12:00:00 GMT+0000
marginCalculatorParams: {
apyUpperMultiplierWad: "1406941241730705152",
apyLowerMultiplierWad: "500790184633923520",
sigmaSquaredWad: "2496808645685",
alphaWad: "244093552965375",
betaWad: "14136010820279574",
xiUpperWad: "16000000000000000000",
xiLowerWad: "68000000000000000000",
tMaxWad: "31536000000000000000000000",
etaIMWad: "2988819497220332",
etaLMWad: "1118219462831499",
...gaps,
minMarginToIncentiviseLiquidators: "0",
},
initTick: -9301,
maturityBuffer: 3600,
},

borrow_av3USDC_31Aug23: {
rateOracle: "AaveV3BorrowRateOracle_USDC",
tickSpacing: 60,
cacheMaxAgeInSeconds: 21600,
lookbackWindowInSeconds: 12 * 24 * 60 * 60,
feeWad: "1000000000000000",
liquidatorRewardWad: "50000000000000000",
vammFeeProtocol: "0",
vammFeeProtocol: 0,
isAlpha: false,
lpMarginCap: "0",
termStartTimestamp: 1685523600,
Expand All @@ -98,6 +129,37 @@ const poolConfigs: PoolConfigurations = {
initTick: -9301,
maturityBuffer: 3600,
},

// GLP pools
glpETH_28Jun23: {
rateOracle: "GlpRateOracle",
tickSpacing: 60,
cacheMaxAgeInSeconds: 21600,
lookbackWindowInSeconds: 14 * 24 * 60 * 60,
feeWad: "5000000000000000", // 0.5% LP Fees
liquidatorRewardWad: "50000000000000000", // 5%
vammFeeProtocol: 0,
isAlpha: false,
lpMarginCap: "0",
termStartTimestamp: 1685523600,
termEndTimestamp: 1687919400, // Wed Jun 28 2023 02:30:00 GMT+0000
marginCalculatorParams: {
apyUpperMultiplierWad: "1209358168717856256",
apyLowerMultiplierWad: "228239625856421728",
sigmaSquaredWad: "41826291005464",
alphaWad: "4298950189896987",
betaWad: "50217814101598760",
xiUpperWad: "31000000000000000000",
xiLowerWad: "55000000000000000000",
tMaxWad: "31536000000000000000000000",
etaIMWad: "4993403947323154",
etaLMWad: "1645276067621130",
...gaps,
minMarginToIncentiviseLiquidators: "0",
},
initTick: -21891,
maturityBuffer: 3600,
},
},

goerli: {
Expand Down Expand Up @@ -135,7 +197,7 @@ const poolConfigs: PoolConfigurations = {
lookbackWindowInSeconds: 13 * 24 * 60 * 60,
feeWad: "200000000000000",
liquidatorRewardWad: "50000000000000000",
vammFeeProtocol: "0",
vammFeeProtocol: 0,
isAlpha: false,
lpMarginCap: "0",
termStartTimestamp: 1684931400,
Expand Down Expand Up @@ -165,7 +227,7 @@ const poolConfigs: PoolConfigurations = {
lookbackWindowInSeconds: 13 * 24 * 60 * 60,
feeWad: "200000000000000",
liquidatorRewardWad: "50000000000000000",
vammFeeProtocol: "0",
vammFeeProtocol: 0,
isAlpha: false,
lpMarginCap: "0",
termStartTimestamp: 1684931400,
Expand Down Expand Up @@ -197,7 +259,7 @@ const poolConfigs: PoolConfigurations = {
lookbackWindowInSeconds: 15 * 24 * 60 * 60,
feeWad: "1000000000000000",
liquidatorRewardWad: "50000000000000000",
vammFeeProtocol: "0",
vammFeeProtocol: 0,
isAlpha: false,
lpMarginCap: "0",
termStartTimestamp: 1684839365,
Expand Down
2 changes: 1 addition & 1 deletion poolConfigs/pool-configs/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type SinglePoolConfiguration = {
liquidatorRewardWad: BigNumberish;

// Denominator for fee protocol
vammFeeProtocol: BigNumberish;
vammFeeProtocol: number;

// alpha state
isAlpha: boolean;
Expand Down
2 changes: 2 additions & 0 deletions tasks/irsInstances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ interface SingleIrsData {
lookbackWindowInSeconds: number;
liquidatorRewardWad: BigNumberish;
feeWad: BigNumberish;
feeProtocol: number;
isAlpha: boolean;
lpMarginCap: BigNumberish;
marginCalculatorParams: {
Expand Down Expand Up @@ -387,6 +388,7 @@ task(
cacheMaxAgeInSeconds: poolConfig.cacheMaxAgeInSeconds,
lookbackWindowInSeconds: poolConfig.lookbackWindowInSeconds,
feeWad: poolConfig.feeWad,
feeProtocol: poolConfig.vammFeeProtocol,
isAlpha: poolConfig.isAlpha,
lpMarginCap: poolConfig.lpMarginCap,
marginCalculatorParams: poolConfig.marginCalculatorParams,
Expand Down
21 changes: 21 additions & 0 deletions tasks/templates/CreateIrsTransactions.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,27 @@
"contractInputsValues": {
"sqrtPriceX96": "{{sqrtPriceX96}}"
}
},
{
"to": "{{predictedVammAddress}}",
"value": "0",
"data": null,
"contractMethod": {
"inputs": [
{
"internalType": "uint8",
"name": "feeProtocol",
"type": "uint8"
}
],
"name": "setFeeProtocol",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
"contractInputsValues": {
"feeProtocol": "{{feeWad}}"
}
}{{^last}},{{/last}}
{{/irsInstances}}
]
Expand Down
2 changes: 1 addition & 1 deletion tasks/vamm/init-vamms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async function writeToMultisigTemplate(data: MultisigTemplate) {
//
// Example:
// ``npx hardhat init-vamms --network mainnet``

// IMPORTANT! initializing VAMM resets protocol feees to 0
task("init-vamms", "Initialises VAMMs").setAction(async (_, hre) => {
// Retrieve multisig address for the current network
const network = hre.network.name;
Expand Down