This repository contains the contracts from the core Lens Protocol repo (link) as a standalone library, useful in Hardhat and Foundry projects.
It includes the Solidity source code of the contracts, their ABIs, and deployment addresses for Lens Chain mainnet and testnet.
The files are kept in sync with the latest-mainnet tag.
npm i lens-modules
Import Lens contracts you want to use in your Solidity project. The paths mirror the lens-v3 repo structure. Eg:
import {Account} from "lens-modules/contracts/extensions/account/Account.sol";
import {IGraph} from "lens-modules/contracts/core/interfaces/IGraph.sol";
import {KeyValue} from "lens-modules/contracts/core/types/Types.sol";Use the Deployments helper JavaScript class to get the contract addresses of the Lens deployments on mainnet and testnet. Eg:
import { lensDeployments } from "lens-modules/deployments";
const lensFactoryAddress = lensDeployments.mainnet.LensFactory.address;Use the ABIs helper JavaScript class to get the ABI of any Lens contract. Eg:
import { accountAbi } from "lens-modules/abis";
await walletClient.writeContract({
address: "0xYourAccountContractAddress",
abi: accountAbi,
functionName: "executeTransaction",
args: [
// ... your function arguments
],
});