Masa - Staking #1

CertiKFiles named in the report

CertiK reviewed Masa (Masa - Staking #1) on 7 May 2024: 7 findings, 1 critical; 6 marked fixed, 1 acknowledged.

1 critical finding, fixed
Open the reportOpen Masa’s security record

Report hosted on skynet.certik.com.

Trustblock does not review code.

Findings7

Statuses are the security firm’s own, from its report.

SeverityOpenAcknowledgedFixed
Critical001
High010
Medium002
Low003
CriticalPotential Theft of Stakes and Rewards by PrivilegFixed

The function `rescueERC20Token` can be used by any address with the `DEFAULT_ADMIN_ROLE` role to transfer tokens from the contract. This includes the staking and reward token `masaToken`. As such, this privileged role is able to steal users' stakes and rewards.

MediumPossible Inconsistent Staking Periods Due to ChanFixed

The variable `blockTime` is meant to denote the amount of time between blocks and is used to determine the number of blocks a staking period is for. ```solidity=351 uint256 stakingPeriodBlocks = (stakeData.period * 30 days) / blockTime; ``` However, `blockTime` can be changed by `setBlockTime`, which can lead to inaccurate staking periods. For example, suppose the staking period is 1, i.e. 30 days, and the starting `blockTime` is 1 day. Then after 15 blocks, half of the staking period, which is 15 days, have elapsed. However, if after these 15 days `blockTime` is updated to 2 days, the staking period would be considered over, since each of the 15 blocks that have **already** elapsed are now considered as 2 days each, for a total of 30 days. This allows a user to unstake earlier than the 30 days staking period. Similarly, decreasing the `blockTime` part way through a stake would increase the amount of time required to unstake.

MediumSource of RewardsFixed

There is currently no guarantee of rewards for stakers. Since the staking token and reward token are the same, there is a possibility that rewards are paid by stakers, leading to a ponzi-scheme.

LowNon-Existence of Certain RolesFixed

Documentation and comments for the staking contract state that there are three specialized roles: - `DEFAULT_ADMIN_ROLE` - `PAUSER_ROLE` - `INTEREST_RATE_ROLE` However, only the `DEFAULT_ADMIN_ROLE` role is currently implemented.

LowPotential Divide by ZeroFixed

Performing division by zero would raise an error and revert the transaction. ```solidity=325 uint256 elapsedFraction = (blocksElapsed * 1e18) / periodInBlocks; // Multiply by 1e18 for precision ``` The expression `(blocksElapsed * 1e18) / periodInBlocks` may divide by zero.

LowUnnecessary Use of `storage`Fixed

The following functions access storage variables without writing to them: - `getUserStake` - `getUserStakesWithInterest` - `canWithdrawStake` Since storage reads are much more expensive than memory reads, it would be more efficient to use `memory` instead of `storage`.

Contracts in scope

No deployed address is recorded for this audit.

The report names a repository or files. Open the report to see its scope.

Repository and files the report names (1)

  • contracts/MasaStaking.sol

Part of Masa’s security record

Masa
Audits2 audits by 1 firmLast audit May 2024, by CertiK.
Critical findingsNo open critical findingsAcross the 2 reports, 1 critical finding was reported. It is marked fixed by the firm that reported it.
Open Masa’s security record

Security firm

CertiK

1,044 projects reviewed · 1,375 reports · latest May 2025

See CertiK’s audits

Something wrong on this page? A missing report, a wrong date, a finding that was fixed since. Tell us and we check it against its source.

Tell us