Platform: Code4rena
Start Date: 05/10/2023
Pot Size: $33,050 USDC
Total HM: 1
Participants: 54
Period: 6 days
Judge: hansfriese
Id: 294
League: ETH
Rank: 54/54
Findings: 1
Award: $5.43
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: thekmj
Also found by: 0x3b, 33BYTEZZZ, Bauchibred, Chom, Dravee, J4X, Limbooo, Maroutis, MiloTruck, MrPotatoMagic, SBSecurity, Sathish9098, Tadev, ZanyBonzy, adam-idarrha, adriro, btk, hyh, lukejohn, nmirchev8, peakbolt, radev_sw, rvierdiiev
5.4311 USDC - $5.43
When new proxy for delegate is deployed, then in constructor delegate
function is called. And only after construction, proxy receives tokens. This means that once proxy calls delegate
, then it's balance is likely 0.
In case if there will be voting token with overriden delegate function that doesn't allow delegate when you have 0 balance, then this approach will not work. Then construction of proxy will simply revert. As result someone will need to send 1 wei of tokens to the proxy, before construction, in order to be able to deploy it, which is not convenient.
First transfer tokens and then deploy proxy.
When someone delegates his voting power to delegator, then DelegationProcessed
event should be emitted.
This is done for case, when user transfers voting power from one delegator to another inside _processDelegation
function, but it isn't done, when user deploys new delegator and transfer voting power. Because of that it will be harder to track voting power changes using events.
Also i guess, that in case if user just withdraws from delegator, then even should be emitted as well.
Emit DelegationProcessed
event inside createProxyDelegatorAndTransfer
function.
In order to send voting tokens, ERC20MultiDelegate uses transferFrom
function from ERC20 standart. This function returns bool
value.
However, not all tokens implement that correctly, so sometimes their transferFrom
function returns nothing.
In case such token will be used as token
inside ERC20MultiDelegate, then all calls will revert and contract will not be able to work.
Use SafeERC20
extension from OZ to make transfer calls.
import {Address} from "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; using Address for address;
ERC20MultiDelegate has imported Address and Math library, but they are never used inside the contract. These imports should be removed.
Remove unused libs imports.
#0 - c4-pre-sort
2023-10-13T12:15:05Z
141345 marked the issue as sufficient quality report
#1 - c4-judge
2023-10-24T16:17:04Z
hansfriese marked the issue as grade-b