Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap: Get Prices for Third Party SNS tokens #449

Open
Tracked by #447
joel-medicala-yral opened this issue Nov 6, 2024 · 2 comments
Open
Tracked by #447

Swap: Get Prices for Third Party SNS tokens #449

joel-medicala-yral opened this issue Nov 6, 2024 · 2 comments
Assignees

Comments

@joel-medicala-yral
Copy link
Contributor

joel-medicala-yral commented Nov 6, 2024

  • Currently in Swap backend #447 we are only getting the prices for YRAL SNS tokens by querying the token prices from the token creator's canister
  • Add support for lookups for third party SNS tokens and cks by getting their prices from third party sources etc...

Flow

flowchart TD
    D{"Is Token Owner? (Call deployed_cdao for each ID)"} -- Not Owner --> E["Error: Not Owner"]
    E --> F["Abort Process"]
    J{"Token Type"} -- DOLR or BTC --> K["Check KV Cache for Price"]
    K -- Cached Price Found --> L["Return Cached Price"]
    K -- No Cached Price --> M{"Token Type"}
    M -- BTC --> N["Fetch Price from Coinbase & Binance, Calculate Average"]
    M -- DOLR --> O["Fetch Price from Kong Swap"]
    N --> P["Store Fetched Price in KV Cache"]
    O --> P
    P --> Q["Return Fetched Price"]
    J -- "Other Token (e.g. ABC)" --> R["Obtain Token Creator via sns_init Params"]
    R --> S@{ label: "Call Token Creator's Canister to Retrieve Price" }
    S --> T@{ label: "Return Token Price from Token Creator's Canister" }
    D --> J

    S@{ shape: rect}
    T@{ shape: rect}
Loading
@joel-medicala-yral joel-medicala-yral mentioned this issue Nov 6, 2024
2 tasks
@joel-medicala-yral joel-medicala-yral changed the title Check Prices for Third Party SNS tokens Swap: Check Prices for Third Party SNS tokens Nov 6, 2024
@joel-medicala-yral joel-medicala-yral changed the title Swap: Check Prices for Third Party SNS tokens Swap: Get Prices for Third Party SNS tokens Nov 6, 2024
@siyara-m-yral siyara-m-yral self-assigned this Jan 16, 2025
@siyara-m-yral
Copy link

  • Add logic to rust doc diagram

@siyara-m-yral
Copy link

  • Not able to fetch direct conversions from the decided API, need more research

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

No branches or pull requests

2 participants