The RAACNFT contract permanently locks user funds (crvUSD) when minting NFTs instead of distributing them to the property seller or the protocol treasury. This occurs because the contract transfers the payment to its own address (address(this)) without any mechanism to later distribute or withdraw these funds.
This is especially concerning because the NFT can be used as collateral to borrow from the LendingPool. If a users NFT collateral value drops in price and he gets liquidated, the NFT gets transferred to the StabilityPool but there is no way to access the capital from the NFT contract => leaving the LendingPool undercollaterized (NFTs Get Permanently Locked in Stability Pool After Liquidation").
In the mint() function of the RAACNFT contract, when a user mints an NFT representing a property, they must send the required amount of crvUSD tokens. The current implementation has these key issues:
The funds are transferred to address(this) (the contract itself)
There is no function to withdraw or distribute these funds
No treasury or property seller address is specified to receive the payments
No mechanism exists to access the locked funds
This is confirmed by the test case which shows the funds remaining in the contract:
In order to run the test you need to:
Run foundryup
to get the latest version of Foundry
Install hardhat-foundry: npm install --save-dev @nomicfoundation/hardhat-foundry
Import it in your Hardhat config: require("@nomicfoundation/hardhat-foundry");
Make sure you've set the BASE_RPC_URL
in the .env
file or comment out the forking
option in the hardhat config.
Run npx hardhat init-foundry
There is one file in the test folder that will throw an error during compilation so rename the file in test/unit/libraries/ReserveLibraryMock.sol
to => ReserveLibraryMock.sol_broken
so it doesn't get compiled anymore (we don't need it anyways).
Create a new folder test/foundry
Paste the below code into a new test file i.e.: FoundryTest.t.sol
Run the test: forge test --mc FoundryTest -vvvv
All funds sent to mint NFTs become permanently locked in the contract
Property sellers cannot receive payments for their properties
Loss of funds for the protocol and the property owners / users
Foundry
Manual Review
The funds should either go to the property owners directly or to the protocol treasury for later distribution or covering the debt after a user gets liquidated. The protocol needs to decide how it wants to handle this but the funds shouldn't be stuck in the contract.
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.