This repository has been archived by the owner on Jul 21, 2024. It is now read-only.
ubl4nk - StakingRewardsFactory::createStakingRewards can not be called by StakingRewardsManager #100
Labels
Non-Reward
This issue will not receive a payout
Sponsor Disputed
The sponsor disputed this issue's validity
Won't Fix
The sponsor confirmed this issue will not be fixed
ubl4nk
high
StakingRewardsFactory::createStakingRewards can not be called by StakingRewardsManager
Summary
I will use the abbreviated names:
Factory#createStakingRewards is protected by the
onlyOwner
, and alsoManager
is trying to call Factory#createStakingRewards, but Manager contract is never the owner of Factory contract, so all the calls from Manager to Factory#createStakingRewards willl be reverted.Vulnerability Detail
We see the Factory is extended from
Ownable
which means the person/address/contract who deploys the Factory will be theowner
of Factory.We also see the Manager is trying to call
Factory#createStakingRewards
:And
createStakingRewards
protected byonlyOwner
:So we can conclude the
Manager
contract should be theowner
ofFactory
contract.But this is not implemented in the code-base and we can never see any code inside the Manager by which the Manager deploys the Factory to be owner of it, or any further function inside Factory which transfers the ownership to Manager.
So the Manager can never be owner of Factory and BUILDER_ROLE will always get a revert when he tries to call Manager#createNewStakingRewardsContract.
Impact
StakingRewardsManager::createNewStakingRewardsContract is out-of-service and always reverts.
Code Snippet
https://github.com/sherlock-audit/2024-01-telcoin/blob/0954297f4fefac82d45a79c73f3a4b8eb25f10e9/telcoin-audit/contracts/telx/core/StakingRewardsFactory.sol#L43-L66
https://github.com/sherlock-audit/2024-01-telcoin/blob/0954297f4fefac82d45a79c73f3a4b8eb25f10e9/telcoin-audit/contracts/telx/core/StakingRewardsManager.sol#L102-L118
Tool used
Manual Review
Recommendation
Consider transferring the ownership of Factory to Manager.
The text was updated successfully, but these errors were encountered: