Module ITIPFeeAMM

Module ITIPFeeAMM 

Expand description

TIPFeeAMM interface defining the base AMM functionality for stablecoin pools. This interface provides core liquidity pool management and swap operations.

NOTE: The FeeManager contract inherits from TIPFeeAMM and shares the same storage layout. When FeeManager is deployed, it effectively “is” a TIPFeeAMM with additional fee management capabilities layered on top. Both contracts operate on the same storage slots.

interface ITIPFeeAMM {
    struct Pool { uint128 reserveUserToken; uint128 reserveValidatorToken; }
    struct PoolKey { address token0; address token1; }
    function M() external view returns (uint256);
    function N() external view returns (uint256);
    function SCALE() external view returns (uint256);
    function MIN_LIQUIDITY() external view returns (uint256);
    function getPoolId(address userToken, address validatorToken) external pure returns (bytes32);
    function getPool(address userToken, address validatorToken) external view returns (Pool memory);
    function pools(bytes32 poolId) external view returns (Pool memory);
    function mint(address userToken, address validatorToken, uint256 amountUserToken, uint256 amountValidatorToken, address to) external returns (uint256 liquidity);
    function mintWithValidatorToken(address userToken, address validatorToken, uint256 amountValidatorToken, address to) external returns (uint256 liquidity);
    function burn(address userToken, address validatorToken, uint256 liquidity, address to) external returns (uint256 amountUserToken, uint256 amountValidatorToken);
    function totalSupply(bytes32 poolId) external view returns (uint256);
    function liquidityBalances(bytes32 poolId, address user) external view returns (uint256);
    function rebalanceSwap(address userToken, address validatorToken, uint256 amountOut, address to) external returns (uint256 amountIn);
    event Mint(address indexed sender, address indexed userToken, address indexed validatorToken, uint256 amountUserToken, uint256 amountValidatorToken, uint256 liquidity);
    event Burn(address indexed sender, address indexed userToken, address indexed validatorToken, uint256 amountUserToken, uint256 amountValidatorToken, uint256 liquidity, address to);
    event RebalanceSwap(address indexed userToken, address indexed validatorToken, address indexed swapper, uint256 amountIn, uint256 amountOut);
    event FeeSwap(address indexed userToken, address indexed validatorToken, uint256 amountIn, uint256 amountOut);
    error IdenticalAddresses();
    error ZeroAddress();
    error PoolExists();
    error PoolDoesNotExist();
    error InvalidToken();
    error InsufficientLiquidity();
    error OnlyProtocol();
    error InsufficientPoolBalance();
    error InsufficientReserves();
    error InsufficientLiquidityBalance();
    error MustDepositLowerBalanceToken();
    error InvalidAmount();
    error InvalidRebalanceState();
    error InvalidRebalanceDirection();
    error InvalidNewReserves();
    error CannotSupportPendingSwaps();
    error DivisionByZero();
    error InvalidSwapCalculation();
    error InsufficientLiquidityForPending();
    error TokenTransferFailed();
    error InternalError();
}

Structs§

Burn
Event with signature Burn(address,address,address,uint256,uint256,uint256,address) and selector 0xa1306df62797fd30333308e15e2db0aed324580be7f22c124614a44310ec7fcc.
CannotSupportPendingSwaps
Custom error with signature CannotSupportPendingSwaps() and selector 0xc3300dec.
DivisionByZero
Custom error with signature DivisionByZero() and selector 0x23d359a3.
FeeSwap
Event with signature FeeSwap(address,address,uint256,uint256) and selector 0xfb8118f81f8ad81ba2e9d74f58b9466f6c3e4b0647d87141726857c82beb1d53.
ITIPFeeAMMInstance
A ITIPFeeAMM instance.
IdenticalAddresses
Custom error with signature IdenticalAddresses() and selector 0xbd969eb0.
InsufficientLiquidity
Custom error with signature InsufficientLiquidity() and selector 0xbb55fd27.
InsufficientLiquidityBalance
Custom error with signature InsufficientLiquidityBalance() and selector 0x98e79136.
InsufficientLiquidityForPending
Custom error with signature InsufficientLiquidityForPending() and selector 0x8b1afede.
InsufficientPoolBalance
Custom error with signature InsufficientPoolBalance() and selector 0xbc6072f1.
InsufficientReserves
Custom error with signature InsufficientReserves() and selector 0x945e9268.
InternalError
Custom error with signature InternalError() and selector 0xfe835e35.
InvalidAmount
Custom error with signature InvalidAmount() and selector 0x2c5211c6.
InvalidNewReserves
Custom error with signature InvalidNewReserves() and selector 0x73281be8.
InvalidRebalanceDirection
Custom error with signature InvalidRebalanceDirection() and selector 0x1e60fee8.
InvalidRebalanceState
Custom error with signature InvalidRebalanceState() and selector 0x66a4528c.
InvalidSwapCalculation
Custom error with signature InvalidSwapCalculation() and selector 0x337e5a83.
InvalidToken
Custom error with signature InvalidToken() and selector 0xc1ab6dc1.
MCall
Function with signature M() and selector 0x693f917e.
MIN_LIQUIDITYCall
Function with signature MIN_LIQUIDITY() and selector 0x21b77d63.
MIN_LIQUIDITYReturn
Container type for the return parameters of the MIN_LIQUIDITY() function.
MReturn
Container type for the return parameters of the M() function.
Mint
Event with signature Mint(address,address,address,uint256,uint256,uint256) and selector 0xeca801b067fae3d181506c21fb55d44a644d16cdb863595643131a7e105b5f01.
MustDepositLowerBalanceToken
Custom error with signature MustDepositLowerBalanceToken() and selector 0x006cf259.
NCall
Function with signature N() and selector 0xc9e525df.
NReturn
Container type for the return parameters of the N() function.
OnlyProtocol
Custom error with signature OnlyProtocol() and selector 0xd35a97ab.
Pool
PoolDoesNotExist
Custom error with signature PoolDoesNotExist() and selector 0x9c8787c0.
PoolExists
Custom error with signature PoolExists() and selector 0xf48e3c26.
PoolKey
RebalanceSwap
Event with signature RebalanceSwap(address,address,address,uint256,uint256) and selector 0x1e9bc167ac8bc86f20f6d5c4c24338e554a9ae0f92faa67d1e2f59fe4a89c97f.
SCALECall
Function with signature SCALE() and selector 0xeced5526.
SCALEReturn
Container type for the return parameters of the SCALE() function.
TokenTransferFailed
Custom error with signature TokenTransferFailed() and selector 0x045c4b02.
ZeroAddress
Custom error with signature ZeroAddress() and selector 0xd92e233d.
burnCall
Function with signature burn(address,address,uint256,address) and selector 0xfa291e53.
burnReturn
Container type for the return parameters of the burn(address,address,uint256,address) function.
getPoolCall
Function with signature getPool(address,address) and selector 0x531aa03e.
getPoolIdCall
Function with signature getPoolId(address,address) and selector 0x2ef61c21.
getPoolIdReturn
Container type for the return parameters of the getPoolId(address,address) function.
getPoolReturn
Container type for the return parameters of the getPool(address,address) function.
liquidityBalancesCall
Function with signature liquidityBalances(bytes32,address) and selector 0x4fb5bf7f.
liquidityBalancesReturn
Container type for the return parameters of the liquidityBalances(bytes32,address) function.
mintCall
Function with signature mint(address,address,uint256,uint256,address) and selector 0xfa28d692.
mintReturn
Container type for the return parameters of the mint(address,address,uint256,uint256,address) function.
mintWithValidatorTokenCall
Function with signature mintWithValidatorToken(address,address,uint256,address) and selector 0xd6f10a87.
mintWithValidatorTokenReturn
Container type for the return parameters of the mintWithValidatorToken(address,address,uint256,address) function.
poolsCall
Function with signature pools(bytes32) and selector 0xb5217bb4.
poolsReturn
Container type for the return parameters of the pools(bytes32) function.
rebalanceSwapCall
Function with signature rebalanceSwap(address,address,uint256,address) and selector 0x1bd94ac7.
rebalanceSwapReturn
Container type for the return parameters of the rebalanceSwap(address,address,uint256,address) function.
totalSupplyCall
Function with signature totalSupply(bytes32) and selector 0xb524abcf.
totalSupplyReturn
Container type for the return parameters of the totalSupply(bytes32) function.

Enums§

ITIPFeeAMMCalls
Container for all the ITIPFeeAMM function calls.
ITIPFeeAMMErrors
Container for all the ITIPFeeAMM custom errors.
ITIPFeeAMMEvents
Container for all the ITIPFeeAMM events.

Functions§

new
Creates a new wrapper around an on-chain ITIPFeeAMM contract instance.