LiquidityPoolMarket
Inherits: BaseMarket
Implements an Automated Market Maker (AMM) style liquidity pool for securities.
State Variables
paymentToken
IERC20 public paymentToken;
shareClass
ShareClass public shareClass;
reserveShares
uint256 public reserveShares;
reservePayments
uint256 public reservePayments;
Functions
constructor
constructor(address _paymentToken, address _shareClass);
addLiquidity
Adds liquidity to the pool.
function addLiquidity(uint256 shares, uint256 payments, string memory uri, bytes memory data) external;
Parameters
Name
Type
Description
shares
uint256
The number of shares to add.
payments
uint256
The amount of payment tokens to add.
uri
string
data
bytes
removeLiquidity
Removes liquidity from the pool.
function removeLiquidity(uint256 shares, uint256 payments, string memory uri, bytes memory data) external;
Parameters
Name
Type
Description
shares
uint256
The number of shares to remove.
payments
uint256
The amount of payment tokens to remove.
uri
string
data
bytes
executeTrade
Executes a trade by swapping payment tokens for shares.
function executeTrade(uint256 sharesBought, string memory uri, bytes memory data) external payable;
Parameters
Name
Type
Description
sharesBought
uint256
The number of shares the buyer wants to purchase.
uri
string
data
bytes
createListing
function createListing(uint96, uint256) external pure override returns (bytes32);
executeTrade
function executeTrade(bytes32, uint96) external payable override;
cancelListing
function cancelListing(bytes32) external pure override;
Events
LiquidityAdded
event LiquidityAdded(address indexed provider, uint256 shares, uint256 payments);
LiquidityRemoved
event LiquidityRemoved(address indexed provider, uint256 shares, uint256 payments);
TradeExecuted
event TradeExecuted(address indexed buyer, uint256 sharesBought, uint256 paymentsPaid);
Last updated
Was this helpful?