Several functions within the contract modify critical state variables without emitting corresponding events. The affected functions include:
registerCollateralToken
createContingentPool
addLiquidity
removeLiquidity
redeemPositionToken
redeemWToken
Lack of Event Emission for Critical State Modifications
Affected Functions
The following functions modify the contract state but do not emit corresponding events:
registerCollateralToken(address _collateralToken)
createContingentPool(PoolParams calldata _poolParams)
addLiquidity(bytes32 _poolId, uint256 _collateralAmount, address _longRecipient, address _shortRecipient)
removeLiquidity(bytes32 _poolId, uint256 _positionTokenAmount, address _recipient)
redeemPositionToken(address _positionToken, uint256 _positionTokenAmount, address _recipient)
redeemWToken(address _wToken, uint256 _wTokenAmount, address _recipient)
These functions modify important state variables such as the user's liquidity, collateral tokens, and pool parameters. However, they do not emit events that would inform external users or applications of the state change.
##Root Cause The root cause of this vulnerability is the absence of event emissions in critical functions that modify contract state. Events in Solidity are used to log important state changes and interactions, allowing off-chain services (like DApps, monitoring services, and explorers) to efficiently track contract activity. Without emitting events, these functions lack a way to signal external observers that a significant change has occurred.
Transparency Issues: Users and external observers cannot efficiently track state changes.
Inefficient Off-Chain Indexing: DApps and monitoring tools cannot reliably detect actions without continuously querying the blockchain.
Security & Debugging Challenges: Auditors and developers face difficulties when tracing transactions to identify issues or anomalies.
##PoC
Consider the function addLiquidity:
To enhance transparency, each function should emit an event upon execution. For example, modifying addLiquidity as follows:
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.