registrationUsername
Function Type: public
Function Signature: registrationUsername(address,string,uint256,uint256,bytes,uint256,uint256,bool,bytes)
Completes username registration using a pre-registration commitment. The user reveals the username and clowNumber to validate their prior pre-registration commit. This function processes the required registration fee payment via EVVM and finalizes the username registration, associating it with the user.
Requirements:
- A valid pre-registration corresponding to
keccak256(abi.encodePacked(username, clowNumber))must exist and be associated withuser. - A minimum waiting period (30 minutes) must have passed since the pre-registration timestamp.
- The
usermust pay the registration fee plus any optional priority fee via the EVVM contract.
Parameters
| Parameter | Type | Description |
|---|---|---|
user | address | The address of the end-user registering the username (must match the address used in pre-registration). |
username | string | The desired username being registered (must match the value used to generate the pre-registered hash). |
clowNumber | uint256 | The secret number used with username during pre-registration hash calculation. Revealing it proves ownership of the commitment. |
nonce | uint256 | The user's NameService nonce specific to this registration action. |
signature | bytes | The EIP-191 signature from user authorizing this registration action. |
priorityFee_EVVM | uint256 | Optional fee (in MATE) paid by user to the msg.sender (executor) via EVVM, added to the registration fee payment. |
nonce_EVVM | uint256 | user's nonce for the EVVM payment function call used to pay the total amount. |
priorityFlag_EVVM | bool | Priority flag (sync/async) for the EVVM payment function call. |
signature_EVVM | bytes | user's signature authorizing the EVVM call to transfer the total payment (Registration Fee + priorityFee_EVVM). |
- The EVVM payment signature (
signature_EVVM) covers the total payment amount and is paid byuser. It uses the Single Payment Signature Structure. - The NameService registration signature (
signature) must be generated byuserand follows the Registration Signature Structure. - The EVVM parameters are mandatory as a registration fee is always required.
Execution Methods
Can be executed by any address (msg.sender). Rewards are only distributed if the executor is a staker.
Fisher Execution
When the executor is the fisher:
- The user sends the payment request to the fishing spot
- The fisher captures the transaction and validates all parameters
- The fisher submits the transaction to the contract for processing
Direct Execution
When the executor is the user or a service:
- The user/service submits their transaction directly to the contract
Workflow
-
NameService Nonce Verification: Checks if the provided
nonceis unused for theuserusing theverifyIfNonceIsAvailablemodifier. Reverts if used. -
Username Validation: Unless
useris the admin address, callsisValidUsernameto validate theusernameagainst character set and length rules. Reverts if invalid. -
Username Availability Check: Calls
isUsernameAvailableto ensure theusernameis not already registered. Reverts withUsernameAlreadyRegisteredif unavailable. -
Registration Signature Verification: Verifies the
signatureprovided byuserusingverifyMessageSignedForRegistrationUsername. Reverts withInvalidSignatureOnNameServiceif invalid. -
Registration Payment: Calls
makePayto process the registration fee payment:- Calculates the required registration fee using
getPriceOfRegistration(username)with dynamic pricing - If username has existing offers, uses market-based pricing via
seePriceToRenewlogic - If no offers exist, uses standard rate of 100x current EVVM reward amount
- Transfers the total payment amount from the
uservia EVVM - Uses the provided EVVM parameters for authorization
- Calculates the required registration fee using
-
Pre-Registration Validation:
- Reconstructs the expected hash:
keccak256(abi.encodePacked(username, clowNumber)) - Retrieves pre-registration data stored under key
"@<hash_string>" - Verifies the stored user matches
userand the waiting period has passed - Reverts with
PreRegistrationNotValidif validation fails
- Reconstructs the expected hash:
-
Username Registration: Creates the final username registration in
identityDetailswith:- Owner:
user - Expiration:
block.timestamp + 366 days - Flags: Marked as username (
flagNotAUsername = 0x00)
- Owner:
-
Nonce Management: Marks the
nonceas used for theuserin thenameServiceNoncemapping. -
Staker Rewards: If the executor is a staker, distributes rewards via
makeCaPay:- Base reward:
50 * getRewardAmount() - Plus the
priorityFee_EVVMamount
- Base reward:
-
Cleanup: Deletes the pre-registration entry to free storage.