Repository navigation
feat(rates): price KTON from its pool's projected ratio - #990
Open
awesome-doge wants to merge 1 commit into
Open
awesome-doge wants to merge 1 commit into
awesome-doge wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
KTON is a liquid staking token on a newer version of the same pool contract as Tonstakers. This prices it from the pool itself, as
getTonstakersPriceandgetBemoPricedo:projected_balance / projected_supplyfromget_pool_full_data.Today its rate comes from DEX pools and reads about 2.43 TON, while one KTON redeems for about 1.08 TON at the pool. With a fetcher price set, the DEX pass leaves KTON alone (it only fills accounts that have no price yet).
The pool's
get_pool_full_datareturns 34 entries, so TonAPI does not decode it; the price is read from the last two stack entries, which are the projected pair in every version of the contract.Verified: a local run against tonapi.io today returns 1.0801711839525128 for the KTON jetton;
go test ./pkg/rates/covers the stack parsing. The comment incalculator.gosays the production source is not in the open-source version, so this is offered as a reference implementation.Pool:
EQA9HwEZD_tONfVz6lJS0PVKR5viEiEGyj9AuQewGQVnXPg0Jetton:
EQBuIhXNNkWf9AW9miNGNTSO_uFZ23ejfIWrieXge5f733mw