Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vault share pricing and unmatured position valuation #4

Merged
merged 15 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
357 changes: 325 additions & 32 deletions contracts/Everlong.sol

Large diffs are not rendered by default.

31 changes: 23 additions & 8 deletions contracts/interfaces/IEverlong.sol
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;

import { IERC4626 } from "openzeppelin/interfaces/IERC4626.sol";
import { ERC4626 } from "solady/tokens/ERC4626.sol";
import { IEverlongAdmin } from "./IEverlongAdmin.sol";
import { IEverlongEvents } from "./IEverlongEvents.sol";
import { IEverlongPositions } from "./IEverlongPositions.sol";
import { IEverlongPortfolio } from "./IEverlongPortfolio.sol";

interface IEverlong is
abstract contract IEverlong is
ERC4626,
IEverlongAdmin,
IERC4626,
IEverlongEvents,
IEverlongPositions
IEverlongPortfolio
{
// ╭─────────────────────────────────────────────────────────╮
// │ Structs │
// ╰─────────────────────────────────────────────────────────╯

/// @notice Tracks the total amount of bonds managed by Everlong
/// with the same maturity.
struct Position {
/// @notice Time when the position matures.
uint128 maturityTime;
/// @notice Quantity of bonds in the position.
uint128 bondAmount;
/// @notice Vault share price at time of purchase.
uint128 vaultSharePrice;
mcclurejt marked this conversation as resolved.
Show resolved Hide resolved
}

// ╭─────────────────────────────────────────────────────────╮
// │ Getters │
// ╰─────────────────────────────────────────────────────────╯

/// @notice Gets the address of the underlying Hyperdrive Instance
function hyperdrive() external view returns (address);
function hyperdrive() external view virtual returns (address);

/// @notice Gets the Everlong instance's kind.
/// @return The Everlong instance's kind.
function kind() external pure returns (string memory);
function kind() external pure virtual returns (string memory);

/// @notice Gets the Everlong instance's version.
/// @return The Everlong instance's version.
function version() external pure returns (string memory);
function version() external pure virtual returns (string memory);

// ╭─────────────────────────────────────────────────────────╮
// │ Errors │
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.20;

import { Position } from "../types/Position.sol";
import { IEverlong } from "./IEverlong.sol";

interface IEverlongPositions {
interface IEverlongPortfolio {
// ╭─────────────────────────────────────────────────────────╮
// │ Stateful │
// ╰─────────────────────────────────────────────────────────╯
Expand All @@ -17,15 +17,15 @@ interface IEverlongPositions {

/// @notice Gets the number of positions managed by the Everlong instance.
/// @return The number of positions.
function getPositionCount() external view returns (uint256);
function positionCount() external view returns (uint256);

/// @notice Gets the position at an index.
/// Position `maturityTime` increases with each index.
/// @param _index The index of the position.
/// @return The position.
function getPosition(
function positionAt(
uint256 _index
) external view returns (Position memory);
) external view returns (IEverlong.Position memory);

/// @notice Determines whether any positions are matured.
/// @return True if any positions are matured, false otherwise.
Expand All @@ -34,7 +34,7 @@ interface IEverlongPositions {
/// @notice Determines whether Everlong has sufficient excess liquidity
/// for opening a long.
/// @return True if sufficient excess liquidity, false otherwise.
function hasSufficientExcessLiquidity() external view returns (bool);
// function hasSufficientExcessLiquidity() external view returns (bool);

/// @notice Determines whether Everlong's portfolio can currently be rebalanced.
/// @return True if the portfolio can be rebalanced, false otherwise.
Expand Down
45 changes: 0 additions & 45 deletions contracts/internal/EverlongAdmin.sol

This file was deleted.

Loading
Loading