Weather Witness

First Flight #40
Beginner FriendlyFoundrySolidityNFT
100 EXP
View results
Submission Details
Severity: high
Valid

All Eth is locked in the contract

Description

Contract WeatherNft receives Eth when a user mints NFT using function WeatherNft::requestMintWeatherNFT:

function requestMintWeatherNFT(
string memory _pincode,
string memory _isoCode,
bool _registerKeeper,
uint256 _heartbeat,
uint256 _initLinkDeposit
) external payable returns (bytes32 _reqId) {
require(
msg.value == s_currentMintPrice,
WeatherNft__InvalidAmountSent()
);
...
}

However, there is no functions that withdraw Eth. That means that all Eth sent to the contract are locked in the contract.

Risk

Likelihood: High
Impact: High

All Eth paid to mint NFTs is locked in the contract.

Recommended Mitigation

Add a function to withdraw Eth:

function withdraw() external onlyOwner {
uint256 balance = address(this).balance;
require(balance > 0, "No ETH available to withdraw");
payable(owner()).transfer(balance);
}
Updates

Appeal created

bube Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

Lack of `withdraw` function

The contract collects funds for minting a WeatherNFT, but there is no function that allows the owner to withdraw these funds.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.