This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-Add SingleBalancedVault and Tests
- Loading branch information
Showing
6 changed files
with
1,902 additions
and
10 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
packages/perennial-vaults/contracts/interfaces/ISingleBalancedVault.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
//SPDX-License-Identifier: Apache-2.0 | ||
pragma solidity ^0.8.13; | ||
|
||
import "@equilibria/perennial/contracts/interfaces/IController.sol"; | ||
import "@equilibria/perennial/contracts/interfaces/ICollateral.sol"; | ||
import "@equilibria/root/number/types/UFixed18.sol"; | ||
|
||
interface ISingleBalancedVault { | ||
|
||
/* BalancedVault Interface */ | ||
|
||
struct Version { | ||
UFixed18 longPosition; | ||
UFixed18 shortPosition; | ||
UFixed18 totalShares; | ||
UFixed18 longAssets; | ||
UFixed18 shortAssets; | ||
UFixed18 totalAssets; | ||
} | ||
|
||
struct VersionContext { | ||
uint256 version; | ||
UFixed18 latestCollateral; | ||
UFixed18 latestShares; | ||
} | ||
|
||
event Deposit(address indexed sender, address indexed account, uint256 version, UFixed18 assets); | ||
event Redemption(address indexed sender, address indexed account, uint256 version, UFixed18 shares); | ||
event Claim(address indexed sender, address indexed account, UFixed18 assets); | ||
event PositionUpdated(IProduct product, UFixed18 targetPosition); | ||
event CollateralUpdated(IProduct product, UFixed18 targetCollateral); | ||
|
||
error BalancedVaultDepositLimitExceeded(); | ||
error BalancedVaultRedemptionLimitExceeded(); | ||
|
||
function initialize(string memory name_, string memory symbol_) external; | ||
function sync() external; | ||
function controller() external view returns (IController); | ||
function collateral() external view returns (ICollateral); | ||
function long() external view returns (IProduct); | ||
function short() external view returns (IProduct); | ||
function targetLeverage() external view returns (UFixed18); | ||
function maxCollateral() external view returns (UFixed18); | ||
function unclaimed(address account) external view returns (UFixed18); | ||
function totalUnclaimed() external view returns (UFixed18); | ||
function claim(address account) external; | ||
|
||
/* Partial ERC4626 Interface */ | ||
|
||
function asset() external view returns (Token18); | ||
function totalAssets() external view returns (UFixed18); | ||
function convertToShares(UFixed18 assets) external view returns (UFixed18); | ||
function convertToAssets(UFixed18 shares) external view returns (UFixed18); | ||
function maxDeposit(address account) external view returns (UFixed18); | ||
function deposit(UFixed18 assets, address account) external; | ||
function maxRedeem(address account) external view returns (UFixed18); | ||
function redeem(UFixed18 shares, address account) external; | ||
|
||
/* Partial ERC20 Interface */ | ||
|
||
event Transfer(address indexed from, address indexed to, UFixed18 value); | ||
event Approval(address indexed account, address indexed spender, UFixed18 value); | ||
|
||
function name() external view returns (string memory); | ||
function symbol() external view returns (string memory); | ||
function decimals() external view returns (uint8); | ||
function totalSupply() external view returns (UFixed18); | ||
function balanceOf(address account) external view returns (UFixed18); | ||
function transfer(address to, UFixed18 amount) external returns (bool); | ||
function allowance(address account, address spender) external view returns (UFixed18); | ||
function approve(address spender, UFixed18 amount) external returns (bool); | ||
function transferFrom(address from, address to, UFixed18 amount) external returns (bool); | ||
} |
Oops, something went wrong.