1
  • From where they are fetching the price of token i.e., exchange value ?
  • How they are calculating Minimum Tokens Brought in operation xtzToToken ?
  • How they are calculating Minimum XTZ Brought in operation tokenToXtz ?
1

From where they are fetching the price of token i.e., exchange value ?

The price of XTZ comes from the CoinGecko API. The price of the FA1.2 token is calculated relative to the XTZ value. Half of the pool is XTZ, half is FA1.2. So if there is 1000 XTZ and 5000 kUSD, 1 XTZ is worth four USD (4/1), XTZ is worth 5 kUSD according to Dexter, then 1 kUSD worth 3.2 USD. The fiat value given to the FA1.2 should only be considered a reference value since there is not guarantee that an outside market would value it at that amount.

How they are calculating Minimum Tokens Brought in operation xtzToToken ?

There is a library that performs these calculations: xtzToToken.

How they are calculating Minimum XTZ Brought in operation tokenToXtz ?

tokenToXtz.

2
  • How does dexter exchange know the price of each token in XTZ? From where are they fetching or calculating it? – Pawan Dhanwani Mar 17 at 7:47
  • Each dexter exchange has a pool of xtz and a token. You can see them in the Dexter exchange contract's storage better-call.dev/mainnet/KT1BGQR7t4izzKZ7eRodKWTodAsM23P38v7N/… tokenPool / xtzPool will give you the price of token in xtz. This ratio changes any time xtzToToken or tokenToXtz is performed. – MCH Mar 17 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.