/**
* @notice Amount of Pledges listed in this contract
* @dev Amount of Pledges listed in this contract
* @return uint256: Amount of Pledges listed in this contract
*/
function pledgesIndex() public view returns(uint256){
return pledges.length;
}
Recommendation
Consider changing the name to pledgesLength() or pledgesAmount().
#
NC-2. Order of Functions
Description
According to Style Guide, ordering helps readers identify which functions they can call and to find the constructor and fallback definitions easier.
Functions should be grouped according to their visibility and ordered:
1) constructor
2) receive function (if exists)
3) fallback function (if exists)
4) external
5) public
6) internal
7) private
According to Style Guide, there should be a single space between the control structures if, while, and for and the parenthetic block representing the conditional.
QA Report for Paladin - Warden Pledges contest
Overview
During the audit, 1 low and 5 non-critical issues were found.
Low Risk Findings (1)
L-1. Missing check for zero address
Description
If address(0x0) is set it may cause the contract to revert or work wrong.
Instances
Recommendation
Add checks.
Non-Critical Risk Findings (5)
NC-1. Misleading function name
Instances
Recommendation
Consider changing the name to
pledgesLength()
orpledgesAmount()
.#
NC-2. Order of Functions
Description
According to Style Guide, ordering helps readers identify which functions they can call and to find the constructor and fallback definitions easier.
Functions should be grouped according to their visibility and ordered: 1) constructor 2) receive function (if exists) 3) fallback function (if exists) 4) external 5) public 6) internal 7) private
Instances
Internal function should be after external:
Public function should be after external:
Recommendation
Reorder functions where possible.
#
NC-3. Spaces between the control structures
Description
According to Style Guide, there should be a single space between the control structures
if
,while
, andfor
and the parenthetic block representing the conditional.Instances
if(
for(
Recommendation
Change:
to:
#
NC-4. Maximum line length exceeded
Description
Some lines of code are too long.
Instances
Recommendation
According to Style Guide, maximum suggested line length is 120 characters.
Make the lines shorter.
#
NC-5. Typos
Instances
* @param targetVotes Maximum taget of votes to have (own balacne + delegation) for the receiver
=>target
* @param targetVotes Maximum taget of votes to have (own balacne + delegation) for the receiver
=>balance
* @param maxTotalRewardAmount Maximum total reward amount allowed ot be pulled by this contract
=>to
* @param maxFeeAmount Maximum feeamount allowed ot be pulled by this contract
=>fee amount
* @param maxFeeAmount Maximum feeamount allowed ot be pulled by this contract
=>to
// Add the total reards as available for the Pledge & write Pledge parameters in storage
=>rewards
* @param maxTotalRewardAmount Maximum added total reward amount allowed ot be pulled by this contract
=>to
* @param maxFeeAmount Maximum fee amount allowed ot be pulled by this contract
=>to
* @param pledgeId ID fo the Pledge
=>for
* @param pledgeId ID fo the Pledge to close
=>for
* @param minRewardPerSecond Minmum amount of reward per vote per second for the token
=>Minimum
* @param minRewardsPerSecond Minmum amount of reward per vote per second for each token in the list
=>Minimum
* @param minRewardPerSecond Minmum amount of reward per vote per second for the token
=>Minimum
* @param minRewardPerSecond Minmum amount of reward per vote per second for the token
=>Minimum