-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random Number Generator #238
Conversation
Converting to draft: fixing the fee refund logic |
In the end simplified the contract logic to make the example focus more on the randomness generation part. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Really good tests and nice to mock the randomness part as well.
Some small changes/comments and it'll be good!
Below is an implementation of a `CoinFlip` contract that utilizes a [Pragma Verifiable Random Function (VRF)](https://docs.pragma.build/Resources/Cairo%201/randomness/randomness) to generate random numbers on-chain. | ||
|
||
```rust | ||
{{#include ../../listings/applications/coin_flip/src/contract.cairo}} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have a quick explanation of the contract, with the different state Flipped
and Landed
, why we have both (contract call to oracle, then oracle call...), need to funds some eth to pay for fees.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know what you think 5c68e77
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Issue(s): Close #128
Description
Built off of #183
Explain randomness in the context of blockchain, and Starknet specifically, and provide an example with
CoinFlip
contract.Checklist
./scripts/cairo_programs_verifier.sh
successfully