Repository for adding Lens Protocol collect, follow and reference modules.
To have your module added to Lens Testnet or Mainnet please open a PR and follow the instructions here: #TODO
npm install- If you also want to use Foundry - follow the Foundry installation instructions here.
 
This repository contains both - Hardhat and Foundry tests. Foundry will be used for all future modules, and existing modules will be migrated to Foundry testing suite.
npm run testwill compile and run the Hardhat tests suite
forge testwill compile and run the Foundry tests suite.
- Edit 
TESTING_FORK.env variable to be one ofmainnet/testnet/sandboxand fill the rest of .env (FOUNDRYsection) - If a module is already deployed and its address exists in 
addresses.json- tests will be run against that deployment. If there is no module in json - a new local instance of the module will be deployed. Remove the module key fromaddresses.jsonif you want to force testing a local module deployment. - Run 
forge testto fork the chosen network and test against existing LensHub contracts. 
- Make sure to fill in the 
.envusing.env.example(theFoundrysection). You can specify either aMNEMONICor a singlePRIVATE_KEY(make sure to include both variables, even if one of them is an empty string) - Run deployment script with a command like 
bash script/deploy-module.sh testnet StepwiseCollectModulefrom the project root folder (e.g. to deployStepwiseCollectModuleontestnet). - Follow the on-screen instructions to verify if everything is correct and confirm deployment & contract verification.
 - If only the verification is needed of an existing deployed contract - use the 
--verify-onlyflag followed by ABI-Encoded constructor args. 
The addresses.json file in root contains all existing deployed contracts on all of target environments (mainnet/testnet/sandbox) on corresponding chains.
After a succesful module deployment the new address will be added to addresses.json, overwriting the existing one (the script will ask for confirmation if you want to redeploy an already existing deployment).
npm run coveragefor Hardhat coverage reportforge coveragefor Foundry coverage report
- Aave Fee Collect Module: Extend the LimitedFeeCollectModule to deposit all received fees into the Aave Polygon Market (if applicable for the asset) and send the resulting aTokens to the beneficiary.
 - Auction Collect Module: This module works by creating an English auction for the underlying publication. After the auction ends, only the auction winner is allowed to collect the publication.
 - Base Fee Collect Module: An abstract base fee collect module contract which can be used to construct flexible fee collect modules using inheritance.
 - Multirecipient Fee Collect Module: Fee Collect module that allows multiple recipients (up to 5) with different proportions of fees payout.
 - Simple Fee Collect Module: A simple fee collect module implementation, as an example of using base fee collect module abstract contract.
 - Updatable Ownable Fee Collect Module: A fee collect module that, for each publication that uses it, mints an ERC-721 ownership-NFT to its author. Whoever owns the ownership-NFT has the rights to update the parameters required to do a successful collect operation over its underlying publication.
 
- Degrees Of Separation Reference Module: This reference module allows to set a degree of separation 
n, and then allows to comment/mirror only to profiles that are at most atndegrees of separation from the author of the root publication. - Token Gated Reference Module: A reference module that validates that the user who tries to reference has a required minimum balance of ERC20/ERC721 token.