DotnsScarcityPricing

Git Source

Inherits: IDotnsPricing

Title: DotNS Scarcity Pricing

Prices a registration on a geometric scarcity curve driven by base length.

The curve doubles the base fee for each character below nine and halves it for each character from nine upward, never below the floor. The base fee is the curve's value at nine characters. Both parameters are fixed at deployment, so a new curve is a fresh deployment registered under DotnsConstants.COST_MODEL. Held as a length-sensitive candidate for a later cost-model version; the launch default is the constant DotnsFlatPricing, so this model ships unregistered until governance registers it.

Note: security-contact: admin@parity.io

Constants

FORM_ID

Identifier of the scarcity curve form, mixed into version.

Distinguishes this curve shape from another model that reuses the same base fee and floor, so version cannot collide across model forms.

uint256 public constant FORM_ID = uint256(keccak256("dotns.pricing.scarcity.v1"))

baseFee

Base fee D in wei: the curve's value at nine characters.

uint256 public immutable baseFee

minPrice

Price floor F in wei: the least any name can cost. Never above the base fee.

uint256 public immutable minPrice

Functions

constructor

Fixes the base fee and floor for the life of this model.

Carries the curve invariants: the base fee and floor are both strictly positive, the floor does not exceed the base fee, and the base fee stays within type(uint256).max / 512 so the multiplication below nine characters cannot overflow. An all-digit label such as "42" strips to base length 0 and reaches the 2**9 multiplier, which sets the /512 ceiling. Any breach triggers @custom:reverts PricingError.

constructor(uint256 baseFeeValue, uint256 minPriceValue) ;

Parameters

NameTypeDescription
baseFeeValueuint256Base fee D in wei.
minPriceValueuint256Price floor F in wei.

priceForBaseLength

Returns the registration cost in wei for a label of the given base length.

Below nine the multiplier is at most 512, and the constructor caps the base fee at type(uint256).max / 512 so the multiplication cannot overflow. From nine upward the base fee is right-shifted by baseLength - 9, so it only decreases and the floor stops a long base length costing nothing. The floor stays at or below the base fee, so it only binds from nine characters upward, never in the doubling range below nine.

function priceForBaseLength(uint256 baseLength)
    external
    view
    override
    returns (uint256 weiPrice);

Parameters

NameTypeDescription
baseLengthuint256Digit-stripped length of the label being priced.

Returns

NameTypeDescription
weiPriceuint256Registration cost in wei for that base length.

version

Returns a stable identifier for this model and its parameters.

Two deployments with the same parameters share a version; any change to the base fee or floor changes it.

function version() external view override returns (uint256 modelVersion);

Returns

NameTypeDescription
modelVersionuint256Identifier derived from the model form and its parameters.