If you notice some outdated information please let us know!
PASS
The final review score is indicated as a percentage. The percentage is calculated as Achieved Points due to MAX Possible Points. For each element the answer can be either Yes/No or a percentage. For a detailed breakdown of the individual weights of each question, please consult this document.
Very simply, the audit looks for the following declarations from the developer's site. With these declarations, it is reasonable to trust the smart contracts.
This report is for informational purposes only and does not constitute investment advice of any kind, nor does it constitute an offer to provide investment advisory or other services. Nothing in this report shall be considered a solicitation or offer to buy or sell any security, token, future, option or other financial instrument or to offer or provide any investment advice or service to any person in any jurisdiction. Nothing contained in this report constitutes investment advice or offers any opinion with respect to the suitability of any security, and the views expressed in this report should not be taken as advice to buy, sell or hold any security. The information in this report should not be relied upon for the purpose of investing. In preparing the information contained in this report, we have not taken into account the investment needs, objectives and financial circumstances of any particular investor. This information has no regard to the specific investment objectives, financial situation and particular needs of any specific recipient of this information and investments discussed may not be suitable for all investors.
Any views expressed in this report by us were prepared based upon the information available to us at the time such views were written. The views expressed within this report are limited to DeFiSafety and the author and do not reflect those of any additional or third party and are strictly based upon DeFiSafety, its authors, interpretations and evaluation of relevant data. Changed or additional information could cause such views to change. All information is subject to possible correction. Information may quickly become unreliable for various reasons, including changes in market conditions or economic circumstances.
This completed report is copyright (c) DeFiSafety 2023. Permission is given to copy in whole, retaining this copyright label.
This section looks at the code deployed on the relevant chain that gets reviewed and its corresponding software repository. The document explaining these questions is here.
1. Are the smart contract addresses easy to find? (%)
Protofi's smart contracts can be found on TheOtherCrypto's (ProtoFi's main crypto developper) fantom-contract repository, linked in their Documentation.
2. How active is the primary contract? (%)
The protocol's ProtofiMasterChef and ProtofiRouter contracts log in well over 100s of Fantom transactions a day. Supporting documents can be found in the appendix.
3. Does the protocol have a public software repository? (Y/N)
While ProtoFi does not have an official public software repository under its name, TheOtherCrypto (Protofi's main crypto developper)'s repositories are linked to the protocol's documentation and therefore earns a Yes to this question.
4. Is there a development history visible? (%)
3 out of the 5 repositories are forked from other source codes and the repositories related to ProtoFi's contracts have 1 branch and less than 30 commits each, demonstrating poor development activity and resulting in a score of 0.
5. Is the team public (not anonymous)?
ProtoFi displays their team within their documentation on the Team page.
This section looks at the software documentation. The document explaining these questions is here.
7. Is the protocol's software architecture documented? (Y/N)
Software architecture in and of itself is not documented. The GitHub repositories show limited information but the tokenomics, smart contract management and token utility are explained via written content on their Tokenomics page and their [Medium] posts(https://medium.com/@protofi.app/defis-new-beginning-2040a017fb29), which gives ProtoFi an electrifying Yes to the question.
8. Does the software documentation fully cover the deployed contracts' source code? (%)
There is 100% coverage of all contracts and functions by cross-referencing the code in GitHub and the contact addresses in their documentation.
9. Is it possible to trace the documented software to its implementation in the protocol's source code? (%)
While the addresses and code can be traced non explicitly, a direct link from the addresses to the source code would make it clear and easier to look up. For that matter, ProtoFi earns a 60% on this question.
10. Has the protocol tested their deployed code? (%)
There are no tests reported on ProtoFi's code.
11. How covered is the protocol's code? (%)
As there are no visible code testing, this question is also a 0.
12. Does the protocol provide scripts and instructions to run their tests? (Y/N)
There are no clear indication of scripts and instructions on ProtoFi's code testing.
13. Is there a detailed report of the protocol's test results?(%)
As there are no visible signs of testing documentation in the GitHub or in the documentation, this question will also be a 0 for ProtoFi.
14. Has the protocol undergone Formal Verification? (Y/N)
ProtoFi has not undergone Formal Verification.
15. Were the smart contracts deployed to a testnet? (Y/N)
Because ProtoFi has not documented any testing and has not provided testnet smart contract addresses in their documentation, ProtoFi is assigned a "No" for this question.
This section looks at the 3rd party software audits done. It is explained in this document.
16. Is the protocol sufficiently audited? (%)
ProtoFi has been audited pre-deployment by CertiK. While the protocol has been reviewed by RugDoc, we do not consider a review as an audit and therefore, ProtoFi earns a 90 on this one.
17. Is the bounty value acceptably high (%)
There are no clear indication of a bug bounty program for the protocol on Immunefi nor on the website and the documentation.
This section covers the documentation of special access controls for a DeFi protocol. The admin access controls are the contracts that allow updating contracts or coefficients in the protocol. Since these contracts can allow the protocol admins to "change the rules", complete disclosure of capabilities is vital for user's transparency. It is explained in this document.
18. Is the protocol's admin control information easy to find?
Admin controls are clearly stated within the protocol's Contract page.
19. Are relevant contracts clearly labelled as upgradeable or immutable? (%)
ProtoFi displays that their smart contracts are immutable within their Investor Protection Logic page.
20. Is the type of smart contract ownership clearly indicated? (%)
The ownership can be found directly within the contracts and addresses page.
21. Are the protocol's smart contract change capabilities described? (%)
ProtoFi describes all the change capabilities that can be made by the owner of the contract in their contracts page.
22. Is the protocol's admin control information easy to understand? (%)
Admin control is directly displayed within the contract docs of the protocol.
23. Is there sufficient Pause Control documentation? (%)
Protofi describes their Pause Control documentation within their Pause controls segment. No evidence of testing yet.
24. Is there sufficient Timelock documentation? (%)
ProtoFi explains why the protocol does not need a timelock in its Investor Protection Logic page. This earns the protocol 100%.
25. Is the Timelock of an adequate length? (Y/N)
ProtoFi explains why the protocol does not need a timelock in its Investor Protection Logic page. This earns the protocol 100%.
This section goes over the documentation that a protocol may or may not supply about their Oracle usage. Oracles are a fundamental part of DeFi as they are responsible for relaying tons of price data information to thousands of protocols using blockchain technology. Not only are they important for price feeds, but they are also an essential component of transaction verification and security. These questions are explained in this document.
26. Is the protocol's Oracle sufficiently documented? (%)
ProtoFi explains why they do not use an Oracle and how they are not affected by oracle-based risks.
27. Is front running mitigated by this protocol? (Y/N)
Front running is mitigated by ProtoFi's ChronoLock feature, preventing bot arbitrage and PROTO pool manipulation here.
28. Can flashloan attacks be applied to the protocol, and if so, are those flashloan attack risks mitigated? (Y/N)
ProtoFi uses their ProtoShield system to cap the number of tokens transferrable per transaction; there are also transaction fees related to each transaction.
1// SPDX-License-Identifier: MIT
2pragma solidity >= 0.6.12;
3
4import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
5import "@openzeppelin/contracts/math/SafeMath.sol";
6import "@openzeppelin/contracts/access/Ownable.sol";
7import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
8
9
10/**
11This is the MoneyPot contract.
12It will be used to distribute shares rewards to ELCTs stakers.
13This is owned by the team, and the team will be able to set start and end blocks to distribute
14daily or weekly rewards to ELCTs stakers.
15Owner --> TBD, it should be activated daily, do we need a timelock?
16Modified from Pancake SmartChef contract (https://bscscan.com/address/0xABFd8d1942628124aB971937154f826Bce86DcbC#code)
17 */
18contract MoneyPot is Ownable, ReentrancyGuard {
19 using SafeMath for uint256;
20 using SafeERC20 for IERC20;
21
22 // Info of each user.
23 struct UserInfo {
24 uint256 amount; // How many LP tokens the user has provided.
25 uint256 rewardDebt; // Reward debt. See explanation below.
26 }
27
28 // Info of each pool.
29 struct PoolInfo {
30 IERC20 stakeToken; // Address of LP token contract.
31 uint256 allocPoint; // How many allocation points assigned to this pool.
32 uint256 lastRewardBlock; // Last block number that reward distribution occurs.
33 uint256 accRewardPerShare; // Accumulated reward per share, times 1e12. See below.
34 }
35
36 // Token to stake
37 IERC20 public stakingToken;
38 // Token used as reward
39 IERC20 public rewardToken;
40
41 // Reward token given per block
42 uint256 public rewardPerBlock;
43
44 // Info of each pool.
45 PoolInfo[] public poolInfo;
46 // Info of each user that stakes LP tokens.
47 mapping (address => UserInfo) public userInfo;
48 // Total allocation points. Must be the sum of all allocation points in all pools.
49 uint256 private totalAllocPoint = 0;
50 // The block number when reward mining starts.
51 uint256 public startBlock;
52 // The block number when reward mining ends.
53 uint256 public bonusEndBlock;
54
55 event Deposit(address indexed user, uint256 amount);
56 event Withdraw(address indexed user, uint256 amount);
57 event EmergencyWithdraw(address indexed user, uint256 amount);
58 event StopReward(uint256 blockNumber);
59
60 constructor(
61 IERC20 _stakingToken,
62 IERC20 _rewardToken,
63 uint256 _rewardPerBlock,
64 uint256 _startBlock,
65 uint256 _bonusEndBlock
66 ) public {
67 stakingToken = _stakingToken;
68 rewardToken = _rewardToken;
69 rewardPerBlock = _rewardPerBlock;
70 startBlock = _startBlock;
71 bonusEndBlock = _bonusEndBlock;
72
73 // staking pool
74 poolInfo.push(PoolInfo({
75 stakeToken: _stakingToken,
76 allocPoint: 1000, // Max allocation to this single pool
77 lastRewardBlock: startBlock,
78 accRewardPerShare: 0
79 }));
80 totalAllocPoint = 1000;
81 }
82
83 // Can be used for emergency to instantly stop rewards
84 function stopReward() public onlyOwner {
85 bonusEndBlock = block.number;
86 emit StopReward(block.number);
87 }
88
89 // Return reward multiplier over the given _from to _to block.
90 function getMultiplier(uint256 _from, uint256 _to) public view returns (uint256) {
91 if (_to <= bonusEndBlock) {
92 return _to.sub(_from);
93 } else if (_from >= bonusEndBlock) {
94 return 0;
95 } else {
96 return bonusEndBlock.sub(_from);
97 }
98 }
99
100 // View function to see pending Reward on frontend.
101 function pendingReward(address _user) external view returns (uint256) {
102 PoolInfo storage pool = poolInfo[0];
103 UserInfo storage user = userInfo[_user];
104 uint256 accRewardPerShare = pool.accRewardPerShare;
105 uint256 stokenSupply = pool.stakeToken.balanceOf(address(this));
106 if (block.number > pool.lastRewardBlock && stokenSupply != 0) {
107 uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
108 uint256 tokenReward = multiplier.mul(rewardPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
109 accRewardPerShare = accRewardPerShare.add(tokenReward.mul(1e12).div(stokenSupply));
110 }
111 return user.amount.mul(accRewardPerShare).div(1e12).sub(user.rewardDebt);
112 }
113
114 // Update reward variables of the given pool to be up-to-date.
115 function updatePool(uint256 _pid) public {
116 PoolInfo storage pool = poolInfo[_pid];
117 if (block.number <= pool.lastRewardBlock) {
118 return;
119 }
120 uint256 stokenSupply = pool.stakeToken.balanceOf(address(this));
121 if (stokenSupply == 0) {
122 pool.lastRewardBlock = block.number;
123 return;
124 }
125 uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
126 uint256 tokenReward = multiplier.mul(rewardPerBlock).mul(pool.allocPoint).div(totalAllocPoint);
127 pool.accRewardPerShare = pool.accRewardPerShare.add(tokenReward.mul(1e12).div(stokenSupply));
128 pool.lastRewardBlock = block.number;
129 }
130
131 // Update reward variables for all pools. Be careful of gas spending!
132 function massUpdatePools() public {
133 uint256 length = poolInfo.length;
134 for (uint256 pid = 0; pid < length; ++pid) {
135 updatePool(pid);
136 }
137 }
138
139
140 // Stake staking tokens to moneypot
141 function deposit(uint256 _amount) public nonReentrant {
142 PoolInfo storage pool = poolInfo[0];
143 UserInfo storage user = userInfo[msg.sender];
144
145 updatePool(0);
146 if (user.amount > 0) {
147 uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e12).sub(user.rewardDebt);
148 if(pending > 0) {
149 rewardToken.safeTransfer(address(msg.sender), pending);
150 }
151 }
152 if(_amount > 0) {
153 pool.stakeToken.safeTransferFrom(address(msg.sender), address(this), _amount);
154 user.amount = user.amount.add(_amount);
155 }
156 user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e12);
157
158 emit Deposit(msg.sender, _amount);
159 }
160
161
162 /**
163 Sets the startBlock and bonusEndBlock for the moneypot, making it easy to update
164 the blocks distribute new rewards later in time. Resets also the lastRewardBlock.
165 */
166 function setBlocksBoundaries(uint256 _startBlock, uint256 _endBlock) public onlyOwner {
167 PoolInfo storage pool = poolInfo[0];
168
169 require(pool.lastRewardBlock <= _startBlock, "set: startBlock should be >= to the previous one");
170 require(bonusEndBlock <= _endBlock, "set: endBlock should be >= to the previous one");
171 require(_startBlock <= _endBlock, "set: _startBlock should be >= to endBlock");
172
173 updatePool(0);
174
175 pool.lastRewardBlock = _startBlock;
176 startBlock = _startBlock;
177 bonusEndBlock = _endBlock;
178 }
179
180 // Withdraw stake tokens from STAKING.
181 function withdraw(uint256 _amount) public nonReentrant {
182 PoolInfo storage pool = poolInfo[0];
183 UserInfo storage user = userInfo[msg.sender];
184 require(user.amount >= _amount, "withdraw: not good");
185 updatePool(0);
186 uint256 pending = user.amount.mul(pool.accRewardPerShare).div(1e12).sub(user.rewardDebt);
187 if(pending > 0) {
188 rewardToken.safeTransfer(address(msg.sender), pending);
189 }
190 if(_amount > 0) {
191 user.amount = user.amount.sub(_amount);
192 pool.stakeToken.safeTransfer(address(msg.sender), _amount);
193 }
194 user.rewardDebt = user.amount.mul(pool.accRewardPerShare).div(1e12);
195
196 emit Withdraw(msg.sender, _amount);
197 }
198
199 // Withdraw without caring about rewards. EMERGENCY ONLY.
200 function emergencyWithdraw() public nonReentrant {
201 PoolInfo storage pool = poolInfo[0];
202 UserInfo storage user = userInfo[msg.sender];
203 pool.stakeToken.safeTransfer(address(msg.sender), user.amount);
204 user.amount = 0;
205 user.rewardDebt = 0;
206 emit EmergencyWithdraw(msg.sender, user.amount);
207 }
208
209 // Withdraw reward. EMERGENCY ONLY.
210 function emergencyRewardWithdraw(uint256 _amount) public onlyOwner {
211 require(_amount < rewardToken.balanceOf(address(this)), 'not enough token');
212 rewardToken.safeTransfer(address(msg.sender), _amount);
213 }
214
215}
Tests to Code: 0 / 2048 = 0 %