-
Notifications
You must be signed in to change notification settings - Fork 95
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
feat: errors #20
feat: errors #20
Conversation
This is very good, however I'm a bit worried that this is a bit out of scope of just
I think it would be better to have this in-depth explanation part in the Cairo Book directly, and here give a very succint description and advanced example of how to use errors and condition checks in smart contracts.
Yes, it's an excellent idea. mod Errors{
const BALANCE_TOO_LOW = 'user balance is too low';
}
#[contract]
mod Vault{
fn withdraw(){
///
assert(amount<=balance, Errors::BALANCE_TOO_LOW);
}
} |
I agree. I might want to explain too much because I'm also learning at the same time. I'll try to keep things simple and move in-depth explanations to the Cairo book if I think it's interesting content. |
🔥 |
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 🔥
Close #6
I'm considering adding another practical example of a simple vault contract with a deposit and withdraw function. Please let me know if you think it's a good idea.
Additionally, I have included some security considerations that I believe are important to keep in mind. Please let me know if you find this kind of content useful.