Skip to main content

Diamond Loupe

This example shows how you can reuse the implementation of Diamond Standard with Diamond Loupe extension, which allows you to iterate over diamond contract's facets and available functions.

How to use this extension

First, you should implement basic version of Diamond standard.

After you can just add implementation of DiamondLoupe via #[openbrush::implementation(Diamond, DiamondLoupe)] attribute.

#![cfg_attr(not(feature = "std"), no_std, no_main)]

#[openbrush::implementation(Diamond, DiamondLoupe)]
pub mod my_diamond_loupe {

Find result

#![cfg_attr(not(feature = "std"), no_std, no_main)]

#[openbrush::implementation(Ownable, Diamond, DiamondLoupe)]
pub mod diamond {
use openbrush::{

#[derive(Default, Storage)]
pub struct Contract {
ownable: ownable::Data,
diamond: diamond::Data,
loupe: diamond_loupe::Data,

fn diamond_cut() {}

impl Contract {
pub fn new(owner: AccountId) -> Self {
let mut instance = Self::default();
ownable::Internal::_init_with_owner(&mut instance, owner);


#[ink(message, payable, selector = _)]
pub fn forward(&self) {

And that's it! Your Diamond is now extended by the DiamondLoupe extension and ready to use its functions! You can check an example of the usage of Diamond Loupe.