<p>Since Indigo has just open-sourced their <a href="https://github.com/IndigoProtocol/indigo-smart-contracts" rel="nofollow noreferrer">smart contracts</a> including Oracle. I've just found answers to my questions.</p>
<p><strong>Question 1</strong>: How frequently will Oracle data be updated?</p>
<p><strong>Answer</strong>: It depends on protocols, for the specific cases of Indigo is once per hour at launch as stated in their whitepaper. &quot;Periodically, Indigo receives price data from the outside world via Oracles. The rate at which price feeds are updated is configurable, and at launch will be set to once per hour.&quot;</p>
<p><strong>Question 2</strong>: what will happen if the off-chain part is broken? For instance, ADA/USD ratio rate can't be updated and smart contracts keep using the old rate.</p>
<p><strong>Answer</strong>: As I checked Indigo’s source code, they added an expiry time for update operations in the datum. Thus, in case price feeds are not being updated for a longer time than the expiry time, the UTxOs will not be validated to consume unless price feeds are refreshed.</p>
<p>see, <a href="https://github.com/IndigoProtocol/indigo-smart-contracts/blob/main/src/Indigo/Contracts/Oracle/Common.hs#L44-L64" rel="nofollow noreferrer">https://github.com/IndigoProtocol/indigo-smart-contracts/blob/main/src/Indigo/Contracts/Oracle/Common.hs#L44-L64</a></p>
<pre><code>data OracleParams = OracleParams
  { -- | Owner of the Oracle - the PubKeyHash that can
    -- update the authentic Oracle output with NFT
    opOwner :: Spooky.PubKeyHash,
    -- | the time offset by which a time approximation is considered valid
    opBiasTime :: POSIXTime,
    -- | the time how long the oracle is active
    opExpirationTime :: POSIXTime
  }
  deriving (Generic, P.Show, ToJSON, FromJSON, P.Eq, P.Ord, OpenApi.ToSchema)

PlutusTx.makeLift ''OracleParams
PlutusTx.makeIsDataIndexed ''OracleParams [('OracleParams, 0)]

data OracleDatum = MkOracleDatum
  { -- | Price in lovelace with decimal places
    odPrice :: OnChainDecimal,
    odExpiration :: POSIXTime
  }
  deriving stock (P.Show, Generic)
  deriving anyclass (ToJSON, FromJSON)
</code></pre>

CC BY-SA 4.0
2023-04-18T14:15:06.407Z
2023-04-18T15:32:39.583Z
2023-04-18T15:32:39.583Z
manhdt
<p>I've read the Oracle implementation recently via <a href="https://plutus-pioneer-program.readthedocs.io/en/latest/pioneer/week6.html" rel="nofollow noreferrer">https://plutus-pioneer-program.readthedocs.io/en/latest/pioneer/week6.html</a>.</p>
<p>As I understand, Oracle has 2 primary operations the following</p>
<ol>
<li>Use: an Oracle UTxO will be used to execute a transaction</li>
<li>Update: As part of the EUTxO model/blockchain, every data in the chain are immutable, meaning Oracle data can't be updated itself. It requires update operations to update the data. For instance ADA/USD ratio rate.</li>
</ol>
<p>Due to the update operation, there are 2 questions that come to my mind. Could anyone please help to explain this to me, please?</p>
<ol>
<li>How frequently will Oracle data be updated? I think there would have different answers for different scenarios, but I don't know any specific cases in practice yet. It would be good if you could help to estimate costs for them based on scenarios.</li>
<li>I suppose we have the off-chain part to send transactions for updating Oracle data. So what will happen if the off-chain part is broken? For instance, ADA/USD ratio rate can't be updated and smart contracts keep using the old rate.</li>
</ol>
<p>If you have any idea about the way Indigo <a href="https://indigoprotocol.io/" rel="nofollow noreferrer">https://indigoprotocol.io/</a> (or any other launched products on the Cardano ecosystem) implement their Oracle, It would be very appreciated if you could add them here.</p>
<p>Thank you very much!</p>

<oracles>
How does Oracle execute update operations?
# How does Oracle execute update operations?

(Asked by: username_0 on 2023-04-17)

I've read the Oracle implementation recently via <https://plutus-pioneer-program.readthedocs.io/en/latest/pioneer/week6.html>.

As I understand, Oracle has 2 primary operations the following

1. Use: an Oracle UTxO will be used to execute a transaction
2. Update: As part of the EUTxO model/blockchain, every data in the chain are immutable, meaning Oracle data can't be updated itself. It requires update operations to update the data. For instance ADA/USD ratio rate.

Due to the update operation, there are 2 questions that come to my mind. Could anyone please help to explain this to me, please?

1. How frequently will Oracle data be updated? I think there would have different answers for different scenarios, but I don't know any specific cases in practice yet. It would be good if you could help to estimate costs for them based on scenarios.
2. I suppose we have the off-chain part to send transactions for updating Oracle data. So what will happen if the off-chain part is broken? For instance, ADA/USD ratio rate can't be updated and smart contracts keep using the old rate.

If you have any idea about the way Indigo <https://indigoprotocol.io/> (or any other launched products on the Cardano ecosystem) implement their Oracle, It would be very appreciated if you could add them here.

Thank you very much!

**Tags:** oracles

---

## 1 answers

### Answer by username_0 on 2023-04-18. Score: 1

Since Indigo has just open-sourced their smart contracts including Oracle. I've just found answers to my questions.
Question 1: How frequently will Oracle data be updated?
Answer: It depends on protocols, for the specific cases of Indigo is once per hour at launch as stated in their whitepaper. "Periodically, Indigo receives price data from the outside world via Oracles. The rate at which price feeds are updated is configurable, and at launch will be set to once per hour."
Question 2: what will happen if the off-chain part is broken? For instance, ADA/USD ratio rate can't be updated and smart contracts keep using the old rate.
Answer: As I checked Indigo’s source code, they added an expiry time for update operations in the datum. Thus, in case price feeds are not being updated for a longer time than the expiry time, the UTxOs will not be validated to consume unless price feeds are refreshed.
see, https://github.com/IndigoProtocol/indigo-smart-contracts/blob/main/src/Indigo/Contracts/Oracle/Common.hs#L44-L64
data OracleParams = OracleParams
  { -- | Owner of the Oracle - the PubKeyHash that can
    -- update the authentic Oracle output with NFT
    opOwner :: Spooky.PubKeyHash,
    -- | the time offset by which a time approximation is considered valid
    opBiasTime :: POSIXTime,
    -- | the time how long the oracle is active
    opExpirationTime :: POSIXTime
  }
  deriving (Generic, P.Show, ToJSON, FromJSON, P.Eq, P.Ord, OpenApi.ToSchema)

PlutusTx.makeLift ''OracleParams
PlutusTx.makeIsDataIndexed ''OracleParams [('OracleParams, 0)]

data OracleDatum = MkOracleDatum
  { -- | Price in lovelace with decimal places
    odPrice :: OnChainDecimal,
    odExpiration :: POSIXTime
  }
  deriving stock (P.Show, Generic)
  deriving anyclass (ToJSON, FromJSON)


---

