The LongShort._seedMarketInitially function requires a minimum funding of 1e18 initialMarketSeedForEachMarketSide synthetic tokens which is then used to compute the amountToLockInYieldManager = initialMarketSeedForEachMarketSide * 2 payment tokens.
But not all tokens have 18 decimals.
In case of using USDC (6 decimals) or WBTC (8 decimals) as the payment token, this would require 2*10^12 USD or 2 * 10^10 WBTC * 40,000 USD/WBTC = 8 * 10^14 USD of initial capital which is too high for almost anyone to pay.
Impact
Markets with different decimals cannot be initialized as they would require a seed investment of over a billion USD.
Recommendation
Incorporate the payment token decimals into the equation.
Either in require(initialMarketSeedForEachMarketSide >= 10**(paymentTokens[marketIndex].decimals()), "Insufficient market seed") or keep the initialMarketSeedForEachMarketSide in 1e18 but convert the amountToLockInYieldManager to an equivalent decimals value.
For example, amountToLockInYieldManager = 2 * initialMarketSeedForEachMarketSide * 10**paymentToken.decimals() / 1e18
Handle
cmichel
Vulnerability details
The
LongShort._seedMarketInitially
function requires a minimum funding of1e18 initialMarketSeedForEachMarketSide
synthetic tokens which is then used to compute theamountToLockInYieldManager = initialMarketSeedForEachMarketSide * 2
payment tokens. But not all tokens have 18 decimals. In case of using USDC (6 decimals) or WBTC (8 decimals) as the payment token, this would require2*10^12 USD
or2 * 10^10 WBTC * 40,000 USD/WBTC = 8 * 10^14 USD
of initial capital which is too high for almost anyone to pay.Impact
Markets with different decimals cannot be initialized as they would require a seed investment of over a billion USD.
Recommendation
Incorporate the payment token decimals into the equation. Either in
require(initialMarketSeedForEachMarketSide >= 10**(paymentTokens[marketIndex].decimals()), "Insufficient market seed")
or keep theinitialMarketSeedForEachMarketSide
in1e18
but convert theamountToLockInYieldManager
to an equivalent decimals value. For example,amountToLockInYieldManager = 2 * initialMarketSeedForEachMarketSide * 10**paymentToken.decimals() / 1e18