The price to mint eventually end up at 0. Assuming this is correct,
a price of 0 is transfered to the beneficiary.
The just costs gas and does not do anything useful.
Proof of Concept
function getPrice() public view returns (uint) {
...
uint elapsed = block.timestamp.sub(saleStartTime);
if (elapsed > saleDuration) {
return 0;
....
}
Handle
gpersoon
Vulnerability details
Impact
The price to mint eventually end up at 0. Assuming this is correct, a price of 0 is transfered to the beneficiary. The just costs gas and does not do anything useful.
Proof of Concept
function getPrice() public view returns (uint) { ... uint elapsed = block.timestamp.sub(saleStartTime); if (elapsed > saleDuration) { return 0; .... }
function mint() external payable reentrancyGuard returns (uint) { ... uint salePrice = getPrice(); ... beneficiary.transfer(salePrice);
Tools Used
Editor
Recommended Mitigation Steps
add an if statement: if (salePrice > 0) beneficiary.transfer(salePrice);