-
Clone the repository:
git clone https://github.com/rankify-it/contracts.git cd contracts
-
Install dependencies:
pnpm install
-
Setup environment variables
mkdir .secrets cp dev.env.sample .secrets/dev.env vi .secrets/dev.env
-
Compile the smart contracts:
pnpm hardhat compile
-
Deploy the smart contracts:
pnpm hardhat deploy --network <network> --tags <tags>
We are using Ethereum Distribution System 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).
Specific address for distributor deployment can be found in the deployments folder.
MAODistribution.sol is used to create a new Meritocratic Autonomous Organization (MAO).
This deployment will create following infrastructure:
- RankToken - ERC1155 token used to represent the ranks in the MAO.
- Governance token - ERC20 token used to represent the governance in the MAO.
- ACID Distribution - Arguable Voting Tournament contract used to distribute governance tokens.
- Aragon OSx DAO - Aragon DAO used as wrapped smart account that represents the MAO.
- Aragon Token Voting Plugin - Aragon plugin used to vote on proposals within the DAO.
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 contract and specify proper distribution Id and arguments.
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.
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 - Facet that contains the main logic of the distribution.
- RankifyInstanceMainFacet - Facet that contains the main logic of the distribution.
- RankifyGameMastersFacetFacet - Facet that contains the main logic of the distribution.
- RankifyInstanceGameOwnersFacet - Facet that contains the ownable logic of the distribution. (NB this will be deprecated)
- RankifyInstanceRequirementsFacet - Facet that contains the requirements logic of the distribution.
To understand how it works further please refer to docs.rankify.it or ask us a question in Discord
We welcome contributions to improve the Rankify smart contracts. Please fork the repository and submit a pull request.
This project is licensed under the MIT License.