Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
SudoSwap Enumerable NFT Pair
copy icon
sudoswap
• version 1.0.0
Pair
AMM
NFT
Enumerable

SudoSwap Enumerable NFT Pair

Pairs are either LSSVMPairEnumerable or LSSVMPairMissingEnumerable depending on whether or not the pair's ERC721 contract supports Enumerable or not. If it doesn't, we implement our own ID set to allow for easy access to NFT IDs in the pool.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

sudoswap

Last Publish

1/27/2023
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
_sendAnyNFTsToRecipient(address,uint256) :
This function is used to send any number of Non-Fungible Tokens (NFTs) from the contract to a recipient. It takes in three parameters: an IERC721 interface, the address of the recipient, and the number of NFTs to be sent. It first calculates the last index of the NFTs owned by the contract, then iterates through the NFTs from the last index to the first, sending each one to the recipient using the safeTransferFrom function. (autogenerated documentation)
_sendSpecificNFTsToRecipient(address,uint256[]) :
This function is an internal override function that sends specific Non-Fungible Tokens (NFTs) from the contract address to a specified recipient. It takes in three parameters: an IERC721 interface, the address of the recipient, and an array of uint256 values representing the NFT IDs. The function loops through the array of NFT IDs and uses the safeTransferFrom() function to transfer each NFT from the contract address to the recipient address. (autogenerated documentation)
getAllHeldIds() :
This function retrieves all the IDs of the non-fungible tokens (NFTs) held by the contract. It does this by first retrieving the total number of NFTs held by the contract using the balanceOf() function from the IERC721 interface. It then creates an array of the same size and iterates through the NFTs, using the tokenOfOwnerByIndex() function from the IERC721Enumerable interface to retrieve the ID of each NFT and store it in the array. Finally, the array is returned. (autogenerated documentation)
onERC721Received(uint256,) :
This function is part of the ERC721 standard and is used to handle the transfer of ERC721 tokens. It takes four parameters: the address of the sender, the address of the receiver, the ID of the token being transferred, and a byte array containing additional data. The function returns a bytes4 value, which is the selector for the onERC721Received function. This selector is used to identify the function when it is called. The function itself does not actually perform the transfer of the token, but rather it is used to trigger the transfer when it is called. (autogenerated documentation)
withdrawERC721(uint256[]) :
This function allows the owner of the contract to withdraw ERC721 tokens from the contract. It takes an IERC721 interface and an array of uint256 values (the nftIds) as parameters. It then loops through the array of nftIds and calls the safeTransferFrom function of the IERC721 interface, transferring the tokens from the contract to the msg.sender. Finally, it emits an NFTWithdrawal event. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i sudoswap-pair-enumerable
copy icon

Last Publish

1/27/2023

Version

1.0.0

Creator

sudoswap

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.