Frankencoin-ZCHF / FrankenCoin

Frankencoin Smart Contracts
MIT License
12 stars 6 forks source link

We smerge into version2024 #34

Closed luziusmeisser closed 2 months ago

luziusmeisser commented 2 months ago

To fix

samclassix commented 2 months ago

difference in calc

updated screenshot

Screenshot 2024-09-13 at 10 01 58 AM
{
  expP: 59811875000000000000000n,
  bZchf0: 90000000000000000000000n,
  bCoin0: 1000000000000000000000n,
  size: 1000000000000000000n,
  bZchf1: 30188750000000000000000n,
  bCoin1: 1001000000000000000000n
}
      1) buy 10x liq. price
{
  expP: 5979097222222222183956n,
  bZchf0: 90000000000000000000000n,
  bCoin0: 1000000000000000000000n,
  size: 10000000000000000000n,
  bZchf1: 30209722222222222604880n,
  bCoin1: 1010000000000000000000n
}
      2) buy 1x liq. price

What does it mean?

somehow, the actual cost is slightly higher then the price indicates

Price: 5979097222222222183956n,
size: 10000000000000000000n, **=> floatToDec18(1) aka 1 ether**
cost: 5979097222222222183956n **must be the same as price**

bZchf0: 90000000000000000000000n, **balance before**
bZchf1: 30209722222222222604880n, **balance after**
bZchf1 + cost: +90000694444444444444440 <--- this does not match, you pay more

bCoin0: 1000000000000000000000n,  **collateral before**
bCoin1: 1010000000000000000000n, **collateral after**
samclassix commented 2 months ago

Question to roller SC

if logic || or && ? Screenshot 2024-09-13 at 1 35 04 PM

meaning, if its a self-owned position, should it still consider to clone, if exp. is within the clone-able timeframe? Or just in case its not your position AND within the timeframe of clone-able foreign position?