A comprehensive implementation of an ERC-20 pool token system with Superfluid Instant Distribution Agreement (IDA) for instant revenue sharing and modular auction-based redemption.
This system implements a novel approach to NFT fractionalization and revenue distribution:
- Pass-through payouts: Revenue is instantly distributed to pool token holders via Superfluid IDA
- Wallet visibility: Uses only ERC-20 (pool tokens) and ERC-721 (underlying NFTs) - no ERC-1155
- Auction-only redemption: NFTs can only be redeemed through auctions with earnest money
- Second-price mechanics: Winners pay the second-highest bid amount
- Audited-first stack: Reuses battle-tested components (Superfluid, thirdweb Marketplace)
- PoolShare (ERC-20): Tradeable pool tokens with IDA synchronization
- Escrow: NFT custody and revenue distribution hub
- AuctionAdapter: Interface to external auction marketplaces
- SettlementVault: Second-price settlement and proceeds routing
- Instant Distribution: No epochs, no snapshots - revenue flows immediately to current holders
- Permissionless Auctions: Anyone can start an auction by posting earnest money
- Modular Design: Swap auction engines without touching core contracts
- Invariant Protection:
totalSupply == totalNFTs × 1e18maintained at all times
- Foundry
- Node.js 16+ (for package management)
git clone <repository-url>
cd split
forge install# Run all tests
forge test
# Run with verbosity
forge test -vvv
# Run specific test
forge test --match-test testFullAuctionFlow- Copy and configure environment variables:
cp env.example .env
# Edit .env with your configuration- Deploy to testnet:
forge script script/Deploy.s.sol:Deploy --rpc-url $TESTNET_RPC_URL --private-key $PRIVATE_KEY --broadcast- Verify contracts:
forge script script/Deploy.s.sol:Deploy --rpc-url $TESTNET_RPC_URL --private-key $PRIVATE_KEY --verify// Approve NFT transfer
nft.approve(address(escrow), tokenId);
// Deposit NFT and receive pool tokens
uint256[] memory tokenIds = [tokenId];
escrow.deposit(nftCollection, tokenIds);
// You now have 1e18 pool tokens per NFT depositedRevenue is automatically distributed to your wallet as USDCx (Superfluid token):
// Check your USDCx balance
uint256 usdcxBalance = usdcx.balanceOf(yourAddress);
// Convert USDCx back to USDC anytime
usdcx.downgrade(usdcxBalance);// Approve earnest money (e.g., 500 USDC)
usdc.approve(address(auctionAdapter), earnestAmount);
// Start auction (earnest money becomes opening bid and reserve price)
uint256 listingId = auctionAdapter.startAuction(
nftCollection,
tokenId,
earnestAmount,
72 hours // duration
);Use the marketplace interface directly:
// Approve bid amount
usdc.approve(address(marketplace), bidAmount);
// Place bid
marketplace.offer(listingId, 1, address(usdc), bidAmount, deadline);Anyone can settle after auction ends:
settlementVault.settle(listingId);// When USDC accumulates in escrow from operations
escrow.forwardRevenue(); // Converts to USDCx and distributes instantly- PoolShare:
TBD - Escrow:
TBD - AuctionAdapter:
TBD - SettlementVault:
TBD
- PoolShare:
TBD - Escrow:
TBD - AuctionAdapter:
TBD - SettlementVault:
TBD
- Decimals: 18
- Supply: 1e18 tokens per NFT in escrow
- Transfers: Automatically sync with Superfluid IDA units
- Source: USDC from leasing, royalties, or other operations
- Mechanism: Instant distribution via Superfluid IDA
- Token: USDCx (upgradeable/downgradeable with USDC)
- Initiation: Anyone can start by posting earnest money
- Reserve: Earnest money amount
- Settlement: Second-price (winner pays second-highest bid)
- Proceeds: Flow through same revenue distribution system
- Invariant Protection: Total supply always equals NFT count × 1e18
- Reentrancy Guards: All state-changing functions protected
- Access Controls: Role-based permissions for critical functions
- Emergency Functions: Owner can rescue stuck tokens
// Required Superfluid contracts
ISuperfluid host = ISuperfluid(SUPERFLUID_HOST);
IInstantDistributionAgreementV1 ida = IInstantDistributionAgreementV1(IDA_ADDRESS);
ISuperToken usdcx = ISuperToken(USDCX_ADDRESS);Currently supports thirdweb Marketplace V3. To add support for other marketplaces:
- Implement marketplace-specific adapter
- Ensure it follows the
IMarketplaceinterface - Update settlement vault to handle marketplace-specific settlement
// Check pool token balance
const poolBalance = await poolShare.balanceOf(userAddress);
// Check USDCx received
const usdcxBalance = await usdcx.balanceOf(userAddress);
// Start auction
const tx = await auctionAdapter.startAuction(
nftAddress,
tokenId,
earnestAmount,
duration
);├── src/
│ ├── PoolShare.sol # ERC-20 pool token with IDA sync
│ ├── Escrow.sol # NFT custody and revenue distribution
│ ├── AuctionAdapter.sol # Marketplace integration
│ ├── SettlementVault.sol # Second-price settlement
│ ├── interfaces/ # External contract interfaces
│ └── mocks/ # Mock contracts for testing
├── test/ # Comprehensive test suite
├── script/ # Deployment scripts
└── README.md # This file
- New Auction Engine: Implement
IMarketplaceinterface - Additional Revenue Sources: Add to
Escrow.forwardRevenue() - Compliance Features: Extend
PoolSharetransfer hooks - Advanced Settlement: Enhance
SettlementVaultlogic
- Unit Tests: Each contract tested in isolation
- Integration Tests: Full flow testing with all components
- Invariant Tests: Verify system invariants hold
- Fuzz Tests: Random input testing for edge cases
- Modular Design: Each component can be audited separately
- External Dependencies: Relies on audited Superfluid and marketplace contracts
- Minimal Custom Logic: Reduces attack surface
- Marketplace Dependency: Relies on external marketplace for auction mechanics
- Superfluid Dependency: Requires Superfluid protocol for distribution
- Second-Price Implementation: Simplified for MVP (can be enhanced)
- Batch Operations: Support for multi-NFT deposits
- Efficient IDA Updates: Only update when balances change
- Minimal Storage: Lean data structures
- ✅ Core contracts implementation
- ✅ Comprehensive testing
- ✅ Deployment scripts
- ✅ Documentation
- Enhanced second-price mechanics
- Multiple marketplace support
- Advanced analytics dashboard
- Governance token integration
- Cross-chain deployment
- Advanced compliance features
- Automated market making
- DAO governance
- Fork the repository
- Create a feature branch
- Make changes with tests
- Submit a pull request
MIT License - see LICENSE file for details.
- Documentation: This README and inline code comments
- Issues: GitHub Issues tracker
- Community: [Discord/Telegram link]
- Superfluid Protocol for instant distribution infrastructure
- thirdweb for marketplace contracts
- OpenZeppelin for security-focused base contracts
- Foundry for development framework