Finished Reviews

PoolTogether Process Quality Review

Score: 91%

This is a Process Quality Review of PoolTogether completed on April 13, 2021. It was performed using the Process Review process (version 0.6.2) and is documented here. The review was performed by Lucas of DeFiSafety. Check out our Telegram.

The final score of the review is 91%, an excellent score. The breakdown of the scoring is in Scoring Appendix. For our purposes, a pass is 70%.

Summary of the Process

Very simply, the review looks for the following declarations from the developer's site. With these declarations, it is reasonable to trust the smart contracts.

  • Here are my smart contracts on the blockchain

  • Here is the documentation that explains what my smart contracts do

  • Here are the tests I ran to verify my smart contract

  • Here are the audit(s) performed on my code by third party experts

Disclaimer

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 2021. Permission is given to copy in whole, retaining this copyright label.

Code and Team

This section looks at the code deployed on the Mainnet that gets reviewed and its corresponding software repository. The document explaining these questions is here. This review will answer the questions;

  1. Are the executing code addresses readily available? (Y/N)

  2. Is the code actively being used? (%)

  3. Is there a public software repository? (Y/N)

  4. Is there a development history visible? (%)

  5. Is the team public (not anonymous)? (Y/N)

Are the executing code addresses readily available? (Y/N)

Answer: Yes

They are available at https://docs.pooltogether.com/resources-1/networks/ethereum as indicated in the Appendix.

Is the code actively being used? (%)

Answer: 100%

Activity is 25 transactions a day on contract CompoundPrizePool.sol, as indicated in the Appendix.

Percentage Score Guidance

100% More than 10 transactions a day 70% More than 10 transactions a week 40% More than 10 transactions a month 10% Less than 10 transactions a month 0% No activity

Is there a public software repository? (Y/N)

Answer: Yes

GitHub: https://github.com/pooltogether

Is there a public software repository with the code at a minimum, but normally test and scripts also (Y/N). Even if the repo was created just to hold the files and has just 1 transaction, it gets a Yes. For teams with private repos, this answer is No.

Is there a development history visible? (%)

Answer: 100%

With 798 commits and 19 branches, this is clearly a well-maintained repository.

This checks if the software repository demonstrates a strong steady history. This is normally demonstrated by commits, branches and releases in a software repository. A healthy history demonstrates a history of more than a month (at a minimum).

Guidance: 100% Any one of 100+ commits, 10+branches 70% Any one of 70+ commits, 7+branches 50% Any one of 50+ commits, 5+branches 30% Any one of 30+ commits, 3+branches 0% Less than 2 branches or less than 10 commits

Is the team public (not anonymous)? (Y/N)

Answer: Yes

Some of the protocol members are clearly listed in their medium articles.

For a yes in this question the real names of some team members must be public on the website or other documentation. If the team is anonymous and then this question is a No.

Documentation

This section looks at the software documentation. The document explaining these questions is here.

Required questions are;

  1. Is there a whitepaper? (Y/N)

  2. Are the basic software functions documented? (Y/N)

  3. Does the software function documentation fully (100%) cover the deployed contracts? (%)

  4. Are there sufficiently detailed comments for all functions within the deployed contract code (%)

  5. Is it possible to trace from software documentation to the implementation in codee (%)

Is there a whitepaper? (Y/N)

Answer: Yes

Are the basic software functions documented? (Y/N)

Answer: Yes

Location: https://docs.pooltogether.com/protocol/overview

Does the software function documentation fully (100%) cover the deployed contracts? (%)

Answer: 100%

With Robust and well-organized function documentation, PoolTogther has put together impressive documentation.

Guidance:

100% All contracts and functions documented 80% Only the major functions documented 79-1% Estimate of the level of software documentation 0% No software documentation

Are there sufficiently detailed comments for all functions within the deployed contract code (%)

Answer: 31%

Code examples are in the Appendix. As per the SLOC, there is 31% commenting to code (CtC).

The Comments to Code (CtC) ratio is the primary metric for this score.

Guidance: 100% CtC > 100 Useful comments consistently on all code 90-70% CtC > 70 Useful comment on most code 60-20% CtC > 20 Some useful commenting 0% CtC < 20 No useful commenting

How to improve this score

This score can improve by adding comments to the deployed code such that it comprehensively covers the code. For guidance, refer to the SecurEth Software Requirements.

Is it possible to trace from software documentation to the implementation in code (%)

Answer: 100%

There is clear explicit tracability between the code and the documentation at a requirement level for all code.

Guidance: 100% - Clear explicit traceability between code and documentation at a requirement level for all code 60% - Clear association between code and documents via non explicit traceability 40% - Documentation lists all the functions and describes their functions 0% - No connection between documentation and code

How to improve this score

This score can improve by adding traceability from requirements to code such that it is clear where each requirement is coded. For reference, check the SecurEth guidelines on traceability.

Testing

This section looks at the software testing available. It is explained in this document. This section answers the following questions;

  1. Full test suite (Covers all the deployed code) (%)

  2. Code coverage (Covers all the deployed lines of code, or explains misses) (%)

  3. Scripts and instructions to run the tests (Y/N)

  4. Packaged with the deployed code (Y/N)

  5. Report of the results (%)

  6. Formal Verification test done (%)

  7. Stress Testing environment (%)

Is there a Full test suite? (%)

Answer: 100%

With a TtC of 170%, there is clearly a robust test suite present.

This score is guided by the Test to Code ratio (TtC). Generally a good test to code ratio is over 100%. However the reviewers best judgement is the final deciding factor.

Guidance: 100% TtC > 120% Both unit and system test visible 80% TtC > 80% Both unit and system test visible 40% TtC < 80% Some tests visible 0% No tests obvious

Code coverage (Covers all the deployed lines of code, or explains misses) (%)

Answer: 92%

Location: https://coveralls.io/github/pooltogether/pooltogether-pool-contracts?branch=master

Guidance: 100% - Documented full coverage 99-51% - Value of test coverage from documented results 50% - No indication of code coverage but clearly there is a reasonably complete set of tests 30% - Some tests evident but not complete 0% - No test for coverage seen

How to improve this score

This score can improve by adding tests achieving full code coverage. A clear report and scripts in the software repository will guarantee a high score.

Scripts and instructions to run the tests (Y/N)

Answer: Yes

Location: https://github.com/pooltogether/pooltogether-pool-contracts

How to improve this score

Add the scripts to the repository and ensure they work. Ask an outsider to create the environment and run the tests. Improve the scripts and docs based on their feedback.

Packaged with the deployed code (Y/N)

Answer: Yes

How to improve this score

Improving this score requires redeployment of the code, with the tests. This score gives credit to those who test their code before deployment and release them together. If a developer adds tests after deployment they can gain full points for all test elements except this one.

Report of the results (%)

Answer: 0%

Guidance: 100% - Detailed test report as described below 70% - GitHub Code coverage report visible 0% - No test report evident

How to improve this score

Add a report with the results. The test scripts should generate the report or elements of it.

Formal Verification test done (%)

Answer: 0%

There is no evidence of formal verification testing done.

Stress Testing environment (%)

Answer: 100%

There is evidence of stress-testing on the Kovan Network. https://docs.pooltogether.com/resources-1/networks/ethereum#kovan

Audits

Answer: 100%

PoolToghther has been audited by OpenZeppelin twice, with the last time being october 21st.

PoolTogether has also been audited by DitCraft.

PoolTogether was released January 7th.

Guidance:

  1. Multiple Audits performed before deployment and results public and implemented or not required (100%)

  2. Single audit performed before deployment and results public and implemented or not required (90%)

  3. Audit(s) performed after deployment and no changes required. Audit report is public. (70%)

  4. No audit performed (20%)

  5. Audit Performed after deployment, existence is public, report is not public and no improvements deployed OR smart contract address' not found, question 1 (0%)

Appendices

Author Details

The author of this review is Rex of DeFi Safety.

Email : [email protected]defisafety.com Twitter : @defisafety

I started with Ethereum just before the DAO and that was a wonderful education. It showed the importance of code quality. The second Parity hack also showed the importance of good process. Here my aviation background offers some value. Aerospace knows how to make reliable code using quality processes.

I was coaxed to go to EthDenver 2018 and there I started SecuEth.org with Bryant and Roman. We created guidelines on good processes for blockchain code development. We got EthFoundation funding to assist in their development.

Process Quality Reviews are an extension of the SecurEth guidelines that will further increase the quality processes in Solidity and Vyper development.

DeFiSafety is my full time gig and we are working on funding vehicles for a permanent staff.

Scoring Appendix

Executing Code Appendix

Code Used Appendix

Example Code Appendix

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.0 <0.7.0;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/SafeCastUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/introspection/ERC165CheckerUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/SafeERC20Upgradeable.sol";
import "@pooltogether/fixed-point/contracts/FixedPoint.sol";
import "../external/compound/ICompLike.sol";
import "../registry/RegistryInterface.sol";
import "../reserve/ReserveInterface.sol";
import "../token/TokenListenerInterface.sol";
import "../token/TokenListenerLibrary.sol";
import "../token/ControlledToken.sol";
import "../token/TokenControllerInterface.sol";
import "../utils/MappedSinglyLinkedList.sol";
import "./PrizePoolInterface.sol";
/// @title Escrows assets and deposits them into a yield source. Exposes interest to Prize Strategy. Users deposit and withdraw from this contract to participate in Prize Pool.
/// @notice Accounting is managed using Controlled Tokens, whose mint and burn functions can only be called by this contract.
/// @dev Must be inherited to provide specific yield-bearing asset control, such as Compound cTokens
abstract contract PrizePool is PrizePoolInterface, OwnableUpgradeable, ReentrancyGuardUpgradeable, TokenControllerInterface {
using SafeMathUpgradeable for uint256;
using SafeCastUpgradeable for uint256;
using SafeERC20Upgradeable for IERC20Upgradeable;
using MappedSinglyLinkedList for MappedSinglyLinkedList.Mapping;
using ERC165CheckerUpgradeable for address;
/// @dev Emitted when an instance is initialized
event Initialized(
address reserveRegistry,
uint256 maxExitFeeMantissa,
uint256 maxTimelockDuration
);
/// @dev Event emitted when controlled token is added
event ControlledTokenAdded(
ControlledTokenInterface indexed token
);
/// @dev Emitted when reserve is captured.
event ReserveFeeCaptured(
uint256 amount
);
event AwardCaptured(
uint256 amount
);
/// @dev Event emitted when assets are deposited
event Deposited(
address indexed operator,
address indexed to,
address indexed token,
uint256 amount,
address referrer
);
/// @dev Event emitted when timelocked funds are re-deposited
event TimelockDeposited(
address indexed operator,
address indexed to,
address indexed token,
uint256 amount
);
/// @dev Event emitted when interest is awarded to a winner
event Awarded(
address indexed winner,
address indexed token,
uint256 amount
);
/// @dev Event emitted when external ERC20s are awarded to a winner
event AwardedExternalERC20(
address indexed winner,
address indexed token,
uint256 amount
);
/// @dev Event emitted when external ERC20s are transferred out
event TransferredExternalERC20(
address indexed to,
address indexed token,
uint256 amount
);
/// @dev Event emitted when external ERC721s are awarded to a winner
event AwardedExternalERC721(
address indexed winner,
address indexed token,
uint256[] tokenIds
);
/// @dev Event emitted when assets are withdrawn instantly
event InstantWithdrawal(
address indexed operator,
address indexed from,
address indexed token,
uint256 amount,
uint256 redeemed,
uint256 exitFee
);
/// @dev Event emitted upon a withdrawal with timelock
event TimelockedWithdrawal(
address indexed operator,
address indexed from,
address indexed token,
uint256 amount,
uint256 unlockTimestamp
);
event ReserveWithdrawal(
address indexed to,
uint256 amount
);
/// @dev Event emitted when timelocked funds are swept back to a user
event TimelockedWithdrawalSwept(
address indexed operator,
address indexed from,
uint256 amount,
uint256 redeemed
);
/// @dev Event emitted when the Liquidity Cap is set
event LiquidityCapSet(
uint256 liquidityCap
);
/// @dev Event emitted when the Credit plan is set
event CreditPlanSet(
address token,
uint128 creditLimitMantissa,
uint128 creditRateMantissa
);
/// @dev Event emitted when the Prize Strategy is set
event PrizeStrategySet(
address indexed prizeStrategy
);
/// @dev Emitted when credit is minted
event CreditMinted(
address indexed user,
address indexed token,
uint256 amount
);
/// @dev Emitted when credit is burned
event CreditBurned(
address indexed user,
address indexed token,
uint256 amount
);
struct CreditPlan {
uint128 creditLimitMantissa;
uint128 creditRateMantissa;
}
struct CreditBalance {
uint192 balance;
uint32 timestamp;
bool initialized;
}
/// @dev Reserve to which reserve fees are sent
RegistryInterface public reserveRegistry;
/// @dev A linked list of all the controlled tokens
MappedSinglyLinkedList.Mapping internal _tokens;
/// @dev The Prize Strategy that this Prize Pool is bound to.
TokenListenerInterface public prizeStrategy;
/// @dev The maximum possible exit fee fraction as a fixed point 18 number.
/// For example, if the maxExitFeeMantissa is "0.1 ether", then the maximum exit fee for a withdrawal of 100 Dai will be 10 Dai
uint256 public maxExitFeeMantissa;
/// @dev The maximum possible timelock duration for a timelocked withdrawal (in seconds).
uint256 public maxTimelockDuration;
/// @dev The total funds that are timelocked.
uint256 public timelockTotalSupply;
/// @dev The total funds that have been allocated to the reserve
uint256 public reserveTotalSupply;
/// @dev The total amount of funds that the prize pool can hold.
uint256 public liquidityCap;
/// @dev the The awardable balance
uint256 internal _currentAwardBalance;
/// @dev The timelocked balances for each user
mapping(address => uint256) internal _timelockBalances;
/// @dev The unlock timestamps for each user
mapping(address => uint256) internal _unlockTimestamps;
/// @dev Stores the credit plan for each token.
mapping(address => CreditPlan) internal _tokenCreditPlans;
/// @dev Stores each users balance of credit per token.
mapping(address => mapping(address => CreditBalance)) internal _tokenCreditBalances;
/// @notice Initializes the Prize Pool
/// @param _controlledTokens Array of ControlledTokens that are controlled by this Prize Pool.
/// @param _maxExitFeeMantissa The maximum exit fee size
/// @param _maxTimelockDuration The maximum length of time the withdraw timelock
function initialize (
RegistryInterface _reserveRegistry,
ControlledTokenInterface[] memory _controlledTokens,
uint256 _maxExitFeeMantissa,
uint256 _maxTimelockDuration
)
public
initializer
{
require(address(_reserveRegistry) != address(0), "PrizePool/reserveRegistry-not-zero");
_tokens.initialize();
for (uint256 i = 0; i < _controlledTokens.length; i++) {
_addControlledToken(_controlledTokens[i]);
}
__Ownable_init();
__ReentrancyGuard_init();
_setLiquidityCap(uint256(-1));
reserveRegistry = _reserveRegistry;
maxExitFeeMantissa = _maxExitFeeMantissa;
maxTimelockDuration = _maxTimelockDuration;
emit Initialized(
address(_reserveRegistry),
maxExitFeeMantissa,
maxTimelockDuration
);
}
/// @dev Returns the address of the underlying ERC20 asset
/// @return The address of the asset
function token() external override view returns (address) {
return address(_token());
}
/// @dev Returns the total underlying balance of all assets. This includes both principal and interest.
/// @return The underlying balance of assets
function balance() external returns (uint256) {
return _balance();
}
/// @dev Checks with the Prize Pool if a specific token type may be awarded as an external prize
/// @param _externalToken The address of the token to check
/// @return True if the token may be awarded, false otherwise
function canAwardExternal(address _externalToken) external view returns (bool) {
return _canAwardExternal(_externalToken);
}
/// @notice Deposits timelocked tokens for a user back into the Prize Pool as another asset.
/// @param to The address receiving the tokens
/// @param amount The amount of timelocked assets to re-deposit
/// @param controlledToken The type of token to be minted in exchange (i.e. tickets or sponsorship)
function timelockDepositTo(
address to,
uint256 amount,
address controlledToken
)
external
onlyControlledToken(controlledToken)
canAddLiquidity(amount)
nonReentrant
{
address operator = _msgSender();
_mint(to, amount, controlledToken, address(0));
_timelockBalances[operator] = _timelockBalances[operator].sub(amount);
timelockTotalSupply = timelockTotalSupply.sub(amount);
emit TimelockDeposited(operator, to, controlledToken, amount);
}
/// @notice Deposit assets into the Prize Pool in exchange for tokens
/// @param to The address receiving the newly minted tokens
/// @param amount The amount of assets to deposit
/// @param controlledToken The address of the type of token the user is minting
/// @param referrer The referrer of the deposit
function depositTo(
address to,
uint256 amount,
address controlledToken,
address referrer
)
external override
onlyControlledToken(controlledToken)
canAddLiquidity(amount)
nonReentrant
{
address operator = _msgSender();
_mint(to, amount, controlledToken, referrer);
_token().safeTransferFrom(operator, address(this), amount);
_supply(amount);
emit Deposited(operator, to, controlledToken, amount, referrer);
}
/// @notice Withdraw assets from the Prize Pool instantly. A fairness fee may be charged for an early exit.
/// @param from The address to redeem tokens from.
/// @param amount The amount of tokens to redeem for assets.
/// @param controlledToken The address of the token to redeem (i.e. ticket or sponsorship)
/// @param maximumExitFee The maximum exit fee the caller is willing to pay. This should be pre-calculated by the calculateExitFee() fxn.
/// @return The actual exit fee paid
function withdrawInstantlyFrom(
address from,
uint256 amount,
address controlledToken,
uint256 maximumExitFee
)
external override
nonReentrant
onlyControlledToken(controlledToken)
returns (uint256)
{
(uint256 exitFee, uint256 burnedCredit) = _calculateEarlyExitFeeLessBurnedCredit(from, controlledToken, amount);
require(exitFee <= maximumExitFee, "PrizePool/exit-fee-exceeds-user-maximum");
// burn the credit
_burnCredit(from, controlledToken, burnedCredit);
// burn the tickets
ControlledToken(controlledToken).controllerBurnFrom(_msgSender(), from, amount);
// redeem the tickets less the fee
uint256 amountLessFee = amount.sub(exitFee);
uint256 redeemed = _redeem(amountLessFee);
_token().safeTransfer(from, redeemed);
emit InstantWithdrawal(_msgSender(), from, controlledToken, amount, redeemed, exitFee);
return exitFee;
}
/// @notice Limits the exit fee to the maximum as hard-coded into the contract
/// @param withdrawalAmount The amount that is attempting to be withdrawn
/// @param exitFee The exit fee to check against the limit
/// @return The passed exit fee if it is less than the maximum, otherwise the maximum fee is returned.
function _limitExitFee(uint256 withdrawalAmount, uint256 exitFee) internal view returns (uint256) {
uint256 maxFee = FixedPoint.multiplyUintByMantissa(withdrawalAmount, maxExitFeeMantissa);
if (exitFee > maxFee) {
exitFee = maxFee;
}
return exitFee;
}
/// @notice Withdraw assets from the Prize Pool by placing them into the timelock.
/// The timelock is used to ensure that the tickets have contributed their fair share of the prize.
/// @dev Note that if the user has previously timelocked funds then this contract will try to sweep them.
/// If the existing timelocked funds are still locked, then the incoming
/// balance is added to their existing balance and the new timelock unlock timestamp will overwrite the old one.
/// @param from The address to withdraw from
/// @param amount The amount to withdraw
/// @param controlledToken The type of token being withdrawn
/// @return The timestamp from which the funds can be swept
function withdrawWithTimelockFrom(
address from,
uint256 amount,
address controlledToken
)
external override
nonReentrant
onlyControlledToken(controlledToken)
returns (uint256)
{
uint256 blockTime = _currentTime();
(uint256 lockDuration, uint256 burnedCredit) = _calculateTimelockDuration(from, controlledToken, amount);
uint256 unlockTimestamp = blockTime.add(lockDuration);
_burnCredit(from, controlledToken, burnedCredit);
ControlledToken(controlledToken).controllerBurnFrom(_msgSender(), from, amount);
_mintTimelock(from, amount, unlockTimestamp);
emit TimelockedWithdrawal(_msgSender(), from, controlledToken, amount, unlockTimestamp);
// return the block at which the funds will be available
return unlockTimestamp;
}
/// @notice Adds to a user's timelock balance. It will attempt to sweep before updating the balance.
/// Note that this will overwrite the previous unlock timestamp.
/// @param user The user whose timelock balance should increase
/// @param amount The amount to increase by
/// @param timestamp The new unlock timestamp
function _mintTimelock(address user, uint256 amount, uint256 timestamp) internal {
// Sweep the old balance, if any
address[] memory users = new address[](1);
users[0] = user;
_sweepTimelockBalances(users);
timelockTotalSupply = timelockTotalSupply.add(amount);
_timelockBalances[user] = _timelockBalances[user].add(amount);
_unlockTimestamps[user] = timestamp;
// if the funds should already be unlocked
if (timestamp <= _currentTime()) {
_sweepTimelockBalances(users);
}
}
/// @notice Updates the Prize Strategy when tokens are transferred between holders.
/// @param from The address the tokens are being transferred from (0 if minting)
/// @param to The address the tokens are being transferred to (0 if burning)
/// @param amount The amount of tokens being trasferred
function beforeTokenTransfer(address from, address to, uint256 amount) external override onlyControlledToken(msg.sender) {
if (from != address(0)) {
uint256 fromBeforeBalance = IERC20Upgradeable(msg.sender).balanceOf(from);
// first accrue credit for their old balance
uint256 newCreditBalance = _calculateCreditBalance(from, msg.sender, fromBeforeBalance, 0);
if (from != to) {
// if they are sending funds to someone else, we need to limit their accrued credit to their new balance
newCreditBalance = _applyCreditLimit(msg.sender, fromBeforeBalance.sub(amount), newCreditBalance);
}
_updateCreditBalance(from, msg.sender, newCreditBalance);
}
if (to != address(0) && to != from) {
_accrueCredit(to, msg.sender, IERC20Upgradeable(msg.sender).balanceOf(to), 0);
}
// if we aren't minting
if (from != address(0) && address(prizeStrategy) != address(0)) {
prizeStrategy.beforeTokenTransfer(from, to, amount, msg.sender);
}
}
/// @notice Returns the balance that is available to award.
/// @dev captureAwardBalance() should be called first
/// @return The total amount of assets to be awarded for the current prize
function awardBalance() external override view returns (uint256) {
return _currentAwardBalance;
}
/// @notice Captures any available interest as award balance.
/// @dev This function also captures the reserve fees.
/// @return The total amount of assets to be awarded for the current prize
function captureAwardBalance() external override nonReentrant returns (uint256) {
uint256 tokenTotalSupply = _tokenTotalSupply();
// it's possible for the balance to be slightly less due to rounding errors in the underlying yield source
uint256 currentBalance = _balance();
uint256 totalInterest = (currentBalance > tokenTotalSupply) ? currentBalance.sub(tokenTotalSupply) : 0;
uint256 unaccountedPrizeBalance = (totalInterest > _currentAwardBalance) ? totalInterest.sub(_currentAwardBalance) : 0;
if (unaccountedPrizeBalance > 0) {
uint256 reserveFee = calculateReserveFee(unaccountedPrizeBalance);
if (reserveFee > 0) {
reserveTotalSupply = reserveTotalSupply.add(reserveFee);
unaccountedPrizeBalance = unaccountedPrizeBalance.sub(reserveFee);
emit ReserveFeeCaptured(reserveFee);
}
_currentAwardBalance = _currentAwardBalance.add(unaccountedPrizeBalance);
emit AwardCaptured(unaccountedPrizeBalance);

SLOC Appendix

Solidity Contracts

Language

Files

Lines

Blanks

Comments

Code

Complexity

Solidity

55

5899

901

1189

3809

338

Comments to Code 1189/3809 = 31%

Javascript Tests

Language

Files

Lines

Blanks

Comments

Code

Complexity

JavaScript

95

8883

1923

511

6449

127

Tests to Code 6449/ 3809 = 170%