Skip to content

Policy Contract

Back to Native Contracts

Controls network-wide policy parameters. Most setter methods require committee multi-signature authorization.

Methods

MethodSignatureReturnSafeEmbedded runtime behavior
getFeePerBytegetFeePerByte()uint256Returns current embedded fee-per-byte value.
setFeePerBytesetFeePerByte(uint256)voidUpdates embedded policy state; committee authorization is not modeled.
getExecFeeFactorgetExecFeeFactor()uint32Returns current embedded execution fee factor.
setExecFeeFactorsetExecFeeFactor(uint32)voidUpdates embedded execution fee factor.
getExecPicoFeeFactorgetExecPicoFeeFactor()uint256Returns execution fee factor scaled to picoGAS.
getStoragePricegetStoragePrice()uint256Returns current embedded storage price.
setStoragePricesetStoragePrice(uint256)voidUpdates embedded storage price.
getMillisecondsPerBlockgetMillisecondsPerBlock()uint256Returns current embedded milliseconds-per-block value.
setMillisecondsPerBlocksetMillisecondsPerBlock(uint256)voidUpdates embedded milliseconds-per-block value.
getMaxValidUntilBlockIncrementgetMaxValidUntilBlockIncrement()uint256Returns current embedded max valid-until-block increment.
setMaxValidUntilBlockIncrementsetMaxValidUntilBlockIncrement(uint256)voidUpdates embedded max valid-until-block increment.
getMaxTraceableBlocksgetMaxTraceableBlocks()uint256Returns current embedded max traceable blocks value.
setMaxTraceableBlockssetMaxTraceableBlocks(uint256)voidUpdates embedded max traceable blocks value.
getAttributeFeegetAttributeFee(uint8)uint256Reads fee for the requested attribute type, defaulting to zero.
setAttributeFeesetAttributeFee(uint8,uint256)voidUpdates embedded attribute-fee map.
isBlockedisBlocked(address)boolChecks embedded blocked-account set.
blockAccountblockAccount(address)boolAdds non-empty account to embedded blocked-account set.
unblockAccountunblockAccount(address)boolRemoves account from embedded blocked-account set.
getBlockedAccountsgetBlockedAccounts()iterator/arrayDevpack exposes an iterator wrapper; embedded runtime returns an array of blocked accounts.
setWhitelistFeeContractsetWhitelistFeeContract(address,string,uint8,uint256)voidAdds an embedded whitelist-fee contract entry.
removeWhitelistFeeContractremoveWhitelistFeeContract(address,string,uint8)voidRemoves embedded entries matching the contract hash.
getWhitelistFeeContractsgetWhitelistFeeContracts()iterator/arrayDevpack exposes an iterator wrapper; embedded runtime returns an array of entries.
recoverFundrecoverFund(address,address)boolEmbedded runtime is a no-op that returns true.

Code Example

solidity
import "devpack/contracts/NativeCalls.sol";

contract FeeEstimator {
    function estimateStorageCost(uint256 bytesCount) public view returns (uint256) {
        uint256 pricePerByte = NativeCalls.getStoragePrice();
        return pricePerByte * bytesCount;
    }

    function getNetworkFeeParams() public view returns (uint256 feePerByte, uint32 execFactor) {
        feePerByte = NativeCalls.getFeePerByte();
        execFactor = NativeCalls.getExecFeeFactor();
    }

    function requireNotBlocked(address account) internal view {
        require(!NativeCalls.isBlocked(account), "account is blocked");
    }
}

MIT Licensed