PayableMint Trait Implementation
In this section we will:
- Define a new data type.
- Implement functions defined in the
PayableMint
trait from the previous section in filelogics/impl/payable_mint.rs
. - Update the contract's constructor to accept new parameters.
- Write a unit test for
mint()
.
New Type Definition
Since the contract is able to accept new parameters, we will need storage to log them. Let's create a new file called logics/impls/payable_mint/types.rs
and add new type Data
:
use openbrush::traits::Balance;
#[derive(Default, Debug)]
#[openbrush::storage_item]
pub struct Data {
pub last_token_id: u64,
pub max_supply: u64,
pub price_per_mint: Balance,
}rice_per_mint: Balance,
}
Don't forget to update the logics/impls/payable_mint/mod.rs
file with:
pub mod types;