E721Farm
Inherits: Farm, IERC721Receiver
Author: Sperax Foundation.
This contract contains the core logic for E721 farms.
State Variables
nftContract
depositToTokenId
Functions
onERC721Received
Function is called when user transfers the NFT to this farm.
Parameters
Name
Type
Description
<none>
address
_from
address
The address of the owner.
_tokenId
uint256
NFT Id generated by other protocol (e.g. Camelot or Uniswap).
_data
bytes
The data should be the lockup flag (bool).
Returns
Name
Type
Description
<none>
bytes4
bytes4 The onERC721Received selector.
withdraw
Function to withdraw a deposit from the farm.
Parameters
Name
Type
Description
_depositId
uint256
The id of the deposit to be withdrawn.
_getLiquidity
Function to get the liquidity. Must be defined by the farm.
This function should be overridden to add the respective logic.
Parameters
Name
Type
Description
_tokenId
uint256
The nft tokenId.
Returns
Name
Type
Description
<none>
uint256
The liquidity of the nft position.