obront
medium
According to the docs, the Funding Rate is intended to correspond to the gap between long and short positions that the Float Pool is required to make up. However, as its implemented, the totalFunding
is calculated only on the size of the overbalanced position, leading to some unexpected situations.
According to the comments, totalFunding
is meant to be calculated as follows:
totalFunding is calculated on the notional of between long and short liquidity and 2x long and short liquidity.
This makes sense. The purpose of the funding rate is to compensate the Float Pool for the liquidity provided to balance the market.
However, the implementation of this function does not accomplish this. Instead, totalFunding
is based only on the size of the overbalancedValue
:
uint256 totalFunding = (2 * overbalancedValue * fundingRateMultiplier * oracleManager.EPOCH_LENGTH()) / (365.25 days * 10000);
This can be summarized as 2 * overbalancedValue * funding rate percentage * epochs / yr
.
This formula can cause problems, because the size of the overbalanced value doesn't necessarily correspond to the balancing required for the Float Pool.
For these examples, let's set:
fundingRateMultiplier = 100
(1%)EPOCH_LENGTH() = 3.6525 days
(1% of a year)
SITUATION A:
- Overbalanced: LONG
- Long Effective Liquidity: 1_000_000 ether
- Short Effective Liquidity: 999_999 ether
totalFunding = 2 * 1_000_000 ether * 1% * 1% = 200 ether
- Amount of balancing supplied by Float = 1mm - 999,999 = 1 ether
SITUATION B:
- Overbalanced: LONG
- Long Effective Liquidity: 1_000 ether
- Short Effective Liquidity: 100 ether
totalFunding = 2 * 1_000 ether * 1% * 1% = 0.2 ether
- Amount of balancing supplied by Float = 1000 - 100 = 900 ether
We can see that in Situation B, Float supplied 900X more liquidity to the system, and earned 1000X less fees.
Funding Rates will not accomplish the stated objective, and will serve to incentivize pools that rely heavily on Float for balancing, while disincentivizing large, balanced markets.
Manual Review, Foundry
Adjust the totalFunding
formula to represent the stated outcome. A simple example of how that might be accomplished is below, but I'm sure there are better implementations:
uint256 totalFunding = ((overbalancedValue - underbalancedValue) * fundingRateMultiplier * oracle.EPOCH_LENGTH()) / (365.25 days * 10_000);