🎩Senator Votes Extension
Keeping the records in the Senate
The Votes Implementation
In the Monolithic DAO structure, for a token to be governed it must implement the Votes extension. The Votes extension keeps a record of voting power through time that is used by the Governor to check on member votes at proposal snapshot block.
It means that, every time a member interacts with the Governor contract, a external call is made to the token contract to check his voting weight.
One external call is acceptable, but N external calls, witch is the case of Senate pattern, can make the costs exponentially high.
Each External calls in transactions costs gas 😱
To solve this problem, we created the SenatorVotes Extension.
WTF?
This extension is fully built upon Votes extension from Openzeppelin, with one additional voting delegation to the Senate Books at the transfer process.
This way, all interactions with the Chancellor contract (Senate version of Governor) consults its internal books without the need to make a external call to the token contracts.
This way, no matter how much members (tokens) the senate has, the gas cost for interacting with the Senate/Chancellor contract will not rise.
For that to be possible, on top of the local delegation made in the token contract on token transfer, the SenatorVotes will make one external call to the Senate informing of the voting weight movement.
This increases around 76% of the base cost of token transfer, which is not expensive.
At 20 GWEI gas price, a basic ERC721Votes Safe Transfer (safeTransferFrom) costs 0.00282734 eth.
At same gas price, the basic ERC721SenatorVotes Safe Transfer costs 0.00500394 eth.
How to Use?
To use it you just need to import the ERC721SenatorVotes.sol and use it with your ERC721 contract, to whom he is totally compatible.
As for now (v1.0) we only have the extension for ERC721 tokens, but we intend to create the extension for ERC20 tokens in the future.
Can Old Dogs learn New tricks?
Can tokens already published with the Votes extension participate in a Senate?
But in the case of members that implements the Votes pattern, Senate have to make external call to get voting weight, getting us to the previous scenario of exponential increase of gas cost upon interaction with the DAO contracts.
Don't know if will participate in a senate in the future? Use our extension. Is compatible with Votes extension too. 😉
Last updated