Skip to content

Commit

Permalink
refactor!: rename CollectibleV1to CommunityERC721
Browse files Browse the repository at this point in the history
As discussed in #46, `CollectibleV1` is not a good name for this
contract as we don't want versioning in the naming. To align with other
contracts in this repository, we're renaming this contract to
`CommunityERC721`.

BREAKING CHANGE: Any references to `CollectibleV1` must be replaced with
`CommunityERC721`

Closes #46
  • Loading branch information
0x-r4bbit committed Feb 23, 2024
1 parent cba8cf4 commit 7a8e52d
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 45 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ This projects implements smart contracts that are used by Status to enable token
- [BaseToken](#basetoken)
- [Ownertoken](#ownertoken)
- [MasterToken](#mastertoken)
- [CollectibleV1](#collectiblev1)
- [CommunityERC721](#collectiblev1)
- [CommunityERC20](#communityerc20)
- [Deploying community tokens](#deploying-community-tokens)
- [CommunityTokenDeployer](#communitytokendeployer)
Expand Down Expand Up @@ -101,12 +101,12 @@ The smart contracts of this repository implement these tokens and how they'll be

There are different roles in a Status community. Gaining roles in a community is done by proving ownership of certain assets and tokens. Below is a summary of the existing roles and what token funds are necessary to get a role:

| **Role** | **Description** | **Count** | **Token ownership** |
| ------------ | --------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
| Owner | Owner of the Status community. | 1 | `OwnerToken` |
| Token Master | Helps creating community tokens and airdrops. | 0-n | `MasterToken` |
| Admin | Helps maintaining the community. | 0-n | Combination of `CollectibleV1`, `CommunityERC20`, `ERC721`, `ERC20` |
| Member | Member of the community. | 0-n | None or any combintion of `CollectibleV1`, `CommunityER20`, `ERC721`, `ERC20` |
| **Role** | **Description** | **Count** | **Token ownership** |
| ------------ | --------------------------------------------- | --------- | ------------------------------------------------------------------------------- |
| Owner | Owner of the Status community. | 1 | `OwnerToken` |
| Token Master | Helps creating community tokens and airdrops. | 0-n | `MasterToken` |
| Admin | Helps maintaining the community. | 0-n | Combination of `CommunityERC721`, `CommunityERC20`, `ERC721`, `ERC20` |
| Member | Member of the community. | 0-n | None or any combintion of `CommunityERC721`, `CommunityER20`, `ERC721`, `ERC20` |

### Owners

Expand All @@ -124,7 +124,7 @@ The `OwnerToken` is an `ERC721` token and exists only once per community.
### Token Masters

A token master is a Status user that has special privileges within a Status community.
A token master is allowed to create community tokens (`CollectibleV1`, `CommunityERC20`), new token permissions as well as airdropping tokens to other accounts.
A token master is allowed to create community tokens (`CommunityERC721`, `CommunityERC20`), new token permissions as well as airdropping tokens to other accounts.
The primary reason for token masters to exist is that they help the single owner of the community with token related actions.

There can be none or multiple token masters within a single Status community.
Expand All @@ -140,10 +140,10 @@ An admin is a member of a Status community with special privileges, such as:

Owners and token masters can create token permissions in the community to make other users admins of the community.

The admin role is represented via ownership of any token combination of `CollectibleV1`, `CommunityERC20`, `ERC721`, and `ERC20` tokens.
The admin role is represented via ownership of any token combination of `CommunityERC721`, `CommunityERC20`, `ERC721`, and `ERC20` tokens.
The owner or token masters have to create a token permission to specify which token ownership is needed to be an admin in the community.

Both, `CollectibleV1` and `CommunityERC20` tokens are part of this repository.
Both, `CommunityERC721` and `CommunityERC20` tokens are part of this repository.

## Community tokens

Expand All @@ -155,11 +155,11 @@ Below is a description of all community tokens that can be deployed and minted t

### `BaseToken`

`BaseToken` is an abstract contract that `OwnerToken`, `MasterToken`, and `CollectibleV1` inherit from to get shared functionality.
`BaseToken` is an abstract contract that `OwnerToken`, `MasterToken`, and `CommunityERC721` inherit from to get shared functionality.
`BaseToken` is an `ERC721` token that offers some custom functionality:

- A custom `onlyOwner` modifier that checks for ownership of wither `OwnerToken` or `MasterToken`
- The ability to configure a maximum supply. This is used for both `MasterToken` and `CollectibleV1` tokens.
- The ability to configure a maximum supply. This is used for both `MasterToken` and `CommunityERC721` tokens.
- A `mintTo` function that allows for minting tokens to multiple addresses at once.
- A mechanism to burn tokens "remotely". The use case here is to remove token masters or admins privileges.
- The ability to batch transfer tokens to multiple receivers.
Expand All @@ -180,13 +180,13 @@ The `MasterToken` is coexists with the `OwnerToken`, however there's no mechanis

`MasterToken` are not transferrable but remote burnable. This ensures malicious users can't allow other users to create or airdrop tokens via Status communities.

### `CollectibleV1`
### `CommunityERC721`

`CollectibleV1` token inherits `BaseToken` and are used to create custom NFTs for Status communities.
`CommunityERC721` token inherits `BaseToken` and are used to create custom NFTs for Status communities.
The use case for these tokens are role based permissions.
Owners or token masters might deploy instances of this token to create token permissions that introduce an admin role, or permissoins to view and/or post to channels.

`CollectibleV1` tokens can also be configured to be transferrable or remote burnable.
`CommunityERC721` tokens can also be configured to be transferrable or remote burnable.
Creators of such a token can also specify their maximum supply.

### `CommunityERC20`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: Mozilla Public License 2.0
pragma solidity ^0.8.17;

import {CollectibleV1} from "../../contracts/tokens/CollectibleV1.sol";
import {CommunityERC721} from "../../contracts/tokens/CommunityERC721.sol";

contract CollectibleV1Harness is CollectibleV1 {
contract CommunityERC721Harness is CommunityERC721 {
constructor(
string memory name,
string memory symbol,
Expand All @@ -14,7 +14,7 @@ contract CollectibleV1Harness is CollectibleV1 {
address ownerToken,
address masterToken
)
CollectibleV1(
CommunityERC721(
name,
symbol,
maxSupply,
Expand Down
11 changes: 0 additions & 11 deletions certora/scripts/verify-collectible-v1.sh

This file was deleted.

11 changes: 11 additions & 0 deletions certora/scripts/verify-community-erc721.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
certoraRun \
contracts/tokens/CommunityERC721.sol \
certora/harness/CommunityERC721Harness.sol \
--verify CommunityERC721Harness:certora/specs/CommunityERC721.spec \
--packages @openzeppelin=lib/openzeppelin-contracts \
--optimistic_loop \
--loop_iter 3 \
--rule_sanity "basic" \
--wait_for_results "all" \
--msg "Verifying CommunityERC721.sol"

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.17;

import { BaseToken } from "./BaseToken.sol";

contract CollectibleV1 is BaseToken {
contract CommunityERC721 is BaseToken {
constructor(
string memory _name,
string memory _symbol,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"scripts": {
"clean": "rm -rf cache out",
"lint": "pnpm lint:sol && pnpm prettier:check",
"verify": "pnpm verify:collectible_v1 && pnpm verify:community_token_deployer",
"verify": "pnpm verify:community_erc721 && pnpm verify:community_token_deployer",
"lint:sol": "forge fmt --check && pnpm solhint {script,src,test}/**/*.sol",
"prettier:check": "prettier --check **/*.{json,md,yml} --ignore-path=.prettierignore",
"prettier:write": "prettier --write **/*.{json,md,yml} --ignore-path=.prettierignore",
"verify:collectible_v1": "./certora/scripts/verify-collectible-v1.sh",
"verify:community_erc721": "./certora/scripts/verify-community-erc721.sh",
"verify:community_token_deployer": "./certora/scripts/verify-community-token-deployer.sh"
}
}
Expand Down
26 changes: 13 additions & 13 deletions test/CollectibleV1.t.sol → test/CommunityERC721.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { CommunityOwnable } from "../contracts/CommunityOwnable.sol";
import { BaseToken } from "../contracts/tokens/BaseToken.sol";
import { OwnerToken } from "../contracts/tokens/OwnerToken.sol";
import { MasterToken } from "../contracts/tokens/MasterToken.sol";
import { CollectibleV1 } from "../contracts/tokens/CollectibleV1.sol";
import { CommunityERC721 } from "../contracts/tokens/CommunityERC721.sol";

contract CollectibleV1Test is Test {
CollectibleV1 internal collectibleV1;
contract CommunityERC721Test is Test {
CommunityERC721 internal collectibleV1;

address internal deployer;
address[] internal accounts = new address[](4);
Expand All @@ -28,7 +28,7 @@ contract CollectibleV1Test is Test {
(OwnerToken ownerToken, MasterToken masterToken, DeploymentConfig deploymentConfig) = deployment.run();
deployer = deploymentConfig.deployer();

collectibleV1 = new CollectibleV1(
collectibleV1 = new CommunityERC721(
name, symbol, maxSupply, remoteBurnable, transferable, baseURI, address(ownerToken), address(masterToken)
);

Expand All @@ -39,7 +39,7 @@ contract CollectibleV1Test is Test {
}
}

contract DeploymentTest is CollectibleV1Test {
contract DeploymentTest is CommunityERC721Test {
function test_Deployment() public {
assertEq(collectibleV1.name(), name);
assertEq(collectibleV1.symbol(), symbol);
Expand All @@ -50,11 +50,11 @@ contract DeploymentTest is CollectibleV1Test {
}
}

contract MintToTest is CollectibleV1Test {
contract MintToTest is CommunityERC721Test {
event StatusMint(address indexed from, address indexed to, uint256 indexed tokenId);

function setUp() public virtual override {
CollectibleV1Test.setUp();
CommunityERC721Test.setUp();
}

function test_RevertWhen_SenderIsNotOwner() public {
Expand Down Expand Up @@ -92,9 +92,9 @@ contract MintToTest is CollectibleV1Test {
}
}

contract RemoteBurnTest is CollectibleV1Test {
contract RemoteBurnTest is CommunityERC721Test {
function setUp() public virtual override {
CollectibleV1Test.setUp();
CommunityERC721Test.setUp();
}

function test_RevertWhen_SenderIsNotOwner() public {
Expand All @@ -119,9 +119,9 @@ contract RemoteBurnTest is CollectibleV1Test {
}
}

contract SafeBatchTransferFromTest is CollectibleV1Test {
contract SafeBatchTransferFromTest is CommunityERC721Test {
function setUp() public virtual override {
CollectibleV1Test.setUp();
CommunityERC721Test.setUp();
}

function test_RevertWhen_ReceiversAndIdsMismatch() public {
Expand Down Expand Up @@ -233,13 +233,13 @@ contract SafeBatchTransferFromTest is CollectibleV1Test {
}
}

contract NotTransferableTest is CollectibleV1Test {
contract NotTransferableTest is CommunityERC721Test {
function setUp() public virtual override {
DeployOwnerAndMasterToken deployment = new DeployOwnerAndMasterToken();
(OwnerToken ownerToken, MasterToken masterToken, DeploymentConfig deploymentConfig) = deployment.run();
deployer = deploymentConfig.deployer();

collectibleV1 = new CollectibleV1(
collectibleV1 = new CommunityERC721(
name, symbol, maxSupply, remoteBurnable, false, baseURI, address(ownerToken), address(masterToken)
);

Expand Down

0 comments on commit 7a8e52d

Please sign in to comment.