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

Dot Code School Suggestion: Feedback for Section 2 - Chapter 1: Common Types in FRAME #5

Open
Yung-Beef opened this issue Nov 7, 2024 · 0 comments

Comments

@Yung-Beef
Copy link

The text is not clear at all that you should add this to your file:

// Define type aliases for easier access
pub type AccountIdOf<T> = <T as frame_system::Config>::AccountId;
pub type AssetIdOf<T> = <<T as Config>::Fungibles as fungibles::Inspect<
	<T as frame_system::Config>::AccountId,
>>::AssetId;

pub type BalanceOf<T> = <<T as Config>::NativeBalance as fungible::Inspect<
	<T as frame_system::Config>::AccountId,
>>::Balance;

pub type AssetBalanceOf<T> = <<T as Config>::Fungibles as fungibles::Inspect<
	<T as frame_system::Config>::AccountId,
>>::Balance;

So I didn't add it yet, and then wasn't getting the error mentioned below, and was very confused. I've added it now, just at the top of my file, but I'm not sure it should go there?

The last step is also not clear for adding the trait bounds for Fungibles. It says "define the Fungibles type in a similar way in order to fix the last error" so I added this:

        type Fungibles: fungible::Inspect<Self::AccountId>
            + fungible::Mutate<Self::AccountId>
            + fungible::hold::Inspect<Self::AccountId>
            + fungible::hold::Mutate<Self::AccountId>
            + fungible::freeze::Inspect<Self::AccountId>
            + fungible::freeze::Mutate<Self::AccountId>;

That gets rid of the errors, but I'm not sure it's correct because the last line says "The Fungibles type needs to implement the traits from pallet assets" and I can't figure out where the traits are in that pallet, if there even are any.

Also, when I clicked on Show Answer, it just changed to correct and didn't show anything.

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

No branches or pull requests

1 participant