Last active
August 23, 2021 02:13
-
-
Save alexkroeger/2f2725a64d303c0990206111f6721e29 to your computer and use it in GitHub Desktop.
Uniswap Proposal 8 Contract Diffs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/compound_governorbravodelegate.sol b/uniswap_governorbravodelegate.sol | |
index 7c574ec..2ac6dfe 100644 | |
--- a/compound_governorbravodelegate.sol | |
+++ b/uniswap_governorbravodelegate.sol | |
@@ -6,13 +6,13 @@ import "./GovernorBravoInterfaces.sol"; | |
contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoEvents { | |
/// @notice The name of this contract | |
- string public constant name = "Compound Governor Bravo"; | |
+ string public constant name = "Uniswap Governor Bravo"; | |
/// @notice The minimum setable proposal threshold | |
- uint public constant MIN_PROPOSAL_THRESHOLD = 50000e18; // 50,000 Comp | |
+ uint public constant MIN_PROPOSAL_THRESHOLD = 1000000e18; // 1,000,000 Uni | |
/// @notice The maximum setable proposal threshold | |
- uint public constant MAX_PROPOSAL_THRESHOLD = 100000e18; //100,000 Comp | |
+ uint public constant MAX_PROPOSAL_THRESHOLD = 10000000e18; //10,000,000 Uni | |
/// @notice The minimum setable voting period | |
uint public constant MIN_VOTING_PERIOD = 5760; // About 24 hours | |
@@ -27,7 +27,7 @@ contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoE | |
uint public constant MAX_VOTING_DELAY = 40320; // About 1 week | |
/// @notice The number of votes in support of a proposal required in order for a quorum to be reached and for a vote to succeed | |
- uint public constant quorumVotes = 400000e18; // 400,000 = 4% of Comp | |
+ uint public constant quorumVotes = 40000000e18; // 40,000,000 = 4% of Uni | |
/// @notice The maximum number of actions that can be included in a proposal | |
uint public constant proposalMaxOperations = 10; // 10 actions | |
@@ -41,22 +41,22 @@ contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoE | |
/** | |
* @notice Used to initialize the contract during delegator contructor | |
* @param timelock_ The address of the Timelock | |
- * @param comp_ The address of the COMP token | |
+ * @param uni_ The address of the Uni token | |
* @param votingPeriod_ The initial voting period | |
* @param votingDelay_ The initial voting delay | |
* @param proposalThreshold_ The initial proposal threshold | |
*/ | |
- function initialize(address timelock_, address comp_, uint votingPeriod_, uint votingDelay_, uint proposalThreshold_) public { | |
+ function initialize(address timelock_, address uni_, uint votingPeriod_, uint votingDelay_, uint proposalThreshold_) public { | |
require(address(timelock) == address(0), "GovernorBravo::initialize: can only initialize once"); | |
require(msg.sender == admin, "GovernorBravo::initialize: admin only"); | |
require(timelock_ != address(0), "GovernorBravo::initialize: invalid timelock address"); | |
- require(comp_ != address(0), "GovernorBravo::initialize: invalid comp address"); | |
+ require(uni_ != address(0), "GovernorBravo::initialize: invalid uni address"); | |
require(votingPeriod_ >= MIN_VOTING_PERIOD && votingPeriod_ <= MAX_VOTING_PERIOD, "GovernorBravo::initialize: invalid voting period"); | |
require(votingDelay_ >= MIN_VOTING_DELAY && votingDelay_ <= MAX_VOTING_DELAY, "GovernorBravo::initialize: invalid voting delay"); | |
require(proposalThreshold_ >= MIN_PROPOSAL_THRESHOLD && proposalThreshold_ <= MAX_PROPOSAL_THRESHOLD, "GovernorBravo::initialize: invalid proposal threshold"); | |
timelock = TimelockInterface(timelock_); | |
- comp = CompInterface(comp_); | |
+ uni = UniInterface(uni_); | |
votingPeriod = votingPeriod_; | |
votingDelay = votingDelay_; | |
proposalThreshold = proposalThreshold_; | |
@@ -74,7 +74,7 @@ contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoE | |
function propose(address[] memory targets, uint[] memory values, string[] memory signatures, bytes[] memory calldatas, string memory description) public returns (uint) { | |
// Reject proposals before initiating as Governor | |
require(initialProposalId != 0, "GovernorBravo::propose: Governor Bravo not active"); | |
- require(comp.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold, "GovernorBravo::propose: proposer votes below proposal threshold"); | |
+ require(uni.getPriorVotes(msg.sender, sub256(block.number, 1)) > proposalThreshold, "GovernorBravo::propose: proposer votes below proposal threshold"); | |
require(targets.length == values.length && targets.length == signatures.length && targets.length == calldatas.length, "GovernorBravo::propose: proposal function information arity mismatch"); | |
require(targets.length != 0, "GovernorBravo::propose: must provide actions"); | |
require(targets.length <= proposalMaxOperations, "GovernorBravo::propose: too many actions"); | |
@@ -156,7 +156,7 @@ contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoE | |
require(state(proposalId) != ProposalState.Executed, "GovernorBravo::cancel: cannot cancel executed proposal"); | |
Proposal storage proposal = proposals[proposalId]; | |
- require(msg.sender == proposal.proposer || comp.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold, "GovernorBravo::cancel: proposer above threshold"); | |
+ require(msg.sender == proposal.proposer || uni.getPriorVotes(proposal.proposer, sub256(block.number, 1)) < proposalThreshold, "GovernorBravo::cancel: proposer above threshold"); | |
proposal.canceled = true; | |
for (uint i = 0; i < proposal.targets.length; i++) { | |
@@ -258,7 +258,7 @@ contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoE | |
Proposal storage proposal = proposals[proposalId]; | |
Receipt storage receipt = proposal.receipts[voter]; | |
require(receipt.hasVoted == false, "GovernorBravo::castVoteInternal: voter already voted"); | |
- uint96 votes = comp.getPriorVotes(voter, proposal.startBlock); | |
+ uint96 votes = uni.getPriorVotes(voter, proposal.startBlock); | |
if (support == 0) { | |
proposal.againstVotes = add256(proposal.againstVotes, votes); | |
@@ -318,12 +318,11 @@ contract GovernorBravoDelegate is GovernorBravoDelegateStorageV1, GovernorBravoE | |
/** | |
* @notice Initiate the GovernorBravo contract | |
* @dev Admin only. Sets initial proposal id which initiates the contract, ensuring a continuous proposal id count | |
- * @param governorAlpha The address for the Governor to continue the proposal id count from | |
+ * @param proposalCount proposal id to initialize from | |
*/ | |
- function _initiate(address governorAlpha) external { | |
+ function _initiate(uint proposalCount) external { | |
require(msg.sender == admin, "GovernorBravo::_initiate: admin only"); | |
require(initialProposalId == 0, "GovernorBravo::_initiate: can only initiate once"); | |
- proposalCount = GovernorAlpha(governorAlpha).proposalCount(); | |
initialProposalId = proposalCount; | |
timelock.acceptAdmin(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/compound_governorbravodelegator.sol b/uniswap_governorbravodelegator.sol | |
index bf1211a..d049744 100644 | |
--- a/compound_governorbravodelegator.sol | |
+++ b/uniswap_governorbravodelegator.sol | |
@@ -6,7 +6,7 @@ import "./GovernorBravoInterfaces.sol"; | |
contract GovernorBravoDelegator is GovernorBravoDelegatorStorage, GovernorBravoEvents { | |
constructor( | |
address timelock_, | |
- address comp_, | |
+ address uni_, | |
address admin_, | |
address implementation_, | |
uint votingPeriod_, | |
@@ -18,7 +18,7 @@ contract GovernorBravoDelegator is GovernorBravoDelegatorStorage, GovernorBravoE | |
delegateTo(implementation_, abi.encodeWithSignature("initialize(address,address,uint256,uint256,uint256)", | |
timelock_, | |
- comp_, | |
+ uni_, | |
votingPeriod_, | |
votingDelay_, | |
proposalThreshold_)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment