IDotnsCostModelRegistry
Title: DotNS Cost Model Registry
Holds every cost model the protocol has run and names the current one.
The address registered under DotnsConstants.COST_MODEL points here, set once and never
repointed. Changing the live curve registers a new model, which adds its version and moves
the current pointer. Prior models stay live and priceable by version, so a registration
committed against an earlier curve settles at the amount it committed to.
Note: security-contact: admin@parity.io
Functions
register
Registers a model and makes it current.
Owner-only. Keys the model by its own version, so a version can be registered once;
a repeat triggers @custom:reverts AlreadyRegistered. Moves the current pointer to the
new version and emits @custom:emits CostModelRegistered.
function register(IDotnsPricing model) external;
Parameters
| Name | Type | Description |
|---|---|---|
model | IDotnsPricing | The cost model to register. |
setCurrentVersion
Points the current version at an already-registered model.
Owner-only. Reverts to a previously registered version without redeploying it, so
governance can roll fresh pricing back to an earlier curve. @custom:reverts
UnknownVersion when no model is registered for version. Emits @custom:emits
CurrentModelSet.
function setCurrentVersion(uint256 version) external;
Parameters
| Name | Type | Description |
|---|---|---|
version | uint256 | The already-registered version to make current. |
modelOf
Returns the model registered for a version, or the zero address when none.
function modelOf(uint256 version) external view returns (IDotnsPricing model);
Parameters
| Name | Type | Description |
|---|---|---|
version | uint256 | The version to look up. |
Returns
| Name | Type | Description |
|---|---|---|
model | IDotnsPricing | The model registered for that version. |
currentVersion
Returns the version currently serving fresh pricing.
function currentVersion() external view returns (uint256 version);
Returns
| Name | Type | Description |
|---|---|---|
version | uint256 | The current version identifier. |
current
Returns the current model.
function current() external view returns (IDotnsPricing model);
Returns
| Name | Type | Description |
|---|---|---|
model | IDotnsPricing | The model serving the current version. |
priceForBaseLength
Prices a base length at the current version.
function priceForBaseLength(uint256 baseLength) external view returns (uint256 weiPrice);
Parameters
| Name | Type | Description |
|---|---|---|
baseLength | uint256 | Digit-stripped length of the label being priced. |
Returns
| Name | Type | Description |
|---|---|---|
weiPrice | uint256 | Registration cost in wei at the current version. |
priceForBaseLengthAtVersion
Prices a base length at a specific version.
@custom:reverts UnknownVersion when no model is registered for version.
function priceForBaseLengthAtVersion(
uint256 version,
uint256 baseLength
)
external
view
returns (uint256 weiPrice);
Parameters
| Name | Type | Description |
|---|---|---|
version | uint256 | The version to price against. |
baseLength | uint256 | Digit-stripped length of the label being priced. |
Returns
| Name | Type | Description |
|---|---|---|
weiPrice | uint256 | Registration cost in wei at that version. |
Events
CostModelRegistered
Emitted when a model is registered and becomes current.
event CostModelRegistered(uint256 indexed version, address indexed model);
Parameters
| Name | Type | Description |
|---|---|---|
version | uint256 | The model's version identifier. |
model | address | The model address now serving that version. |
CurrentModelSet
Emitted when the current version is pointed at an already-registered model.
event CurrentModelSet(uint256 indexed version);
Parameters
| Name | Type | Description |
|---|---|---|
version | uint256 | The version now serving fresh pricing. |
Errors
AlreadyRegistered
Thrown when registering a model whose version is already held.
error AlreadyRegistered(uint256 version);
Parameters
| Name | Type | Description |
|---|---|---|
version | uint256 | The version already registered. |
UnknownVersion
Thrown when pricing against a version that was never registered.
error UnknownVersion(uint256 version);
Parameters
| Name | Type | Description |
|---|---|---|
version | uint256 | The version with no registered model. |
ZeroVersion
Thrown when registering a model whose version is zero, which is the sentinel for an unregistered version and so cannot name a real model.
error ZeroVersion();
PricingVersionMismatch
Thrown when a registration reveals at a different version than it committed to.
Raised where a commit-reveal flow binds a version at commit and checks it at reveal, so the version a name prices at cannot move after the commitment is made.
error PricingVersionMismatch(uint256 committed, uint256 revealed);
Parameters
| Name | Type | Description |
|---|---|---|
committed | uint256 | The version bound when the commitment was made. |
revealed | uint256 | The version supplied at reveal. |