Guild Creation Guide
Creating a new guild (MAO - Meritocratic Autonomous Organization) involves deploying a complete set of smart contracts through the DAODistributor factory. This guide explains the technical process and requirements.
Architecture Overview
The guild creation process deploys 6 core components that work together to create a fully functional MAO:
Governance Token
A DistributableGovernanceERC20 token that represents voting power in the organization and can be earned through contributions.
Governance Access Manager
Controls minting permissions for the governance token, ensuring only distribution components can mint new tokens.
Governor Contract
Handles proposal creation, voting, and execution for organizational decisions using the governance tokens.
Rankify Instance (Diamond Proxy)
The core game engine that manages tournaments, competitions, and skill assessment within the guild.
Rank Token Access Manager
Controls minting and burning of rank tokens based on tournament results and expert contributions.
Rank Token
ERC20 tokens representing competence and expertise within specific domains, earned through successful participation.
Technical Creation Flow
The guild creation follows this technical process:
- Call DAODistributor.instantiate(): Provide guild configuration including governance settings (token name, voting parameters) and Rankify settings (participation costs, token URIs)
- MAODistribution.createOrg(): Deploys governance infrastructure using clone factories for gas efficiency
- MAODistribution.createRankify(): Deploys the Rankify diamond proxy and rank token system
- Component Integration: All components are configured to work together with proper access controls and permissions
- Return Addresses: The factory returns addresses of all 6 deployed contracts for frontend integration
Required Parameters
To create a guild, you need to provide two sets of parameters:
Governance Settings:
- Token name and symbol: Display name and ticker for the governance token
- Pre-mint amounts and receivers: Initial token distribution
- Organization name: Display name for the DAO
- Voting delay: Time before voting starts after proposal creation
- Voting period: Duration of the voting period
- Quorum requirements: Minimum participation for valid votes
Rankify Settings:
- Principal cost: Cost for players to participate in tournaments
- Principal time constant: Time-based parameters for participation
- Rank token metadata URIs: Token and contract metadata locations
- Payment token address: Token used for payments within the guild
Implementation Example
Here's a basic example of how to create a guild using the contracts:
Solidity Example:
// Prepare governance settings
MAODistribution.GovernanceArgs memory govArgs = MAODistribution.GovernanceArgs({
tokenName: "MyGuild Governance",
tokenSymbol: "MYG",
preMintAmounts: [1000 ether],
preMintReceivers: [msg.sender],
orgName: "My Expert Guild",
votingDelay: 1 days,
votingPeriod: 7 days,
quorum: 100 ether
});
// Prepare Rankify settings
MAODistribution.UserRankifySettings memory rankifyArgs = MAODistribution.UserRankifySettings({
principalCost: 10 ether,
principalTimeConstant: 86400, // 1 day
rankTokenURI: "https://api.myguild.com/rank/",
rankTokenContractURI: "https://api.myguild.com/contract",
paymentToken: address(paymentToken)
});
// Encode parameters
MAODistribution.DistributorArguments memory args = MAODistribution.DistributorArguments({
govSettings: govArgs,
rankifySettings: rankifyArgs
});
bytes memory encodedArgs = abi.encode(args);
// Create the guild
(address[] memory instances, bytes32 name, uint256 version) =
daoDistributor.instantiate(distributionId, encodedArgs);Gas Optimization
The guild creation process is optimized for gas efficiency:
Clone Factories
Uses OpenZeppelin's Clones library to deploy minimal proxy contracts instead of full contract bytecode, significantly reducing deployment costs.
Diamond Proxy
Rankify instances use the EIP-2535 Diamond pattern, allowing for modular functionality while maintaining a single proxy address.
Batch Deployment
All components are deployed and configured in a single transaction, reducing overall gas costs and ensuring atomic deployment.