Skip to content

Commit

Permalink
Small updates to iota-move-raffle-tutorial 4
Browse files Browse the repository at this point in the history
  • Loading branch information
teunvw14 committed Dec 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent d548819 commit 3fdbba5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/posts/iota-move-raffle-tutorial/index.md
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ module raffle::raffle {

Since `UID`s have to be unique by definition, Move's type system won't let us create a copy of `ticket_id` directly. Instead we have to call `to_inner()` to get an `ID` (which basically functions as an object pointer, which MoveVM is fine with us copying).

Maybe you've already noticed that there's a problem with our function. In fact there's two. The first is that we don't check if there's enough tokens in `payment` to fulfill the `ticket_price`. The second is that this function lets people buy tickets to raffles that have already been resolved (i.e. a winner has already been picked).
Maybe you've already noticed that there's a problem with our function. In fact there's two. The first is that we don't check if there's enough tokens in `payment` to fulfill the `ticket_price`. The second is that our `buy_ticket` function lets people buy tickets to raffles that have already been resolved (i.e. raffles for which a winner has already been picked).

The first problem we don't have to worry about: Luckily for us, calling `coin.split(amount)` aborts automatically if the `coin` doesn't contain at least `amount` tokens.

0 comments on commit 3fdbba5

Please sign in to comment.