IOTA Smart contract require developers to generate hashes for smart contract functions and views, as well as for parameter and variable names.
They are used to be passed as argument to calls to other function in the same smart contract and other smart contract functions and views.
The usage is very simple. For example, if your smart contract has the function below:
samplecontract.rs
fn my_sc_function(ctx: &ScFuncContext) {
ctx.log("Hello world!");
}
You can set your constants and generate their hashes with:
contants.rs
```
pub const MYSCFUNCTION : &str = "myscfunction";
// Here is the HNAME generation pub const HNAMEMYSCFUNCTION : ScHname = generatehname!("myscfunction"); ```
No need to manually generate hashes and hardcode them.