Skip to content

Commit 0c4f23c

Browse files
authored
19 factory subject allow list (#62)
* merge main * contracts - yay! Tests - Nay :( * clonedist unit test * cleanup * diamondDistribution tests * moved diamond code to /vendor/diamond, modified imports accordingly, removed initDiamond bytecode check * modified import paths of facets * improved eds and moved it in to /vendor/eds directory * added mock files for eds * removed old eds files from interfaces * tests * better naming * restore pnpm lock file * updated abi's * initial commit * use eds as dependency * remove abis from src control * dirty commit to share wip /w aragon team * concept compiles * remove compositeERC1155, make RankToken clonable, use layers for Rank Token permission checks * remove get rank interfaces from rank token * remove composite functionality from ranking instance for now * Distributable Governance token, with ERC7746 middleware * mao distribution instantiate does not revert anymore * playbooks * clean up deployment script * remove storage pattern * move distribution pattern to test setup routine * deployment pipeline and MAO distr unit test seems to work * hotfixed some tests * parametrize fork block number * fix typo * remove some logs * tdd, cleanup, specific fork block number * rank token tests pass * restore pnpm files, cleanup unused packages * cleanup deploy scripts * add tracer to deps * bump hh dep to meet tracer reqs * fix workflow (hopefully) * basic changeset info * env for both jobs * happy linter - happy life * force node env to test during tests and linting * rm unused * use stable osx ether version * seems like ethers 2.22.11 has bug * improved docs generation format * update docstrings * fix test types * add readme * happy linter - happy life * changeset elaborated * canonical names for standard defined methods * canonical names for standard defined methods * fix interface id name * removed compiler warnings, improved doc generation, defined scope to variables * happy linter - happy life * Update README.md * upd readme * migrated to eds 2.0, added sample dev env file * added sample env and updated readme
1 parent be9d58a commit 0c4f23c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4165
-3866
lines changed

.changeset/silly-seahorses-tickle.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
'rankify-contracts': minor
3+
---
4+
5+
## Addition of Ethereum Distribution System (EDS)
6+
7+
- **Feature**: Integrated the Ethereum Distribution System (EDS) for distributing Rankify contracts.
8+
- **Description**: Rankify contracts are now distributed via the Ethereum Distribution System, enhancing the efficiency and security of the distribution process.
9+
10+
## Redesign of Contracts
11+
12+
- **Feature**: Redesigned contracts to work seamlessly as part of the Ethereum Distribution System.
13+
- **Description**: The contracts have been restructured and optimized to ensure compatibility and smooth operation within the EDS framework. This redesign includes:
14+
- Improved contract architecture for better integration with EDS.
15+
- Enhanced security measures to protect against potential vulnerabilities.
16+
- Optimized performance to handle the distribution process more efficiently.
17+
18+
## Impact
19+
20+
- **Users**:
21+
- Can create new subjects that are called Meritocratic Autonomous Organizations (MAOs).
22+
- Will benefit from a more secure and efficient distribution process.
23+
- **Developers**: Developers will need to familiarize themselves with the new contract architecture and EDS integration.
24+
- **Operations**: The distribution process will be streamlined, reducing the potential for errors and improving overall system reliability.
25+
26+
## Next Steps
27+
28+
- **Documentation**: Update the documentation to include details on the new EDS integration and contract redesign.
29+
- **Testing**: Conduct thorough testing to ensure the new system operates as expected.
30+
- **Deployment**: Plan and execute the deployment of the updated contracts and distribution system.

.github/workflows/main.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: CI
2-
on:
2+
on:
33
pull_request:
44
branches: [main,staging]
55
types: [opened, reopened, labeled, synchronize]
6+
env:
7+
FORK_RPC_URL: ${{ secrets.FORK_RPC_URL }}
8+
NODE_ENV: 'TEST'
69
jobs:
710
lint:
811
runs-on: ubuntu-latest
@@ -22,3 +25,4 @@ jobs:
2225

2326
- name: Running tests
2427
run: pnpm test:parallel
28+

README.md

+96-26
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,111 @@
1-
# Rankify smart contracts
2-
![rankToken_resize](https://github.com/rankify-it/contracts/assets/61459744/82d4496e-7e46-47ee-8f2f-2fca6d3c30b8)
1+
### Installation
32

4-
Welcome to the Rankify Smart Contracts repository. This project contains the smart contracts used for the Rankify platform.
3+
1. Clone the repository:
54

6-
## Overview
5+
```sh
6+
git clone https://github.com/rankify-it/contracts.git
7+
cd contracts
8+
```
79

8-
Rankify is a decentralized platform that leverages blockchain technology to provide generic, transparent and sybil resistent rating systems for various applications. The platform allows users to create and participate in rankings, and earn rewards based on their contributions.
10+
2. Install dependencies:
911

12+
```sh
13+
pnpm install
14+
```
1015

11-
## Getting Started
16+
3. Setup environment variables
1217

13-
To get started with Rankify smart contracts, follow the instructions below.
18+
```sh
19+
mkdir .secrets
20+
cp dev.env.sample .secrets/dev.env
21+
vi .secrets/dev.env
22+
```
1423

24+
4. Compile the smart contracts:
1525

16-
### Installation
26+
```sh
27+
pnpm hardhat compile
28+
```
1729

18-
1. Clone the repository:
19-
```sh
20-
git clone https://github.com/rankify-it/contracts.git
21-
cd contracts
22-
```
30+
5. Deploy the smart contracts:
31+
```sh
32+
pnpm hardhat deploy --network <network> --tags <tags>
33+
```
2334

24-
2. Install dependencies:
25-
```sh
26-
pnpm install
27-
```
35+
## Available Distributions
36+
37+
We are using [Ethereum Distribution System](https://github.com/peeramid-labs/eds) to enable users to deploy their own infrastructure in transparent and decentralized way.
38+
39+
In order to be out of box compatible with the interfaces & notifications of the Rankify platform, any deployment should should be done from the Peeramid Labs Distributor contract ([PeeramidLabsDistributor.sol](./src/distributors/PeeramidLabsDistributor.sol)).
40+
41+
Specific address for distributor deployment can be found in the [deployments](./deployments) folder.
42+
43+
### Meritocratic Autonomous Organization (MAO)
44+
45+
[MAODistribution.sol](./src/distributions/MAODistribution.sol) is used to create a new Meritocratic Autonomous Organization (MAO).
2846

29-
3. Compile the smart contracts:
30-
```sh
31-
pnpm hardhat compile
32-
```
47+
This deployment will create following infrastructure:
3348

34-
4. Deploy the smart contracts:
35-
```sh
36-
pnpm hardhat deploy --network <network> --tags <tags>
37-
```
49+
- [RankToken](./src/tokens/RankToken.sol) - ERC1155 token used to represent the ranks in the MAO.
50+
- [Governance token](./src/tokens/DistributableGovernanceERC20.sol) - ERC20 token used to represent the governance in the MAO.
51+
- [ACID Distribution](./src/distributions/ArguableVotingTournament.sol) - Arguable Voting Tournament contract used to distribute governance tokens.
52+
- [Aragon OSx DAO](https://aragon.org/) - Aragon DAO used as wrapped smart account that represents the MAO.
53+
- [Aragon Token Voting Plugin](https://github.com/aragon/token-voting-plugin) - Aragon plugin used to vote on proposals within the DAO.
54+
55+
#### How to instantiate
56+
57+
In order to instantiate the MAO distribution, you don't need to deploy a thing. You just need to call the `instantiate` function of the the [PeeramidLabsDistributor.sol](./src/distributors/PeeramidLabsDistributor.sol) contract and specify proper distribution Id and arguments.
58+
59+
```ts
60+
import { MAODistribution } from 'rankify-contracts/types';
61+
const distributorArguments: MAODistribution.DistributorArgumentsStruct = {
62+
DAOSEttings: {
63+
daoURI: 'https://example.com/dao',
64+
subdomain: 'example',
65+
metadata: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('metadata')),
66+
tokenName: 'tokenName',
67+
tokenSymbol: 'tokenSymbol',
68+
},
69+
ACIDSettings: {
70+
RankTokenContractURI: 'https://example.com/rank',
71+
gamePrice: 1,
72+
joinGamePrice: 1,
73+
maxPlayersSize: 16,
74+
maxTurns: 1,
75+
metadata: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('metadata')),
76+
minPlayersSize: 4,
77+
paymentToken: rankify.address,
78+
rankTokenURI: 'https://example.com/rank',
79+
timePerTurn: 1,
80+
timeToJoin: 1,
81+
voteCredits: 14,
82+
},
83+
};
84+
const data = ethers.utils.defaultAbiCoder.encode(
85+
[
86+
'tuple(tuple(string daoURI, string subdomain, bytes metadata, string tokenName, string tokenSymbol) DAOSEttings, tuple(uint256 timePerTurn, uint256 maxPlayersSize, uint256 minPlayersSize, uint256 timeToJoin, uint256 maxTurns, uint256 voteCredits, uint256 gamePrice, address paymentToken, uint256 joinGamePrice, string metadata, string rankTokenURI, string RankTokenContractURI) ACIDSettings)',
87+
],
88+
[distributorArguments],
89+
);
90+
const distributorsDistId = process.env.DISTRIBUTOR_DIST_ID;
91+
const tx = await distributorContract.instantiate(distributorsDistId, data);
92+
```
93+
94+
In order to get `distributorsDistId` you can call `getDistributions` at `PeeramidLabsDistributor` contract and look for. We will host a public API to get the list of distributions soon.
95+
96+
### ACID distribution
97+
98+
[ArguableVotingTournament.sol](./src/distributions/ArguableVotingTournament.sol) is used to distribute governance tokens to the participants of the MAO by conducting autonomous competence identification tournaments.
99+
100+
This distribution deploys the Diamond Proxy that contains the following facets:
101+
102+
- [EIP712InspectorFacet](./src/facets/EIP712InspectorFacet.sol) - Facet that contains the main logic of the distribution.
103+
- [RankifyInstanceMainFacet](./src/facets//RankifyInstanceMainFacet.sol) - Facet that contains the main logic of the distribution.
104+
- [RankifyGameMastersFacetFacet](./src/facets/RankifyInstanceGameMastersFacet.sol) - Facet that contains the main logic of the distribution.
105+
- [RankifyInstanceGameOwnersFacet](./src/facets/RankifyInstanceGameOwnersFacet.sol) - Facet that contains the ownable logic of the distribution. (NB this will be deprecated)
106+
- [RankifyInstanceRequirementsFacet](./src/facets/RankifyInstanceRequirementsFacet.sol) - Facet that contains the requirements logic of the distribution.
107+
108+
To understand how it works further please refer to [docs.rankify.it](https://docs.rankify.it/governance) or ask us a question in [Discord](https://discord.gg/EddGgGUuWC)
38109

39110
## Contributing
40111

@@ -43,4 +114,3 @@ We welcome contributions to improve the Rankify smart contracts. Please fork the
43114
## License
44115

45116
This project is licensed under the MIT License.
46-

deploy/01_deployRankToken.ts

-29
This file was deleted.

deploy/02_deployRankify.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
1515
};
1616

1717
export default func;
18-
func.tags = ['rankify_token', 'rankify'];
18+
func.tags = ['rankify'];

deploy/03_deployGame.ts

-115
This file was deleted.

deploy/04_upgradeGame.ts

-31
This file was deleted.

deploy/06_deoployMultipass.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ethers } from 'hardhat';
66
import { MultipassDiamond } from '../types';
77
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
88
const { deployments, getNamedAccounts } = hre;
9-
const { deploy, diamond } = deployments;
9+
const { diamond } = deployments;
1010
const { deployer, owner } = await getNamedAccounts();
1111

1212
const deployment = await diamond.deploy('Multipass', {

0 commit comments

Comments
 (0)