Inherits:
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
The number of shares to add.
The amount of payment tokens to add.
removeLiquidity
Removes liquidity from the pool.
function removeLiquidity(uint256 shares, uint256 payments, string memory uri, bytes memory data) external;
Parameters
The number of shares to remove.
The amount of payment tokens to remove.
executeTrade
Executes a trade by swapping payment tokens for shares.
function executeTrade(uint256 sharesBought, string memory uri, bytes memory data) external payable;
Parameters
The number of shares the buyer wants to purchase.
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);