feat: Allow minting ERC20TransferableReceivables on behalf of other users #1091
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the ERC20TransferableReceivable feature by allowing anyone to mint an NFT on behalf of the payee. Currently, only the initial payee can mint their own NFT, logic we introduced to prevent a frontrunning attack. However, this process can be cumbersome for users who have to manually mint multiple requests at once.
The proposed solution is to modify the mint call to accept an address payee, and set the initial ERC721 owner as the payee. This change would make the minting process more flexible, allowing others to cover the minting costs, such as Request finance in the case of automatically recurring invoices.
To maintain security, the existing system of allowing multiple minted receivables for an invoice, keyed by a hash of the initialRecipient and the paymentReference, would still be used. This prevents anyone from frontrunning the call and setting themselves as the initialRecipient since the hash would still be invalid.