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 Router
copy icon
sudoswap
• version 1.0.0
AMM
Router

SudoSwap Router

The LSSVMRouter allows splitting swaps across multiple LSSVMPairs to purchase and sell multiple NFTs in one call.

*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
swapETHForAnyNFTs(address,address,uint256) :
This function allows users to swap ETH for any type of NFTs. It takes in an array of PairSwapAny objects, an address for the ETH recipient, an address for the NFT recipient, and a deadline. It then calls the _swapETHForAnyNFTs function, passing in the swapList, the amount of ETH sent, the ethRecipient, and the nftRecipient. The function returns the remaining value of the ETH sent. (autogenerated documentation)
swapETHForSpecificNFTs(address,address,uint256) :
This function allows a user to swap ETH for specific NFTs. It takes in an array of PairSwapSpecific objects, an address for the ETH recipient, an address for the NFT recipient, and a deadline. It then calls the _swapETHForSpecificNFTs function, passing in the swapList, the msg.value (the amount of ETH sent to the contract), the ethRecipient, and the nftRecipient. The function returns the remaining value of the ETH sent to the contract. (autogenerated documentation)
swapNFTsForAnyNFTsThroughETH(uint256,address,address,uint256) :
This function allows users to swap NFTs for any other NFTs through ETH. It takes in a trade object containing two trades, one for swapping NFTs for tokens and one for swapping tokens for NFTs, a minimum output amount, an ETH recipient address, an NFT recipient address, and a deadline. It then calls the _swapNFTsForToken function to swap the NFTs for tokens, adds the ETH sent with the transaction to the output amount, and then calls the _swapETHForAnyNFTs function to swap the tokens for NFTs. Finally, it returns the output amount, which is the sum of the tokens received from the NFT-to-token trade (autogenerated documentation)
swapNFTsForSpecificNFTsThroughETH(uint256,address,address,uint256) :
This function allows users to swap NFTs for specific NFTs through ETH. It takes in a trade object containing the NFT to token trades and token to NFT trades, a minimum output amount, an ETH recipient address, an NFT recipient address, and a deadline. It then calls the _swapNFTsForToken function to swap the NFTs for tokens, adds the msg.value to the output amount, and then calls the _swapETHForSpecificNFTs function to swap the ETH for the specific NFTs. Finally, it returns the output amount plus the minimum output amount. (autogenerated documentation)
swapERC20ForAnyNFTs(uint256,address,uint256) :
This function allows a user to swap ERC20 tokens for any type of NFT. It takes an array of PairSwapAny objects, which contain the ERC20 token address and the NFT address, an input amount of ERC20 tokens, an address of the NFT recipient, and a deadline. The function then calls the _swapERC20ForAnyNFTs function, which swaps the ERC20 tokens for the NFTs and returns the remaining value of the ERC20 tokens. (autogenerated documentation)
swapERC20ForSpecificNFTs(uint256,address,uint256) :
This function allows a user to swap a specific amount of ERC20 tokens for a list of specific Non-Fungible Tokens (NFTs). The function takes in an array of PairSwapSpecific objects, which contain the address of the NFT contract and the ID of the NFT to be swapped, the amount of ERC20 tokens to be swapped, the address of the recipient of the NFTs, and a deadline for the transaction. The function then calls the _swapERC20ForSpecificNFTs function, which performs the swap and returns the remaining value of the ERC20 tokens that were not used in the swap. (autogenerated documentation)
swapNFTsForToken(uint256,address,uint256) :
This function allows users to swap multiple non-fungible tokens (NFTs) for a specified amount of tokens. The function takes in an array of PairSwapSpecific objects, a minimum output amount, a token recipient address, and a deadline. It then calls the _swapNFTsForToken function, passing in the swapList, minOutput, and a payable address of the token recipient. The function returns the output amount of tokens that the user will receive. (autogenerated documentation)
swapNFTsForAnyNFTsThroughERC20(uint256,uint256,address,uint256) :
This function allows users to swap NFTs for any other NFTs through an ERC20 token. It takes in a trade object containing two trades, one for swapping NFTs for the ERC20 token and one for swapping the ERC20 token for any other NFTs. It also takes in an input amount, a minimum output amount, an address of the NFT recipient, and a deadline. The function first calls the _swapNFTsForToken function to swap the NFTs for the ERC20 token. It then adds the input amount to the output amount. Finally, it calls the _swapERC20ForAnyNFTs function to swap the ERC20 (autogenerated documentation)
swapNFTsForSpecificNFTsThroughERC20(uint256,uint256,address,uint256) :
This function allows users to swap NFTs for specific NFTs through an ERC20 token. It takes in a trade object containing two trades, one for swapping NFTs for tokens and one for swapping tokens for specific NFTs. It also takes in an input amount, a minimum output amount, an address of the NFT recipient, and a deadline. The function first swaps the NFTs for tokens and adds the input amount to the output amount. It then swaps the tokens for specific NFTs and adds the minimum output amount to the output amount. The final output amount is then returned. (autogenerated documentation)
robustSwapETHForAnyNFTs(address,address,uint256) :
This function is used to swap ETH for any type of NFTs. It takes in an array of RobustPairSwapAny objects, an ETH recipient address, an NFT recipient address, and a deadline. It then iterates through the array of RobustPairSwapAny objects and calls the swapTokenForAnyNFTs function on each one. This function calculates the cost of the swap and checks to make sure it is below the maxCost specified in the RobustPairSwapAny object. If it is, the swap is executed and the cost is subtracted from the remainingValue. Finally, if there is any remainingValue, it is sent to the ETH recipient address. (autogenerated documentation)
robustSwapETHForSpecificNFTs(address,address,uint256) :
This function is used to swap ETH for specific NFTs. It takes in an array of RobustPairSwapSpecific objects, an ETH recipient address, an NFT recipient address, and a deadline. It then iterates through the array of RobustPairSwapSpecific objects, calculating the cost of each swap and ensuring that it is below the maximum cost specified in the object. If the cost is below the maximum cost, it will execute the swap, transferring the NFTs to the NFT recipient address and subtracting the cost from the remaining ETH value. Finally, if there is any remaining ETH value, it will be transferred to the ETH recipient address. (autogenerated documentation)
robustSwapERC20ForAnyNFTs(uint256,address,uint256) :
This function allows users to swap ERC20 tokens for any type of NFTs. It takes in an array of RobustPairSwapAny objects, an input amount, an address of the NFT recipient, and a deadline. It then iterates through the array of RobustPairSwapAny objects and checks if the cost of the swap is within the maximum cost specified in the object. If it is, it will execute the swap and subtract the cost from the input amount. Finally, it returns the remaining value. (autogenerated documentation)
robustSwapERC20ForSpecificNFTs(uint256,address,uint256) :
This function is used to swap ERC20 tokens for specific NFTs. It takes an array of RobustPairSwapSpecific objects, an input amount of tokens, an address of the NFT recipient, and a deadline as parameters. It then iterates through the array of RobustPairSwapSpecific objects and calls the getBuyNFTQuote function on each one to get the cost of the swap. If the cost is less than the maxCost specified in the RobustPairSwapSpecific object, it calls the swapTokenForSpecificNFTs function to perform the swap. The remaining value is then returned. (autogenerated documentation)
robustSwapNFTsForToken(address,uint256) :
This function is used to swap a list of non-fungible tokens (NFTs) for a token. It takes in an array of RobustPairSwapSpecificForToken objects, an address of the token recipient, and a deadline. It then iterates through the array and calls the getSellNFTQuote function on each object to get the output amount. If the output amount is greater than or equal to the minimum output, it calls the swapNFTsForToken function to swap the NFTs for the token. Finally, it returns the total output amount. (autogenerated documentation)
robustSwapETHForSpecificNFTsAndNFTsToToken() :
This function is used to facilitate a trade between ETH and specific NFTs. It takes in a parameter called "params" which contains two arrays of trades, one for swapping ETH for NFTs and one for swapping NFTs for ETH. For each trade, it checks to make sure that the cost of the trade is within the specified maximum cost and that the output of the trade is at least the specified minimum output. If these conditions are met, it will execute the trade and update the remaining value of ETH and the output amount of tokens accordingly. (autogenerated documentation)
robustSwapERC20ForSpecificNFTsAndNFTsToToken() :
This function is used to facilitate a robust swap of ERC20 tokens for specific NFTs and NFTs for tokens. It takes in a set of parameters, including the input amount, the token and NFT recipient addresses, and the token-to-NFT and NFT-to-token trades. It then iterates through the token-to-NFT trades, calculating the pair cost for each trade and swapping the tokens for the specified NFTs if the pair cost is less than the maximum cost specified in the trade. It then iterates through the NFT-to-token trades, calculating the pair output for each trade and swapping the NFTs for the specified tokens if the pair output is greater than (autogenerated documentation)
pairTransferERC20From(address,address,uint256) :
This function is used to transfer ERC20 tokens from one address to another. It first checks that the sender is a valid pair, and then checks that the variant is either ENUMERABLE_ERC20 or MISSING_ENUMERABLE_ERC20. If these checks pass, it then calls the token's safeTransferFrom function to transfer the specified amount of tokens from the from address to the to address. (autogenerated documentation)
pairTransferNFTFrom(address,address,uint256) :
This function is used to transfer a Non-Fungible Token (NFT) from one address to another. It takes in five parameters: an IERC721 nft, the address of the sender, the address of the recipient, the ID of the NFT, and the variant of the pair. The function first checks to make sure that the sender is a valid pair, and then it uses the safeTransferFrom() function to transfer the NFT from the sender to the recipient. (autogenerated documentation)
_checkDeadline(uint256) :
This function is used to check if a deadline has passed. It takes in a uint256 deadline as an argument and checks if the current block timestamp is less than or equal to the deadline. If the deadline has passed, it will throw an error. (autogenerated documentation)
_swapETHForAnyNFTs(uint256,address,address) :
This function is used to swap ETH for any NFTs. It takes in an array of PairSwapAny objects, an input amount of ETH, an ETH recipient address, and an NFT recipient address. It then iterates through the array of PairSwapAny objects, calculating the cost of each pair and using the remaining value to swap the ETH for the NFTs. Finally, if there is any remaining value, it is sent to the ETH recipient address. (autogenerated documentation)
_swapETHForSpecificNFTs(uint256,address,address) :
This function is used to swap ETH for specific NFTs. It takes in an array of PairSwapSpecific objects, an input amount of ETH, an ETH recipient address, and an NFT recipient address. It then iterates through the array of PairSwapSpecific objects, calculating the cost of each pair and using the remaining value to swap ETH for the specified NFTs. Finally, if there is any remaining value, it is sent to the ETH recipient address. (autogenerated documentation)
_swapERC20ForAnyNFTs(uint256,address) :
This function is used to swap ERC20 tokens for any type of NFTs. It takes an array of PairSwapAny objects, an input amount of ERC20 tokens, and an address of the NFT recipient as parameters. It then iterates through the array of PairSwapAny objects and calls the pair.swapTokenForAnyNFTs() function for each one. This function takes the number of items to swap, the remaining value of the ERC20 tokens, the address of the NFT recipient, a boolean value, and the address of the sender as parameters. It then swaps the ERC20 tokens for the NFTs and returns the remaining value of the ERC20 tokens. (autogenerated documentation)
_swapERC20ForSpecificNFTs(uint256,address) :
This function is used to swap ERC20 tokens for specific NFTs. It takes an array of PairSwapSpecific objects, an input amount of ERC20 tokens, and an address of the NFT recipient as parameters. It then iterates through the array of PairSwapSpecific objects and calls the pair.swapTokenForSpecificNFTs() function for each one. This function takes the NFT IDs, the remaining value of ERC20 tokens, the address of the NFT recipient, a boolean value, and the address of the sender as parameters. It then returns the remaining value of ERC20 tokens after the swap. (autogenerated documentation)
_swapNFTsForToken(uint256,address) :
This function is used to swap a list of non-fungible tokens (NFTs) for a token. It takes in an array of PairSwapSpecific objects, a minimum output amount, and a token recipient address as parameters. It then iterates through the array of PairSwapSpecific objects and calls the swapNFTsForToken function on each one. This function returns the total output amount of tokens that were swapped for the NFTs. Finally, it checks to make sure that the output amount is greater than or equal to the minimum output amount, and if not, it throws an error. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i sudoswap-router
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.