3

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?

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.

2
  • 1
    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. Sep 5 at 19:15
  • 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
    Sep 7 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.