-
Notifications
You must be signed in to change notification settings - Fork 6
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: psp22 trait contract example with drink tests #300
base: main
Are you sure you want to change the base?
Conversation
# This is the 1st commit message: refactor: general # This is the commit message #2: init # This is the commit message #3: begin refactor # This is the commit message #4: refactor: error handling # This is the commit message #5: tests: add error handling tests # This is the commit message #6: WIP # This is the commit message #7: finalise error handling # This is the commit message #8: refactor: easier review
Co-authored-by: Frank Bell <[email protected]>
assert_eq!( | ||
last_contract_event(&session).unwrap(), | ||
Created { | ||
id: TOKEN, | ||
creator: account_id_from_slice(&contract), | ||
admin: account_id_from_slice(&contract), | ||
} | ||
.encode() | ||
.as_slice() | ||
); |
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.
This can be improved but not now. Opened an issue: r0gue-io/pop-drink#24
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.
Wouldn't this improve these assertions a lot (deriving debug and partialeq traits under std
feature):
#[ink::event]
#[cfg_attr(feature = "std", derive(Debug, PartialEq))]
pub struct Transfer {
/// The source of the transfer. `None` when minting.
#[ink(topic)]
pub from: Option<AccountId>,
/// The recipient of the transfer. `None` when burning.
#[ink(topic)]
pub to: Option<AccountId>,
/// The amount transferred (or minted/burned).
pub value: u128,
}
Is working in the integration tests for me. This gives much clearer errors.
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.
Pushed some small changes, lgtm now! Thanks for all the hard work!
@@ -108,9 +108,9 @@ impl From<StatusCode> for Psp22Error { | |||
let encoded = value.0.to_le_bytes(); | |||
match encoded { | |||
// BalanceLow. | |||
[3, ASSETS, 0, _] => Psp22Error::InsufficientBalance, | |||
[_, ASSETS, 0, _] => Psp22Error::InsufficientBalance, |
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.
Why remove this 3
and not change it to MODULE_ERROR
?
447f1b4
to
411ff66
Compare
Description
Example contract for the fungible use case that applies the PSP22 traits from #297. The PR includes:
pop-drink
andpop-sandbox
: https://github.com/r0gue-io/pop-drink