-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDepositToken.sol
59 lines (49 loc) · 1.62 KB
/
DepositToken.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
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "./Interfaces.sol";
import "@openzeppelin/contracts-0.6/math/SafeMath.sol";
import "@openzeppelin/contracts-0.6/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts-0.6/utils/Address.sol";
import "@openzeppelin/contracts-0.6/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts-0.6/token/ERC20/ERC20.sol";
/**
* @title DepositToken
* @author ConvexFinance
* @notice Simply creates a token that can be minted and burned from the operator
*/
contract DepositToken is ERC20 {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
address public operator;
/**
* @param _operator Booster
* @param _lptoken Underlying LP token for deposits
* @param _namePostfix Postfixes lpToken name
* @param _symbolPrefix Prefixed lpToken symbol
*/
constructor(
address _operator,
address _lptoken,
string memory _namePostfix,
string memory _symbolPrefix
)
public
ERC20(
string(
abi.encodePacked(ERC20(_lptoken).name(), _namePostfix)
),
string(abi.encodePacked(_symbolPrefix, ERC20(_lptoken).symbol()))
)
{
operator = _operator;
}
function mint(address _to, uint256 _amount) external {
require(msg.sender == operator, "!authorized");
_mint(_to, _amount);
}
function burn(address _from, uint256 _amount) external {
require(msg.sender == operator, "!authorized");
_burn(_from, _amount);
}
}