allo-protocol / allo-v2

Core Allo V2 Contracts
GNU Affero General Public License v3.0
90 stars 73 forks source link

Allo Protocol

The Allo Protocol introduces a sophisticated ecosystem on the Ethereum blockchain, enabling automated and decentralized fund allocation and distribution. The protocol comprises a set of smart contracts that collectively offer an advanced framework for fund management, fee handling, and governance. The technical architecture and interactions within the protocol are explained below.

Table of Contents

Diagram

flowchart
    Actor --> |profile management| Registry.sol --> |deploys|Anchor.sol
    PoolManager --> |createPool for profile| Allo.sol --> |validate profile| Registry.sol

    PoolManager --> |pool manager actions| Allo.sol --> |invoke pool function| BaseStrategy.sol

    PoolManager/Recipient/Allocator --> |invoke function unique to strategy implmentation|BaseStrategy.sol

Contract Overview

Contract Purpose
Registry.sol Registry of profiles which offers profile management
Anchor.sol - Contract which can receive funds / execute transaction.
- Generated using identityId and name of the profile
- Is linked to a profile in Registry.sol
Allo.sol - Management of a pool
- Requires a profile from registry to create a pool
- Expects a strategy which implements BaseStrategy.sol
- Expects all interactions with the functions on BaseStrategys.sol to happen via Allo.sol
BaseStrategy.sol - Abstract contract which implements IStrategy.sol
- Every strategy should override the internal functions to be deemed as a valid strategy
- Can have other functions unique to the strategy which can be invoked directly on the strategy

Registry Contract (Registry.sol)

The Registry contract serves as the foundational building block of the Allo Protocol. It facilitates the creation, attestation, and management of profiles. A profile is a unique entity representing a user's identity within the protocol. This contract offers functions to query profiles by ID and anchor, as well as to create new profiles with personalized metadata, attestation addresses, and members.

Each time a profile generates a new anchor (during profile creation or when profile name is updated), it triggers the deployment of an Anchor Contract. These Anchor Contracts serve as versatile tools that can receive funds or fulfill other designated purposes. This dynamic mechanism enables profiles to engage in a wide array of activities within the protocol, enhancing flexibility and functionality across the Allo ecosystem.

Anchor Contract (Anchor.sol)

The Anchor contract is a vital component that enhances the capabilities of profiles. It acts as an isolated enclave, allowing profile owners to securely interact with external addresses. Profile owners can execute calls to target addresses while maintaining control over the amount of native tokens sent and the data transmitted. This contract leverages the Registry contract for verifying ownership, ensuring that only authorized users can utilize its functionality.

Allo Contract (Allo.sol)

At the heart of the Allo Protocol lies the Allo contract, a versatile and feature-rich smart contract that enables efficient and decentralized fund allocation and distribution. The contract encompasses mechanisms for handling fees, managing treasury, and defining access controls. Its comprehensive design is composed of distinct functions, variables, modifiers, and events that collaboratively enable a robust fund management framework.

Key Functionality and Interactions

Profile Creation and Management:

The Allo Protocol commences with the creation and management of profiles through the Registry contract. Users can create profiles, each uniquely identified by a profile ID. Profile metadata, attestation addresses, and members can be customized during creation. The Registry contract ensures that only authorized users can manipulate profiles by verifying ownership.

Secure External Interactions:

The Anchor contract bridges the gap between profile owners and external addresses. It provides a secure gateway for profile owners to execute calls to external contracts. Profile owners can specify the amount of native tokens and data to be sent along with the call. The Anchor contract incorporates the Registry contract to validate the ownership of the profile, assuring that only legitimate owners can access its functionalities.

Advanced Fund Allocation and Distribution:

The crux of the protocol's functionality resides within the Allo contract, which enables decentralized and automated fund management. Pools are created and managed within this contract, each with customizable strategies for fund allocation and distribution. Users can create pools, define parameters, and set strategies, while administrators and managers control the actual allocation and distribution of funds.

Fee Handling and Treasury Management:

The Allo contract incorporates a comprehensive fee management system. It allows the contract owner to set and update fee parameters, control treasury addresses, and recover funds. This fee structure ensures the protocol's sustainability and adaptability. The treasury management mechanism enhances the contract's robustness by enabling controlled fund recovery.

Roles and Actors

The Allo Protocol delegates distinct roles to participants to foster efficient governance:

Conclusion

The Allo Protocol is a technologically advanced framework for decentralized fund allocation and distribution. By employing the Registry, Anchor, and Allo contracts in tandem, the protocol establishes an ecosystem where users can securely manage their funds, define strategies, and participate in a DeFi ecosystem that embodies transparency and user-centric governance.

User Flows

Allo Contract

Overall Interaction

  1. Users create profiles in the Registry contract and associate their addresses with specific roles and permissions.
  2. Users, identified by their addresses and associated profiles, interact with the Allo contract to create pools, allocate funds, and manage pools.
  3. The Allo contract checks user profiles with the Registry to ensure that only authorized users perform certain actions.
  4. Strategies (inherited from BaseStrategy) within the Allo contract handle allocation, distribution, and management of funds based on specific logic.
  5. The Anchor contract allows for dynamic execution of arbitrary calls based on predefined conditions, often triggered by events in the Allo ecosystem.
  6. Together, these contracts create an ecosystem where users can manage and allocate funds according to various strategies while adhering to predefined permissions and conditions.