Funding Rate calculation is not correct
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.\\nAccording to the comments, `totalFunding` is meant to be calculated as follows:\\ntotalFunding is calculated on the notional of between long and short liquidity and 2x long and short liquidity.\\nThis makes sense. The purpose of the funding rate is to compensate the Float Pool for the liquidity provided to balance the market.\\nHowever, the implementation of this function does not accomplish this. Instead, `totalFunding` is based only on the size of the overbalancedValue:\\n```\\nuint256 totalFunding = (2 * overbalancedValue * fundingRateMultiplier * oracleManager.EPOCH_LENGTH()) / (365.25 days * 10000);\\n```\\n\\nThis can be summarized as `2 * overbalancedValue * funding rate percentage * epochs / yr`.\\nThis formula can cause problems, because the size of the overbalanced value doesn't necessarily correspond to the balancing required for the Float Pool.\\nFor these examples, let's set:\\n`fundingRateMultiplier = 100` (1%)\\n`EPOCH_LENGTH() = 3.6525 days` (1% of a year)\\nSITUATION A:\\nOverbalanced: LONG\\nLong Effective Liquidity: 1_000_000 ether\\nShort Effective Liquidity: 999_999 ether\\n`totalFunding = 2 * 1_000_000 ether * 1% * 1% = 200 ether`\\nAmount of balancing supplied by Float = 1mm - 999,999 = 1 ether\\nSITUATION B:\\nOverbalanced: LONG\\nLong Effective Liquidity: 1_000 ether\\nShort Effective Liquidity: 100 ether\\n`totalFunding = 2 * 1_000 ether * 1% * 1% = 0.2 ether`\\nAmount of balancing supplied by Float = 1000 - 100 = 900 ether\\nWe can see that in Situation B, Float supplied 900X more liquidity to the system, and earned 1000X less fees.
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:\\n```\\nuint256 totalFunding = ((overbalancedValue - underbalancedValue) * fundingRateMultiplier * oracle.EPOCH_LENGTH()) / (365.25 days * 10_000);\\n```\\n
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.
```\\nuint256 totalFunding = (2 * overbalancedValue * fundingRateMultiplier * oracleManager.EPOCH_LENGTH()) / (365.25 days * 10000);\\n```\\n