Gotchas and Limitations
While CommissionRoad is designed to be flexible, there are some constraints and "gotchas" you should be aware of.
1. safeTransferFrom is Not Supported
The CommissionRoadERC721 contract explicitly reverts on safeTransferFrom.
- Reason: To prevent reentrancy attacks or complex callback logic during transfers that could be exploited.
- Solution: Use standard
transferFromif you need to move the NFT. Be aware that this might break compatibility with some marketplaces that strictly requiresafeTransferFrom.
2. Reentrancy Protection
Both CommissionRoad and CommissionVault use ReentrancyGuard.
- Impact: You cannot call back into the CommissionRoad contract from a target contract during a
commissionCall. - Scenario: If you are executing a call to a contract that attempts to call
commissionCallrecursively, it will fail.
3. msg.value Requirements
When using commissionCall to pay fees in ETH:
- Validation: The contract checks if
msg.value >= totalValueSentToTargets + commission. - Refunds: Any excess ETH sent is refunded to
msg.sender. - Gotcha: If you calculate
msg.valueexactly but a target requires slightly more (or less), ensure your calculation is precise. It is safer to send slightly more and let the contract refund the dust.
4. Permit2 Nonces
When using Permit2 for token payments:
- Nonce Tracking: You must track user nonces correctly off-chain or fetch them from the Permit2 contract.
- Race Conditions: If a user submits two transactions quickly, they might reuse a nonce, causing one to fail. Ensure your frontend handles nonce incrementing robustly.
5. NFT Ownership Claiming
- Claiming: Commissions are claimed by the current owner of the NFT.
- Transferring: If you transfer your NFT to a new address, the unclaimed commissions in the Vault act as if they "follow" the NFT. They are still recorded in the Vault, but now only the new owner can claim them.
- Implication: If you sell your CommissionRoad NFT, you are selling the right to claim all accrued but unclaimed fees. Claim your fees before you sell!