Platform: Code4rena
Start Date: 13/02/2024
Pot Size: $24,500 USDC
Total HM: 5
Participants: 84
Period: 6 days
Judge: 0xA5DF
Id: 331
League: ETH
Rank: 46/84
Findings: 1
Award: $38.68
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xAadi
Also found by: 0xbrett8571, DarkTower, JcFichtner, JrNet, MrPotatoMagic, PoeAudits, TheSavageTeddy, ZanyBonzy, clara
38.6789 USDC - $38.68
The system consists of LiquidInfrastructureNFT and LiquidInfrastructureERC20 contracts to enable revenue generating real-world assets to be tokenized on-chain.
This architecture provides flexibility to model different types of real-world assets. Grouping them under the ERC20 allows easy investor access.
The core innovation that enables the Althea Liquid Infrastructure protocol is the split between the NFTs representing individual real-world revenue streams, and the ERC20 that aggregates multiple NFTs for collective investment.
NFT Flexibility
The NFT abstraction allows a lot of flexibility in modeling real-world assets like:
Basically any asset that can generate automated on-chain revenue streams can become an NFT.
The NFT then handles thresholds for keeping operating balances, withdrawal logic, and disaster recovery features.
This provides the building blocks to tokenize diverse real-world assets.
ERC20 Aggregation
The ERC20 serves as an aggregation layer on top of multiple NFTs. This provides a simple way for investors to get exposure to an entire portfolio of assets.
Rather than investing directly into each individual NFT, investors can purchase the ERC20 which automatically distributes revenue proportionally across all holders.
Some key benefits this unlocks:
This dual token model delivers flexibility on the asset side and simplicity for investors.
Common patterns like Ownable, ReentrancyGuard, ERC20, ERC721 are used from OpenZeppelin.
Custom access control modifiers check NFT ownership/approvals. This reduces code duplication.
Use of Well-Known Libraries
Incorporating established OpenZeppelin libraries like Ownable, ReentrancyGuard, ERC20 and ERC721 is a best practice. These building blocks have been formally audited and validate core functionality, improving security.
For example:
Leveraging such well-vetted libraries reduces the need to implement and validate common functionality like transfers, balances, etc from scratch.
Custom Access Control Modifiers
The OwnableApprovableERC721 abstract contract demonstrates good practice by encapsulating ERC721 ownership and approval checks into custom modifiers like onlyOwner(tokenId)
and onlyOwnerOrApproved(tokenId)
.
These modifiers clearly express permissions, while reducing duplicate ownerOf and approval logic throughout the inheritance tree.
For example, onlyOwnerOrApproved
explicitly requires either direct ownership or an active approval before allowing the function call to proceed.
This simplifies writing access controlled contracts that derive their policy from ERC721 ownership status.
mint
and withdrawals
.Main risks are around distribution logic, denial of service and unauthorized token access.
Access Control
Sensitive permissioned functions like mint
and withdrawals
are rightly restricted to just the contract owner. This follows the principle of least privilege, limiting exposure.
For example, arbitrary minting of the ERC20 could undesirably dilute existing holders. Similarly, withdrawal logic needs to be carefully controlled to avoid theft of funds.
Locking Distribution Logic
Locking mechanisms that block other state changing functionality during active revenue distributions help prevent potential reentrancy issues.
For example, by restricting transfers during distribute(), it reduces the risk that a malicious receiver could attempt to recursively call back into distribution. This protects integrity of the distribution state.
Allowlist Enforcement
Tightly controlling which addresses are allowed to hold ERC20 balances provides oversight over token holders. Important for compliance.
The allowlist requirement on receiving distributions provides a gatekeeper to prevent unauthorized parties from acquiring the token. This directly counters a major risk vector.
Proper implementation of the allowlist and appropriate permissioning of the functions that manage it are therefore critical to review.
No formal test suite found in repository. Likely tests done independently. Without significant test coverage of critical functionality like distribution, withdrawals and access control lists, major issues could be missed.
The Owner role has a lot of power. Withdrawals could potentially be opened up via governance.
Adding timelocks could decentralize control further.
The Owner currently holds significant control over critical functionality like:
This places trust in the Owner address to act appropriately. However, too much centralized control raises risks if the Owner key is compromised.
Potential Decentralization Strategies
Some ways to decentralize powers away from only the Owner include:
Governance-Controlled Withdrawals
Timelock Controls
Core Protocol Ownership Renunciation
Governance-Managed Allowlists
Implementing such strategies through a DAO can shift powers away from the Owner to community stakeholders. This would reduce central points of failure and align with crypto ethos.
Central points of failure:
Centralized Mint/Burn Control
The Owner possesses sole authority over minting new ERC20 tokens and burning existing tokens.
This is risky as there are no contingencies if the Owner's private keys are lost. Without backups, no new token creation or burning could occur, disrupting economics.
Similarly, unrestricted minting powers could lead to runaway inflation if the Owner key is compromised.
Lack of Emergency Recovery
There appear to be no emergency revert provisions if the Owner's keys are lost or stolen.
Typically, timelock-gated admin functionality allows recovery as a last resort. This prevents a permanent loss of critical control.
For example, loss of Owner keys could completely halt key operations like:
Essentially bricking the core protocol without contingencies.
This single point of failure around the Owner account needs remediation to make the system resilient against disasters.
I'd recommend instituting standard emergency mechanisms common in DeFi protocols to decentralize control and add redundancy.
30 hours
#0 - c4-pre-sort
2024-02-22T18:44:08Z
0xRobocop marked the issue as insufficient quality report
#1 - c4-judge
2024-03-08T14:32:33Z
0xA5DF marked the issue as grade-b