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

19 factory subject allow list #62

Merged
merged 71 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
77e5fa1
merge main
peersky Jul 8, 2024
b5aaeef
contracts - yay! Tests - Nay :(
peersky Jul 8, 2024
5b92337
clonedist unit test
peersky Jul 8, 2024
97dd55a
cleanup
peersky Jul 8, 2024
a38b9c2
diamondDistribution tests
peersky Jul 8, 2024
1618787
moved diamond code to /vendor/diamond, modified imports accordingly, …
peersky Jul 11, 2024
3d6315a
modified import paths of facets
peersky Jul 11, 2024
8c5db4a
improved eds and moved it in to /vendor/eds directory
peersky Jul 11, 2024
b428455
added mock files for eds
peersky Jul 11, 2024
19846a0
removed old eds files from interfaces
peersky Jul 11, 2024
f93672f
tests
peersky Jul 11, 2024
ab769d0
better naming
peersky Jul 11, 2024
6be9855
restore pnpm lock file
peersky Jul 11, 2024
de1c6ac
updated abi's
peersky Jul 11, 2024
1c57847
Merge branch 'main' into 16-generic-diamond-factory
peersky Jul 11, 2024
85bf289
initial commit
peersky Jul 11, 2024
a5e6f3f
Merge branch 'main' into 19-factory-subject-allow-list
peersky Aug 21, 2024
9c64dc4
use eds as dependency
peersky Sep 10, 2024
0cd573d
remove abis from src control
peersky Sep 11, 2024
dea3c19
dirty commit to share wip /w aragon team
peersky Sep 12, 2024
ab0abc5
concept compiles
peersky Sep 12, 2024
5a13004
remove compositeERC1155, make RankToken clonable, use layers for Rank…
peersky Sep 18, 2024
32a5b5f
remove get rank interfaces from rank token
peersky Sep 18, 2024
e527eed
remove composite functionality from ranking instance for now
peersky Sep 18, 2024
6265f62
Distributable Governance token, with ERC7746 middleware
peersky Sep 18, 2024
f1bdf38
mao distribution instantiate does not revert anymore
peersky Sep 24, 2024
925c3a8
playbooks
peersky Sep 25, 2024
16506fa
clean up deployment script
peersky Sep 25, 2024
21f7455
remove storage pattern
peersky Sep 25, 2024
c0d20d2
move distribution pattern to test setup routine
peersky Sep 25, 2024
1eb8fec
deployment pipeline and MAO distr unit test seems to work
peersky Sep 25, 2024
3d99eb3
hotfixed some tests
peersky Sep 25, 2024
65b0810
parametrize fork block number
peersky Sep 26, 2024
30e7ca7
fix typo
peersky Sep 26, 2024
3ed3541
remove some logs
peersky Sep 26, 2024
076268e
tdd, cleanup, specific fork block number
peersky Sep 26, 2024
d456069
rank token tests pass
peersky Sep 26, 2024
13fae3f
restore pnpm files, cleanup unused packages
peersky Sep 26, 2024
b5eda4d
Merge branch 'main' into 19-factory-subject-allow-list
peersky Sep 26, 2024
2ebdffc
Merge branch 'main' into 19-factory-subject-allow-list
peersky Sep 26, 2024
2f9f2d4
Merge branch 'main' into 19-factory-subject-allow-list
peersky Sep 26, 2024
2b176be
cleanup deploy scripts
peersky Sep 26, 2024
4b73961
add tracer to deps
peersky Sep 26, 2024
15c9b88
bump hh dep to meet tracer reqs
peersky Sep 26, 2024
facaff2
fix workflow (hopefully)
peersky Sep 26, 2024
ab30650
basic changeset info
peersky Sep 26, 2024
6036162
env for both jobs
peersky Sep 26, 2024
95de7d3
Merge branch 'main' into 19-factory-subject-allow-list
peersky Sep 26, 2024
28f5ca5
happy linter - happy life
peersky Sep 26, 2024
d62f479
force node env to test during tests and linting
peersky Sep 26, 2024
69783df
rm unused
peersky Sep 26, 2024
dc0c0af
use stable osx ether version
peersky Sep 26, 2024
b4c71c8
seems like ethers 2.22.11 has bug
peersky Sep 27, 2024
1e3eb5c
improved docs generation format
peersky Sep 28, 2024
ec152af
update docstrings
peersky Sep 28, 2024
24a7766
Merge branch 'main' into 19-factory-subject-allow-list
peersky Sep 28, 2024
d7568b8
fix test types
peersky Sep 28, 2024
2d39216
add readme
peersky Sep 28, 2024
c2f516b
happy linter - happy life
peersky Sep 28, 2024
21ac2cf
changeset elaborated
peersky Sep 28, 2024
02114b6
canonical names for standard defined methods
peersky Sep 28, 2024
2163f5c
canonical names for standard defined methods
peersky Sep 28, 2024
325daf1
fix interface id name
peersky Sep 28, 2024
9566bb3
Merge branch '19-factory-subject-allow-list' of github.com:peeramid-l…
peersky Sep 28, 2024
841025d
removed compiler warnings, improved doc generation, defined scope to …
peersky Sep 29, 2024
0215eee
happy linter - happy life
peersky Sep 29, 2024
bcfc624
Update README.md
peersky Sep 30, 2024
a8c8579
upd readme
peersky Sep 30, 2024
ebd6e21
Merge branch 'main' into 19-factory-subject-allow-list
peersky Sep 30, 2024
e773b6d
migrated to eds 2.0, added sample dev env file
peersky Oct 1, 2024
bebaee4
added sample env and updated readme
peersky Oct 1, 2024
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
30 changes: 30 additions & 0 deletions .changeset/silly-seahorses-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
'rankify-contracts': minor
---

## Addition of Ethereum Distribution System (EDS)

- **Feature**: Integrated the Ethereum Distribution System (EDS) for distributing Rankify contracts.
- **Description**: Rankify contracts are now distributed via the Ethereum Distribution System, enhancing the efficiency and security of the distribution process.

## Redesign of Contracts

- **Feature**: Redesigned contracts to work seamlessly as part of the Ethereum Distribution System.
- **Description**: The contracts have been restructured and optimized to ensure compatibility and smooth operation within the EDS framework. This redesign includes:
- Improved contract architecture for better integration with EDS.
- Enhanced security measures to protect against potential vulnerabilities.
- Optimized performance to handle the distribution process more efficiently.

## Impact

- **Users**:
- Can create new subjects that are called Meritocratic Autonomous Organizations (MAOs).
- Will benefit from a more secure and efficient distribution process.
- **Developers**: Developers will need to familiarize themselves with the new contract architecture and EDS integration.
- **Operations**: The distribution process will be streamlined, reducing the potential for errors and improving overall system reliability.

## Next Steps

- **Documentation**: Update the documentation to include details on the new EDS integration and contract redesign.
- **Testing**: Conduct thorough testing to ensure the new system operates as expected.
- **Deployment**: Plan and execute the deployment of the updated contracts and distribution system.
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: CI
on:
on:
pull_request:
branches: [main,staging]
types: [opened, reopened, labeled, synchronize]
env:
FORK_RPC_URL: ${{ secrets.FORK_RPC_URL }}
NODE_ENV: 'TEST'
jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -22,3 +25,4 @@ jobs:

- name: Running tests
run: pnpm test:parallel

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

Welcome to the Rankify Smart Contracts repository. This project contains the smart contracts used for the Rankify platform.
1. Clone the repository:

## Overview
```sh
git clone https://github.com/rankify-it/contracts.git
cd contracts
```

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.
2. Install dependencies:

```sh
pnpm install
```

## Getting Started
3. Setup environment variables

To get started with Rankify smart contracts, follow the instructions below.
```sh
mkdir .secrets
cp dev.env.sample .secrets/dev.env
vi .secrets/dev.env
```

4. Compile the smart contracts:

### Installation
```sh
pnpm hardhat compile
```

1. Clone the repository:
```sh
git clone https://github.com/rankify-it/contracts.git
cd contracts
```
5. Deploy the smart contracts:
```sh
pnpm hardhat deploy --network <network> --tags <tags>
```

2. Install dependencies:
```sh
pnpm install
```
## Available Distributions

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.

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)).

Specific address for distributor deployment can be found in the [deployments](./deployments) folder.

### Meritocratic Autonomous Organization (MAO)

[MAODistribution.sol](./src/distributions/MAODistribution.sol) is used to create a new Meritocratic Autonomous Organization (MAO).

3. Compile the smart contracts:
```sh
pnpm hardhat compile
```
This deployment will create following infrastructure:

4. Deploy the smart contracts:
```sh
pnpm hardhat deploy --network <network> --tags <tags>
```
- [RankToken](./src/tokens/RankToken.sol) - ERC1155 token used to represent the ranks in the MAO.
- [Governance token](./src/tokens/DistributableGovernanceERC20.sol) - ERC20 token used to represent the governance in the MAO.
- [ACID Distribution](./src/distributions/ArguableVotingTournament.sol) - Arguable Voting Tournament contract used to distribute governance tokens.
- [Aragon OSx DAO](https://aragon.org/) - Aragon DAO used as wrapped smart account that represents the MAO.
- [Aragon Token Voting Plugin](https://github.com/aragon/token-voting-plugin) - Aragon plugin used to vote on proposals within the DAO.

#### How to instantiate

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.

```ts
import { MAODistribution } from 'rankify-contracts/types';
const distributorArguments: MAODistribution.DistributorArgumentsStruct = {
DAOSEttings: {
daoURI: 'https://example.com/dao',
subdomain: 'example',
metadata: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('metadata')),
tokenName: 'tokenName',
tokenSymbol: 'tokenSymbol',
},
ACIDSettings: {
RankTokenContractURI: 'https://example.com/rank',
gamePrice: 1,
joinGamePrice: 1,
maxPlayersSize: 16,
maxTurns: 1,
metadata: ethers.utils.hexlify(ethers.utils.toUtf8Bytes('metadata')),
minPlayersSize: 4,
paymentToken: rankify.address,
rankTokenURI: 'https://example.com/rank',
timePerTurn: 1,
timeToJoin: 1,
voteCredits: 14,
},
};
const data = ethers.utils.defaultAbiCoder.encode(
[
'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)',
],
[distributorArguments],
);
const distributorsDistId = process.env.DISTRIBUTOR_DIST_ID;
const tx = await distributorContract.instantiate(distributorsDistId, data);
```

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.

### ACID distribution

[ArguableVotingTournament.sol](./src/distributions/ArguableVotingTournament.sol) is used to distribute governance tokens to the participants of the MAO by conducting autonomous competence identification tournaments.

This distribution deploys the Diamond Proxy that contains the following facets:

- [EIP712InspectorFacet](./src/facets/EIP712InspectorFacet.sol) - Facet that contains the main logic of the distribution.
- [RankifyInstanceMainFacet](./src/facets//RankifyInstanceMainFacet.sol) - Facet that contains the main logic of the distribution.
- [RankifyGameMastersFacetFacet](./src/facets/RankifyInstanceGameMastersFacet.sol) - Facet that contains the main logic of the distribution.
- [RankifyInstanceGameOwnersFacet](./src/facets/RankifyInstanceGameOwnersFacet.sol) - Facet that contains the ownable logic of the distribution. (NB this will be deprecated)
- [RankifyInstanceRequirementsFacet](./src/facets/RankifyInstanceRequirementsFacet.sol) - Facet that contains the requirements logic of the distribution.

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)

## Contributing

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

This project is licensed under the MIT License.

29 changes: 0 additions & 29 deletions deploy/01_deployRankToken.ts

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/02_deployRankify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
};

export default func;
func.tags = ['rankify_token', 'rankify'];
func.tags = ['rankify'];
115 changes: 0 additions & 115 deletions deploy/03_deployGame.ts

This file was deleted.

31 changes: 0 additions & 31 deletions deploy/04_upgradeGame.ts

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/06_deoployMultipass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ethers } from 'hardhat';
import { MultipassDiamond } from '../types';
const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts } = hre;
const { deploy, diamond } = deployments;
const { diamond } = deployments;
const { deployer, owner } = await getNamedAccounts();

const deployment = await diamond.deploy('Multipass', {
Expand Down
Loading
Loading