-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathHyperdriveTarget1.sol
More file actions
80 lines (74 loc) · 3.5 KB
/
HyperdriveTarget1.sol
File metadata and controls
80 lines (74 loc) · 3.5 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.24;
import { IHyperdrive } from "../interfaces/IHyperdrive.sol";
import { IHyperdriveAdminController } from "../interfaces/IHyperdriveAdminController.sol";
import { HyperdriveAdmin } from "../internal/HyperdriveAdmin.sol";
import { HyperdriveCheckpoint } from "../internal/HyperdriveCheckpoint.sol";
import { HyperdriveLong } from "../internal/HyperdriveLong.sol";
import { HyperdriveLP } from "../internal/HyperdriveLP.sol";
import { HyperdriveMultiToken } from "../internal/HyperdriveMultiToken.sol";
import { HyperdrivePair } from "../internal/HyperdrivePair.sol";
import { HyperdriveShort } from "../internal/HyperdriveShort.sol";
import { HyperdriveStorage } from "../internal/HyperdriveStorage.sol";
/// @author DELV
/// @title HyperdriveTarget1
/// @notice Hyperdrive's target 1 logic contract.
/// @custom:disclaimer The language used in this code is for coding convenience
/// only, and is not intended to, and does not, have any
/// particular legal or regulatory significance.
abstract contract HyperdriveTarget1 is
HyperdriveAdmin,
HyperdriveMultiToken,
HyperdriveLP,
HyperdriveLong,
HyperdriveShort,
HyperdrivePair,
HyperdriveCheckpoint
{
/// @notice Instantiates target1.
/// @param _config The configuration of the Hyperdrive pool.
/// @param __adminController The admin controller that will specify the
/// admin parameters for this contract.
constructor(
IHyperdrive.PoolConfig memory _config,
IHyperdriveAdminController __adminController
) HyperdriveStorage(_config, __adminController) {}
/// Shorts ///
/// @notice Closes a short position with a specified maturity time.
/// @param _maturityTime The maturity time of the short.
/// @param _bondAmount The amount of shorts to close.
/// @param _minOutput The minimum output of this trade. The units of this
/// quantity are either base or vault shares, depending on the value
/// of `_options.asBase`.
/// @param _options The options that configure how the trade is settled.
/// @return The proceeds of closing this short. The units of this quantity
/// are either base or vault shares, depending on the value of
/// `_options.asBase`.
function closeShort(
uint256 _maturityTime,
uint256 _bondAmount,
uint256 _minOutput,
IHyperdrive.Options calldata _options
) external returns (uint256) {
return _closeShort(_maturityTime, _bondAmount, _minOutput, _options);
}
/// Longs ///
/// @notice Closes a long position with a specified maturity time.
/// @param _maturityTime The maturity time of the long.
/// @param _bondAmount The amount of longs to close.
/// @param _minOutput The minimum proceeds the trader will accept. The units
/// of this quantity are either base or vault shares, depending on
/// the value of `_options.asBase`.
/// @param _options The options that configure how the trade is settled.
/// @return The proceeds the user receives. The units of this quantity are
/// either base or vault shares, depending on the value of
/// `_options.asBase`.
function closeLong(
uint256 _maturityTime,
uint256 _bondAmount,
uint256 _minOutput,
IHyperdrive.Options calldata _options
) external returns (uint256) {
return _closeLong(_maturityTime, _bondAmount, _minOutput, _options);
}
}