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: 32/54
Findings: 1
Award: $10.69
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: polarzero
Also found by: 0x3b, 0xSmartContract, 0xnev, ABA, Bulletprime, J4X, Limbooo, MrPotatoMagic, SBSecurity, Sathish9098, asui, d3e4, hyh, ihtishamsudo, inzinko, marchev, pfapostol, radev_sw, rahul, ro1sharkm
10.6913 USDC - $10.69
The ENSToken allows voting rights to be delegated to another address but its limitation is that it can only be delegated to only one address and the full voting rights of the token holder. Either he delegate his full voting rights or not at all. This is where the multiDelegate comes in.
Multi delegate will allow users to delegate their voting rights to multiple addresses in one transaction and they can also specify how much of the rights to delegate to each address. This is done by creating a proxy contract for every address that the ENSToken holder wants to delegate.
The tokens of the user will have to be transferred to the proxy contract although the main reason of delegate is to still hold the tokens and give only the voting rights to an address. But the user can get his tokens back anytime from the multiDelegate contract.
This means that the users trust the proxy and the multiDelegate contract to handle their tokens securely.
This contract will be created everytime a user wants to delegate to a new address from the multiDelegate contract.
Because the user can specify the amount of tokens to send to the proxy and the address to delegate for that proxy address this is how a user can create multiple proxy contract for multiple address and can give any amount of voting rights.
This is the simple proxy contract with no functions:
contract ERC20ProxyDelegator { constructor(ERC20Votes _token, address _delegate) { _token.approve(msg.sender, type(uint256).max); _token.delegate(_delegate); } }
This will be done by calling the delegateMulti
function in the multiDelegate contract. No value should be passed as the sources and the targets will be the addresses the user wants to delegate to and the amounts are the amount of ENSToken for each addresses to have the voting rights.
When a delegated previously and wants to stop delegating and get back his tokens the user will call the delegateMulti
function by passing the arguments:
A user can also transfer the voting rights from one address to another directly.
This will be done by calling the the delegateMulti
function with the arguments:
* sources - the address the user wants to move the voting rights from.
* targets - the address the user wants to move the voting rights to.
* amounts - how much of the rights to move from sources to targets .
In this process, the given amount of ENSToken tokens will be transfered from the sources to the targets respectively which in turn will change the amount of voting rights. If the target address has never been delegated then a new proxy contract will be created for that target else it will send the ENSToken to the existing proxy to increase the voting rights.
Note: In the above explanation sources or targets are said to be address but it will need to be turned into uint256 first.
The ERC1155 (multiDelegate) token:
The multiDelegate.sol
contract is also an ERC1155 token. This token represents the amount of the ENSTokens and is minted when a user delegate ENSToken(send to the proxy) to an address.
The id of this token will be determined by the given target.
The holder of this token can get back the ENSToken by following the step 2 explained above.
48 hours
#0 - c4-pre-sort
2023-10-14T08:44:40Z
141345 marked the issue as sufficient quality report
#1 - c4-judge
2023-10-24T16:46:28Z
hansfriese marked the issue as grade-b