Core Functionality
The Oracle contract has three main functions:- Accepts token price requests from users who have deposited SYLO tokens
- Allows authorised responders (Pricing Daemon) to provide price data for those requests
- Maintains a record of the latest price for each token
User Flow
- User deposits SYLO tokens using the
depositfunction
Note that this requires the Oracle contract to be approved for the specified amount before the call. When using the monitor both the approve and deposit functions will cost SYLOs, in addition to the actual deposit, so expect that the total SYLOs spent will slightly exceed the specific deposit amount.
- User requests price data with
createRequestorcreateRequests(batch) - Pricing Daemon will provide price data via
createResponse - Users can query responses with
getResponseor get the latest token price viagetLatestData
createRequest/createRequests will return the request ID/IDs that correlate to the most recent requests made. Users will find it useful to store this ID value to use as the argument to getResponse which will return the latest token data, as requested by the user.Another useful aspect to note is that the latest
requestId is publicly available. With this information, a user can take advantage of the latest token data without making a request themselves. Simply query for the latest requestId and include this value as the argument to getResponse.
Deployments
Pricing Sylo Monitor deployments can be found at the following URL.| Monitor URL | Chain |
|---|---|
| https://pricing.sylo.io/ | Mainnet |
| Chain | Contract address |
|---|---|
| Root Mainnet | 0xA1C10036F5398601f34d11F0be7Da26a8875Fb0d |
| Root Porcini (Testnet) | 0xf459E82138096876C25cd5fbc54c487476640619 |
Data structures
- Request: Stores token ID, timestamp of the block when the request was processed, and processed status
- Response: Stores timestamp of the block when the response was processed, token price value, and request ID