Skip to content

Commit

Permalink
fix: imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Grimal committed Oct 11, 2024
1 parent 06234f9 commit 03ab532
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/DelegatesContracts/DelegatesUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

pragma solidity ^0.8.20;

import {IVotes} from
"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/governance/utils/IVotes.sol";
import {IDelegates} from "./IDelegates.sol";
import {ECDSA} from
"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts//contracts/utils/cryptography/ECDSA.sol";
import {ContextUpgradeable} from "lib/openzeppelin-contracts-upgradeable/contracts//utils/ContextUpgradeable.sol";
import {NoncesUpgradeable} from "lib/openzeppelin-contracts-upgradeable/contracts//utils/NoncesUpgradeable.sol";
"lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol";
import {ContextUpgradeable} from "lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol";
import {NoncesUpgradeable} from "lib/openzeppelin-contracts-upgradeable/contracts/utils/NoncesUpgradeable.sol";
import {EIP712Upgradeable} from
"lib/openzeppelin-contracts-upgradeable/contracts/utils/cryptography/EIP712Upgradeable.sol";
import {Initializable} from "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";
Expand All @@ -17,7 +16,7 @@ abstract contract DelegatesUpgradeable is
ContextUpgradeable,
EIP712Upgradeable,
NoncesUpgradeable,
IVotes
IDelegates
{
bytes32 private constant DELEGATION_TYPEHASH =
keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
Expand Down Expand Up @@ -79,7 +78,7 @@ abstract contract DelegatesUpgradeable is
virtual
{
if (block.timestamp > expiry) {
revert VotesExpiredSignature(expiry);
revert DelegatesExpiredSignature(expiry);
}
address signer = ECDSA.recover(
_hashTypedDataV4(keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry))), v, r, s
Expand Down
39 changes: 39 additions & 0 deletions src/DelegatesContracts/IDelegates.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IDelegates {
/**
* @dev The signature used has expired.
*/
error DelegatesExpiredSignature(uint256 expiry);

/**
* @dev Emitted when an account changes their delegate.
*/
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);

/**
* @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of voting units.
*/
event DelegateVotesChanged(address indexed delegate, uint256 previousVotes, uint256 newVotes);

/**
* @dev Returns the current amount of votes that `account` has.
*/
function getVotes(address account) external view returns (uint256);

/**
* @dev Returns the delegate that `account` has chosen.
*/
function delegates(address account) external view returns (address);

/**
* @dev Delegates votes from the sender to `delegatee`.
*/
function delegate(address delegatee) external;

/**
* @dev Delegates votes from signer to `delegatee`.
*/
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external;
}

0 comments on commit 03ab532

Please # to comment.