How vana-com/vana-dlp-smart-contracts works
Main Components
• Data Liquidity Pool (DLP) Contract – the upgradeable pool that handles file uploads, reward calculations, and integration with external contracts.
• DAT (Data Access Token) Contract – an ERC20 token contract with additional governance features (ERC20Permit and ERC20Votes).
• Dependency Contracts – these include:
• Data Registry Contract, which catalogs files, manages file metadata, and controls access.
• TEE Pool Contract, which coordinates file validation via trusted execution environments.
• Root Network Contract, which handles the registration of DLPs, staking, and reward distribution via an epoch-based system.
• Deployment & Testing Scripts – shown by deploy directory (deploy.ts, dlp-deploy.ts, token-deploy.ts) and test directory which verifies these contracts.
• Utility Scripts – assisting with time manipulation and helper functionalities used by tests or deployment.
Relationships and Interactions
• The DLP Contract is central and integrates directly with the Data Registry and TEE Pool contracts, as well as registering itself with the Root Network for rewards.
• The DAT contract is the token associated with the DLP, managing minting, governance, and additional extension functionalities.
• The data flow, as described in the README, goes from a data contributor (e.g., “Bob”):
• Bob uploads his file to the Data Registry.
• The file is then associated with an attestation via the TEE Pool.
• Once a valid proof is established, Bob interacts with the DLP contract to get rewarded.
• There is also an administrative flow for registering, updating, and deregistering a DLP with the Root Network contract.
• The deployment scripts manage the deployment order and configuration settings as required (using environment variables).
Architectural Patterns and Design Principles
• Use of the Universal Upgradeable Proxy Standard (UUPS) for the DLP contract ensures upgradeability while preserving state.
• Modular separation: Each dependency (Data Registry, TEE Pool, Root Network) is handled in separate contracts and directories, enabling independent testing and updates.
• Standardization: The DAT token leverages widely adopted patterns from OpenZeppelin (ERC20, ERC20Votes) ensuring reliability and security.
• Clear boundaries exist between on-chain smart contract logic and off-chain interactions (e.g., deployment scripts, environment setups, and optional UI interactions).
Incorporate Technologies and Frameworks
• Hardhat – for deployment and testing.
• Typescript – evident from tsconfig.json and script files.
• OpenZeppelin libraries – for upgradeable contracts, ERC20, Pausable, etc.
• Gelato integration for gasless transactions (via trusted forwarder) and deployment support.
Elements
• From Data Contributor to Data Registry (file submission).
• From Data Registry to TEE Pool (attestation/proof validation).
• From TEE Pool back to Data Registry (storing attestations).
• Then linking Data Registry and DLP (to trigger reward logic).
• From DLP to Root Network (for registration and staking-based reward distribution).
Overall Approach
• Drill down to show sub-components within the DLP smart contract (initialization, file management, contributor details) to capture important methods (like initialize, pause, update functions, and reward requests).