short side of getReservedUsd does not work for market that has the same collateral token
short side of getReservedUsd does not work for market that has the same collateral token\\nConsider the case of ETH / USD market with both long and short collateral token as ETH.\\nthe available amount to be reserved (ETH) would CHANGE with the price of ETH.\\n```\\n    function getReservedUsd(\\n        DataStore dataStore,\\n        Market.Props memory market,\\n        MarketPrices memory prices,\\n        bool isLong\\n    ) internal view returns (uint256) {\\n        uint256 reservedUsd;\\n        if (isLong) {\\n            // for longs calculate the reserved USD based on the open interest and current indexTokenPrice\\n            // this works well for e.g. an ETH / USD market with long collateral token as WETH\\n            // the available amount to be reserved would scale with the price of ETH\\n            // this also works for e.g. a SOL / USD market with long collateral token as WETH\\n            // if the price of SOL increases more than the price of ETH, additional amounts would be\\n            // automatically reserved\\n            uint256 openInterestInTokens = getOpenInterestInTokens(dataStore, market, isLong);\\n            reservedUsd = openInterestInTokens * prices.indexTokenPrice.max;\\n        } else {\\n            // for shorts use the open interest as the reserved USD value\\n            // this works well for e.g. an ETH / USD market with short collateral token as USDC\\n            // the available amount to be reserved would not change with the price of ETH\\n            reservedUsd = getOpenInterest(dataStore, market, isLong);\\n        }\\n\\n        return reservedUsd;\\n    }\\n```\\n
Consider apply both long and short calculations of reserveUsd with relation to the indexTokenPrice.
reservedUsd does not work when long and short collateral tokens are the same.
```\\n    function getReservedUsd(\\n        DataStore dataStore,\\n        Market.Props memory market,\\n        MarketPrices memory prices,\\n        bool isLong\\n    ) internal view returns (uint256) {\\n        uint256 reservedUsd;\\n        if (isLong) {\\n            // for longs calculate the reserved USD based on the open interest and current indexTokenPrice\\n            // this works well for e.g. an ETH / USD market with long collateral token as WETH\\n            // the available amount to be reserved would scale with the price of ETH\\n            // this also works for e.g. a SOL / USD market with long collateral token as WETH\\n            // if the price of SOL increases more than the price of ETH, additional amounts would be\\n            // automatically reserved\\n            uint256 openInterestInTokens = getOpenInterestInTokens(dataStore, market, isLong);\\n            reservedUsd = openInterestInTokens * prices.indexTokenPrice.max;\\n        } else {\\n            // for shorts use the open interest as the reserved USD value\\n            // this works well for e.g. an ETH / USD market with short collateral token as USDC\\n            // the available amount to be reserved would not change with the price of ETH\\n            reservedUsd = getOpenInterest(dataStore, market, isLong);\\n        }\\n\\n        return reservedUsd;\\n    }\\n```\\n