Skip to content

Commit

Permalink
chore: Integrate Lens Protocol contracts and update Hardhat configura…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
bigint committed Mar 2, 2025
1 parent 764292d commit 81d1cff
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 68 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"[solidity]": {
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity",
"editor.tabSize": 1
},
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports": "explicit"
Expand All @@ -25,5 +29,7 @@
"git.enableSmartCommit": true,
"editor.fontSize": 11,
"editor.lineHeight": 2.3,
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.fontFamily": "Monolisa, Menlo, Monaco, 'Courier New', monospace"
}
59 changes: 59 additions & 0 deletions packages/contracts/contracts/ProGroupRule.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;

import {INamespaceRule} from "lens-contracts/contracts/core/interfaces/INamespaceRule.sol";
import {KeyValue} from "lens-contracts/contracts/core/types/Types.sol";

contract ProGroupRule is INamespaceRule {
string private constant REQUIRED_USERNAME = "yoginth";

function configure(bytes32, KeyValue[] calldata) external override {}

function processCreation(
bytes32,
address,
address,
string calldata username,
KeyValue[] calldata,
KeyValue[] calldata
) external pure override {
require(
keccak256(abi.encodePacked(username)) ==
keccak256(abi.encodePacked(REQUIRED_USERNAME))
);

revert("Not implemented");
}

function processRemoval(
bytes32,
address,
string calldata,
KeyValue[] calldata,
KeyValue[] calldata
) external pure override {
revert("Not implemented");
}

function processAssigning(
bytes32,
address,
address,
string calldata,
KeyValue[] calldata,
KeyValue[] calldata
) external pure override {
revert("Not implemented");
}

function processUnassigning(
bytes32,
address,
address,
string calldata,
KeyValue[] calldata,
KeyValue[] calldata
) external pure override {
revert("Not implemented");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { Wallet } from "zksync-ethers";

export default async function (hre: HardhatRuntimeEnvironment) {
try {
// Initialize the wallet.
const wallet = new Wallet(process.env.PRIVATE_KEY as string);
const deployer = new Deployer(hre, wallet as any);
const artifact = await deployer.loadArtifact("HeyPro");
const heyProContract = await deployer.deploy(artifact);
const artifact = await deployer.loadArtifact("ProGroupRule");
const contract = await deployer.deploy(artifact);
console.log(
`${artifact.contractName} was deployed to ${await heyProContract.getAddress()}`
`${artifact.contractName} was deployed to ${await contract.getAddress()}`
);
} catch (error) {
console.error("Error in deployment:", error);
Expand Down
11 changes: 7 additions & 4 deletions packages/contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import "@nomicfoundation/hardhat-toolbox";
import type { HardhatUserConfig } from "hardhat/config";

const config: HardhatUserConfig = {
solidity: "0.8.28",
zksolc: { version: "latest", settings: {} },
defaultNetwork: "lensSepoliaTestnet",
solidity: "0.8.26",
zksolc: {
version: "latest",
settings: { optimizer: { enabled: true, mode: "1" } }
},
defaultNetwork: "lensTestnet",
networks: {
lensSepoliaTestnet: {
lensTestnet: {
accounts: [process.env.PRIVATE_KEY as string],
url: "https://rpc.testnet.lens.dev",
chainId: 37111,
Expand Down
3 changes: 3 additions & 0 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
"hardhat": "^2.22.15",
"typescript": "^5.6.3",
"zksync-ethers": "^6.16.1"
},
"dependencies": {
"lens-contracts": "github:lens-protocol/lens-v3"
}
}
Loading

0 comments on commit 81d1cff

Please sign in to comment.