makeOffer
Function Type: external
Function Signature: makeOffer(address,string,uint256,uint256,uint256,bytes,uint256,uint256,bool,bytes)
Allows a user (_user) to make a formal, time-limited offer to purchase an existing username (_username) by committing principal 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). |
username | string | The target username for which the offer is being made. |
expireDate | uint256 | The Unix timestamp when this offer automatically expires if not accepted or withdrawn. |
amount | uint256 | The total gross amount of principal tokens the offeror commits. This includes the actual offer value plus a 0.5% service fee. |
nonce | uint256 | The offeror's nonce specific to this NameService contract for replay protection of this makeOffer action. |
signature | bytes | The EIP-191 signature from user authorizing this make offer action. |
priorityFee_EVVM | uint256 | Optional fee (in principal tokens) paid by user to the msg.sender (staker executing the transaction) via the EVVM contract for prioritized processing. |
nonce_EVVM | uint256 | user's nonce for the EVVM payment function call used to transfer the total payment. |
priorityFlag_EVVM | bool | Priority flag (sync/async) for the EVVM payment function call. |
signature_EVVM | bytes | user's signature authorizing the EVVM payment call to transfer the total payment. |
Returns: offerID - Unique identifier for the created offer
- 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 NameService make offer signature (
signature) must be generated byuserand follows the Make Offer Signature Structure.
Execution Methods
This function can be executed by any address.
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
nonceis unused for theuserusing theverifyIfNonceIsAvailablemodifier. Reverts if used. -
Offer Validation: Validates the offer parameters:
- Ensures the target
usernameexists and is not flagged as a pre-registration - Verifies
amount > 0andexpireDate > block.timestamp - Reverts with
PreRegistrationNotValidif validation fails
- Ensures the target
-
Make Offer Signature Validation: Verifies the
signatureprovided byuserusingverifyMessageSignedForMakeOffer. Reverts withInvalidSignatureOnNameServiceif invalid. -
Payment Execution: Calls
makePayto transfer theamountandpriorityFee_EVVMfromuserto the service via EVVM. Reverts if payment fails. -
Offer ID Assignment: Finds the next available sequential ID for an offer by looping through existing offer slots until an empty one (
address(0)offerer) is found. -
Offer Creation: Creates and stores the offer in the
usernameOffersmapping with:offerer:userexpireDate: provided expiration timestampamount: net offer amount (99.5% of inputamountafter 0.5% fee)
-
Reward Distribution: Distributes rewards to the executor via
makeCaPay:- Base MATE reward (
getRewardAmount()) - Plus 0.125% of the gross
amount - Plus the
priorityFee_EVVM
- Base MATE reward (
-
Token Locking: Updates
mateTokenLockedForWithdrawOffersto track locked tokens for future withdrawals. -
Offer Slot Management: Updates the username's
offerMaxSlotsif this offer exceeds the current maximum slot count. -
Nonce Management: Marks the user's
nonceas used in thenameServiceNoncemapping.