initialize(uint256) :
This function initializes the FollowNFT contract. It sets the _initialized boolean to true and sets the _profileId to the profileId passed in as an argument. It also emits an event to signal that the contract has been initialized. (autogenerated documentation)
mint(address) :
This function mints a new token and assigns it to the address specified in the 'to' parameter. It does this by incrementing the _tokenIdCounter variable and then calling the _mint() function, passing in the address and the tokenId. (autogenerated documentation)
delegate(address) :
This function allows a user to delegate their voting power to another user. It does this by calling the _delegate() function, which takes two parameters: the address of the user delegating their voting power, and the address of the user to whom they are delegating their voting power. The function then updates the voting power of the delegatee to include the voting power of the delegator. (autogenerated documentation)
delegateBySig(address,address) :
This function allows a delegator to delegate their voting power to a delegatee by providing a signature. The function first validates the signature by calculating the digest of the data provided in the signature and comparing it to the recovered address from the signature. If the address matches, the function then delegates the voting power to the delegatee. (autogenerated documentation)
getPowerByBlockNumber(address,uint256) :
This function allows a user to retrieve the power associated with a given block number. It does this by first checking that the block number is valid (i.e. not greater than the current block number). If the block number is valid, the function then checks if the user has any snapshots stored. If the user does have snapshots stored, the function calls the _getSnapshotValueByBlockNumber() function to retrieve the power associated with the given block number. (autogenerated documentation)
getDelegatedSupplyByBlockNumber(uint256) :
This function returns the delegated supply of a token at a given block number. It does this by first checking if the block number is valid (i.e. not greater than the current block number). If it is valid, it then checks if there are any snapshots of the delegated supply stored in the contract. If there are, it then calls the _getSnapshotValueByBlockNumber() function to retrieve the delegated supply at the given block number. (autogenerated documentation)
name() :
This function is used to get the name of a Follow NFT associated with a given profile ID. It does this by first calling the getHandle() function from the ILensHub contract, passing in the profile ID as an argument. This returns a string representing the handle associated with the profile ID. The function then encodes this handle with the constant FOLLOW_NFT_NAME_SUFFIX and returns the resulting string. (autogenerated documentation)
symbol() :
This function is used to get the symbol of a Follow NFT. It works by first retrieving the handle of the profile associated with the Follow NFT from the ILensHub contract, then encoding the first 4 bytes of the handle along with a predefined suffix to create the symbol. (autogenerated documentation)
_getSnapshotValueByBlockNumber() :
This function is used to retrieve the value of a snapshot from a mapping of snapshots based on a given block number. It uses a binary search algorithm to find the snapshot with the closest block number to the given block number. If the given block number is greater than the highest block number in the mapping, it returns the value of the highest block number. If the given block number is lower than the lowest block number in the mapping, it returns 0. (autogenerated documentation)
tokenURI(uint256) :
This function is used to retrieve the URI of a given tokenId. It first checks if the tokenId exists, and if it does, it calls the getFollowNFTURI function from the ILensHub contract, passing in the _profileId as an argument. This function returns a string containing the URI of the tokenId. (autogenerated documentation)
_beforeTokenTransfer(address,address,uint256) :
This function is an internal override of the _beforeTokenTransfer function in the ERC721 contract. It is used to update the delegate mapping when an NFT is transferred from one address to another. It also emits a FollowNFTTransferEvent to the LensHub contract and calls the followModuleTransferHook function in the FollowModule contract. (autogenerated documentation)
_delegate(address,address) :
This function allows a delegator to delegate their balance to a delegatee. It first stores the delegator's balance in a variable, then stores the delegatee's address in the _delegates mapping. Finally, it calls the _moveDelegate function to move the delegator's balance to the delegatee. (autogenerated documentation)
_moveDelegate(address,address,uint256) :
This function is used to move delegated power from one address to another. It first checks if the from address is 0, and if not, it subtracts the amount from the from address's delegated power and updates the snapshot. It then checks if the to address is 0, and if not, it adds the amount to the to address's delegated power and updates the snapshot. If the from address is 0, it adds the amount to the total delegated power and updates the snapshot. If the to address is 0, it subtracts the amount from the total delegated power and updates the snapshot. (autogenerated documentation)
_writeSnapshot(address,uint128,uint256) :
This function is used to store a snapshot of the current value of a given address. It takes in the address of the owner, the new value, and the owner's snapshot count as parameters. It then stores the current block number and the new value in a mapping of uint256 to Snapshot for the given owner. If the owner's snapshot count is not 0 and the block number of the previous snapshot is the same as the current block number, then the new value is stored in the previous snapshot. Otherwise, a new snapshot is created and the owner's snapshot count is incremented. (autogenerated documentation)
_writeSupplySnapshot(uint128,uint256) :
This function is used to store a snapshot of the current supply of a token. It takes two parameters, a newValue (the current supply of the token) and a supplySnapshotCount (the number of snapshots that have been taken). The function first checks if the current block number matches the block number of the last snapshot taken. If it does, the newValue is updated in the last snapshot. If not, a new snapshot is created with the current block number and the newValue. The supplySnapshotCount is then incremented. (autogenerated documentation)