Phala-Network / phat-offchain-rollup

Phat Contract Offchain Rollup implementation
Apache License 2.0
18 stars 13 forks source link

Sub0 Workshop: Price feed results remain empty in chainstate despite deployment with valid pairings #4

Closed oracle58 closed 1 year ago

oracle58 commented 1 year ago

After following all steps including deploy_price_feed call and verification that get_deployment includes my testpair:

{
      "name": "testpair",
      "owner": "42kS2Uj8SvTAtZYJJ3mbHK33Mk2w9a8aPkcKpirZKguvTzA3",
      "contractId": "0x19771db36c8c3ee91af607cf45c6674325dd081220a7bb4dea58d0ac6d97e265",
      "createdAt": "1,669,680,375,000",
      "expiredAt": "1,669,683,975,000"
    }

I am not able to retrieve the data feed in the chainstate.

I tried various valid pairings and verified availability using https://api.coingecko.com/api/v3/simple/price?ids={token0}&vs_currencies={token1}, which e.g. returns:

{"polkadot":{"usd":5.12}}

for token0 = polkadot, token1 = usd.

In the polkadot.js app (dev->chainstate section), I only get empty responses, when I select Storage -> phatOracle -> my account as param -> press +:

phatOracle.priceFeeds: Option<PhatOffchainRollupOraclePalletPriceQuote>
[ ]

In a nutshell

Yet the priceFeeds remain empty in the chainstate.

Thanks for any help!

HashWarlock commented 1 year ago

Scheduler went down. To enable this action manually, you will need to do the following:

  1. "Attach" the sub_price_feed.contract and load you contract id into the parameter
  2. Interact with the contract by selecting maybe_init_rollup. You'll get a result similar to the first results in the screenshot
    sub_price_feed.maybe_init_rollup
    0x8235a60f02d9fb4beb951f6a783f2ea68f606a5f0882b24de2f49cae189f1df1
    11/29/2022, 5:09:55 PM
    {
    "Ok": "0x3cf2aedb55c95a30f7b7d971e642911c9b564519845e4237114ec512791c35e9"
    }
  3. Next, interact with the contract and select feed_price. This will feed the price to the Phala PoC5 Testnet pallet and return a similar result:
    sub_price_feed.feed_price
    0x8235a60f02d9fb4beb951f6a783f2ea68f606a5f0882b24de2f49cae189f1df1
    11/29/2022, 5:10:29 PM
    {
    "Ok": "0x700442c9ef6163659e4fa4e2acb6ff97071f9e025f60f1f7ae20b8ab05de379b"
    }
Screen Shot 2022-11-29 at 17 10 55
  1. Now you can go to polkadot.js.org and verify the price feed here. Screen Shot 2022-11-29 at 17 11 59
oracle58 commented 1 year ago

Thanks a lot for the support! Now I am getting response(s) as expected, e.g.:

phatOracle.priceFeeds: Option<PhatOffchainRollupOraclePalletPriceQuote>
[
  [
    [
      431tDnWpv3ZC1KFfvAA24NMxch2WMhgr3VpXP89SjCPddQou
      polkadot_btc
    ]
    {
      contractId: 0x8a08655705149eb5fe05dee94119a5580069e66dcfc88b42573a3965514e7ea4
      price: 323,029,999
      timestampMs: 1,669,758,936,000
    }
  ]
  [
    [
      431tDnWpv3ZC1KFfvAA24NMxch2WMhgr3VpXP89SjCPddQou
      polkadot_usd
    ]
    {
      contractId: 0x428c9aa65df78ca0e110bc3855269f4c22461d6650afc6ad97827ca733a9f429
      price: 5,319,999,999,999
      timestampMs: 1,669,758,714,000
    }
  ]
]

No more issues from my side, if you like, fell free to close -- and thanks again :)!

Edit: After this step is complete the NFT is automatically sent to the owner of the respective sub_feed_price contract, right?