MochiTreasuryV0.sol Is Unusable In Its Current State
The MochiTreasuryV0 contract attempts to lock tokens in Curve's VotingEscrow contract, but VotingEscrow does not allow contracts to call its lock functions. As a result, any attempt to lock tokens from the treasury contract will fail.
Submitted by leastwood
Impact
MochiTreasuryV0.sol interacts with Curve’s voting escrow contract to lock tokens for 90 days, where it can be later withdrawn by the governance role. However, VotingEscrow.vy does not allow contracts to call the following functions; create_lock(), increase_amount() and increase_unlock_time(). For these functions, msg.sender must be an EOA account or an approved smart wallet. As a result, any attempt to lock tokens will fail in MochiTreasuryV0.sol.
Proof of Concept
Tools Used
- Manual code review
- Discussions with the Mochi team
Recommended Mitigation Steps
Consider updating this contract to potentially use another escrow service that enables msg.sender to be a contract. Alternatively, this escrow functionality can be replaced with an internal contract which holds usdm tokens instead, removing the need to convert half of the tokens to Curve tokens. Holding Curve tokens for a minimum of 90 days may overly expose the Mochi treasury to Curve token price fluctuations.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the treasury contract was designed to interact with Curve's VotingEscrow, which restricts certain functions to externally owned accounts (EOAs) or approved smart wallets, not arbitrary contracts.
Impact
The treasury contract cannot lock tokens as intended, making it unusable for that purpose.
What the attacker needed
None
The fix
The contract should be updated to use an escrow service that allows contracts as msg.sender, or replace the escrow functionality with an internal contract holding usdm tokens.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract is a program on a blockchain. This report says the treasury contract tries to use another contract (Curve's voting escrow) to lock tokens, but that other contract only allows regular user accounts, not contracts, to do this. So the treasury's locking attempts always fail.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.