Mystery Box

First Flight #25
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

The testWithdrawFunds function has an incorrect assertEq parameter.

To run a testWithdrawFunds function in asserEq should be 0.2 eth. Because in the Protocol constructor is necessary to send 0.1 eth to the smart contract.

constructor() payable {
owner = msg.sender;
boxPrice = 0.1 ether;
require(msg.value >= SEEDVALUE, "Incorrect ETH sent");
...
}

Recommended Mitigation:

You can change a value in eq test

function testWithdrawFunds() public {
// @audit at the beginig on smart contract is 0.1 eth (sended to the SC during constructor initialization)
assertEq(ownerBalanceAfter - ownerBalanceBefore, 0.2 ether);}

Alternatively, sending funds to the smart contract during initialization is not necessary and can be removed from the constructor. This is because the funds on the Protocol do not matter. In the Protocol, a reward for a specific item is declared, but during the transfer of the reward to friends, it is only a virtual value without any connection to ETH.

Updates

Appeal created

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

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

Give us feedback!