Skip to content

feat(rates): price KTON from its pool's projected ratio - #990

Open
awesome-doge wants to merge 1 commit into
tonkeeper:masterfrom
awesome-doge:kton-pool-rate
Open

awesome-doge wants to merge 1 commit into
tonkeeper:masterfrom
awesome-doge:kton-pool-rate

Conversation

@awesome-doge

Copy link
Copy Markdown

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 getTonstakersPrice and getBemoPrice do: projected_balance / projected_supply from get_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_data returns 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 in calculator.go says the production source is not in the open-source version, so this is offered as a reference implementation.

Pool: EQA9HwEZD_tONfVz6lJS0PVKR5viEiEGyj9AuQewGQVnXPg0
Jetton: EQBuIhXNNkWf9AW9miNGNTSO_uFZ23ejfIWrieXge5f733mw

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant