Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 185 additions & 0 deletions spot-contracts/.openzeppelin/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -2840,6 +2840,191 @@
},
"namespaces": {}
}
},
"a0651b4cbe00a1624a6fc2c5b84c09b23347cbff34f3e4103c29fce3da7b9030": {
"address": "0xFad454b578a54c0602FB6D711F26fd701235FaB6",
"txHash": "0x6b08759f0988cf344fc4394829e8035a3427d2d166f58dc75bb7cc65fbac8ba6",
"layout": {
"solcVersion": "0.8.20",
"storage": [
{
"label": "_initialized",
"offset": 0,
"slot": "0",
"type": "t_uint8",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:63",
"retypedFrom": "bool"
},
{
"label": "_initializing",
"offset": 1,
"slot": "0",
"type": "t_bool",
"contract": "Initializable",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:68"
},
{
"label": "__gap",
"offset": 0,
"slot": "1",
"type": "t_array(t_uint256)50_storage",
"contract": "ContextUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:40"
},
{
"label": "_owner",
"offset": 0,
"slot": "51",
"type": "t_address",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
},
{
"label": "__gap",
"offset": 0,
"slot": "52",
"type": "t_array(t_uint256)49_storage",
"contract": "OwnableUpgradeable",
"src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94"
},
{
"label": "targetSubscriptionRatio",
"offset": 0,
"slot": "101",
"type": "t_uint256",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:80"
},
{
"label": "deviationRatioBoundLower",
"offset": 0,
"slot": "102",
"type": "t_uint256",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:83"
},
{
"label": "deviationRatioBoundUpper",
"offset": 0,
"slot": "103",
"type": "t_uint256",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:86"
},
{
"label": "perpMintFeePerc",
"offset": 0,
"slot": "104",
"type": "t_uint256",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:94"
},
{
"label": "perpBurnFeePerc",
"offset": 0,
"slot": "105",
"type": "t_uint256",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:97"
},
{
"label": "perpRolloverFee",
"offset": 0,
"slot": "106",
"type": "t_struct(RolloverFeeSigmoidParams)5758_storage",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:109"
},
{
"label": "vaultMintFeePerc",
"offset": 0,
"slot": "109",
"type": "t_uint256",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:117"
},
{
"label": "vaultBurnFeePerc",
"offset": 0,
"slot": "110",
"type": "t_uint256",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:120"
},
{
"label": "vaultUnderlyingToPerpSwapFeePerc",
"offset": 0,
"slot": "111",
"type": "t_uint256",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:123"
},
{
"label": "vaultPerpToUnderlyingSwapFeePerc",
"offset": 0,
"slot": "112",
"type": "t_uint256",
"contract": "FeePolicy",
"src": "contracts/FeePolicy.sol:126"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]",
"numberOfBytes": "1568"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]",
"numberOfBytes": "1600"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_int256": {
"label": "int256",
"numberOfBytes": "32"
},
"t_struct(RolloverFeeSigmoidParams)5758_storage": {
"label": "struct FeePolicy.RolloverFeeSigmoidParams",
"members": [
{
"label": "lower",
"type": "t_int256",
"offset": 0,
"slot": "0"
},
{
"label": "upper",
"type": "t_int256",
"offset": 0,
"slot": "1"
},
{
"label": "growth",
"type": "t_int256",
"offset": 0,
"slot": "2"
}
],
"numberOfBytes": "96"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint8": {
"label": "uint8",
"numberOfBytes": "1"
}
},
"namespaces": {}
}
}
}
}
8 changes: 1 addition & 7 deletions spot-contracts/contracts/FeePolicy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable {
/// @notice Fixed point representation of 1.0 or 100%.
uint256 public constant ONE = (1 * 10 ** DECIMALS);

/// @notice Sigmoid asymptote bound.
/// @dev Set to 0.05 or 5%, i.e) the rollover fee can be at most 5% on either direction.
uint256 public constant SIGMOID_BOUND = ONE / 20;

/// @notice Target subscription ratio lower bound, 0.75 or 75%.
uint256 public constant TARGET_SR_LOWER_BOUND = (ONE * 75) / 100;

Expand Down Expand Up @@ -209,9 +205,7 @@ contract FeePolicy is IFeePolicy, OwnableUpgradeable {
/// @notice Update the parameters determining the slope and asymptotes of the sigmoid fee curve.
/// @param p Lower, Upper and Growth sigmoid paramters are fixed point numbers with {DECIMALS} places.
function updatePerpRolloverFees(RolloverFeeSigmoidParams calldata p) external onlyOwner {
// If the bond duration is 28 days and 13 rollovers happen per year,
// perp can be inflated or enriched up to ~65% annually.
if (p.lower < -int256(SIGMOID_BOUND) || p.upper > int256(SIGMOID_BOUND) || p.lower > p.upper) {
if (p.lower > p.upper) {
revert InvalidSigmoidAsymptotes();
}
perpRolloverFee.lower = p.lower;
Expand Down
3 changes: 2 additions & 1 deletion spot-contracts/tasks/scripts/mainnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,5 @@ yarn hardhat --network mainnet validate_upgrade PerpetualTranche 0xC1f33e0cf7e40
yarn hardhat --network mainnet validate_upgrade RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd

yarn hardhat --network mainnet prepare_upgrade PerpetualTranche 0xC1f33e0cf7e40a67375007104B929E49a581bafE
yarn hardhat --network mainnet prepare_upgrade RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd
yarn hardhat --network mainnet prepare_upgrade RolloverVault 0x82A91a0D599A45d8E9Af781D67f695d7C72869Bd
yarn hardhat --network mainnet prepare_upgrade FeePolicy 0xE22977381506bF094CB3ed50CB8834E358F7ef6c
19 changes: 0 additions & 19 deletions spot-contracts/test/FeePolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,25 +174,6 @@ describe("FeePolicy", function () {
});

describe("when parameters are invalid", function () {
it("should revert", async function () {
await expect(
feePolicy.connect(deployer).updatePerpRolloverFees({
lower: toPerc("-0.051"),
upper: toPerc("0.01"),
growth: toPerc("3"),
}),
).to.be.revertedWithCustomError(feePolicy, "InvalidSigmoidAsymptotes");
});
it("should revert", async function () {
await expect(
feePolicy.connect(deployer).updatePerpRolloverFees({
lower: toPerc("-0.01"),
upper: toPerc("0.051"),
growth: toPerc("3"),
}),
).to.be.revertedWithCustomError(feePolicy, "InvalidSigmoidAsymptotes");
});

it("should revert", async function () {
await expect(
feePolicy.connect(deployer).updatePerpRolloverFees({
Expand Down