Function darkfi::validator::utils::deploy_native_contracts

source ·
pub async fn deploy_native_contracts(
    overlay: &BlockchainOverlayPtr,
    block_target: u32,
) -> Result<()>
Expand description

Deploy DarkFi native wasm contracts to provided blockchain overlay. If overlay already contains the contracts, it will just open the necessary db and trees, and give back what it has. This means that on subsequent runs, our native contracts will already be in a deployed state, so what we actually do here is a redeployment. This kind of operation should only modify the contract’s state in case it wasn’t deployed before (meaning the initial run). Otherwise, it shouldn’t touch anything, or just potentially update the db schemas or whatever is necessary. This logic should be handled in the init function of the actual contract, so make sure the native contracts handle this well.