CodeHashLockupDepositPercent

Constant v334 → current Perbill

Ensures some deposit remains while instances exist.

Current Value

0x00a3e111
Relevant for: developers

The Big Picture

When a contract instance exists, part of the code deposit is locked. This prevents removing code while instances still need it. The percentage determines how much stays locked.

From Chain Metadata

The percentage of the storage deposit that should be held for using a code hash. Instantiating a contract, or calling [`chain_extension::Ext::lock_delegate_dependency`] protects the code from being removed. In order to prevent abuse these actions are protected with a percentage of the code deposit.

Use Cases

  • Understand deposit lockup mechanics
  • Plan code removal strategies

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Query CodeHashLockupDepositPercent constant
const value = api.consts[stringCamelCase("Contracts")][stringCamelCase("CodeHashLockupDepositPercent")];
console.log("CodeHashLockupDepositPercent:", value.toHuman());

Type Information

Type
Perbill
Byte Size
4 bytes
Encoding
fixed
Raw Hex
0x00a3e111

Runtime Info

Pallet
Contracts
First Version
v334
Latest Version
v334
Current Runtime
v393