Liquid Staking

Stakelink
DeFiHardhatOracle
50,000 USDC
View results
Submission Details
Severity: low
Invalid

Missing view Modifier in `onTokenTransfer` Function

Summary

The function onTokenTransfer in the contract lacks the view modifier, which should be added because the function only reads the contract's state without modifying it.

Vulnerability Details

  • The function onTokenTransfer performs a check on the sender (msg.sender) against the address of the stakingPool, but does not alter the contract's state.

  • Functions that only read state should be marked with the view modifier to optimize gas consumption and improve code clarity.

Impact

  • No direct security risk, but omitting the view modifier can lead to inefficient gas usage and unclear intent in the code.

Tools Used

  • Wake extension (VSCode).

Recommendations

  • Add the view modifier to the function onTokenTransfer as it does not mutate the contract's state:

  • Line: contracts/linkStaking/OperatorVCS.sol 94-96

function onTokenTransfer(address, uint256, bytes calldata) external view {
if (msg.sender != address(stakingPool)) revert UnauthorizedToken();
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.