-
Notifications
You must be signed in to change notification settings - Fork 6
/
bBTC.sol
42 lines (32 loc) · 1.02 KB
/
bBTC.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
// SPDX-License-Identifier: MIT
pragma solidity 0.6.11;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ICore} from "./interfaces/ICore.sol";
import {IbBTC} from "./interfaces/IbBTC.sol";
contract bBTC is ERC20, IbBTC {
address public core;
constructor(address _core)
public
ERC20("Interest-Bearing BTC", "ibBTC")
{
require(_core != address(0), "NULL_ADDRESS");
core = _core;
}
modifier onlyCore() {
require(msg.sender == core, "bBTC: NO_AUTH");
_;
}
function mint(address account, uint amount) override external onlyCore {
_mint(account, amount);
}
function burn(address account, uint amount) override external onlyCore {
_burn(account, amount);
}
function switchCore(address _core) external onlyCore {
require(_core != address(0), "NULL_ADDRESS");
core = _core;
}
function pricePerShare() external view returns (uint) {
return ICore(core).pricePerShare();
}
}