RAACNFT's mint function has a refund calculation issue where users can receive incorrect refund amounts. When users provide more funds than the house price, the refund mechanism fails to properly validate the arithmetic, potentially leading to economic imbalances in the protocol.
From the RAACNFT.sol contract, the mint function includes a refund mechanism as follows.
The contract calculates refunds using simple subtraction (_amount - price) without considering edge cases. But this way the user's final balance doesn't always match the expected balance after refund.
Expected
If amount > price: User should receive (amount - price) as refund
If amount ≤ price: User should pay exactly the price
The root cause stems from the refund calculation not being properly bounded. While the contract checks if price > amount, it doesn't validate the refund arithmetic against the user's initial balance.
The protocol's minting mechanism includes a clever refund system, if you send more funds than the house price, you get the difference back. However, there's an interesting edge case in this process.
When a user wants to mint an RAAC NFT, they call the mint function with two parameters:
tokenId: representing the specific property
amount: the funds they're sending
The contract then:
Checks the house price from the oracle
Verifies the sent amount is sufficient
Processes the payment
Handles any refund
You see how the refund calculation uses simple subtraction: function mint
You see the issue is in assuming this straightforward calculation will always produce the correct economic outcome. However the final balance doesn't always match what we'd expect. In certain scenarios, users could receive incorrect refund amounts, disrupting the protocol's economic assumptions about house price payments.
When users mint an NFT representing a $500,000 house by sending 600,000 RAAC tokens, the refund mechanism could potentially return incorrect amounts, disrupting the protocol's careful economic balance.
Like a real estate escrow system where the excess deposit isn't properly reconciled. This vulnerability directly impacts RAAC's core value proposition of maintaining precise 1:1 relationships between on-chain tokens and real-world property values.
manual
We need to put in some solid checks before we process any refunds. That means making sure all stay within safe limits and that there’s enough balance in the account to cover what’s going out.
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.