PSP37 Mintable
This example shows how you can reuse the implementation of PSP37 token with PSP37Mintable extension.
How to use this extension
First, you should implement basic version of PSP37.
For your smart contract to use this extension, you only need to implement the
PSP37Mintable
via #[openbrush::implementation(PSP37Mintable)]
attribute.
Final code
#![cfg_attr(not(feature = "std"), no_std, no_main)]
#[openbrush::implementation(PSP37, PSP37Mintable)]
#[openbrush::contract]
pub mod my_psp37 {
use openbrush::traits::Storage;
#[derive(Default, Storage)]
#[ink(storage)]
pub struct Contract {
#[storage_field]
psp37: psp37::Data,
}
impl Contract {
#[ink(constructor)]
pub fn new() -> Self {
Self::default()
}
}
}
And that's it! Your PSP37
is now extended by the PSP37Mintable
extension and ready to use its functions!
You can check an example of the usage of PSP37 Mintable.