Skip to content

Commit e95c7ac

Browse files
authored
upgraded fee policy impl without bounds on rollover fees (#248)
1 parent 8c4f781 commit e95c7ac

File tree

4 files changed

+188
-27
lines changed

4 files changed

+188
-27
lines changed

spot-contracts/.openzeppelin/mainnet.json

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2840,6 +2840,191 @@
28402840
},
28412841
"namespaces": {}
28422842
}
2843+
},
2844+
"a0651b4cbe00a1624a6fc2c5b84c09b23347cbff34f3e4103c29fce3da7b9030": {
2845+
"address": "0xFad454b578a54c0602FB6D711F26fd701235FaB6",
2846+
"txHash": "0x6b08759f0988cf344fc4394829e8035a3427d2d166f58dc75bb7cc65fbac8ba6",
2847+
"layout": {
2848+
"solcVersion": "0.8.20",
2849+
"storage": [
2850+
{
2851+
"label": "_initialized",
2852+
"offset": 0,
2853+
"slot": "0",
2854+
"type": "t_uint8",
2855+
"contract": "Initializable",
2856+
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63",
2857+
"retypedFrom": "bool"
2858+
},
2859+
{
2860+
"label": "_initializing",
2861+
"offset": 1,
2862+
"slot": "0",
2863+
"type": "t_bool",
2864+
"contract": "Initializable",
2865+
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68"
2866+
},
2867+
{
2868+
"label": "__gap",
2869+
"offset": 0,
2870+
"slot": "1",
2871+
"type": "t_array(t_uint256)50_storage",
2872+
"contract": "ContextUpgradeable",
2873+
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40"
2874+
},
2875+
{
2876+
"label": "_owner",
2877+
"offset": 0,
2878+
"slot": "51",
2879+
"type": "t_address",
2880+
"contract": "OwnableUpgradeable",
2881+
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
2882+
},
2883+
{
2884+
"label": "__gap",
2885+
"offset": 0,
2886+
"slot": "52",
2887+
"type": "t_array(t_uint256)49_storage",
2888+
"contract": "OwnableUpgradeable",
2889+
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94"
2890+
},
2891+
{
2892+
"label": "targetSubscriptionRatio",
2893+
"offset": 0,
2894+
"slot": "101",
2895+
"type": "t_uint256",
2896+
"contract": "FeePolicy",
2897+
"src": "contracts/FeePolicy.sol:80"
2898+
},
2899+
{
2900+
"label": "deviationRatioBoundLower",
2901+
"offset": 0,
2902+
"slot": "102",
2903+
"type": "t_uint256",
2904+
"contract": "FeePolicy",
2905+
"src": "contracts/FeePolicy.sol:83"
2906+
},
2907+
{
2908+
"label": "deviationRatioBoundUpper",
2909+
"offset": 0,
2910+
"slot": "103",
2911+
"type": "t_uint256",
2912+
"contract": "FeePolicy",
2913+
"src": "contracts/FeePolicy.sol:86"
2914+
},
2915+
{
2916+
"label": "perpMintFeePerc",
2917+
"offset": 0,
2918+
"slot": "104",
2919+
"type": "t_uint256",
2920+
"contract": "FeePolicy",
2921+
"src": "contracts/FeePolicy.sol:94"
2922+
},
2923+
{
2924+
"label": "perpBurnFeePerc",
2925+
"offset": 0,
2926+
"slot": "105",
2927+
"type": "t_uint256",
2928+
"contract": "FeePolicy",
2929+
"src": "contracts/FeePolicy.sol:97"
2930+
},
2931+
{
2932+
"label": "perpRolloverFee",
2933+
"offset": 0,
2934+
"slot": "106",
2935+
"type": "t_struct(RolloverFeeSigmoidParams)5758_storage",
2936+
"contract": "FeePolicy",
2937+
"src": "contracts/FeePolicy.sol:109"
2938+
},
2939+
{
2940+
"label": "vaultMintFeePerc",
2941+
"offset": 0,
2942+
"slot": "109",
2943+
"type": "t_uint256",
2944+
"contract": "FeePolicy",
2945+
"src": "contracts/FeePolicy.sol:117"
2946+
},
2947+
{
2948+
"label": "vaultBurnFeePerc",
2949+
"offset": 0,
2950+
"slot": "110",
2951+
"type": "t_uint256",
2952+
"contract": "FeePolicy",
2953+
"src": "contracts/FeePolicy.sol:120"
2954+
},
2955+
{
2956+
"label": "vaultUnderlyingToPerpSwapFeePerc",
2957+
"offset": 0,
2958+
"slot": "111",
2959+
"type": "t_uint256",
2960+
"contract": "FeePolicy",
2961+
"src": "contracts/FeePolicy.sol:123"
2962+
},
2963+
{
2964+
"label": "vaultPerpToUnderlyingSwapFeePerc",
2965+
"offset": 0,
2966+
"slot": "112",
2967+
"type": "t_uint256",
2968+
"contract": "FeePolicy",
2969+
"src": "contracts/FeePolicy.sol:126"
2970+
}
2971+
],
2972+
"types": {
2973+
"t_address": {
2974+
"label": "address",
2975+
"numberOfBytes": "20"
2976+
},
2977+
"t_array(t_uint256)49_storage": {
2978+
"label": "uint256[49]",
2979+
"numberOfBytes": "1568"
2980+
},
2981+
"t_array(t_uint256)50_storage": {
2982+
"label": "uint256[50]",
2983+
"numberOfBytes": "1600"
2984+
},
2985+
"t_bool": {
2986+
"label": "bool",
2987+
"numberOfBytes": "1"
2988+
},
2989+
"t_int256": {
2990+
"label": "int256",
2991+
"numberOfBytes": "32"
2992+
},
2993+
"t_struct(RolloverFeeSigmoidParams)5758_storage": {
2994+
"label": "struct FeePolicy.RolloverFeeSigmoidParams",
2995+
"members": [
2996+
{
2997+
"label": "lower",
2998+
"type": "t_int256",
2999+
"offset": 0,
3000+
"slot": "0"
3001+
},
3002+
{
3003+
"label": "upper",
3004+
"type": "t_int256",
3005+
"offset": 0,
3006+
"slot": "1"
3007+
},
3008+
{
3009+
"label": "growth",
3010+
"type": "t_int256",
3011+
"offset": 0,
3012+
"slot": "2"
3013+
}
3014+
],
3015+
"numberOfBytes": "96"
3016+
},
3017+
"t_uint256": {
3018+
"label": "uint256",
3019+
"numberOfBytes": "32"
3020+
},
3021+
"t_uint8": {
3022+
"label": "uint8",
3023+
"numberOfBytes": "1"
3024+
}
3025+
},
3026+
"namespaces": {}
3027+
}
28433028
}
28443029
}
28453030
}

spot-contracts/contracts/FeePolicy.sol

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable {
6767
/// @notice Fixed point representation of 1.0 or 100%.
6868
uint256 public constant ONE = (1 * 10 ** DECIMALS);
6969

70-
/// @notice Sigmoid asymptote bound.
71-
/// @dev Set to 0.05 or 5%, i.e) the rollover fee can be at most 5% on either direction.
72-
uint256 public constant SIGMOID_BOUND = ONE / 20;
73-
7470
/// @notice Target subscription ratio lower bound, 0.75 or 75%.
7571
uint256 public constant TARGET_SR_LOWER_BOUND = (ONE * 75) / 100;
7672

@@ -209,9 +205,7 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable {
209205
/// @notice Update the parameters determining the slope and asymptotes of the sigmoid fee curve.
210206
/// @param p Lower, Upper and Growth sigmoid paramters are fixed point numbers with {DECIMALS} places.
211207
function updatePerpRolloverFees(RolloverFeeSigmoidParams calldata p) external onlyOwner {
212-
// If the bond duration is 28 days and 13 rollovers happen per year,
213-
// perp can be inflated or enriched up to ~65% annually.
214-
if (p.lower < -int256(SIGMOID_BOUND) || p.upper > int256(SIGMOID_BOUND) || p.lower > p.upper) {
208+
if (p.lower > p.upper) {
215209
revert InvalidSigmoidAsymptotes();
216210
}
217211
perpRolloverFee.lower = p.lower;

spot-contracts/tasks/scripts/mainnet.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,5 @@ yarn hardhat --network mainnet validate_upgrade PerpetualTranche 0xC1f33e0cf7e40
115115
yarn hardhat --network mainnet validate_upgrade RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd
116116

117117
yarn hardhat --network mainnet prepare_upgrade PerpetualTranche 0xC1f33e0cf7e40a67375007104B929E49a581bafE
118-
yarn hardhat --network mainnet prepare_upgrade RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd
118+
yarn hardhat --network mainnet prepare_upgrade RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd
119+
yarn hardhat --network mainnet prepare_upgrade FeePolicy 0xE22977381506bF094CB3ed50CB8834E358F7ef6c

spot-contracts/test/FeePolicy.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -174,25 +174,6 @@ describe("FeePolicy", function () {
174174
});
175175

176176
describe("when parameters are invalid", function () {
177-
it("should revert", async function () {
178-
await expect(
179-
feePolicy.connect(deployer).updatePerpRolloverFees({
180-
lower: toPerc("-0.051"),
181-
upper: toPerc("0.01"),
182-
growth: toPerc("3"),
183-
}),
184-
).to.be.revertedWithCustomError(feePolicy, "InvalidSigmoidAsymptotes");
185-
});
186-
it("should revert", async function () {
187-
await expect(
188-
feePolicy.connect(deployer).updatePerpRolloverFees({
189-
lower: toPerc("-0.01"),
190-
upper: toPerc("0.051"),
191-
growth: toPerc("3"),
192-
}),
193-
).to.be.revertedWithCustomError(feePolicy, "InvalidSigmoidAsymptotes");
194-
});
195-
196177
it("should revert", async function () {
197178
await expect(
198179
feePolicy.connect(deployer).updatePerpRolloverFees({

0 commit comments

Comments
 (0)