Paladin - Warden Pledges contest - 0xRoxas's results

A governance lending protocol transforming users voting power into a new money lego.

General Information

Platform: Code4rena

Start Date: 27/10/2022

Pot Size: $33,500 USDC

Total HM: 8

Participants: 96

Period: 3 days

Judge: kirk-baird

Total Solo HM: 1

Id: 176

League: ETH

Paladin

Findings Distribution

Researcher Performance

Rank: 85/96

Findings: 1

Award: $11.52

Gas:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Gas Report

Optimizations found [3]

[G-01] Variable Can be Made Constant to Save Gas

Variables that are the same value no matter the context can be made constant to save gas.

minDelegationTime can be made constant. If it is not called by other functions (it is constant now so it won't need to be) it can also be made private to save more gas.

Findings [1]:

/contracts/WardenPledge.sol Line(s): 79

79:	uint256 public minDelegationTime = 1 weeks;

[G-02] Variable Can be Made Immutable to Save Gas

If a variable is only initialized in the constructor of a function it can be made immutable to save gas.

Example:

60:	IVotingEscrow public votingEscrow;

to

60:	IVotingEscrow public immutable votingEscrow;
Findings [2]:

/contracts/WardenPledge.sol Line(s): 60, 62

60:	IVotingEscrow public votingEscrow;
62:	IBoostV2 public delegationBoost;

[G-03] Using unchecked when Arithmetic Cnnot Oerflow Saves gas

There are mutliple occurances where arithmetic is performed that cannot overflow / underflow based on a previous require. Adding an unchecked brace around these occurances will save gas (Solidity will not force an underflow / overflow).

NOTE: Findings show the check before each line that allows the second line to be unchecked. Only the line following the check should be unchecked (NOT the check itself).

unchecked {
	//Code
}
Findings [3]:

/contracts/WardenPledge.sol Line(s): 267-268, 383-385, 429/431

267:	ewardAmount > pledgeAvailableRewardAmounts[pledgeId]) revert Errors.RewardsBalanceTooLow();
268:	eAvailableRewardAmounts[pledgeId] -= rewardAmount;
383:	if(newEndTimestamp != _getRoundedTimestamp(newEndTimestamp) || newEndTimestamp < oldEndTimestamp) revert Errors.InvalidEndTimestamp();
385:	uint256 addedDuration = newEndTimestamp - oldEndTimestamp;
429:	if(newRewardPerVote <= oldRewardPerVote) revert Errors.RewardsPerVotesTooLow();
431:	uint256 rewardPerVoteDiff = newRewardPerVote - oldRewardPerVote;

#0 - c4-judge

2022-11-12T00:47:53Z

kirk-baird marked the issue as grade-b

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter