-
Notifications
You must be signed in to change notification settings - Fork 7
/
DelegationSurrogate.sol
29 lines (27 loc) · 1.5 KB
/
DelegationSurrogate.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.23;
import {IERC20Delegates} from "src/interfaces/IERC20Delegates.sol";
/// @title DelegationSurrogate
/// @author ScopeLift
/// @notice A dead-simple contract whose only purpose is to hold governance tokens on behalf of
/// users while delegating voting power to one specific delegatee. This is needed because a single
/// address can only delegate its (full) token weight to a single address at a time. Thus, when a
/// contract holds governance tokens in a pool on behalf of disparate token holders, those holders
/// are typically disenfranchised from their governance rights.
///
/// If a pool contract deploys a DelegationSurrogate for each delegatee, and transfers each
/// depositor's tokens to the appropriate surrogate—or deploys it on their behalf—users can retain
/// their governance rights.
///
/// The pool contract deploying the surrogates must handle all accounting. The surrogate simply
/// delegates its voting weight and max-approves its deployer to allow tokens to be reclaimed.
contract DelegationSurrogate {
/// @param _token The governance token that will be held by this surrogate
/// @param _delegatee The address of the would-be voter to which this surrogate will delegate its
/// voting weight. 100% of all voting tokens held by this surrogate will be delegated to this
/// address.
constructor(IERC20Delegates _token, address _delegatee) {
_token.delegate(_delegatee);
_token.approve(msg.sender, type(uint256).max);
}
}