The LINK token transfer in the requestMintWeatherNFT function could fail silently, potentially leading to a denial of service condition where users pay ETH but the automation registration fails.
In the requestMintWeatherNFT function, the contract attempts to transfer LINK tokens from the user but doesn't properly handle potential transfer failures:
While the contract uses safeTransferFrom, which reverts on failure, there's no specific error handling or recovery mechanism if this fails after the user has already paid ETH.
This PoC demonstrates three scenarios where the LINK token transfer could fail:
Insufficient allowance: The user approves less LINK than required
Insufficient balance: The user has less LINK than required
Transfer failure: The LINK token itself fails during the transfer operation
In all cases, the user's ETH payment would be processed before the LINK transfer fails, potentially leaving them with locked funds and no NFT or automation.
If the LINK token transfer fails (due to insufficient allowance, balance issues, or token contract problems):
The user will have already paid ETH for minting
The automation registration will fail
The user may be left with an NFT that doesn't have automation set up
This creates a poor user experience and potential financial loss
Implement proper error handling and transaction management:
Use a try-catch pattern to handle transfer failures gracefully:
Consider implementing a two-step process where users first approve LINK tokens, then a separate transaction handles the ETH payment and minting.
Add a mechanism for users to retry automation registration if it fails initially.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.