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 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 MATE) 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 byuser
and 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
nonce
is unused for theuser
using theverifyIfNonceIsAvailable
modifier. Reverts if used. -
Offer Validation: Validates the offer parameters:
- Ensures the target
username
exists and is not flagged as a pre-registration - Verifies
amount > 0
andexpireDate > block.timestamp
- Reverts with
PreRegistrationNotValid
if validation fails
- Ensures the target
-
Make Offer Signature Validation: Verifies the
signature
provided byuser
usingverifyMessageSignedForMakeOffer
. Reverts withInvalidSignatureOnNameService
if invalid. -
Payment Execution: Calls
makePay
to transfer theamount
andpriorityFee_EVVM
fromuser
to 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
usernameOffers
mapping with:offerer
:user
expireDate
: provided expiration timestampamount
: net offer amount (99.5% of inputamount
after 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
mateTokenLockedForWithdrawOffers
to track locked tokens for future withdrawals. -
Offer Slot Management: Updates the username's
offerMaxSlots
if this offer exceeds the current maximum slot count. -
Nonce Management: Marks the user's
nonce
as used in thenameServiceNonce
mapping.