registrationUsername
Function Type: public
Function Signature: registrationUsername(address,string,uint256,uint256,bytes,uint256,uint256,bool,bytes)
Function Selector: 0xd134f8b4
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
user
must 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 byuser
and 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
nonce
is unused for theuser
using theverifyIfNonceIsAvailable
modifier. Reverts if used. -
Username Validation: Unless
user
is the admin address, callsisValidUsername
to validate theusername
against character set and length rules. Reverts if invalid. -
Username Availability Check: Calls
isUsernameAvailable
to ensure theusername
is not already registered. Reverts withUsernameAlreadyRegistered
if unavailable. -
Registration Signature Verification: Verifies the
signature
provided byuser
usingverifyMessageSignedForRegistrationUsername
. Reverts withInvalidSignatureOnNameService
if invalid. -
Registration Payment: Calls
makePay
to process the registration fee payment:- Calculates the required registration fee using
getPricePerRegistration()
- Transfers the total payment amount from the
user
via 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
user
and the waiting period has passed - Reverts with
PreRegistrationNotValid
if validation fails
- Reconstructs the expected hash:
-
Username Registration: Creates the final username registration in
identityDetails
with:- Owner:
user
- Expiration:
block.timestamp + 366 days
- Flags: Marked as username (
flagNotAUsername = 0x00
)
- Owner:
-
Nonce Management: Marks the
nonce
as used for theuser
in thenameServiceNonce
mapping. -
Staker Rewards: If the executor is a staker, distributes rewards via
makeCaPay
:- Base reward:
50 * getRewardAmount()
- Plus the
priorityFee_EVVM
amount
- Base reward:
-
Cleanup: Deletes the pre-registration entry to free storage.