-
Notifications
You must be signed in to change notification settings - Fork 12
/
esLBR.sol
44 lines (35 loc) · 1.63 KB
/
esLBR.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
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
/**
* @title esLBR is an ERC20-compliant token, but cannot be transferred and can only be minted through the esLBRMinter contract or redeemed for LBR by destruction.
* - The maximum amount that can be minted through the esLBRMinter contract is 55 million.
* - esLBR can be used for community governance voting.
*/
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import "../interfaces/Iconfigurator.sol";
interface IProtocolRewardsPool {
function refreshReward(address user) external;
}
contract esLBR is ERC20Votes {
Iconfigurator public immutable configurator;
uint256 maxSupply = 100_000_000 * 1e18;
constructor(address _config) ERC20Permit("esLBR") ERC20("esLBR", "esLBR") {
configurator = Iconfigurator(_config);
}
function _transfer(address, address, uint256) internal virtual override {
revert("not authorized");
}
function mint(address user, uint256 amount) external returns (bool) {
require(configurator.tokenMiner(msg.sender), "not authorized");
require(totalSupply() + amount <= maxSupply, "exceeding the maximum supply quantity.");
try IProtocolRewardsPool(configurator.getProtocolRewardsPool()).refreshReward(user) {} catch {}
_mint(user, amount);
return true;
}
function burn(address user, uint256 amount) external returns (bool) {
require(configurator.tokenMiner(msg.sender), "not authorized");
try IProtocolRewardsPool(configurator.getProtocolRewardsPool()).refreshReward(user) {} catch {}
_burn(user, amount);
return true;
}
}