[][src]Function xpx_supercontracts_sdk::utils::constructor

pub fn constructor(constructor_handler: fn() -> i64) -> i64

Constructor is function for one time call that can can invoke only once for all lifetime of SuperContract.

Most useful case is run some specific functionality and functions once for SuperContract life. Example: create Mosaic

Difference from init fucntion that, function can call every time when execute some SuperContract function. And for that concrete function it can call only once.

Examples

use xpx_supercontracts_sdk::utils::{constructor, ping};
let res = constructor(|| -> i64 {
    let respond = ping(10);
	let res = respond.unwrap();
    assert_eq!(res, 11);
	res
});