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 selector0xa1306df62797fd30333308e15e2db0aed324580be7f22c124614a44310ec7fcc. - Cannot
Support Pending Swaps - Custom error with signature
CannotSupportPendingSwaps()and selector0xc3300dec. - Division
ByZero - Custom error with signature
DivisionByZero()and selector0x23d359a3. - FeeSwap
- Event with signature
FeeSwap(address,address,uint256,uint256)and selector0xfb8118f81f8ad81ba2e9d74f58b9466f6c3e4b0647d87141726857c82beb1d53. - ITIP
FeeAMM Instance - A
ITIPFeeAMMinstance. - Identical
Addresses - Custom error with signature
IdenticalAddresses()and selector0xbd969eb0. - Insufficient
Liquidity - Custom error with signature
InsufficientLiquidity()and selector0xbb55fd27. - Insufficient
Liquidity Balance - Custom error with signature
InsufficientLiquidityBalance()and selector0x98e79136. - Insufficient
Liquidity ForPending - Custom error with signature
InsufficientLiquidityForPending()and selector0x8b1afede. - Insufficient
Pool Balance - Custom error with signature
InsufficientPoolBalance()and selector0xbc6072f1. - Insufficient
Reserves - Custom error with signature
InsufficientReserves()and selector0x945e9268. - Internal
Error - Custom error with signature
InternalError()and selector0xfe835e35. - Invalid
Amount - Custom error with signature
InvalidAmount()and selector0x2c5211c6. - Invalid
NewReserves - Custom error with signature
InvalidNewReserves()and selector0x73281be8. - Invalid
Rebalance Direction - Custom error with signature
InvalidRebalanceDirection()and selector0x1e60fee8. - Invalid
Rebalance State - Custom error with signature
InvalidRebalanceState()and selector0x66a4528c. - Invalid
Swap Calculation - Custom error with signature
InvalidSwapCalculation()and selector0x337e5a83. - Invalid
Token - Custom error with signature
InvalidToken()and selector0xc1ab6dc1. - MCall
- Function with signature
M()and selector0x693f917e. - MIN_
LIQUIDITY Call - Function with signature
MIN_LIQUIDITY()and selector0x21b77d63. - MIN_
LIQUIDITY Return - 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 selector0xeca801b067fae3d181506c21fb55d44a644d16cdb863595643131a7e105b5f01. - Must
Deposit Lower Balance Token - Custom error with signature
MustDepositLowerBalanceToken()and selector0x006cf259. - NCall
- Function with signature
N()and selector0xc9e525df. - NReturn
- Container type for the return parameters of the
N()function. - Only
Protocol - Custom error with signature
OnlyProtocol()and selector0xd35a97ab. - Pool
- Pool
Does NotExist - Custom error with signature
PoolDoesNotExist()and selector0x9c8787c0. - Pool
Exists - Custom error with signature
PoolExists()and selector0xf48e3c26. - PoolKey
- Rebalance
Swap - Event with signature
RebalanceSwap(address,address,address,uint256,uint256)and selector0x1e9bc167ac8bc86f20f6d5c4c24338e554a9ae0f92faa67d1e2f59fe4a89c97f. - SCALE
Call - Function with signature
SCALE()and selector0xeced5526. - SCALE
Return - Container type for the return parameters of the
SCALE()function. - Token
Transfer Failed - Custom error with signature
TokenTransferFailed()and selector0x045c4b02. - Zero
Address - Custom error with signature
ZeroAddress()and selector0xd92e233d. - burn
Call - Function with signature
burn(address,address,uint256,address)and selector0xfa291e53. - burn
Return - Container type for the return parameters of the
burn(address,address,uint256,address)function. - getPool
Call - Function with signature
getPool(address,address)and selector0x531aa03e. - getPool
IdCall - Function with signature
getPoolId(address,address)and selector0x2ef61c21. - getPool
IdReturn - Container type for the return parameters of the
getPoolId(address,address)function. - getPool
Return - Container type for the return parameters of the
getPool(address,address)function. - liquidity
Balances Call - Function with signature
liquidityBalances(bytes32,address)and selector0x4fb5bf7f. - liquidity
Balances Return - Container type for the return parameters of the
liquidityBalances(bytes32,address)function. - mint
Call - Function with signature
mint(address,address,uint256,uint256,address)and selector0xfa28d692. - mint
Return - Container type for the return parameters of the
mint(address,address,uint256,uint256,address)function. - mint
With Validator Token Call - Function with signature
mintWithValidatorToken(address,address,uint256,address)and selector0xd6f10a87. - mint
With Validator Token Return - Container type for the return parameters of the
mintWithValidatorToken(address,address,uint256,address)function. - pools
Call - Function with signature
pools(bytes32)and selector0xb5217bb4. - pools
Return - Container type for the return parameters of the
pools(bytes32)function. - rebalance
Swap Call - Function with signature
rebalanceSwap(address,address,uint256,address)and selector0x1bd94ac7. - rebalance
Swap Return - Container type for the return parameters of the
rebalanceSwap(address,address,uint256,address)function. - total
Supply Call - Function with signature
totalSupply(bytes32)and selector0xb524abcf. - total
Supply Return - Container type for the return parameters of the
totalSupply(bytes32)function.
Enums§
- ITIP
FeeAMM Calls - Container for all the
ITIPFeeAMMfunction calls. - ITIP
FeeAMM Errors - Container for all the
ITIPFeeAMMcustom errors. - ITIP
FeeAMM Events - Container for all the
ITIPFeeAMMevents.
Functions§
- new
- Creates a new wrapper around an on-chain
ITIPFeeAMMcontract instance.