Closed code423n4 closed 1 year ago
hansfriese marked the issue as satisfactory
hansfriese marked the issue as duplicate of #304
hansfriese marked the issue as duplicate of #261
hansfriese marked the issue as not a duplicate
hansfriese marked the issue as duplicate of #304
hansfriese changed the severity to QA (Quality Assurance)
hansfriese marked the issue as grade-b
Lines of code
https://github.com/code-423n4/2023-03-neotokyo/blob/dfa5887062e47e2d0c801ef33062d44c09f6f36e/contracts/staking/NeoTokyoStaker.sol#L1077-L1081
Vulnerability details
A user can stake
BYTES 2.0
tokens into their Citizens to boost the points weight of those Citizens. The boost (bonusPoints
) computed in_stakeBytes()
:The rate is 200 BYTES per point. The issue is that if a user calls
stake()
, transferring anamount
lower than2 BYTES
,bonusPoints
will be rounded to 0. The variables are updated, but the user does not get any bonus, and has essentially locked theirBYTES
into the contract for nothing.Impact
As the only way for a user to retrieve their staked
BYTES
is towithdraw()
their stakedCitizen
, this means the result is the user'sBYTES
are frozen until the end of the timelock.Tools Used
Manual Analysis
Mitigation
In the case of staking
BYTES
, the call should revert if there is nobonusPoints
, to prevent users from freezing temporarily theirBYTES
without getting any bonus.