-
Notifications
You must be signed in to change notification settings - Fork 35
/
BondPoolBase.sol
59 lines (49 loc) · 1.61 KB
/
BondPoolBase.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.8.0;
import "../../interfaces/IStore.sol";
import "../../interfaces/IBondPool.sol";
import "../../libraries/BondPoolLibV1.sol";
import "../../core/Recoverable.sol";
abstract contract BondPoolBase is IBondPool, Recoverable {
using AccessControlLibV1 for IStore;
using BondPoolLibV1 for IStore;
using PriceLibV1 for IStore;
using ValidationLibV1 for IStore;
constructor(IStore s) Recoverable(s) {} //solhint-disable-line
function getNpmMarketPrice() external view override returns (uint256) {
return s.getNpmPriceInternal(1 ether);
}
function calculateTokensForLp(uint256 lpTokens) external view override returns (uint256) {
return s.calculateTokensForLpInternal(lpTokens);
}
/**
* @dev Gets the bond pool information
*
*/
function getInfo(address forAccount) external view override returns (BondPoolInfoType memory) {
return s.getBondPoolInfoInternal(forAccount);
}
/**
* @dev Sets up the bond pool
*
*/
function setup(SetupBondPoolArgs calldata args) external override nonReentrant {
// @suppress-zero-value-check The uint values are checked in the function `setupBondPoolInternal`
s.mustNotBePaused();
AccessControlLibV1.mustBeLiquidityManager(s);
s.setupBondPoolInternal(args);
emit BondPoolSetup(args);
}
/**
* @dev Version number of this contract
*/
function version() external pure override returns (bytes32) {
return "v0.1";
}
/**
* @dev Name of this contract
*/
function getName() external pure override returns (bytes32) {
return ProtoUtilV1.CNAME_BOND_POOL;
}
}