Skip to main content
Version: 2.2.0

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.

For your smart contract to use this extension, you only need to implement the DiamoundLoupe trait in your Diamond smart contract. Add import for openbrush::contracts::diamond::extensions::diamond_loupe::*, inherit the implementation for DiamondLoupe trait, where you can also customize (override) the original functions from DiamondLoupe.

use openbrush::contracts::diamond::extensions::diamond_loupe::*;

impl DiamondLoupe for Contract {}

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.