safe-config-service icon indicating copy to clipboard operation
safe-config-service copied to clipboard

How does the chain get the token price?

Open lance-web3 opened this issue 1 year ago • 5 comments

What should I configure?

cgw logs

{"build_number":"234a559","level":"error","message":"Error getting native coin price: Error ","request_id":"052850c3-0ba6-402e-b422-9aada3087714","timestamp":"2024-08-22T08:51:01.820Z","version":"v1.53.0"}

{"build_number":"234a559","level":"error","message":"Error getting token prices: Error: Error getting 0x5fd55a1b9fc24967c4db09c513c3ba0dfa7ff687 price from provider ","request_id":"7e46512c-42ef-4daf-90e7-35794b0c8b09","timestamp":"2024-08-22T08:51:32.146Z","version":"v1.53.0"}

ui screen capture image

cfg admin config image

@fmrsabino @hectorgomezv @iamacook

lance-web3 avatar Aug 22 '24 08:08 lance-web3

Hello @lance-web3,

We currently use Coingecko to get the fiat prices, so you would need to take those configuration values from the Coingecko API: https://api.coingecko.com/api/v3/asset_platforms

I understand you are trying to get prices on fxCore Mainnet, so:

    {
        "id": "function-x",
        "chain_identifier": 530,
        "name": "Function X",
        "shortname": "",
        "native_coin_id": "fx-coin"
    },

So:

Prices provider native coin: fx-coin
Prices provider chain name: function-x

You can left "Balances provider" configuration keys empty.

hectorgomezv avatar Aug 22 '24 12:08 hectorgomezv

Hello @lance-web3,

We currently use Coingecko to get the fiat prices, so you would need to take those configuration values from the Coingecko API: https://api.coingecko.com/api/v3/asset_platforms

I understand you are trying to get prices on fxCore Mainnet, so:

    {
        "id": "function-x",
        "chain_identifier": 530,
        "name": "Function X",
        "shortname": "",
        "native_coin_id": "fx-coin"
    },

So:

Prices provider native coin: fx-coin
Prices provider chain name: function-x

You can left "Balances provider" configuration keys empty.

ok it works, how about for all other tokens? I am wondering.. @hectorgomezv

lance-web3 avatar Aug 29 '24 02:08 lance-web3

You'd need to configure the native_coin_id (in the Coingecko response) as Prices provider native coin (in the Config Service Chain configuration). And also id (in the Coingecko response) as Prices provider chain name (in the Config Service Chain configuration).

hectorgomezv avatar Aug 29 '24 11:08 hectorgomezv

You'd need to configure the native_coin_id (in the Coingecko response) as Prices provider native coin (in the Config Service Chain configuration). And also id (in the Coingecko response) as Prices provider chain name (in the Config Service Chain configuration).

@hectorgomezv

Say we have more than 1 tokens, You mean it can configure multiple in those field? e.g.

Prices provider native coin: fx-coin,coin2,coin3
Prices provider chain name: function-x

lance-web3 avatar Sep 02 '24 02:09 lance-web3

Hi @lance-web3 Apologies for not following up earlier. Have you found a solution to your question in the meantime? If not, please let me know how we can assist. Otherwise, I will close this issue shortly.

parius avatar Feb 05 '25 18:02 parius