Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/vectorized/solady
url = https://github.com/vectorized/solady
[submodule "lib/v3-core"]
path = lib/v3-core
url = https://github.com/uniswap/v3-core
135 changes: 135 additions & 0 deletions contracts/interfaces/IEtherexPair.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

interface IEtherexPair {
struct Observation {
uint256 timestamp;
uint256 reserve0Cumulative;
uint256 reserve1Cumulative;
}

event Mint(address indexed sender, uint256 amount0, uint256 amount1);
event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to);
event Swap(
address indexed sender,
uint256 amount0In,
uint256 amount1In,
uint256 amount0Out,
uint256 amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);

function quote(address tokenIn, uint256 amountIn, uint256 granularity)
external
view
returns (uint256 amountOut);
function sample(address tokenIn, uint256 amountIn, uint256 points, uint256 window)
external
view
returns (uint256[] memory);
function current(address tokenIn, uint256 amountIn) external view returns (uint256 amountOut);

function currentCumulativePrices()
external
view
returns (uint256 reserve0Cumulative, uint256 reserve1Cumulative, uint256 blockTimestamp);

function observationLength() external view returns (uint256);

function lastObservation() external view returns (Observation memory);

function observations(uint256 index) external view returns (Observation memory);

/// @notice initialize the pool, called only once programatically
function initialize(address _token0, address _token1, bool _stable) external;

/// @notice calculate the current reserves of the pool and their last 'seen' timestamp
/// @return _reserve0 amount of token0 in reserves
/// @return _reserve1 amount of token1 in reserves
/// @return _blockTimestampLast the timestamp when the pool was last updated
function getReserves()
external
view
returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast);

/// @notice mint the pair tokens (LPs)
/// @param to where to mint the LP tokens to
/// @return liquidity amount of LP tokens to mint
function mint(address to) external returns (uint256 liquidity);

/// @notice burn the pair tokens (LPs)
/// @param to where to send the underlying
/// @return amount0 amount of amount0
/// @return amount1 amount of amount1
function burn(address to) external returns (uint256 amount0, uint256 amount1);

/// @notice direct swap through the pool
function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data)
external;

/// @notice force balances to match reserves, can be used to harvest rebases from rebasing tokens or other external factors
/// @param to where to send the excess tokens to
function skim(address to) external;

/// @notice force reserves to match balances, prevents skim excess if skim is enabled
function sync() external;

/// @notice set the pair fees contract address
function setFeeRecipient(address _pairFees) external;

/// @notice set the feesplit variable
function setFeeSplit(uint256 _feeSplit) external;

/// @notice sets the swap fee of the pair
/// @dev scaled to a max of 50% (500_000/1_000_000)
/// @param _fee the fee
function setFee(uint256 _fee) external;

/// @notice 'mint' the fees as LP tokens
/// @dev this is used for protocol/voter fees
function mintFee() external;

/// @notice calculates the amount of tokens to receive post swap
/// @param amountIn the token amount
/// @param tokenIn the address of the token
function getAmountOut(uint256 amountIn, address tokenIn)
external
view
returns (uint256 amountOut);

/// @notice returns various metadata about the pair
function metadata()
external
view
returns (
uint256 _decimals0,
uint256 _decimals1,
uint256 _reserve0,
uint256 _reserve1,
bool _stable,
address _token0,
address _token1
);

/// @notice returns the feeSplit of the pair
function feeSplit() external view returns (uint256);

/// @notice returns the fee of the pair
function fee() external view returns (uint256);

/// @notice returns the feeRecipient of the pair
function feeRecipient() external view returns (address);

/// @notice returns the token0 of the pair
function token0() external view returns (address);

/// @notice returns the token1 of the pair
function token1() external view returns (address);

/// @notice returns if pair is stable
function stable() external view returns (bool);

/// @notice returns kLast
function kLast() external view returns (uint256);
}
Loading