renewUsername
Function Type: external
Function Signature: renewUsername(address,string,address,uint256,uint256,uint256,bytes,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. |
token | address | The address of the token to be used for payment. |
amount | uint256 | The total amount to be transferred for the renewal. |
priorityFee | uint256 | The priority fee amount. |
nonce | uint256 | The nonce value for the signature. |
signature_EVVM | bytes | The EVVM payment signature. |
signature | bytes | The NameService renew username signature. |
Signature Links & EVVM Payment
- The EVVM payment signature (
signature_EVVM) covers the total amount and uses 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.
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: Checks if the provided
_nonceis unused for the_userusing theverifyIfNonceIsAvailablemodifier. Reverts if the nonce is 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): Checks if the executor (
msg.sender) is an sMATE staker (e.g., usingisMateStaker(msg.sender)). Ifmsg.senderis a staker:- Calls an internal helper function (e.g.,
_giveMateRewardormakeCaPay) to distribute rewards in principal tokens directly tomsg.sender. - 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).
- 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 NameService
_nonce(provided as input parameter) as used for the_useraddress within themateNameServiceNoncemapping to prevent replay of this specific accept action.