SeawaterAMM

Git Source

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,
    ISeawaterExecutorSwapPermit2 _executorSwapPermit2,
    ISeawaterExecutorQuote _executorQuote,
    ISeawaterExecutorPosition _executorPosition,
    ISeawaterExecutorUpdatePosition _executorUpdatePosition,
    ISeawaterExecutorAdmin _executorAdmin,
    ISeawaterExecutorFallback _executorFallback
);

Parameters

NameTypeDescription
_proxyAdminaddressthe admin that can control proxy functions (change addresses)
_seawaterAdminaddressthe admin of the AMM
_nftManageraddressthe account that can transfer position NFTs
_emergencyCounciladdress
_executorSwapISeawaterExecutorSwapthe deployed code for the swap executor
_executorSwapPermit2ISeawaterExecutorSwapPermit2the deployed code for the swap_permit2 executor
_executorQuoteISeawaterExecutorQuotethe deployed code for the quote executor
_executorPositionISeawaterExecutorPositionthe deployed code for the positions executor
_executorUpdatePositionISeawaterExecutorUpdatePosition
_executorAdminISeawaterExecutorAdminthe deployed code for the admin executor
_executorFallbackISeawaterExecutorFallbackan 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

NameTypeDescription
newAdminaddressthe new proxy admin to set

updateExecutors

updates the addresses of the executors. only usable by the proxy admin

function updateExecutors(
    ISeawaterExecutorSwap executorSwap,
    ISeawaterExecutorSwapPermit2 executorSwapPermit2,
    ISeawaterExecutorQuote executorQuote,
    ISeawaterExecutorPosition executorPosition,
    ISeawaterExecutorUpdatePosition executorUpdatePosition,
    ISeawaterExecutorAdmin executorAdmin,
    ISeawaterExecutorFallback executorFallback
) public onlyProxyAdmin;

Parameters

NameTypeDescription
executorSwapISeawaterExecutorSwapthe address of the swap executor
executorSwapPermit2ISeawaterExecutorSwapPermit2the deployed code for the swap_permit2 executor
executorQuoteISeawaterExecutorQuotethe deployed code for the quote executor
executorPositionISeawaterExecutorPositionthe address of the position executor
executorUpdatePositionISeawaterExecutorUpdatePosition
executorAdminISeawaterExecutorAdminthe address of the admin executor
executorFallbackISeawaterExecutorFallbackthe address of the fallback executor

directDelegate

function directDelegate(address to) internal;

createPoolD650E2D0

initialises a new pool. only usable by the seawater admin

function createPoolD650E2D0(address, uint256, uint32, uint8, uint128) external;

Parameters

NameTypeDescription
<none>address
<none>uint256
<none>uint32
<none>uint8
<none>uint128

collectProtocol7540FA9F

collects protocol fees. only usable by the seawater admin

function collectProtocol7540FA9F(address, uint128, uint128, address) external returns (uint128, uint128);

Parameters

NameTypeDescription
<none>address
<none>uint128
<none>uint128
<none>address

Returns

NameTypeDescription
<none>uint128the amount of token0 and token1 fees collected
<none>uint128

enablePool579DA658

enables or disables a pool

function enablePool579DA658(address, bool) external;

Parameters

NameTypeDescription
<none>address
<none>bool

authoriseEnabler5B17C274

authorise an address to create and enable pools on its own

function authoriseEnabler5B17C274(address, bool) external;

Parameters

NameTypeDescription
<none>address
<none>bool

setSqrtPriceFF4DB98C

set the sqrt price for a pool in the event of misconfiguration.

function setSqrtPriceFF4DB98C(address, uint256) external;

Parameters

NameTypeDescription
<none>address
<none>uint256

updateNftManager9BDF41F6

set the NFT manager.

function updateNftManager9BDF41F6(address) external;

Parameters

NameTypeDescription
<none>address

updateEmergencyCouncil7D0C1C58

updateEmergencyCouncil to a new address.

function updateEmergencyCouncil7D0C1C58(address) external;

Parameters

NameTypeDescription
<none>address

swap904369BE

swaps within a pool

function swap904369BE(address, bool, int256, uint256) external returns (int256, int256);

Parameters

NameTypeDescription
<none>address
<none>bool
<none>int256
<none>uint256

Returns

NameTypeDescription
<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

NameTypeDescription
<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

NameTypeDescription
<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

NameTypeDescription
<none>address
<none>bool
<none>int256
<none>uint256
<none>uint256
<none>uint256
<none>uint256
<none>bytes

Returns

NameTypeDescription
<none>int256(token0, token1) delta
<none>int256

swap2ExactIn41203F1D

performs a two stage swap across two pools

function swap2ExactIn41203F1D(address, address, uint256, uint256) external returns (uint256, uint256);

Parameters

NameTypeDescription
<none>address
<none>address
<none>uint256
<none>uint256

Returns

NameTypeDescription
<none>uint256(amount in, amount out)
<none>uint256

swap2ExactInPermit236B2FDD8

performs a two stage swap across two pools using permit2 for token transfers

function swap2ExactInPermit236B2FDD8(address, address, uint256, uint256, uint256, uint256, bytes memory)
    external
    returns (uint256, uint256);

Parameters

NameTypeDescription
<none>address
<none>address
<none>uint256
<none>uint256
<none>uint256
<none>uint256
<none>bytes

Returns

NameTypeDescription
<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

NameTypeDescription
tokenaddress
amountInuint256
minOutuint256

Returns

NameTypeDescription
<none>int256amount 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

NameTypeDescription
tokenaddress
amountInuint256
minOutuint256
nonceuint256
deadlineuint256
maxAmountuint256
sigbytes

Returns

NameTypeDescription
<none>int256amount of usdc out
<none>int256

swapOut5E08A399

swaps USDC for _token

function swapOut5E08A399(address token, uint256 amountIn, uint256 minOut) external returns (int256, int256);

Parameters

NameTypeDescription
tokenaddress
amountInuint256
minOutuint256

Returns

NameTypeDescription
<none>int256amount 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

NameTypeDescription
tokenaddress
amountInuint256
minOutuint256
nonceuint256
deadlineuint256
maxAmountuint256
sigbytes

Returns

NameTypeDescription
<none>int256amount of token out
<none>int256

mintPositionBC5B086D

creates a new position

function mintPositionBC5B086D(address, int32, int32) external returns (uint256);

Parameters

NameTypeDescription
<none>address
<none>int32
<none>int32

positionOwnerD7878480

gets the owner of a position

function positionOwnerD7878480(uint256) external returns (address);

Parameters

NameTypeDescription
<none>uint256

Returns

NameTypeDescription
<none>addressthe owner of the position

transferPositionEEC7A3CD

transferPosition transfers a position. usable only by the NFT manager

function transferPositionEEC7A3CD(uint256, address, address) external;

Parameters

NameTypeDescription
<none>uint256
<none>address
<none>address

positionBalance4F32C7DB

gets the number of positions owned by a user

function positionBalance4F32C7DB(address) external returns (uint256);

Parameters

NameTypeDescription
<none>address

Returns

NameTypeDescription
<none>uint256the number of positions owned by the user

positionLiquidity8D11C045

gets the amount of liquidity in a position

function positionLiquidity8D11C045(address, uint256) external returns (uint128);

Parameters

NameTypeDescription
<none>address
<none>uint256

Returns

NameTypeDescription
<none>uint128the amount of liquidity contained in the position

positionTickLower2F77CCE1

get the lower tick of the position id

function positionTickLower2F77CCE1(address, uint256) external returns (int32);

Parameters

NameTypeDescription
<none>address
<none>uint256

Returns

NameTypeDescription
<none>int32the lower tick of the position given

positionTickUpper67FD55BA

get the upper tick of the position id

function positionTickUpper67FD55BA(address, uint256) external returns (int32);

Parameters

NameTypeDescription
<none>address
<none>uint256

Returns

NameTypeDescription
<none>int32the lower tick of the position given

sqrtPriceX967B8F5FC5

gets the current sqrt price of the pool

function sqrtPriceX967B8F5FC5(address) external returns (uint256);

Parameters

NameTypeDescription
<none>address

Returns

NameTypeDescription
<none>uint256the current sqrtPriceX96 for the pool

feesOwed22F28DBD

feesOwed to a position ID given.

function feesOwed22F28DBD(address, uint256) external returns (uint128, uint128);

Parameters

NameTypeDescription
<none>address
<none>uint256

Returns

NameTypeDescription
<none>uint128the 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

NameTypeDescription
<none>address

Returns

NameTypeDescription
<none>int32the current active tick in the pool

tickSpacing653FE28F

gets the tick spacing of the pool

function tickSpacing653FE28F(address) external returns (uint8);

Parameters

NameTypeDescription
<none>address

Returns

NameTypeDescription
<none>uint8the tick spacing of the pool

feeBB3CF608

gets the fee for a specific pool

function feeBB3CF608(address) external returns (uint32);

Parameters

NameTypeDescription
<none>address

Returns

NameTypeDescription
<none>uint32the fee for the pool

feeGrowthGlobal038B5665B

gets the fee growth for token 0

function feeGrowthGlobal038B5665B(address) external returns (uint256);

Parameters

NameTypeDescription
<none>address

Returns

NameTypeDescription
<none>uint256the fee growth for the other token

feeGrowthGlobal1A33A5A1B

gets the fee growth for token 1

function feeGrowthGlobal1A33A5A1B(address) external returns (uint256);

Parameters

NameTypeDescription
<none>address

Returns

NameTypeDescription
<none>uint256the fee growth for fUSDC

collectSingleTo6D76575F

collect a single position's yield

function collectSingleTo6D76575F(address, uint256, address) external returns (uint128, uint128);

Parameters

NameTypeDescription
<none>address
<none>uint256
<none>address

Returns

NameTypeDescription
<none>uint128amount0 and amount1
<none>uint128

collect7F21947C

collects fees from from positions

function collect7F21947C(address[] memory, uint256[] memory) external returns (CollectResult[] memory);

Parameters

NameTypeDescription
<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

NameTypeDescription
<none>address
<none>uint256
<none>int128

Returns

NameTypeDescription
<none>int256the deltas for token0 and token1 for the user
<none>int256

incrPosD3521721

refreshes a position's fees, and adds liquidity, preventing less than the minimum from being taken.

function incrPosD3521721(address, uint256, uint256, uint256, uint256, uint256) external returns (uint256, uint256);

Parameters

NameTypeDescription
<none>address
<none>uint256
<none>uint256
<none>uint256
<none>uint256
<none>uint256

Returns

NameTypeDescription
<none>uint256the deltas for token0, and token1
<none>uint256

decrPosition09293696

refreshes a position's fees, and takes liquidity, preventing less than the minimum from being taken.

function decrPosition09293696(address, uint256, uint256, uint256, uint256, uint256)
    external
    returns (uint256, uint256);

Parameters

NameTypeDescription
<none>address
<none>uint256
<none>uint256
<none>uint256
<none>uint256
<none>uint256

Returns

NameTypeDescription
<none>uint256the deltas for token0, and token1
<none>uint256

fallback

fallback() external;

_getExecutorSwap

function _getExecutorSwap() internal view returns (address);

_getExecutorSwapPermit2

function _getExecutorSwapPermit2() 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);

_getExecutorFallback

function _getExecutorFallback() internal view returns (address);

_setProxyAdmin

function _setProxyAdmin(address newAdmin) internal;

_setProxies

function _setProxies(
    ISeawaterExecutorSwap executorSwap,
    ISeawaterExecutorSwapPermit2 executorSwapPermit2,
    ISeawaterExecutorQuote executorQuote,
    ISeawaterExecutorPosition executorPosition,
    ISeawaterExecutorUpdatePosition executorUpdatePosition,
    ISeawaterExecutorAdmin executorAdmin,
    ISeawaterExecutorFallback executorFallback
) internal;