ds-feeds icon indicating copy to clipboard operation
ds-feeds copied to clipboard

Add constant public function to read feed value that throws if there is a payment token

Open dbrock opened this issue 9 years ago • 2 comments

shayan 8:43 PM I'm trying to get my head around how feedbase works. one main thing now is so when we publish a value, how can we read it. as it says on the documentation inspect does not show the value. I tried using the ABI in the js_module.js but apparently with that geth doesnt let me call the variables/functions. so how would this work? I have this feedbase on morden

{
  "id": 15,
  "token": "0x0000000000000000000000000000000000000000",
  "owner": "0x9172aa9636dc7941a23e72c5d9a43d2e06f5fd01",
  "label": "BTCUSD",
  "price": "0x0",
  "timestamp": 1470249594,
  "expiration": 1471249558,
  "unpaid": false
}

dbrock 8:43 PM it's a little bit annoying to read directly from storage from javascript and we can't expose the value as a regular public constant function as that would defeat the purpose of the fee... I've been asking around various solidity and ethereum developer forums but nobody seems to have a great solution for this yet I actually got the impression that most people never even considered it yet I guess we could add a public function to read the value that would just throw if there is a payment token though that's probably a good idea

shayan 8:46 PM hmm... let's say no fee for now, then I guess I should modify feedbase.sol and remove most of the erc20 requirements, and maybe make the variables public. but not sure that would actually solve anything here. yeah that would be a better idea

dbrock 8:48 PM yeah, cool, I agree. I'll create an issue and add this in the next day or so if you don't beat me to it

shayan 8:49 PM great, I'd try to get it to work as is and if I get the time today I'll do a pull request with the public function

dbrock avatar Aug 03 '16 18:08 dbrock

+1

shayanb avatar Aug 03 '16 19:08 shayanb

This seems to be working: https://github.com/nexusdev/feedbase/pull/23

haven't tested it on a feed with erc20 though.

shayanb avatar Aug 04 '16 16:08 shayanb