token() :
This function retrieves the ERC20 token address from the transaction data. It does this by taking the length of the immutable parameters, subtracting it from the total data size, and then adding 61 to the result. This gives the location of the token address in the data, which is then shifted right by 96 bits to get the address. (autogenerated documentation)
_pullTokenInputAndPayProtocolFee(uint256,bool,address,uint256) :
This function is used to pull a token input and pay the protocol fee for an ERC20 pair. It first checks that the msg.value is 0, as ERC20 pairs do not accept ETH. It then checks if the sender is a router, and if so, it calls the pairTransferERC20From function on the router to transfer the input amount minus the protocol fee to the asset recipient. It then calls the pairTransferERC20From function again to transfer the protocol fee to the factory. If the sender is not a router, it calls the safeTransferFrom function on the token to transfer the input amount minus the protocol fee to the asset recipient, and then calls the safeTransferFrom function again to transfer the protocol fee (autogenerated documentation)
_refundTokenToSender(uint256) :
This function is used to refund a token to the sender. It takes in an input amount as a parameter and then refunds the token to the sender. The exact implementation of this function will depend on the specific token contract, but it typically involves transferring the input amount from the contract's balance to the sender's address. (autogenerated documentation)
_payProtocolFeeFromPair(uint256) :
This function is used to pay the protocol fee from a given ILSSVMPairFactoryLike. It first checks if the protocol fee is greater than 0, and if so, it retrieves the balance of the token associated with the pair from the contract. If the protocol fee is greater than the token balance, it sets the protocol fee to the token balance. Finally, it transfers the protocol fee to the address of the ILSSVMPairFactoryLike. (autogenerated documentation)
_sendTokenOutput(address,uint256) :
This function is an internal override function that is used to send a token output to a specified recipient. It takes two parameters, an address payable tokenRecipient and a uint256 outputAmount. If the outputAmount is greater than 0, the function calls the token() function to safely transfer the outputAmount to the tokenRecipient. (autogenerated documentation)
_immutableParamsLength() :
This function returns the length of the immutable parameters stored in the contract. It works by returning the value of the IMMUTABLE_PARAMS_LENGTH constant, which is set when the contract is deployed. (autogenerated documentation)
withdrawERC20(uint256) :
This function allows the owner of the contract to withdraw a specified amount of ERC20 tokens from the contract. It does this by calling the safeTransfer() function on the ERC20 token, which transfers the specified amount of tokens from the contract to the msg.sender (the owner of the contract). If the token being withdrawn is the token associated with the contract, an event is emitted to notify other users of the withdrawal. (autogenerated documentation)