spectrum-finance / ergo-dex

Smart contracts and specification of the AMM protocol on top of the Ergo blockchain
Creative Commons Zero v1.0 Universal
67 stars 9 forks source link

SwapSell 'SpectrumIsQuote' case failed validation fix. #33

Closed AOranov closed 1 year ago

AOranov commented 1 year ago

To prevent errors arising in the calculations that occurred after the compilation of the contract, separate constants exFeePerTokenDenom, exFeePerTokenNum was replaced by Delta = (exFeePerTokenDenom - exFeePerTokenNum) and exFeePerTokenDenom:

Changes in the n2t SwapSell contract:

{1} -> MaxExFee[Long] {2} -> ExFeePerTokenDenom[Long]

{1} -> ExFeePerTokenDenom[Long] {2} -> Delta[Long]

All related calculations were updated to new logic.