A decentralized marketplace platform enabling anyone to create and manage communities of vendors, with built-in payment splitting and NFT-based access passes.
Flexable is a permissionless platform where:
- Anyone can become a community manager and create vendor networks
- Vendors can join multiple communities to expand their reach
- Users can purchase, trade, and utilize service passes as NFTs
- Payments are automatically split between platform, managers and vendors
- Managers can curate networks of bars, clubs and venues
- Users purchase passes for entry, drinks or VIP access
- Venues get instant payouts based on usage
- Restaurant groups can offer combined dining passes
- Users access multiple venues with a single NFT
- Revenue sharing between participating restaurants
- Shopping districts can create joint loyalty programs
- Store owners receive proportional revenue share
- Customers unlock perks across multiple shops
- Artists/creators can form collaborative networks
- Fans purchase passes for content/experiences
- Fair profit distribution to contributing creators
- Zero upfront costs to create communities
- Automated revenue collection and distribution
- Tools to curate and grow vendor networks
- Access to wider customer base
- Flexible participation in multiple communities
- Transparent and instant payments
- Single pass for multiple services
- Trade/resell passes on NFT marketplaces
- Verifiable proof of purchase on chain
- Cross-chain community bridging
- Advanced tokenomics and staking
- Mobile app for pass management
- Expanded vendor integration tools
Flexable consists of two main smart contracts that work together to create a comprehensive community marketplace:
- FlexablePaymentSplitter - Manages communities, payment splitting, and service purchases
- FlexablePassNFT - Mints NFT passes as proof of service purchases
βββββββββββββββββββββββ ββββββββββββββββββββββββ
β FlexablePaymentSplitter βββββ€ FlexablePassNFT β
β β β β
β β’ Community Mgmt β β β’ ERC721 NFTs β
β β’ Payment Splitting β β β’ Pass Metadata β
β β’ USDC Distribution β β β’ Minting Logic β
β β’ Access Control β β β’ URI Management β
βββββββββββββββββββββββ ββββββββββββββββββββββββ
- Community Creation: Managers can create communities with custom fee structures
- Vendor Management: Add/update vendors with individual pricing and shares
- Access Control: Role-based permissions with admin and manager roles
- Multi-tier Fee Structure: Platform β Manager β Vendors
- Flexible Distribution: Percentage-based vendor profit sharing
- USDC Integration: Native USDC token support with SafeERC20
- Claim System: Pending balances with secure withdrawal mechanism
- Automatic Minting: NFT passes minted on every purchase
- Rich Metadata: Community ID, purchase date, and buyer information
- Customizable URIs: Flexible metadata and image hosting
- ERC721 Standard: Full compatibility with NFT marketplaces
Key Components:
struct Community {
string name;
address manager;
uint256 managerFeeBP; // Manager fee in basis points
bool isActive;
string serviceName;
mapping(uint256 => Vendor) vendors;
uint256 vendorCount;
uint256 totalSharesBP; // Total vendor shares
}
struct Vendor {
address wallet;
string name;
uint256 price; // Service price in USDC
uint256 share; // Percentage share (basis points)
bool active;
string description;
}
Main Functions:
createCommunity()
- Create new community with vendorspurchaseFromVendor()
- Buy services and trigger payment splitclaimFunds()
- Withdraw accumulated earningsupdateManagerFee()
- Adjust manager fee structurecommunityActivation()
- Enable/disable communities
Fee Structure:
- Platform Fee: 10% (1000 basis points) - configurable up to 10%
- Manager Fee: Up to 50% (5000 basis points) - set per community
- Vendor Shares: Remaining amount distributed by percentage shares
Key Components:
struct PassMetadata {
uint256 communityId;
uint256 purchaseDate;
address originalBuyer;
}
Main Functions:
mintPass()
- Mint NFT pass (called by PaymentSplitter)updateTokenURI()
- Update metadata URI (admin only)- Standard ERC721 functions (transfer, approve, etc.)
Roles:
ADMIN_ROLE
- Full contract administrationMINTER_ROLE
- Can mint new passes (typically the PaymentSplitter)
// Deploy NFT contract first
FlexablePassNFT passNFT = new FlexablePassNFT();
// Deploy payment splitter
FlexablePaymentSplitter splitter = new FlexablePaymentSplitter(
USDC_ADDRESS,
PLATFORM_WALLET
);
// Connect contracts
splitter.setPassNFT(address(passNFT));
passNFT.grantRole(MINTER_ROLE, address(splitter));
// Define vendors
Vendor[] memory vendors = new Vendor[](2);
vendors[0] = Vendor({
wallet: 0x123...,
name: "Design Service",
price: 100 * 10**6, // 100 USDC
share: 6000, // 60%
active: true,
description: "UI/UX Design"
});
// Create community
uint256 communityId = splitter.createCommunity(
"Web3 Designers",
1000, // 10% manager fee
vendors,
200 * 10**6 // 200 USDC total price
);
// Approve USDC spending
usdc.approve(address(splitter), 200 * 10**6);
// Purchase and get NFT pass
splitter.purchaseFromVendor(
communityId,
"https://metadata.example.com/pass/"
);
- ReentrancyGuard: Protection against reentrancy attacks
- SafeERC20: Safe token transfers with proper error handling
- Access Control: Role-based permissions for sensitive functions
- Input Validation: Comprehensive requirement checks
- Overflow Protection: Solidity 0.8.25 built-in overflow protection
CommunityCreated
- New community registeredPassPurchased
- Service purchased and NFT mintedPaymentSplit
- Payment distributed to recipientFundsClaimed
- User withdrew earningsPlatformFeeUpdated
- Platform fee changed
PassMinted
- New NFT pass created- Standard ERC721 events (Transfer, Approval, etc.)
- Packed Structs: Efficient storage layout
- Batch Operations: Multiple vendors processed in single transaction
- Minimal External Calls: Reduced contract interactions
- Storage vs Memory: Optimal data location choices
- Solidity Version: 0.8.25
- OpenZeppelin: ^5.0.0
- Network: Ethereum, Polygon, or other EVM-compatible chains
- Token: USDC contract address for payments
MIT License - see LICENSE file for details.
- Fork the repository
- Create feature branch
- Add comprehensive tests
- Submit pull request with detailed description
- Add tradehub which will be named FlexableMarketplace
- Add FlexableAuth will be contract where Admin , Operator and Mintor for all contracts within Flexable.
- Scalydiagram