-
Notifications
You must be signed in to change notification settings - Fork 8
/
VOTES.sol
64 lines (52 loc) · 1.98 KB
/
VOTES.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity 0.8.15;
import {ERC20} from "solmate/tokens/ERC20.sol";
import "src/Kernel.sol";
error VOTES_TransferDisabled();
/// @notice Votes module is the ERC20 token that represents voting power in the network.
/// @dev This is currently a substitute module that stubs gOHM.
contract OlympusVotes is Module, ERC20 {
/*//////////////////////////////////////////////////////////////
MODULE INTERFACE
//////////////////////////////////////////////////////////////*/
constructor(Kernel kernel_)
Module(kernel_)
ERC20("OlympusDAO Dummy Voting Tokens", "VOTES", 0)
{}
/// @inheritdoc Module
function KEYCODE() public pure override returns (Keycode) {
return toKeycode("VOTES");
}
/// @inheritdoc Module
function VERSION() external pure override returns (uint8 major, uint8 minor) {
return (1, 0);
}
/*//////////////////////////////////////////////////////////////
CORE LOGIC
//////////////////////////////////////////////////////////////*/
function mintTo(address wallet_, uint256 amount_) external permissioned {
_mint(wallet_, amount_);
}
function burnFrom(address wallet_, uint256 amount_) external permissioned {
_burn(wallet_, amount_);
}
/// @notice Transfers are locked for this token.
// solhint-disable-next-line no-unused-vars
function transfer(address to_, uint256 amount_) public pure override returns (bool) {
revert VOTES_TransferDisabled();
return true;
}
/// @notice TransferFrom is only allowed by permissioned policies.
function transferFrom(
address from_,
address to_,
uint256 amount_
) public override permissioned returns (bool) {
balanceOf[from_] -= amount_;
unchecked {
balanceOf[to_] += amount_;
}
emit Transfer(from_, to_, amount_);
return true;
}
}