<p>Maybe you could add a timestamp in the utxo's datum, to set how long this utxo is valid. And after this time has passed the utxo cannot be used in a transaction except that the smart-contract can delete it.</p>

CC BY-SA 4.0
2021-09-05T19:15:34.283Z
What if the price doesn't change though? We don't want the oracle to be bound to setting the price every so often, only when it changes, which is unknown.
yoyobigmanyo
CC BY-SA 4.0
2021-09-07T19:44:19.480Z
I don't really understand how you have designed the Oracle. Couldn't the Oracle issue tokens with the current exchange rate on demand. And those tokens can be valid for a short period of time to be used in a swap?
j.karlsson
CC BY-SA 4.0
2021-09-05T19:02:51.247Z
2021-09-05T19:02:51.247Z
j.karlsson
<p>I'm sort of running into an issue with the oracle described in the PPP.</p>
<p>It looks like there is race between the oracle to update the exchange rate and the users to use the exchange rate in a swap.</p>
<p>We could upgrade the current model so that when the oracle updates the exchange rate, a bunch of utxos with &quot;exchange rate tokens&quot; and the new exchange rate in their datum are created, and now, people can swap with those utxos. However, we would need a mechanism for invalidating previous exchange rate utxos when a new value is published and new &quot;exchange rate tokens&quot; are minted.</p>
<p>Is there any way to facilitate such a mechanism where old utxos are invalidated when new tokens are minted? Or any other means of invalidating those transactions?</p>

<plutus><smart-contract><plutus-pioneer-program><token><oracles>
Issues with oracle concurrency
# Issues with oracle concurrency

(Asked by: username_0 on 2021-09-05)

I'm sort of running into an issue with the oracle described in the PPP.

It looks like there is race between the oracle to update the exchange rate and the users to use the exchange rate in a swap.

We could upgrade the current model so that when the oracle updates the exchange rate, a bunch of utxos with "exchange rate tokens" and the new exchange rate in their datum are created, and now, people can swap with those utxos. However, we would need a mechanism for invalidating previous exchange rate utxos when a new value is published and new "exchange rate tokens" are minted.

Is there any way to facilitate such a mechanism where old utxos are invalidated when new tokens are minted? Or any other means of invalidating those transactions?

**Tags:** plutus, smart-contract, plutus-pioneer-program, token, oracles

---

## 1 answers

### Answer by username_1 on 2021-09-05. Score: 2

Maybe you could add a timestamp in the utxo's datum, to set how long this utxo is valid. And after this time has passed the utxo cannot be used in a transaction except that the smart-contract can delete it.

> **Comments:**
> **username_0**: What if the price doesn't change though? We don't want the oracle to be bound to setting the price every so often, only when it changes, which is unknown.  
> **username_1**: I don't really understand how you have designed the Oracle. Couldn't the Oracle issue tokens with the current exchange rate on demand. And those tokens can be valid for a short period of time to be used in a swap?  

---

