SeawaterAMM
Inherits: ISeawaterAMM
Functions
onlyProxyAdmin
modifier onlyProxyAdmin();
constructor
constructor function, sets proxy details and then forwards to the seawater initialiser
constructor(
address _proxyAdmin,
address _seawaterAdmin,
address _nftManager,
address _emergencyCouncil,
ISeawaterExecutorSwap _executorSwap,
ISeawaterExecutorSwapPermit2A _executorSwapPermit2A,
ISeawaterExecutorQuote _executorQuote,
ISeawaterExecutorPosition _executorPosition,
ISeawaterExecutorUpdatePosition _executorUpdatePosition,
ISeawaterExecutorAdmin _executorAdmin,
ISeawaterExecutorAdjustPosition _executorAdjustPositions,
ISeawaterExecutorSwapPermit2B _executorSwapPermit2B,
ISeawaterExecutorFallback _executorFallback
);
Parameters
Name | Type | Description |
---|---|---|
_proxyAdmin | address | the admin that can control proxy functions (change addresses) |
_seawaterAdmin | address | the admin of the AMM |
_nftManager | address | the account that can transfer position NFTs |
_emergencyCouncil | address | |
_executorSwap | ISeawaterExecutorSwap | the deployed code for the swap executor |
_executorSwapPermit2A | ISeawaterExecutorSwapPermit2A | the deployed code for the swap_permit2 executor (facet A) |
_executorQuote | ISeawaterExecutorQuote | the deployed code for the quote executor |
_executorPosition | ISeawaterExecutorPosition | the deployed code for the positions executor |
_executorUpdatePosition | ISeawaterExecutorUpdatePosition | |
_executorAdmin | ISeawaterExecutorAdmin | the deployed code for the admin executor |
_executorAdjustPositions | ISeawaterExecutorAdjustPosition | the deployed code for the adjust positions executor |
_executorSwapPermit2B | ISeawaterExecutorSwapPermit2B | the deployed code for the swap_permit2 executor (facet B) |
_executorFallback | ISeawaterExecutorFallback | an address that functions not matching a specific executor get set to |
updateProxyAdmin
updates the proxy admin. only usable by the proxy admin
function updateProxyAdmin(address newAdmin) public onlyProxyAdmin;
Parameters
Name | Type | Description |
---|---|---|
newAdmin | address | the new proxy admin to set |
directDelegate
function directDelegate(address to) internal;
createPool653F395E
initialises a new pool. only usable by the seawater admin
function createPool653F395E(address, uint256, uint32) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint256 | |
<none> | uint32 |
collectProtocol7540FA9F
collects protocol fees. only usable by the seawater admin
function collectProtocol7540FA9F(address, uint128, uint128, address) external returns (uint128, uint128);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint128 | |
<none> | uint128 | |
<none> | address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint128 | the amount of token0 and token1 fees collected |
<none> | uint128 |
enablePool579DA658
enables or disables a pool
function enablePool579DA658(address, bool) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | bool |
authoriseEnabler5B17C274
authorise an address to create and enable pools on its own
function authoriseEnabler5B17C274(address, bool) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | bool |
setSqrtPriceFF4DB98C
set the sqrt price for a pool in the event of misconfiguration.
function setSqrtPriceFF4DB98C(address, uint256) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint256 |
updateNftManager9BDF41F6
set the NFT manager.
function updateNftManager9BDF41F6(address) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
updateSeawaterAdminD25D364D
set the new admin.
function updateSeawaterAdminD25D364D(address) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
updateEmergencyCouncil7D0C1C58
updateEmergencyCouncil to a new address.
function updateEmergencyCouncil7D0C1C58(address) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
swap904369BE
swaps within a pool
function swap904369BE(address, bool, int256, uint256) external returns (int256, int256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | bool | |
<none> | int256 | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | int256 | (token0, token1) delta |
<none> | int256 |
quote72E2ADE7
reverts with the expected amount of fUSDC or pool token for a swap with the given parameters
function quote72E2ADE7(address, bool, int256, uint256) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | bool | |
<none> | int256 | |
<none> | uint256 |
quote2CD06B86E
reverts with the expected amount of tokenOut for a 2-token swap with the given parameters
function quote2CD06B86E(address, address, uint256, uint256) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | address | |
<none> | uint256 | |
<none> | uint256 |
swapPermit2EE84AD91
swaps within a pool using permit2 for token transfers
function swapPermit2EE84AD91(address, bool, int256, uint256, uint256, uint256, uint256, bytes memory)
external
returns (int256, int256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | bool | |
<none> | int256 | |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 | |
<none> | bytes |
Returns
Name | Type | Description |
---|---|---|
<none> | int256 | (token0, token1) delta |
<none> | int256 |
swap2ExactInPermit254A7DBB1
performs a two stage swap across two pools using permit2 for token transfers
function swap2ExactInPermit254A7DBB1(address, address, uint256, uint256, uint256, uint256, bytes memory)
external
returns (uint256, uint256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | address | |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 | |
<none> | bytes |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | (amount in, amount out) |
<none> | uint256 |
swap2ExactIn41203F1D
performs a two stage swap across two pools
function swap2ExactIn41203F1D(address, address, uint256, uint256) external returns (uint256, uint256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | address | |
<none> | uint256 | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | (amount in, amount out) |
<none> | uint256 |
swapIn32502CA71
swaps _token for USDC
function swapIn32502CA71(address token, uint256 amountIn, uint256 minOut) external returns (int256, int256);
Parameters
Name | Type | Description |
---|---|---|
token | address | |
amountIn | uint256 | |
minOut | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | int256 | amount of usdc out |
<none> | int256 |
swapInPermit2CEAAB576
swaps _token for USDC
function swapInPermit2CEAAB576(
address token,
uint256 amountIn,
uint256 minOut,
uint256 nonce,
uint256 deadline,
uint256 maxAmount,
bytes memory sig
) external returns (int256, int256);
Parameters
Name | Type | Description |
---|---|---|
token | address | |
amountIn | uint256 | |
minOut | uint256 | |
nonce | uint256 | |
deadline | uint256 | |
maxAmount | uint256 | |
sig | bytes |
Returns
Name | Type | Description |
---|---|---|
<none> | int256 | amount of usdc out |
<none> | int256 |
swapOut5E08A399
swaps USDC for _token
function swapOut5E08A399(address token, uint256 amountIn, uint256 minOut) external returns (int256, int256);
Parameters
Name | Type | Description |
---|---|---|
token | address | |
amountIn | uint256 | |
minOut | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | int256 | amount of token out |
<none> | int256 |
swapOutPermit23273373B
swaps USDC for _token
function swapOutPermit23273373B(
address token,
uint256 amountIn,
uint256 minOut,
uint256 nonce,
uint256 deadline,
uint256 maxAmount,
bytes memory sig
) external returns (int256, int256);
Parameters
Name | Type | Description |
---|---|---|
token | address | |
amountIn | uint256 | |
minOut | uint256 | |
nonce | uint256 | |
deadline | uint256 | |
maxAmount | uint256 | |
sig | bytes |
Returns
Name | Type | Description |
---|---|---|
<none> | int256 | amount of token out |
<none> | int256 |
mintPositionBC5B086D
creates a new position
function mintPositionBC5B086D(address, int32, int32) external returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | int32 | |
<none> | int32 |
positionOwnerD7878480
gets the owner of a position
function positionOwnerD7878480(uint256) external returns (address);
Parameters
Name | Type | Description |
---|---|---|
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | address | the owner of the position |
transferPositionEEC7A3CD
transferPosition transfers a position. usable only by the NFT manager
function transferPositionEEC7A3CD(uint256, address, address) external;
Parameters
Name | Type | Description |
---|---|---|
<none> | uint256 | |
<none> | address | |
<none> | address |
positionBalance4F32C7DB
gets the number of positions owned by a user
function positionBalance4F32C7DB(address) external returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | the number of positions owned by the user |
positionLiquidity8D11C045
gets the amount of liquidity in a position
function positionLiquidity8D11C045(address, uint256) external returns (uint128);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint128 | the amount of liquidity contained in the position |
positionTickLower2F77CCE1
get the lower tick of the position id
function positionTickLower2F77CCE1(address, uint256) external returns (int32);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | int32 | the lower tick of the position given |
positionTickUpper67FD55BA
get the upper tick of the position id
function positionTickUpper67FD55BA(address, uint256) external returns (int32);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | int32 | the lower tick of the position given |
sqrtPriceX967B8F5FC5
gets the current sqrt price of the pool
function sqrtPriceX967B8F5FC5(address) external returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | the current sqrtPriceX96 for the pool |
feesOwed22F28DBD
feesOwed to a position ID given.
function feesOwed22F28DBD(address, uint256) external returns (uint128, uint128);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint128 | the amount of token0 and token1 to get in return |
<none> | uint128 |
curTick181C6FD9
gets the currently used tick of the pool
function curTick181C6FD9(address) external returns (int32);
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
Returns
Name | Type | Description |
---|---|---|
<none> | int32 | the current active tick in the pool |
tickSpacing653FE28F
gets the tick spacing of the pool
function tickSpacing653FE28F(address) external returns (uint8);
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint8 | the tick spacing of the pool |
feeBB3CF608
gets the fee for a specific pool
function feeBB3CF608(address) external returns (uint32);
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint32 | the fee for the pool |
feeGrowthGlobal038B5665B
gets the fee growth for token 0
function feeGrowthGlobal038B5665B(address) external returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | the fee growth for the other token |
feeGrowthGlobal1A33A5A1B
gets the fee growth for token 1
function feeGrowthGlobal1A33A5A1B(address) external returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | the fee growth for fUSDC |
collectSingleTo6D76575F
collect a single position's yield
function collectSingleTo6D76575F(address, uint256, address) external returns (uint128, uint128);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint256 | |
<none> | address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint128 | amount0 and amount1 |
<none> | uint128 |
collect7F21947C
collects fees from from positions
function collect7F21947C(address[] memory, uint256[] memory) external returns (CollectResult[] memory);
Parameters
Name | Type | Description |
---|---|---|
<none> | address[] | |
<none> | uint256[] |
updatePositionC7F1F740
refreshes a position's fees, and adds or removes liquidity
function updatePositionC7F1F740(address, uint256, int128) external returns (int256, int256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint256 | |
<none> | int128 |
Returns
Name | Type | Description |
---|---|---|
<none> | int256 | the deltas for token0 and token1 for the user |
<none> | int256 |
incrPositionE2437399
refreshes a position's fees, and adds liquidity, preventing less than the minimum from being taken.
function incrPositionE2437399(address, uint256, uint256, uint256, uint256, uint256)
external
returns (uint256, uint256);
Parameters
Name | Type | Description |
---|---|---|
<none> | address | |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 | |
<none> | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | the deltas for token0, and token1 |
<none> | uint256 |
setExecutorSwap
function setExecutorSwap(address a) external onlyProxyAdmin;
setExecutorSwapPermit2A
function setExecutorSwapPermit2A(address a) external onlyProxyAdmin;
setExecutorQuote
function setExecutorQuote(address a) external onlyProxyAdmin;
setExecutorPosition
function setExecutorPosition(address a) external onlyProxyAdmin;
setExecutorUpdatePosition
function setExecutorUpdatePosition(address a) external onlyProxyAdmin;
setExecutorAdmin
function setExecutorAdmin(address a) external onlyProxyAdmin;
setExecutorAdjustPosition
function setExecutorAdjustPosition(address a) external onlyProxyAdmin;
setExecutorSwapPermit2B
function setExecutorSwapPermit2B(address a) external onlyProxyAdmin;
setExecutorFallback
function setExecutorFallback(address a) external onlyProxyAdmin;
fallback
fallback() external;
_getExecutorSwap
function _getExecutorSwap() internal view returns (address);
_getExecutorSwapPermit2A
function _getExecutorSwapPermit2A() internal view returns (address);
_getExecutorQuote
function _getExecutorQuote() internal view returns (address);
_getExecutorPosition
function _getExecutorPosition() internal view returns (address);
_getExecutorUpdatePosition
function _getExecutorUpdatePosition() internal view returns (address);
_getExecutorAdmin
function _getExecutorAdmin() internal view returns (address);
_getExecutorAdjustPosition
function _getExecutorAdjustPosition() internal view returns (address);
_getExecutorSwapPermit2B
function _getExecutorSwapPermit2B() internal view returns (address);
_getExecutorFallback
function _getExecutorFallback() internal view returns (address);
_setProxyAdmin
function _setProxyAdmin(address newAdmin) internal;
_setProxies
function _setProxies(
ISeawaterExecutorSwap executorSwap,
ISeawaterExecutorSwapPermit2A executorSwapPermit2A,
ISeawaterExecutorQuote executorQuote,
ISeawaterExecutorPosition executorPosition,
ISeawaterExecutorUpdatePosition executorUpdatePosition,
ISeawaterExecutorAdmin executorAdmin,
ISeawaterExecutorAdjustPosition executorAdjustPosition,
ISeawaterExecutorSwapPermit2B executorSwapPermit2B,
ISeawaterExecutorFallback executorFallback
) internal;