astroport-fi / astroport-core

Astroport DEX core contracts
https://astroport.fi/
GNU General Public License v3.0
153 stars 105 forks source link

fix(PCL): derive swap spread using oracle price #384

Closed epanchee closed 11 months ago

epanchee commented 11 months ago

PCL pools currently assert spread against price scale. If gap between internal oracle price and price scale is significant such swaps could possibly incur 20-25% spread according to internal calculations even tho it is fine from user’s perspective (they receive assets according to market price).

For example, current ASTRO - USDC.axl PCL pool state

image

This PR is meant to mitigate this issue and assert spread against current market price a.k.a. internal oracle price (EMA).