PaladinRewardReserve's approvals break if the same contract is in charge of two tokens (e.g. a PalPool)
The approvedSpenders mapping only takes in a spender, rather than both a spender and a token. Approval for one token means approval for all tokens the account controls. Removal for one means removal for all.
mapping(address => address) public delegates;
/** @notice List of Vote checkpoints for each user */
mapping(address => Checkpoint[]) public checkpoints;
/** @notice List of Delegate checkpoints for each user */
mapping(address => DelegateCheckpoint[]) public delegateCheckpoints;
mapping(address => uint256) public userRewardIndex;
/** @notice Current amount of rewards claimable for the user */
mapping(address => uint256) public claimableRewards;
/** @notice Timestamp of last update for user rewards */
mapping(address => uint256) public rewardsLastUpdate;
mapping(address => uint256) public userCurrentBonusRatio;
/** @notice Value by which user Bonus Ratio decrease each second */
mapping(address => uint256) public userBonusRatioDecrease;
Non-library/interface files should use fixed compiler versions, not floating ones
uint256 public constant WEEK = 604800;
/** @notice Seconds in a Month */
uint256 public constant MONTH = 2629800;
/** @notice 1e18 scale */
uint256 public constant UNIT = 1e18;
/** @notice Max BPS value (100%) */
uint256 public constant MAX_BPS = 10000;
/** @notice Seconds in a Year */
uint256 public constant ONE_YEAR = 31557600;
/** @notice Period to wait before unstaking tokens */
uint256 public constant COOLDOWN_PERIOD = 864000; // 10 days
/** @notice Duration of the unstaking period
After that period, unstaking cooldown is expired */
uint256 public constant UNSTAKE_PERIOD = 432000; // 5 days
/** @notice Period to unlock/re-lock tokens without possibility of punishement */
uint256 public constant UNLOCK_DELAY = 1209600; // 2 weeks
/** @notice Minimum duration of a Lock */
uint256 public constant MIN_LOCK_DURATION = 7889400; // 3 months
/** @notice Maximum duration of a Lock */
uint256 public constant MAX_LOCK_DURATION = 63115200; // 2 years
Low Risk Issues
PaladinRewardReserve
's approvals break if the same contract is in charge of two tokens (e.g. a PalPool)The
approvedSpenders
mapping only takes in a spender, rather than both a spender and a token. Approval for one token means approval for all tokens the account controls. Removal for one means removal for all.Non-critical Issues
require()
/revert()
statements should have descriptive reason stringsconstant
s should be defined rather than using magic numbersThe
nonReentrant
modifier
should occur before all other modifiersThis is a best-practice to protect against reentrancy in other modifiers
safeApprove()
is deprecatedDeprecated in favor of
safeIncreaseAllowance()
andsafeDecreaseAllowance()
Multiple
address
mappings can be combined into a singlemapping
of anaddress
to astruct
, where appropriateFile: contracts/HolyPaladinToken.sol (lines 88-94)
Non-library/interface files should use fixed compiler versions, not floating ones
Use the same solidity version in all non-library/interface files
Use native time units such as seconds, minutes, hours, days, weeks and years, rather than numbers of seconds
File: contracts/HolyPaladinToken.sol (lines 17-39)
Typos
File: contracts/HolyPaladinToken.sol (line 33)
punishement
File: contracts/HolyPaladinToken.sol (line 59)
trancking
File: contracts/HolyPaladinToken.sol (line 110)
Timstamp
File: contracts/HolyPaladinToken.sol (line 113)
distriubted
File: contracts/HolyPaladinToken.sol (line 239)
ot
File: contracts/HolyPaladinToken.sol (line 258)
deelegate
File: contracts/HolyPaladinToken.sol (line 421)
fo
File: contracts/HolyPaladinToken.sol (line 706)
transfered
File: contracts/HolyPaladinToken.sol (line 802)
avaialable
File: contracts/HolyPaladinToken.sol (line 840)
rpevious
File: contracts/HolyPaladinToken.sol (line 1323)
chekpoint
File: contracts/PaladinRewardReserve.sol (line 19)
spander
Event is missing
indexed
fieldsEach
event
should use threeindexed
fields if there are three or more fields