renewUsername
Function Type: public
Function Signature: renewUsername(address,string,uint256,bytes,uint256,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 principal 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. |
username | string | The username whose registration is being renewed. |
nonce | uint256 | The nonce value for the NameService signature. |
signature | bytes | The NameService renew username signature. |
priorityFee_EVVM | uint256 | The priority fee amount for EVVM payment. |
nonce_EVVM | uint256 | The nonce value for the EVVM payment signature. |
priorityFlag_EVVM | bool | True for async payment, false for sync payment. |
signature_EVVM | bytes | The EVVM payment signature. |
Signature Links & EVVM Payment
- The EVVM payment signature (
signature_EVVM) is used to pay for the renewal cost and priority fees, following the Single Payment Signature Structure. - The NameService renew username signature (
signature) must be generated by the current owner (user) and follows the Renew Username Signature Structure. - The renewal amount is calculated dynamically based on the username's current state and market demand.
Execution Methods
This function can be executed by any address.
Workflow
Failure at validation steps typically reverts the transaction.
- Username Owner Verification: Checks if the provided
_useraddress is the registered owner of the_username(e.g., using an internal ownership check likeonlyAdminOfIdentity). Reverts if_useris not the owner. - NameService Nonce Verification: Calls internal
verifyAsyncNonce(user, nonce)which reverts withAsyncNonceAlreadyUsed()if the nonce was already used. - Identity Verification: Checks if the identity exists and is a valid username (e.g.,
identityDetails[_username].flagNotAUsernameindicates it's a valid username type). Reverts if the identity doesn't exist or isn't a valid username. - Signature Verification: Validates the
_signatureprovided 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_usernamefor 366 days. - EVVM Payment Execution: The payment is executed using the
makePayfunction. - Reward Distribution (to Executor): If
msg.senderis a staker, the contract distributes rewards by calling EVVM-backed helper functions (e.g.,makeCaPay) that creditmsg.senderwith principal token rewards and any applicable priority fee.- The rewards typically include:
- A base MATE reward (e.g., 1 ×
seeMateReward()value obtained from the EVVM contract). - The full
_priorityFeeForFisheramount, if it was greater than zero and successfully paid in Step 7. - A percentage share (e.g., 50%) of the
renewalFeethat was successfully paid in Step 7.
- A base MATE reward (e.g., 1 ×
- (The remaining portion of the
renewalFeeis typically retained by the service).
- The rewards typically include:
- 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 NameService
_nonce(provided as input parameter) as used for the_useraddress within themateNameServiceNoncemapping to prevent replay of this specific accept action.