Manipulated Price Attack Prevention

In order to prevent the risk of manipulated price attack, BTESTA Space uses the price oracle to enable the leverage function.

The oracle price will be the median price reported by CoinMarketCap, CryptoCompare, and CoinGecko. And, it will update every 1 day or when the off-chain price deviates by more than 5%. In the future, we may switch to use the price report from the decentralized price oracle such as Chainlink and Band Protocol or from the On-chain TWAP.

BTESTA Space will allow opening or liquidating position only when the price difference between PancakeSwap spot price and median price are within 30% of the oracle price. This means the PancakeSwap price can deviate at most 1.30x from the oracle price. This oracle price will limit how the spot price can be manipulated when open or liquidate the position.

The price oracle is within 1.05x of the off-chain market price which only allows opening or liquidation of a position when PancakeSwap spot price is within 1.30x threshold from oracle price.

1. PancakeSwap price will be changed by the attackers only when it’s at the most 1.05β‹…1.30=1.365x1.05β‹…1.30= 1.365x factor. The 1.365x1.365x price change factor will be converted to a position's health change of at most 1.365β‰ˆβ€‹1.1683x\sqrt{1.365} \approx​ 1.1683x factor. This means the debt ratio can be changed by at most 1.1683x1.1683x factor as well.

The attack would be reverted if the debt ratio after opening a position exceeds launcher. So, together with a cap on debt ratio change, the position's worst possible debt ratio would still be healthy under terminate (e.g., workFactorβ‹…1.1683<killFactorworkFactorβ‹…1.1683<killFactor )

2. The position can be at risk spot of liquidation attack when the position's debt ratio hits to 80%/1.1683β‰ˆ 68.47%.* for the 4 PancakeSwap pools. The leverage of the pool is 2.5x2.5x, which means that the starting debt ratio will be roughly 60% (~1.30x price tolerance).

If the position value in BNB multiplied by the launcher is equal to or more than the debt ratio, then the position is allowed to open.

Last updated