Updating resource method pre-conditions
Hey all! 👋 I thought of a possibly silly question that others might also wonder about - does updating a resource method's pre-condition in a contract update also update the pre-conditions within existing instances of that resource. The short answer is yes, but here's how I quickly went about confirming...
I set up a contract,
PizzaPlace
with the following:
I then deployed my contract, configured a Menu in account storage, and placed an order. Of course, based on the pre-condition, I could only order "pizza" for a successful transaction.
PizzaPlace
now also makes sandwiches, so I updated Menu.submitOrder()
pre-condition to:
I then updated the contract. Using the same Menu resource I configured previously, I submitted a transaction with Menu.submitOrder("sandwich")
and behold it worked!
In hindsight, it makes total sense this would be the case. Hope this simple example helps some of my fellow devs! 😃3 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Just little snippets of code as I answer my own & others' questions? 🤔 That could be fun!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View