forked from BeanstalkFarms/Basin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIWellFunction.sol
51 lines (46 loc) · 1.77 KB
/
IWellFunction.sol
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
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
pragma experimental ABIEncoderV2;
/**
* @title IWellFunction
* @notice Defines a relationship between token reserves and LP token supply.
* @dev Well Functions can contain arbitrary logic, but should be deterministic
* if expected to be used alongside a Pump. When interacing with a Well or
* Well Function, always verify that the Well Function is valid.
*/
interface IWellFunction {
/**
* @notice Calculates the `j`th reserve given a list of `reserves` and `lpTokenSupply`.
* @param reserves A list of token reserves. The jth reserve will be ignored, but a placeholder must be provided.
* @param j The index of the reserve to solve for
* @param lpTokenSupply The supply of LP tokens
* @param data Well function data provided on every call
* @return reserve The resulting reserve at the jth index
*/
function calcReserve(
uint[] memory reserves,
uint j,
uint lpTokenSupply,
bytes calldata data
) external view returns (uint reserve);
/**
* @notice Gets the LP token supply given a list of reserves.
* @param reserves A list of token reserves
* @param data Well function data provided on every call
* @return lpTokenSupply The resulting supply of LP tokens
*/
function calcLpTokenSupply(
uint[] memory reserves,
bytes calldata data
) external view returns (uint lpTokenSupply);
/**
* @notice Returns the name of the Well function.
* @dev Used in Well building.
*/
function name() external view returns (string memory);
/**
* @notice Returns the symbol of the Well function.
* @dev Used in Well building.
*/
function symbol() external view returns (string memory);
}