Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Rename LSP26 to LSP26FollowerSystem #968

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/benchmark.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks a lot for that! 👌🏻

Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:
ref: ${{ github.event.pull_request.base.sha }}
fetch-depth: 0

- name: Use Node.js '16.15.0'
uses: actions/setup-node@v2
- name: Use Node.js v20
uses: actions/setup-node@v3
with:
node-version: "16.15.0"
node-version: "20.x"
cache: "npm"

- name: 📦 Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/lsp-smart-contracts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const INTERFACE_IDS = {
LSP20CallVerifier: INTERFACE_ID_LSP20CallVerifier,
LSP11BasicSocialRecovery: '0x049a28f1',
LSP25ExecuteRelayCall: INTERFACE_ID_LSP25,
LSP26FollowingSystem: INTERFACE_ID_LSP26,
LSP26FollowerSystem: INTERFACE_ID_LSP26,
};

// ERC725Y
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.17;

import "@lukso/lsp26-contracts/contracts/ILSP26FollowingSystem.sol";
import "@lukso/lsp26-contracts/contracts/ILSP26FollowerSystem.sol";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.17;

import "@lukso/lsp26-contracts/contracts/LSP26FollowingSystem.sol";
import "@lukso/lsp26-contracts/contracts/LSP26FollowerSystem.sol";
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ import {
ILSP25ExecuteRelayCall as ILSP25
} from "@lukso/lsp25-contracts/contracts/ILSP25ExecuteRelayCall.sol";
import {
ILSP26FollowingSystem as ILSP26
} from "@lukso/lsp26-contracts/contracts/ILSP26FollowingSystem.sol";
ILSP26FollowerSystem as ILSP26
} from "@lukso/lsp26-contracts/contracts/ILSP26FollowerSystem.sol";

// constants
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ describe('Calculate LSP interfaces', () => {
expect(result).to.equal(INTERFACE_IDS.LSP25ExecuteRelayCall);
});

it('LSP26FollowingSystem', async () => {
it('LSP26FollowerSystem', async () => {
const result = await contract.calculateInterfaceLSP26();
expect(result).to.equal(INTERFACE_IDS.LSP26FollowingSystem);
expect(result).to.equal(INTERFACE_IDS.LSP26FollowerSystem);
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/lsp26-contracts/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# LSP26 Following System · [![npm version](https://img.shields.io/npm/v/@lukso/lsp26-contracts.svg?style=flat)](https://www.npmjs.com/package/@lukso/lsp26-contracts)
# LSP26 Follower System · [![npm version](https://img.shields.io/npm/v/@lukso/lsp26-contracts.svg?style=flat)](https://www.npmjs.com/package/@lukso/lsp26-contracts)

Package for the LSP26 Following System standard.
Package for the LSP26 Follower System standard.

## Installation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.17;

interface ILSP26FollowingSystem {
interface ILSP26FollowerSystem {
/// @notice Emitted when following an address.
/// @param follower The address that follows `addr`
/// @param addr The address that is followed by `follower`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.17;

// interfaces
import {ILSP26FollowingSystem} from "./ILSP26FollowingSystem.sol";
import {ILSP26FollowerSystem} from "./ILSP26FollowerSystem.sol";
import {
ILSP1UniversalReceiver
} from "@lukso/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol";
Expand Down Expand Up @@ -31,56 +31,56 @@ import {
LSP26NotFollowing
} from "./LSP26Errors.sol";

contract LSP26FollowingSystem is ILSP26FollowingSystem {
contract LSP26FollowerSystem is ILSP26FollowerSystem {
using EnumerableSet for EnumerableSet.AddressSet;
using ERC165Checker for address;

mapping(address => EnumerableSet.AddressSet) private _followersOf;
mapping(address => EnumerableSet.AddressSet) private _followingsOf;

// @inheritdoc ILSP26FollowingSystem
// @inheritdoc ILSP26FollowerSystem
function follow(address addr) public {
_follow(addr);
}

// @inheritdoc ILSP26FollowingSystem
// @inheritdoc ILSP26FollowerSystem
function followBatch(address[] memory addresses) public {
for (uint256 index = 0; index < addresses.length; ++index) {
_follow(addresses[index]);
}
}

// @inheritdoc ILSP26FollowingSystem
// @inheritdoc ILSP26FollowerSystem
function unfollow(address addr) public {
_unfollow(addr);
}

// @inheritdoc ILSP26FollowingSystem
// @inheritdoc ILSP26FollowerSystem
function unfollowBatch(address[] memory addresses) public {
for (uint256 index = 0; index < addresses.length; ++index) {
_unfollow(addresses[index]);
}
}

// @inheritdoc ILSP26FollowingSystem
// @inheritdoc ILSP26FollowerSystem
function isFollowing(
address follower,
address addr
) public view returns (bool) {
return _followingsOf[follower].contains(addr);
}

// @inheritdoc ILSP26FollowingSystem
// @inheritdoc ILSP26FollowerSystem
function followerCount(address addr) public view returns (uint256) {
return _followersOf[addr].length();
}

// @inheritdoc ILSP26FollowingSystem
// @inheritdoc ILSP26FollowerSystem
function followingCount(address addr) public view returns (uint256) {
return _followingsOf[addr].length();
}

// @inheritdoc ILSP26FollowingSystem
// @inheritdoc ILSP26FollowerSystem
function getFollowsByIndex(
address addr,
uint256 startIndex,
Expand All @@ -97,7 +97,7 @@ contract LSP26FollowingSystem is ILSP26FollowingSystem {
return followings;
}

// @inheritdoc ILSP26FollowingSystem
// @inheritdoc ILSP26FollowerSystem
function getFollowersByIndex(
address addr,
uint256 startIndex,
Expand Down
2 changes: 1 addition & 1 deletion packages/lsp26-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const config: HardhatUserConfig = {
},
packager: {
// What contracts to keep the artifacts and the bindings for.
contracts: ['ILSP26FollowingSystem', 'LSP26FollowingSystem'],
contracts: ['ILSP26FollowerSystem', 'LSP26FollowerSystem'],
// Whether to include the TypeChain factories or not.
// If this is enabled, you need to run the TypeChain files through the TypeScript compiler before shipping to the registry.
includeFactories: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/lsp26-contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@lukso/lsp26-contracts",
"version": "0.15.0",
"description": "Package for the LSP26 Following System standard",
"description": "Package for the LSP26 Follower System standard",
"license": "Apache-2.0",
"author": "",
"main": "./dist/index.cjs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import { OPERATION_TYPES } from '@lukso/lsp0-contracts';

// types
import {
LSP26FollowingSystem,
LSP26FollowingSystem__factory,
LSP26FollowerSystem,
LSP26FollowerSystem__factory,
LSP0ERC725Account,
LSP0ERC725Account__factory,
RevertOnFollow__factory,
RevertOnFollow,
} from '../types';

describe('testing `LSP26FollowingSystem`', () => {
describe('testing `LSP26FollowerSystem`', () => {
let context: {
followerSystem: LSP26FollowingSystem;
followerSystem: LSP26FollowerSystem;
followerSystemAddress: string;
revertOnFollow: RevertOnFollow;
revertOnFollowAddress: string;
Expand All @@ -34,7 +34,7 @@ describe('testing `LSP26FollowingSystem`', () => {
before(async () => {
const signers = await ethers.getSigners();
const [owner, singleFollowSigner] = signers;
const followerSystem = await new LSP26FollowingSystem__factory(owner).deploy();
const followerSystem = await new LSP26FollowerSystem__factory(owner).deploy();
const followerSystemAddress = await followerSystem.getAddress();
const universalProfile = await new LSP0ERC725Account__factory(owner).deploy(owner.address);

Expand Down
Loading