-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathBondPool.sol
More file actions
40 lines (33 loc) · 1.24 KB
/
BondPool.sol
File metadata and controls
40 lines (33 loc) · 1.24 KB
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./BondPoolBase.sol";
contract BondPool is BondPoolBase {
using BondPoolLibV1 for IStore;
using ValidationLibV1 for IStore;
constructor(IStore s) BondPoolBase(s) {} //solhint-disable-line
/**
* @dev Create a new bond contract by supplying your LP tokens
*
* @custom:suppress-acl This is a publicly accessible feature
*
*/
function createBond(uint256 lpTokens, uint256 minNpmDesired) external override nonReentrant {
s.mustNotBePaused();
require(lpTokens > 0, "Please specify `lpTokens`");
require(minNpmDesired > 0, "Please enter `minNpmDesired`");
(uint256 npmToVest, uint256 unlockDate) = s.createBondInternal(lpTokens, minNpmDesired);
emit BondCreated(msg.sender, lpTokens, npmToVest, unlockDate);
}
/**
* @dev Claim your bond and receive your NPM tokens after waiting period
*
* @custom:suppress-acl This is a publicly accessible feature
*
*/
function claimBond() external override nonReentrant {
s.mustNotBePaused();
// @suppress-zero-value-check The uint values are validated in the function `claimBondInternal`
uint256 npmTransferred = s.claimBondInternal();
emit BondClaimed(msg.sender, npmTransferred);
}
}