Skip to content
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

Tutorial step 3- Uplift to latest ink! and Openbrush #15

Open
wants to merge 3 commits into
base: tutorial/trait-step3
Choose a base branch
from

Conversation

bobo-k2
Copy link
Collaborator

@bobo-k2 bobo-k2 commented Jul 28, 2023

No description provided.

@bobo-k2 bobo-k2 requested a review from Maar-io July 28, 2023 11:22
@bobo-k2 bobo-k2 changed the title Tutorial step 23- Uplift to latest ink! and Openbrush Tutorial step 3- Uplift to latest ink! and Openbrush Jul 28, 2023
Copy link
Member

@Maar-io Maar-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check comments

@@ -1,5 +1,4 @@
#![cfg_attr(not(feature = "std"), no_std)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add no_main

instance._init_with_owner(instance.env().caller());
let collection_id = instance.collection_id();
instance._set_attribute(
let mut _instance = Self::default();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove _

Comment on lines 21 to 17
#[openbrush::trait_definition]
pub trait PayableMintImpl: psp34::InternalImpl {
#[ink(message, payable)]
fn mint(&mut self, account: AccountId, id: Id) -> Result<(), PSP34Error> {
if Self::env().transferred_value() != 1_000_000_000_000_000_000 {
return Err(PSP34Error::Custom(String::from("BadMintValue")))
return Err(PSP34Error::Custom(String::from("BadMintValue")));
}
self._mint_to(account, id)

psp34::InternalImpl::_mint_to(self, account, id)
}
} No newline at end of file
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This look to me like the overide of the mint() psp34:InternalImpl.
This chapter was about how to create custom trait, while the code is just overriding OB mint function.
I feel the best would be to delete this whole step in the code and in the doc merge chapters

  • Custom Trait
  • PayableMint trait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants