Username Functions
This section details functions within the MNS service specifically for managing usernames, including the registration process (pre-registration and final registration), handling offers (making, withdrawing, accepting), and renewing username registrations. These actions often involve interactions with an associated EVVM contract for payments (fees, offer amounts) and executor rewards, utilizing MATE tokens.
preRegistrationUsername
Function Type: external
Function Signature: preRegistrationUsername(address,uint256,bytes32,uint256,bytes,uint256,bool,bytes)
Function Selector: 0x393b9c6f
Initiates the first phase (commit phase) of username registration. A user (_user
) commits to a hash (_hashUsername
) derived from their desired username and a secret number. This two-phase process helps prevent front-running attacks. This function must be executed by an sMATE staker (msg.sender
).
Parameters
Parameter | Type | Description |
---|---|---|
_user | address | The address of the end-user initiating the pre-registration. |
_nonce | uint256 | The user's nonce specific to this MNS contract (mateNameServiceNonce ) for replay protection of this pre-registration action. |
_hashUsername | bytes32 | The pre-commitment hash (see Hash Username Structure below). |
_priorityFeeForFisher | uint256 | Optional fee (in MATE tokens) paid by _user to the msg.sender (staker executing the transaction) via the EVVM contract. |
_signature | bytes | The EIP-191 signature from _user authorizing this pre-registration action (signing _hashUsername and _nonce ). |
_nonce_Evvm | uint256 | Required if _priorityFeeForFisher > 0 . _user 's nonce for the EVVM payMateStaker function call used only to pay the priority fee. |
_priority_Evvm | bool | Required if _priorityFeeForFisher > 0 . Priority flag (sync/async) for the EVVM payMateStaker call paying the priority fee. |
_signature_Evvm | bytes | Required if _priorityFeeForFisher > 0 . _user 's signature authorizing the EVVM payMateStaker call paying the priority fee. |
- The EVVM payment signature (
_signature_Evvm
) is only needed if paying a priority fee and follows the Single Payment Signature Structure. - The MNS pre-registration signature (
_signature
) follows the Pre-Registration Signature Structure. - The EVVM parameters (
_nonce_Evvm
,_priority_Evvm
,_signature_Evvm
) are only required and processed if_priorityFeeForFisher
is greater than zero.
Hash Username Structure
The _hashUsername
is calculated off-chain by the user using SHA3-256 (keccak256):
keccak256(abi.encodePacked(username, clowNumber));
Where:
username
(string): The desired username.clowNumber
(uint256): A secret number chosen by the user, required later during theregistrationUsername
step to validate the commitment.
Execution Methods
This function must be executed by an address (msg.sender
) that is an sMATE 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
Failure at validation steps typically reverts the transaction. The steps execute in the specified order.
- MNS Nonce Verification: Checks if the provided
_nonce
is unused for the_user
in themateNameServiceNonce
mapping. Reverts if used. - Executor Staker Verification: Verifies
msg.sender
is an sMATE staker via EVVM'sisMateStaker()
. Reverts if not. - Pre-registration Signature Verification: Verifies the
_signature
provided by_user
(authorizing this MNS action) usingverifyMessageSignedForPreRegistrationUsername
. Reverts if invalid according to the Pre-Registration Signature Structure. - Priority Fee Processing: If
_priorityFeeForFisher > 0
:- Calls an internal helper (
makePay
) to trigger the EVVMpayMateStaker
function. - Uses
_nonce_Evvm
,_priority_Evvm
,_signature_Evvm
for the EVVM call authorization.
- Calls an internal helper (
When processing the priority fee:
- The fee amount must be assigned to the
amount
variable - The
priorityFee
variable should be set to 0 - MATE should be used as the token
- Username Pre-Registration: Records the commitment by storing the
_hashUsername
, the associated_user
address, and a timestamp/block number in theidentityDetails
mapping. The storage key is formatted with an "@" prefix (string.concat("@", AdvancedStrings.bytes32ToString(_hashUsername))
) to distinguish it from final registrations. - Nonce Management: Marks the MNS
_nonce
(provided as input) as used for the_user
in themateNameServiceNonce
mapping. - Reward Distribution (to Executor): Calls an internal helper function (
makeCaPay
) to send rewards in MATE tokens tomsg.sender
(the executor). Rewards consist of:- A base MATE reward fetched from the EVVM contract (1 *
seeMateReward()
). - The
_priorityFeeForFisher
, if it was greater than zero and successfully paid in Step 4.
- A base MATE reward fetched from the EVVM contract (1 *
registrationUsername
Function Type: external
Function Signature: registrationUsername(address,uint256,string,uint256,bytes,uint256,uint256,bool,bytes)
Function Selector: 0xd134f8b4
Completes the second phase (reveal phase) of username registration. The user (_user
) reveals the _username
and _clowNumber
to validate their prior pre-registration commit (_hashUsername
). 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 with_user
. - A minimum waiting period (30 minutes) must have passed since the pre-registration timestamp.
- The
_user
must pay the registration fee (100 * base MATE reward) 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). |
_nonce | uint256 | The user's MNS nonce (mateNameServiceNonce ) specific to this registration action. |
_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. |
_signature | bytes | The EIP-191 signature from _user authorizing this registration action. |
_priorityFeeForFisher | 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 payMateStaker function call used to pay the total amount. |
_priority_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 + _priorityFeeForFisher ). |
- The EVVM payment signature (
_signature_Evvm
) covers the total payment amount and is paid by_user
. It uses the Single Payment Signature Structure. - The MNS registration signature (
_signature
) must be generated by_user
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 an sMATE 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
Failure at validation steps typically reverts the transaction. The steps execute in the specified order.
- MNS Nonce Verification: Checks if the provided
_nonce
is unused for the_user
using theverifyIfNonceIsAvailable
modifier. Reverts if used. - Username Validation: Unless
msg.sender
is an admin address, callsisValidUsername
to validate the_username
against character set and length rules defined by the MNS service. Reverts if invalid. - Username Availability Check: Calls
isUsernameAvailable
to ensure the_username
is not already registered to another user. Reverts if unavailable. - Registration Signature Verification: Verifies the
_signature
provided by_user
(authorizing this MNS registration action) usingverifyMessageSignedForRegistrationUsername
. Reverts if invalid according to the Registration Signature Structure. - Registration Payment (EVVM):
- Calculates the required registration fee (
registrationFee
) in MATE tokens - Calls an internal helper function (e.g.,
makePay
) to trigger the EVVMpayMateStaker
function. - Uses the provided
_nonce_Evvm
,_priority_Evvm
, and_signature_Evvm
(signed by_user
) for EVVM authorization. - Transfers the
totalPayment
amount of MATE tokens from the_user
address via the EVVM contract. The_priorityFeeForFisher
portion is directed tomsg.sender
, while theregistrationFee
portion is typically directed to the MNS address. - Reverts if this EVVM payment process fails.
- Calculates the required registration fee (
- Pre-Registration Check & Validation:
- Reconstructs the expected pre-registration hash:
expectedHash = keccak256(abi.encodePacked(_username, _clowNumber))
. - Retrieves the pre-registration data stored under the key
"@<expectedHash_string>"
. - Verifies that a pre-registration entry exists for this hash, that the stored user address matches
_user
, and that the required minimum waiting period (30 minutes) has elapsed since the pre-registration timestamp. Reverts if any check fails.
- Reconstructs the expected pre-registration hash:
- Username Registration: The function registers the username and basic metadata in the
identityDetails
mapping. - MNS Nonce Update: Marks the
_nonce
(provided for this registration transaction) as used for the_user
in themateNameServiceNonce
mapping. - Reward Distribution (Conditional):
- Checks if
msg.sender
is an sMATE staker via EVVM'sisMateStaker()
. - If
msg.sender
is a staker, calls an internal helper (e.g.,makeCaPay
) to send rewards in MATE tokens tomsg.sender
. Rewards typically include:- A portion of the registration fee 50 *
seeMateReward()
. - The
_priorityFeeForFisher
(if any was specified and paid in Step 5).
- A portion of the registration fee 50 *
- Checks if
- Pre-Registration Cleanup: Deletes the original pre-registration data (entry keyed by
"@<hash_string>"
).
makeOffer
Function Type: external
Function Signature: makeOffer(address,uint256,string,uint256,uint256,uint256,bytes,uint256,bool,bytes)
Function Selector: 0x52649c2e
Allows a user (_user
) to make a formal, time-limited offer to purchase an existing username (_username
) by committing MATE tokens. This function must be executed by an sMATE staker (msg.sender
).
Parameters
Parameter | Type | Description |
---|---|---|
_user | address | The address of the end-user making the offer (offeror). |
_nonce | uint256 | The offeror's nonce specific to this MNS contract (mateNameServiceNonce ) for replay protection of this makeOffer action. |
_username | string | The target username for which the offer is being made. |
_amount | uint256 | The total gross amount of MATE tokens the offeror commits. This includes the actual offer value plus a 0.5% service fee/tax (e.g., offer_value / 0.995 ). |
_expireDate | uint256 | The Unix timestamp (seconds since epoch) when this offer automatically expires if not accepted or withdrawn. |
_priorityFeeForFisher | uint256 | Optional fee (in MATE) paid by _user to the msg.sender (staker executing the transaction) via the EVVM contract for prioritized processing. |
_signature | bytes | The EIP-191 signature from _user authorizing this make offer action. |
_nonce_Evvm | uint256 | _user 's nonce for the EVVM payMateStaker function call used to transfer the total payment. |
_priority_Evvm | bool | Priority flag (sync/async) for the EVVM payMateStaker function call. |
_signature_Evvm | bytes | _user 's signature authorizing the EVVM payMateStaker call to transfer the total payment. |
- The EVVM payment signature (
_signature_Evvm
) covers the total payment amount and is paid by the offeror (_user
). It uses the Single Payment Signature Structure. - The MNS make offer signature (
_signature
) must be generated by_user
and follows the Make Offer Signature Structure.
Execution Methods
This function must be executed by an address (msg.sender
) that is an sMATE 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
Failure at validation steps typically reverts the transaction. The steps execute in the specified order.
- MNS Nonce Verification: Checks if the provided
_nonce
is unused for the_user
(offeror) using theverifyIfNonceIsAvailable
modifier. Reverts if used. - Executor Staker Verification: Verifies
msg.sender
is an sMATE staker via EVVM'sisMateStaker()
. Reverts if not. - Username Validation: Checks that the target
_username
exists and represents a registered username eligible for receiving offers (usingverifyIfIdentityExists
and checking flags). Reverts if the username doesn't exist or isn't eligible. - Amount Validation: Checks if the gross
_amount
provided is greater than zero. Reverts if not. - Make Offer Signature Validation: Verifies the
_signature
provided by_user
(authorizing this MNSmakeOffer
action) usingverifyMessageSignedForMakeOffer
. Reverts if invalid according to the Make Offer Signature Structure. - Payment execution: Calls
makePay
to transfer the_amount
and_priorityFee
of MATE tokens from_user
to the service via the EVVM contract. Reverts if the payment fails. - Offer ID Search: Finds the next available sequential ID for an offer associated with the
_username
. Loops through existing offer slots until an empty one (address(0)
offerer) is found. - Offer Creation: Creates and stores the offer details in the
usernameOffers
mapping using the found offer ID. The stored data includes:offerer
:_user
(address making the offer).expireDate
:_expireDate
(Unix timestamp).amount
: The net offer amount (99.5% of the input_amount
, representing the value available to the seller after the 0.5% fee).
- Reward Distribution (to Executor): Calls an internal helper (e.g.,
makeCaPay
) to send rewards in MATE tokens tomsg.sender
(the executor). Rewards include:- A base MATE reward (e.g., 1 *
seeMateReward()
from EVVM). - The
_priorityFeeForFisher
(if any was specified and paid in Step 7). - A small percentage of the offer amount (e.g., 0.125% of the gross
_amount
).
- A base MATE reward (e.g., 1 *
- Username offers max slot check: Checks if the username offers max slot is reached after creating the offer. If reached, add one or if not skip this step.
- Nonce Management: The system marks the user's nonce as used in the
mateNameServiceNonce
mapping.
withdrawOffer
Function Type: external
Function Signature: withdrawOffer(address,uint256,string,uint256,uint256,bytes,uint256,bool,bytes)
Function Selector: 0x21811609
Allows a user (_user
) who previously made an offer to withdraw that specific offer (_offerID
) from a username (_username
). This action cancels the offer and returns the escrowed MATE tokens to the original offeror. This function must be executed by an sMATE staker (msg.sender
).
Parameters
Parameter | Type | Description |
---|---|---|
_user | address | The address of the user who originally placed the offer and is now withdrawing it. |
_nonce | uint256 | The user's (_user ) nonce specific to the MNS contract (mateNameServiceNonce ) for this withdrawOffer action's replay protection. |
_username | string | The target username associated with the offer being withdrawn. |
_offerID | uint256 | The unique identifier of the specific offer to be withdrawn. |
_priorityFeeForFisher | uint256 | Optional fee (in MATE) paid by _user to the msg.sender (staker executing the transaction) via the EVVM contract for prioritized processing. |
_signature | bytes | The EIP-191 signature from _user authorizing this withdraw offer action (signing _username , _offerID , _nonce ). |
_nonce_Evvm | uint256 | Required if _priorityFeeForFisher > 0 . _user 's nonce for the EVVM payMateStaker call used only to pay the priority fee. |
_priority_Evvm | bool | Required if _priorityFeeForFisher > 0 . Priority flag (sync/async) for the EVVM payMateStaker call paying the priority fee. |
_signature_Evvm | bytes | Required if _priorityFeeForFisher > 0 . _user 's signature authorizing the EVVM payMateStaker call paying the priority fee. |
- The EVVM payment signature (
_signature_Evvm
) covers the total amount and uses the Single Payment Signature Structure. - The MNS withdraw offer signature (
_signature
) follows the Withdraw Offer Signature Structure. - The EVVM parameters facilitate the transfer of the offer funds and any optional priority fee from the offeror (
_user
).
Execution Methods
This function must be executed by an address (msg.sender
) that is an sMATE 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
Failure at validation steps typically reverts the transaction.
- MNS Nonce Verification: Checks if the provided
_nonce
is unused for the_user
using theverifyIfNonceIsAvailable
modifier. Reverts if the nonce is already used. - Executor Staker Verification: Verifies that the
msg.sender
(the executor submitting the transaction) is an sMATE staker by callingisMateStaker()
on the associated EVVM contract. Reverts ifmsg.sender
is not a staker. - Offerer Verification: Retrieves the offer data associated with
_username
and_offerID
from theusernameOffers
mapping. Verifies that the_user
parameter matches theofferer
address stored in the retrieved offer data. Reverts if_user
is not the recorded offerer or if the specified offer does not exist. - Withdrawal Signature Validation: Verifies the
_signature
provided by_user
(which authorizes this MNS withdrawal action) using theverifyMessageSignedForWithdrawOffer
function. Reverts if the signature is invalid according to the Withdraw Offer Signature Structure. - EVVM Payment Execution (Optional Priority Fee): If
_priorityFeeForFisher
is greater than zero:- Calls an internal helper function (e.g.,
makePay
) designed to interact with the EVVM'spayMateStaker
function. - Uses the provided
_nonce_Evvm
,_priority_Evvm
, and_signature_Evvm
parameters to authorize the EVVM payment. - This action attempts to transfer the
_priorityFeeForFisher
amount of MATE tokens from the_user
address to themsg.sender
address via the EVVM contract mechanism. - Reverts if this EVVM payment process fails.
- Calls an internal helper function (e.g.,
- Withdrawal Offer Payment Execution (Return Funds): Calls an internal helper function (e.g.,
makeCaPay
) responsible for refunding the escrowed offer funds. It retrieves the totalamount
stored in theusernameOffers[_username][_offerID]
data structure and transfers this full amount of MATE tokens from the MNS contract's escrow back to the original offeror (_user
). Reverts if this MATE token transfer fails. - Offer Cleanup: Modifies the state of the withdrawn offer in the
usernameOffers
mapping by setting theofferer
field for the specific_username
and_offerID
toaddress(0)
. This effectively invalidates the offer slot. - Reward Distribution (to Executor): Calls an internal helper function (e.g.,
makeCaPay
) to distribute rewards in MATE tokens tomsg.sender
(the executor). The rewards consist of:- A base MATE reward, typically fetched from the EVVM contract (e.g., 1 *
seeMateReward()
). - The
_priorityFeeForFisher
, if it was greater than zero and successfully paid in Step 5. - An additional amount calculated based on the withdrawn offer's value: 0.125% of the
amount
stored inusernameOffers[_username][_offerID]
. (This is derived from the 0.5% fee structure associated with the offer).
- A base MATE reward, typically fetched from the EVVM contract (e.g., 1 *
- Nonce Management: Marks the MNS
_nonce
(provided as input parameter) as used for the_user
address within themateNameServiceNonce
mapping to prevent replay of this specific withdrawal action.
acceptOffer
Function Type: external
Function Signature: acceptOffer(address,uint256,string,uint256,uint256,bytes,uint256,bool,bytes)
Function Selector: 0xae36fe72
Allows the current owner (_user
) of a username (_username
) to accept a specific, active offer (_offerID
) made by another user. Accepting the offer triggers the transfer of the agreed MATE tokens from the MNS escrow to the owner, and transfers the ownership of the username to the original offeror.
Parameters
Parameter Name | Type | Description |
---|---|---|
_user | address | The address of the current owner of the _username who is accepting the offer. |
_nonce | uint256 | The owner's (_user ) nonce specific to the MNS contract (mateNameServiceNonce ) for this acceptOffer action's replay protection. |
_username | string | The username associated with the offer being accepted. |
_offerID | uint256 | The unique identifier of the specific offer being accepted. |
_priorityFeeForFisher | uint256 | Optional fee (in MATE) paid by the owner (_user ) to the msg.sender (executor) via the EVVM contract for prioritized processing of the acceptance transaction. |
_signature | bytes | The EIP-191 signature from the owner (_user ) authorizing this accept offer action (signing _username , _offerID , _nonce ). |
_nonce_Evvm | uint256 | Required if _priorityFeeForFisher > 0 . The owner's (_user ) nonce for the EVVM payMateStaker call used only to pay the priority fee. |
_priority_Evvm | bool | Required if _priorityFeeForFisher > 0 . Priority flag (sync/async) for the EVVM payMateStaker call paying the priority fee. |
_signature_Evvm | bytes | Required if _priorityFeeForFisher > 0 . The owner's (_user ) signature authorizing the EVVM payMateStaker call paying the priority fee. |
- The EVVM payment signature (
_signature_Evvm
) is only used if_priorityFeeForFisher > 0
and covers only that fee amount, paid by the username owner (_user
). It uses the Single Payment Signature Structure. - The MNS accept offer signature (
_signature
) must be generated by the current owner (_user
) and follows the Accept Offer Signature Structure. - The EVVM parameters facilitate the transfer of the offer funds and any optional priority fee from the offeror (
_user
).
Execution Methods
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
Failure at validation steps typically reverts the transaction.
- Username Owner Verification: Checks if the provided
_user
address is the registered owner of the_username
(e.g., using an internal ownership check likeonlyAdminOfIdentity
). Reverts if_user
is not the owner. - MNS Nonce Verification: Checks if the provided
_nonce
is unused for the_user
using theverifyIfNonceIsAvailable
modifier. Reverts if the nonce is already used. - Offer validation: Retrieves the offer data associated with
_username
and_offerID
. Checks that the offer exists (e.g.,offerer != address(0)
) and that itsexpireDate
has not passed based on the current block timestamp. Reverts if the offer is invalid or expired. - Signature Verification: Validates the
_signature
provided by_user
(the owner) against the reconstructed message hash usingverifyMessageSignedForAcceptOffer
. Reverts if the signature is invalid according to the Accept Offer Signature Structure. - EVVM Payment Execution (Optional Priority Fee): If
_priorityFeeForFisher
is greater than zero:- Calls an internal helper function (e.g.,
makePay
) designed to interact with the EVVM'spayMateStaker
function. - Uses the provided
_nonce_Evvm
,_priority_Evvm
, and_signature_Evvm
parameters to authorize the EVVM payment. - This action attempts to transfer the
_priorityFeeForFisher
amount of MATE tokens from the_user
address to themsg.sender
address via the EVVM contract mechanism. - Reverts if this EVVM payment process fails.
- Calls an internal helper function (e.g.,
- Transaction Execution (Pay Seller): Calls an internal helper function (e.g.,
makeCaPay
) to transfer the accepted offer funds (retrieved fromusernameOffers[_username][_offerID].amount
). - Ownership Transfer: Transfers the ownership of the
_username
within the MNS system from the current owner (_user
) to the address of the original offeror (retrieved fromusernameOffers[_username][_offerID].offerer
). - Offer Cleanup: Updates the
usernameOffers[_username][_offerID]
entry by setting theofferer
field toaddress(0)
, marking the offer as fulfilled and the slot as empty/invalid. - Reward Distribution (to Executor): Calls an internal helper function (e.g.,
makeCaPay
) to distribute rewards in MATE tokens tomsg.sender
(the executor). The rewards consist of:- A base MATE reward, typically fetched from the EVVM contract (e.g., 1 *
seeMateReward()
). - The
_priorityFeeForFisher
, if it was greater than zero and successfully paid in Step 5. - An additional amount calculated based on the withdrawn offer's value: 0.125% of the
amount
stored inusernameOffers[_username][_offerID]
. (This is derived from the 0.5% fee structure associated with the offer).
- A base MATE reward, typically fetched from the EVVM contract (e.g., 1 *
- Nonce Management: Marks the MNS
_nonce
(provided as input parameter) as used for the_user
address within themateNameServiceNonce
mapping to prevent replay of this specific accept action.
renewUsername
Function Type: external
Function Signature: renewUsername(address,uint256,string,uint256,bytes,uint256,bool,bytes)
Function Selector: 0xf1747483
Allows the current owner (_user
) of a registered username (_username
) to extend its expiration date by one year. The cost of renewal varies based on when the renewal occurs relative to the current expiration date and involves a payment in MATE tokens facilitated via the EVVM contract.
Parameters
Parameter Name | Type | Description |
---|---|---|
_user | address | The address of the current owner of the _username who is renewing it. |
_nonce | uint256 | The owner's (_user ) nonce specific to the MNS contract (mateNameServiceNonce ) for this renewUsername action's replay protection. |
_username | string | The username whose registration is being renewed. |
_priorityFeeForFisher | uint256 | Optional fee (in MATE) paid by the owner (_user ) to the msg.sender (executor) via the EVVM contract for prioritized processing of the renewal transaction. |
_signature | bytes | The EIP-191 signature from the owner (_user ) authorizing this renew username action. |
_nonce_Evvm | uint256 | The owner's (_user ) nonce for the EVVM payMateStaker call used to pay the Renewal Fee + Priority Fee. |
_priority_Evvm | bool | Priority flag (sync/async) for the EVVM payMateStaker call paying the fees. |
_signature_Evvm | bytes | The owner's (_user ) signature authorizing the EVVM payMateStaker call paying the Renewal Fee + Priority Fee. |
- The EVVM payment signature (
_signature_Evvm
) is paid by the username owner (_user
). It uses the Single Payment Signature Structure. - The MNS renew username signature (
_signature
) must be generated by the current owner (_user
) and follows the Renew Username Signature Structure.
Execution Methods
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
Failure at validation steps typically reverts the transaction.
- Username Owner Verification: Checks if the provided
_user
address is the registered owner of the_username
(e.g., using an internal ownership check likeonlyAdminOfIdentity
). Reverts if_user
is not the owner. - MNS Nonce Verification: Checks if the provided
_nonce
is unused for the_user
using theverifyIfNonceIsAvailable
modifier. Reverts if the nonce is already used. - Identity Verification: Checks if the identity exists and is a valid username (e.g.,
identityDetails[_username].flagNotAUsername
indicates it's a valid username type). Reverts if the identity doesn't exist or isn't a valid username. - Signature Verification: Validates the
_signature
provided by_user
(the owner) against the reconstructed message hash usingverifyMessageSignedForRenewUsername
. Reverts if the signature is invalid according to the Renew Username Signature Structure. - Date Verification: Checks if this calculated date exceeds the maximum allowed registration term (e.g., 100 years from the current block timestamp). Reverts if the renewal would extend the registration beyond this limit.
- Price Calculation: Calls the
seePriceToRenew(_username)
function (or equivalent internal logic) to determine the cost (renewalFee
) in MATE required to renew the_username
for 366 days. - EVVM Payment Execution: The payment is executed using the
makePay
function. - Reward Distribution (to Executor): Checks if the executor (
msg.sender
) is an sMATE staker (e.g., usingisMateStaker(msg.sender)
). Ifmsg.sender
is a staker:- Calls an internal helper function (e.g.,
_giveMateReward
ormakeCaPay
) to distribute rewards in MATE tokens directly tomsg.sender
. - The rewards typically include:
- A base MATE reward (e.g., 1 *
seeMateReward()
value obtained from the EVVM contract). - The full
_priorityFeeForFisher
amount, if it was greater than zero and successfully paid in Step 7. - A percentage share (e.g., 50%) of the
renewalFee
that was successfully paid in Step 7.
- A base MATE reward (e.g., 1 *
- (The remaining portion of the
renewalFee
is typically retained by the service).
- Calls an internal helper function (e.g.,
- Username Renewal: Updates the stored expiration date for the username by adding one year's duration (specifically, 366 days' worth of seconds) to the current
identityDetails[_username].expireDate
. - Nonce Management: Marks the MNS
_nonce
(provided as input parameter) as used for the_user
address within themateNameServiceNonce
mapping to prevent replay of this specific accept action.