Skip to main content

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

ParameterTypeDescription
_useraddressThe address of the end-user initiating the pre-registration.
_nonceuint256The user's nonce specific to this MNS contract (mateNameServiceNonce) for replay protection of this pre-registration action.
_hashUsernamebytes32The pre-commitment hash (see Hash Username Structure below).
_priorityFeeForFisheruint256Optional fee (in MATE tokens) paid by _user to the msg.sender (staker executing the transaction) via the EVVM contract.
_signaturebytesThe EIP-191 signature from _user authorizing this pre-registration action (signing _hashUsername and _nonce).
_nonce_Evvmuint256Required if _priorityFeeForFisher > 0. _user's nonce for the EVVM payMateStaker function call used only to pay the priority fee.
_priority_EvvmboolRequired if _priorityFeeForFisher > 0. Priority flag (sync/async) for the EVVM payMateStaker call paying the priority fee.
_signature_EvvmbytesRequired if _priorityFeeForFisher > 0. _user's signature authorizing the EVVM payMateStaker call paying the priority fee.
note
  • 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 the registrationUsername 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:

  1. The user sends the payment request to the fishing spot
  2. The fisher captures the transaction and validates all parameters
  3. The fisher submits the transaction to the contract for processing

Direct Execution

When the executor is the user or a service:

  1. 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.

  1. MNS Nonce Verification: Checks if the provided _nonce is unused for the _user in the mateNameServiceNonce mapping. Reverts if used.
  2. Executor Staker Verification: Verifies msg.sender is an sMATE staker via EVVM's isMateStaker(). Reverts if not.
  3. Pre-registration Signature Verification: Verifies the _signature provided by _user (authorizing this MNS action) using verifyMessageSignedForPreRegistrationUsername. Reverts if invalid according to the Pre-Registration Signature Structure.
  4. Priority Fee Processing: If _priorityFeeForFisher > 0:
    • Calls an internal helper (makePay) to trigger the EVVM payMateStaker function.
    • Uses _nonce_Evvm, _priority_Evvm, _signature_Evvm for the EVVM call authorization.

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
  1. Username Pre-Registration: Records the commitment by storing the _hashUsername, the associated _user address, and a timestamp/block number in the identityDetails mapping. The storage key is formatted with an "@" prefix (string.concat("@", AdvancedStrings.bytes32ToString(_hashUsername))) to distinguish it from final registrations.
  2. Nonce Management: Marks the MNS _nonce (provided as input) as used for the _user in the mateNameServiceNonce mapping.
  3. Reward Distribution (to Executor): Calls an internal helper function (makeCaPay) to send rewards in MATE tokens to msg.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.

preRegistrationUsername fisher execution preRegistrationUsername direct execution


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

ParameterTypeDescription
_useraddressThe address of the end-user registering the username (must match the address used in pre-registration).
_nonceuint256The user's MNS nonce (mateNameServiceNonce) specific to this registration action.
_usernamestringThe desired username being registered (must match the value used to generate the pre-registered hash).
_clowNumberuint256The secret number used with _username during pre-registration hash calculation. Revealing it proves ownership of the commitment.
_signaturebytesThe EIP-191 signature from _user authorizing this registration action.
_priorityFeeForFisheruint256Optional fee (in MATE) paid by _user to the msg.sender (executor) via EVVM, added to the registration fee payment.
_nonce_Evvmuint256_user's nonce for the EVVM payMateStaker function call used to pay the total amount.
_priority_EvvmboolPriority flag (sync/async) for the EVVM payment function call.
_signature_Evvmbytes_user's signature authorizing the EVVM call to transfer the total payment (Registration Fee + _priorityFeeForFisher).
note
  • 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:

  1. The user sends the payment request to the fishing spot
  2. The fisher captures the transaction and validates all parameters
  3. The fisher submits the transaction to the contract for processing

Direct Execution

When the executor is the user or a service:

  1. 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.

  1. MNS Nonce Verification: Checks if the provided _nonce is unused for the _user using the verifyIfNonceIsAvailable modifier. Reverts if used.
  2. Username Validation: Unless msg.sender is an admin address, calls isValidUsername to validate the _username against character set and length rules defined by the MNS service. Reverts if invalid.
  3. Username Availability Check: Calls isUsernameAvailable to ensure the _username is not already registered to another user. Reverts if unavailable.
  4. Registration Signature Verification: Verifies the _signature provided by _user (authorizing this MNS registration action) using verifyMessageSignedForRegistrationUsername. Reverts if invalid according to the Registration Signature Structure.
  5. Registration Payment (EVVM):
    • Calculates the required registration fee (registrationFee) in MATE tokens
    • Calls an internal helper function (e.g., makePay) to trigger the EVVM payMateStaker 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 to msg.sender, while the registrationFee portion is typically directed to the MNS address.
    • Reverts if this EVVM payment process fails.
  6. 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.
  7. Username Registration: The function registers the username and basic metadata in the identityDetails mapping.
  8. MNS Nonce Update: Marks the _nonce (provided for this registration transaction) as used for the _user in the mateNameServiceNonce mapping.
  9. Reward Distribution (Conditional):
    • Checks if msg.sender is an sMATE staker via EVVM's isMateStaker().
    • If msg.sender is a staker, calls an internal helper (e.g., makeCaPay) to send rewards in MATE tokens to msg.sender. Rewards typically include:
      • A portion of the registration fee 50 * seeMateReward().
      • The _priorityFeeForFisher (if any was specified and paid in Step 5).
  10. Pre-Registration Cleanup: Deletes the original pre-registration data (entry keyed by "@<hash_string>").

registrationUsername fisher execution registrationUsername direct execution


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

ParameterTypeDescription
_useraddressThe address of the end-user making the offer (offeror).
_nonceuint256The offeror's nonce specific to this MNS contract (mateNameServiceNonce) for replay protection of this makeOffer action.
_usernamestringThe target username for which the offer is being made.
_amountuint256The 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).
_expireDateuint256The Unix timestamp (seconds since epoch) when this offer automatically expires if not accepted or withdrawn.
_priorityFeeForFisheruint256Optional fee (in MATE) paid by _user to the msg.sender (staker executing the transaction) via the EVVM contract for prioritized processing.
_signaturebytesThe EIP-191 signature from _user authorizing this make offer action.
_nonce_Evvmuint256_user's nonce for the EVVM payMateStaker function call used to transfer the total payment.
_priority_EvvmboolPriority flag (sync/async) for the EVVM payMateStaker function call.
_signature_Evvmbytes_user's signature authorizing the EVVM payMateStaker call to transfer the total payment.
note

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:

  1. The user sends the payment request to the fishing spot
  2. The fisher captures the transaction and validates all parameters
  3. The fisher submits the transaction to the contract for processing

Direct Execution

When the executor is the user or a service:

  1. 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.

  1. MNS Nonce Verification: Checks if the provided _nonce is unused for the _user (offeror) using the verifyIfNonceIsAvailable modifier. Reverts if used.
  2. Executor Staker Verification: Verifies msg.sender is an sMATE staker via EVVM's isMateStaker(). Reverts if not.
  3. Username Validation: Checks that the target _username exists and represents a registered username eligible for receiving offers (using verifyIfIdentityExists and checking flags). Reverts if the username doesn't exist or isn't eligible.
  4. Amount Validation: Checks if the gross _amount provided is greater than zero. Reverts if not.
  5. Make Offer Signature Validation: Verifies the _signature provided by _user (authorizing this MNS makeOffer action) using verifyMessageSignedForMakeOffer. Reverts if invalid according to the Make Offer Signature Structure.
  6. 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.
  7. 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.
  8. 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).
  9. Reward Distribution (to Executor): Calls an internal helper (e.g., makeCaPay) to send rewards in MATE tokens to msg.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).
  10. 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.
  11. Nonce Management: The system marks the user's nonce as used in the mateNameServiceNonce mapping.

makeOffer fisher execution makeOffer direct execution


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

ParameterTypeDescription
_useraddressThe address of the user who originally placed the offer and is now withdrawing it.
_nonceuint256The user's (_user) nonce specific to the MNS contract (mateNameServiceNonce) for this withdrawOffer action's replay protection.
_usernamestringThe target username associated with the offer being withdrawn.
_offerIDuint256The unique identifier of the specific offer to be withdrawn.
_priorityFeeForFisheruint256Optional fee (in MATE) paid by _user to the msg.sender (staker executing the transaction) via the EVVM contract for prioritized processing.
_signaturebytesThe EIP-191 signature from _user authorizing this withdraw offer action (signing _username, _offerID, _nonce).
_nonce_Evvmuint256Required if _priorityFeeForFisher > 0. _user's nonce for the EVVM payMateStaker call used only to pay the priority fee.
_priority_EvvmboolRequired if _priorityFeeForFisher > 0. Priority flag (sync/async) for the EVVM payMateStaker call paying the priority fee.
_signature_EvvmbytesRequired if _priorityFeeForFisher > 0. _user's signature authorizing the EVVM payMateStaker call paying the priority fee.
Signature Links & EVVM Payment

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:

  1. The user sends the payment request to the fishing spot
  2. The fisher captures the transaction and validates all parameters
  3. The fisher submits the transaction to the contract for processing

Direct Execution

When the executor is the user or a service:

  1. The user/service submits their transaction directly to the contract

Workflow

Failure at validation steps typically reverts the transaction.

  1. MNS Nonce Verification: Checks if the provided _nonce is unused for the _user using the verifyIfNonceIsAvailable modifier. Reverts if the nonce is already used.
  2. Executor Staker Verification: Verifies that the msg.sender (the executor submitting the transaction) is an sMATE staker by calling isMateStaker() on the associated EVVM contract. Reverts if msg.sender is not a staker.
  3. Offerer Verification: Retrieves the offer data associated with _username and _offerID from the usernameOffers mapping. Verifies that the _user parameter matches the offerer address stored in the retrieved offer data. Reverts if _user is not the recorded offerer or if the specified offer does not exist.
  4. Withdrawal Signature Validation: Verifies the _signature provided by _user (which authorizes this MNS withdrawal action) using the verifyMessageSignedForWithdrawOffer function. Reverts if the signature is invalid according to the Withdraw Offer Signature Structure.
  5. 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's payMateStaker 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 the msg.sender address via the EVVM contract mechanism.
    • Reverts if this EVVM payment process fails.
  6. Withdrawal Offer Payment Execution (Return Funds): Calls an internal helper function (e.g., makeCaPay) responsible for refunding the escrowed offer funds. It retrieves the total amount stored in the usernameOffers[_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.
  7. Offer Cleanup: Modifies the state of the withdrawn offer in the usernameOffers mapping by setting the offerer field for the specific _username and _offerID to address(0). This effectively invalidates the offer slot.
  8. Reward Distribution (to Executor): Calls an internal helper function (e.g., makeCaPay) to distribute rewards in MATE tokens to msg.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 in usernameOffers[_username][_offerID]. (This is derived from the 0.5% fee structure associated with the offer).
  9. Nonce Management: Marks the MNS _nonce (provided as input parameter) as used for the _user address within the mateNameServiceNonce mapping to prevent replay of this specific withdrawal action.

withdrawOffer fisher execution withdrawOffer direct execution


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 NameTypeDescription
_useraddressThe address of the current owner of the _username who is accepting the offer.
_nonceuint256The owner's (_user) nonce specific to the MNS contract (mateNameServiceNonce) for this acceptOffer action's replay protection.
_usernamestringThe username associated with the offer being accepted.
_offerIDuint256The unique identifier of the specific offer being accepted.
_priorityFeeForFisheruint256Optional fee (in MATE) paid by the owner (_user) to the msg.sender (executor) via the EVVM contract for prioritized processing of the acceptance transaction.
_signaturebytesThe EIP-191 signature from the owner (_user) authorizing this accept offer action (signing _username, _offerID, _nonce).
_nonce_Evvmuint256Required if _priorityFeeForFisher > 0. The owner's (_user) nonce for the EVVM payMateStaker call used only to pay the priority fee.
_priority_EvvmboolRequired if _priorityFeeForFisher > 0. Priority flag (sync/async) for the EVVM payMateStaker call paying the priority fee.
_signature_EvvmbytesRequired if _priorityFeeForFisher > 0. The owner's (_user) signature authorizing the EVVM payMateStaker call paying the priority fee.
note
  • 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:

  1. The user sends the payment request to the fishing spot
  2. The fisher captures the transaction and validates all parameters
  3. The fisher submits the transaction to the contract for processing

Direct Execution

When the executor is the user or a service:

  1. The user/service submits their transaction directly to the contract

Workflow

Failure at validation steps typically reverts the transaction.

  1. Username Owner Verification: Checks if the provided _user address is the registered owner of the _username (e.g., using an internal ownership check like onlyAdminOfIdentity). Reverts if _user is not the owner.
  2. MNS Nonce Verification: Checks if the provided _nonce is unused for the _user using the verifyIfNonceIsAvailable modifier. Reverts if the nonce is already used.
  3. Offer validation: Retrieves the offer data associated with _username and _offerID. Checks that the offer exists (e.g., offerer != address(0)) and that its expireDate has not passed based on the current block timestamp. Reverts if the offer is invalid or expired.
  4. Signature Verification: Validates the _signature provided by _user (the owner) against the reconstructed message hash using verifyMessageSignedForAcceptOffer. Reverts if the signature is invalid according to the Accept Offer Signature Structure.
  5. 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's payMateStaker 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 the msg.sender address via the EVVM contract mechanism.
    • Reverts if this EVVM payment process fails.
  6. Transaction Execution (Pay Seller): Calls an internal helper function (e.g., makeCaPay) to transfer the accepted offer funds (retrieved from usernameOffers[_username][_offerID].amount).
  7. 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 from usernameOffers[_username][_offerID].offerer).
  8. Offer Cleanup: Updates the usernameOffers[_username][_offerID] entry by setting the offerer field to address(0), marking the offer as fulfilled and the slot as empty/invalid.
  9. Reward Distribution (to Executor): Calls an internal helper function (e.g., makeCaPay) to distribute rewards in MATE tokens to msg.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 in usernameOffers[_username][_offerID]. (This is derived from the 0.5% fee structure associated with the offer).
  10. Nonce Management: Marks the MNS _nonce (provided as input parameter) as used for the _user address within the mateNameServiceNonce mapping to prevent replay of this specific accept action.

acceptOffer fisher execution acceptOffer direct execution


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 NameTypeDescription
_useraddressThe address of the current owner of the _username who is renewing it.
_nonceuint256The owner's (_user) nonce specific to the MNS contract (mateNameServiceNonce) for this renewUsername action's replay protection.
_usernamestringThe username whose registration is being renewed.
_priorityFeeForFisheruint256Optional fee (in MATE) paid by the owner (_user) to the msg.sender (executor) via the EVVM contract for prioritized processing of the renewal transaction.
_signaturebytesThe EIP-191 signature from the owner (_user) authorizing this renew username action.
_nonce_Evvmuint256The owner's (_user) nonce for the EVVM payMateStaker call used to pay the Renewal Fee + Priority Fee.
_priority_EvvmboolPriority flag (sync/async) for the EVVM payMateStaker call paying the fees.
_signature_EvvmbytesThe owner's (_user) signature authorizing the EVVM payMateStaker call paying the Renewal Fee + Priority Fee.
Signature Links & EVVM Payment

Execution Methods

Fisher Execution

When the executor is the fisher:

  1. The user sends the payment request to the fishing spot
  2. The fisher captures the transaction and validates all parameters
  3. The fisher submits the transaction to the contract for processing

Direct Execution

When the executor is the user or a service:

  1. The user/service submits their transaction directly to the contract

Workflow

Failure at validation steps typically reverts the transaction.

  1. Username Owner Verification: Checks if the provided _user address is the registered owner of the _username (e.g., using an internal ownership check like onlyAdminOfIdentity). Reverts if _user is not the owner.
  2. MNS Nonce Verification: Checks if the provided _nonce is unused for the _user using the verifyIfNonceIsAvailable modifier. Reverts if the nonce is already used.
  3. 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.
  4. Signature Verification: Validates the _signature provided by _user (the owner) against the reconstructed message hash using verifyMessageSignedForRenewUsername. Reverts if the signature is invalid according to the Renew Username Signature Structure.
  5. 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.
  6. 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.
  7. EVVM Payment Execution: The payment is executed using the makePay function.
  8. Reward Distribution (to Executor): Checks if the executor (msg.sender) is an sMATE staker (e.g., using isMateStaker(msg.sender)). If msg.sender is a staker:
    • Calls an internal helper function (e.g., _giveMateReward or makeCaPay) to distribute rewards in MATE tokens directly to msg.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.
    • (The remaining portion of the renewalFee is typically retained by the service).
  9. 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.
  10. Nonce Management: Marks the MNS _nonce (provided as input parameter) as used for the _user address within the mateNameServiceNonce mapping to prevent replay of this specific accept action.

renewUsername fisher execution renewUsername direct execution