CustomerEngine.trigger_demand sends ETH with the call into Cyfrin_Hub.sell_to_customer
In Cyfrin_Hub.sell_to_customer (a payable function), when inventory >= requested the contract increases its internal company_balance by revenue = requested * SALE_PRICE
However, when inventory < requested (failed sale), the function does not revert and does not refund or record the incoming ETH. It only decreases reputation and returns
It should revert the funds if it can't complete the sale
Likelihood:
High in normal usage: a demand request with requested > inventory is a common occurrence. Given the current code, the engine sends value regardless, the hub accepts it, and does not revert.
Impact:
Loss of accounting integrity: Internal accounting (company_balance) becomes lower than actual ETH held by the contract. Subsequent logic (share pricing, solvency checks) relies on company_balance and therefore underestimates net worth.
Investor impact: Share price (net_worth / issued_shares) can be understated, harming investors and creating arbitrage opportunities.
Silent fund capture: Users are charged even though the sale fails; funds become trapped and unreflected in internal accounting.
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.