-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add example smart contracts with comprehensive README. #1
Conversation
rusfmt and rust-toolchain files live in individual contracts folders now.
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.
Awesome job! :D
Co-authored-by: Michal Handzlik <h4nsu@users.noreply.github.com>
// simpler for the caller to handle an error - in contract to | ||
// `panic!` that doesn't contain any additional | ||
// information and is simply `CalleeTrapped`. | ||
if transferred_amount < listing_cost { |
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.
Will the caller be reimbursed with transferred amount here?
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.
if my understanding is correct then yes -- returning Err
is equivalent to panic!
w.r.t. to contract's state reversal. I can add a test for that though.
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.
i'd expect that too, but whatever amount is sent with the tx uses the balances pallet (not contracts state from the pallet contracts). But it'd actually be a bug if it wasn't
Co-authored-by: Michal Handzlik <h4nsu@users.noreply.github.com> Co-authored-by: Filip Bielejec <fbielejec@gmail.com>
This PR adds two simple smart contracts showcasing all the basic building blocks of writing smart contracts, including:
The
README.md
itself contains short descriptions of all techniques used when writing the contracts. There's also a description about deploying it to Contracts UI.What will follow will be a simple frontend that interacts with the deployed contracts showing how to publish transaction to a chain (signing it with polkadotjs app extension), how to await finalization, read the results, etc.