MidasPair721

MidasPair721

Contract used to trade through the Liquidity Book and also acts as the manager of liquidity positions.

constructor

constructor(address _factory) {}

Parameters

SellNFT

BuyNFT

event BuyNFT(uint256 indexed nftTokenId, address indexed from, uint24 tradeBin, uint128 indexed lpTokenId);

ERC721PositionMinted

event ERC721PositionMinted(uint256 lpTokenId, uint24 binLower, uint24 binStep, uint256 binAmount, uint256[] nftTokenIds);

ERC20PositionMinted

event ERC20PositionMinted(uint256 lpTokenId, uint24 binLower, uint24 binStep, uint256 binAmount);

PositionBurned

event PositionBurned(uint256 lpTokenId, address owner, uint256 nftAmount, uint256 ftAmount, uint256 feeCollected);

ClaimFee

event ClaimFee(uint128 indexed lpTokenId, address indexed owner, uint256 indexed feeCollected);

FlashLoan

    event FlashLoan(address indexed caller, IMidasFlashLoanCallback receiver, uint256[] NFTIDs)

NewRoyaltyFee

    event NewRoyaltyFee(uint128 indexed newFee)

initialize

function initialize() external;

Function to initialize the pair which is strict to MidasFactory.

getTokenX

function getTokenX() external pure override returns (IERC721)

Pure function to get the NFT address of this pair.

getTokenY

function getTokenY() external pure override returns (IERC20)

Pure function to get the FT address of this pair.

getLPToken

function getLPToken() external pure override returns (LPToken)

Pure function to get the LP Token address of this pair.

factory

function factory() external view override returns (IMidasFactory721)

View function to get the factory address of this pair.

getReserves

function getReserves() external view override returns (uint128 reserveX, uint128 reserveY)

View function to get the NFT and FT reserves of this pair.

Return Values

getIDs

function getIDs() external view override returns (uint24 bestOfferID, uint24 floorPriceID, uint128 currentPositionID)

View function to get current index price info of this pair.

Return Values

getGlobalFees

function getGlobalFees() external view override returns (uint128 feesTotal, uint128 feesProtocol)

View function to get the global fees information, the total fees and those for protocol

Return Values

feeParameters

function feeParameters() external view override returns (uint128 rate, uint128 protocolRate, uint128 royaltyRate)

View function to get the fee parameters of this pair.

Return Values

getBin

function getBin(uint24 _id) external view override returns (uint128 reserveX, uint128 reserveY)

View function to get the reserves of bin at id.

Parameters

Return Values

getLpInfos

function getLpInfos(uint128 _LPtokenID) external view override returns (uint24, uint24, uint128)

View function to get the LP info via LP tokenId.

Parameters

Return Values

getPriceFromBin

function getPriceFromBin(uint24 _id) external view override returns (uint128)

View function to get the price mapping to the specific bin id.

Parameters

Return Values

getLPFromNFT

function getLPFromNFT(uint24 _id) external view override returns (uint128)

View function to get the LP tokenId of the specific NFT.

Parameters

Return Values

getBinParamFromLP

function getBinParamFromLP(uint128 _LPtokenID, uint256 _amount) external view override returns (uint128 _totalPrice)

View function to get the quote price of the specific position.

Parameters

Return Values

getLpReserve

function getLpReserve(uint128 _lpTokenID) external view override returns (uint128, uint128)

View function to get the reserves of the specific position.

Parameters

Return Values

sellNFT

function sellNFT(uint256 NFTID, address _to) external override nonReentrant returns (uint128 _amountOut)

Function to buy the NFT asset at the spot price.

Parameters

Return Values

buyNFT

function buyNFT(uint256 NFTID, address _to) external override nonReentrant

Function to buy the NFT asset at the spot price.

Parameters

mintNFT

function mintNFT(uint24[] calldata _ids, uint256[] calldata _NFTIDs, address _to, bool isLimited) external override nonReentrant

Performs a low level add liquidity of NFT. This needs to be called from a contract which performs important safety checks.

Parameters

Return Values

mintFT

function mintFT(uint24[] calldata _ids, address _to) external override nonReentrant

Performs a low level add liquidity of FT. This needs to be called from a contract which performs important safety checks.

Parameters

Return Values

burn

function burn(uint128 _LPtokenID, address _nftReceiver, address _to) external override nonReentrant

Performs a low level remove liquidity. This needs to be called from a contract which performs important safety checks

Parameters

Return Values

collectProtocolFees

function collectProtocolFees() external override nonReentrant

Collect the protocol fees and send them to the fee recipient.

Return Values

collectLPFees

function collectLPFees(uint128 _LPtokenID , address _to) external override nonReentrant

Collect the LP fees and send them to the fee recipient.

Return Values

collectRoyaltyFees

function collectRoyaltyFees() external override nonReentrant

Collect the royalty fees and send them to the royalty fee recipient.

Return Values

updateRoyalty

function updateRoyalty(uint128 _newRate, address payable[] calldata newrecipients, uint256[] calldata newshares) external override nonReentrant

Update the royalty info of the NFT according to EIP2981.

Parameters

updateSafetyLock

function updateSafetyLock(bool newLock) external override nonReentrant

Update the safety locker status which is strict to factory.

Parameters

flashLoan

function flashLoan(IMidasFlashLoanCallback receiver, uint256[] calldata _tokenIds, bytes calldata data) external override nonReentrant

Parameters

Last updated