refactor!: rename `CollectibleV1`to `CommunityERC721`
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
This commit is contained in:
parent
023e43f4ad
commit
a84c46b3d6
32
README.md
32
README.md
|
@ -74,7 +74,7 @@ This projects implements smart contracts that are used by Status to enable token
|
|||
- [BaseToken](#basetoken)
|
||||
- [Ownertoken](#ownertoken)
|
||||
- [MasterToken](#mastertoken)
|
||||
- [CollectibleV1](#collectiblev1)
|
||||
- [CommunityERC721](#communityerc721)
|
||||
- [CommunityERC20](#communityerc20)
|
||||
- [Deploying community tokens](#deploying-community-tokens)
|
||||
- [CommunityTokenDeployer](#communitytokendeployer)
|
||||
|
@ -106,12 +106,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
|
||||
|
||||
|
@ -119,7 +119,7 @@ An owner is a Status user that has typically created a Status community and ther
|
|||
Owners have special privileges within a Status community, such as:
|
||||
|
||||
- transferring community ownership to other accounts
|
||||
- creating community tokens (`CollectiveV1`, `CommunityERC20`)
|
||||
- creating community tokens (`CommunityERC721`, `CommunityERC20`)
|
||||
- creating token permissions
|
||||
- airdropping tokens to other users
|
||||
|
||||
|
@ -129,7 +129,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.
|
||||
|
@ -145,10 +145,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
|
||||
|
||||
|
@ -160,11 +160,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.
|
||||
|
@ -185,13 +185,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`
|
||||
|
|
|
@ -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,
|
||||
|
@ -14,7 +14,7 @@ contract CollectibleV1Harness is CollectibleV1 {
|
|||
address ownerToken,
|
||||
address masterToken
|
||||
)
|
||||
CollectibleV1(
|
||||
CommunityERC721(
|
||||
name,
|
||||
symbol,
|
||||
maxSupply,
|
|
@ -1,10 +0,0 @@
|
|||
certoraRun \
|
||||
contracts/tokens/CollectibleV1.sol \
|
||||
certora/harness/CollectibleV1Harness.sol \
|
||||
--verify CollectibleV1Harness:certora/specs/CollectibleV1.spec \
|
||||
--packages @openzeppelin=lib/openzeppelin-contracts \
|
||||
--optimistic_loop \
|
||||
--loop_iter 3 \
|
||||
--rule_sanity "basic" \
|
||||
--msg "Verifying CollectibleV1.sol"
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
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" \
|
||||
--msg "Verifying CommunityERC721.sol"
|
||||
|
|
@ -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,
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
@ -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)
|
||||
);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
);
|
||||
|
Loading…
Reference in New Issue