|
1 |
| -## Architecture |
| 1 | +# Circles Architectural Overview |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +Circles is a decentralized economic system built on the Gnosis Chain, designed to create and distribute fair and social money through personal currencies. This overview provides a high-level understanding of the system's architecture and how its various components interact. |
| 6 | + |
| 7 | +# Circles Architectural Overview |
| 8 | + |
| 9 | +## System Architecture Diagram |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +<a href="https://link.excalidraw.com/readonly/EuVbVxV3LE0AZ3Od5rpP" target="_blank" rel="noopener noreferrer"> |
| 14 | + Open Circles Architecture diagram in new tab |
| 15 | +</a> |
| 16 | + |
| 17 | +## Core Components |
| 18 | + |
| 19 | +### Hub v2 (Circles) |
| 20 | + |
| 21 | +The central contract in the Circles ecosystem is the Hub v2, which serves as the main entry point for interactions with the system. It manages: |
| 22 | + |
| 23 | +- Registration of humans, organizations, and groups |
| 24 | +- Minting of personal currencies |
| 25 | +- Trust relationships between entities |
| 26 | +- Group creation and management |
| 27 | +- Minting collateral into group currencies |
| 28 | +- wrapping ERC1155 Circles Ids tokens into ERC20 wrappers |
| 29 | + |
| 30 | +The Hub v2 contract implements the ERC1155 standard, allowing it to handle multiple token types efficiently. |
| 31 | + |
| 32 | +[Code: /src/hub/Hub.sol](https://github.com/aboutcircles/circles-contracts-v2/blob/v0.3.6-docs/src/hub/Hub.sol) |
| 33 | + |
| 34 | +### NameRegistry |
| 35 | + |
| 36 | +The NameRegistry contract manages the names and metadata associated with Circles accounts. It allows users to set custom names, symbols, and metadata for their personal or group currencies. |
| 37 | + |
| 38 | +### Migration Contract |
| 39 | + |
| 40 | +This contract facilitates the migration of tokens and data from Circles v1 to v2. It ensures a smooth transition for existing users and their balances. |
| 41 | + |
| 42 | +### Standard Treasury |
| 43 | + |
| 44 | +The Standard Treasury contract handles the collateral for group currencies. It receives and manages the assets backing group Circles. |
| 45 | + |
| 46 | +### Vault |
| 47 | + |
| 48 | +The Vault contract (placeholder - details to be added) likely serves as a secure storage for certain assets or data within the Circles ecosystem. |
| 49 | + |
| 50 | +## Token Representations |
| 51 | + |
| 52 | +### Circles (ERC1155) |
| 53 | + |
| 54 | +The core representation of Circles currencies uses the ERC1155 standard, allowing for efficient management of multiple token types (personal and group currencies) within a single contract. |
| 55 | + |
| 56 | +### Wrappers |
| 57 | + |
| 58 | +To enhance compatibility with existing DeFi ecosystems, Circles provides ERC20 wrappers: |
| 59 | + |
| 60 | +1. **Demurrage ERC20**: Represents Circles with the demurrage (decay) factor applied. |
| 61 | +2. **Inflationary ERC20**: Represents Circles in their inflationary form, without demurrage applied. |
| 62 | + |
| 63 | +### ERC20Lift |
| 64 | + |
| 65 | +The ERC20Lift contract serves as a bridge between the ERC1155 and ERC20 representations, allowing users to wrap and unwrap their Circles tokens as needed. |
| 66 | + |
| 67 | +## Circles v1 Components (Legacy) |
| 68 | + |
| 69 | +### Hub v1 |
| 70 | + |
| 71 | +The original Hub contract from Circles v1, which is being phased out but remains relevant for migration purposes. |
| 72 | + |
| 73 | +### Token |
| 74 | + |
| 75 | +The individual ERC20 token contracts for personal currencies in Circles v1. |
| 76 | + |
| 77 | +## External Interactions |
| 78 | + |
| 79 | +### Gnosis Chain |
| 80 | + |
| 81 | +Circles is built on the Gnosis Chain, leveraging its security and efficiency. |
| 82 | + |
| 83 | +### Safe |
| 84 | + |
| 85 | +Integration with Safe (formerly Gnosis Safe) provides secure multi-signature wallet functionality for Circles users. |
| 86 | + |
| 87 | +### EoA (Externally Owned Accounts) |
| 88 | + |
| 89 | +Standard Ethereum accounts that can interact with the Circles system. |
| 90 | + |
| 91 | +## Advanced Features and Extensions |
| 92 | + |
| 93 | +### Intent Solver Competition |
| 94 | + |
| 95 | +(Placeholder) A mechanism for optimizing transactions and transfers within the Circles network. |
| 96 | + |
| 97 | +### Pre-/Post-hooks on Intents |
| 98 | + |
| 99 | +(Placeholder) Additional logic that can be executed before or after certain operations in the system. |
| 100 | + |
| 101 | +### Flow Matrix and ERC1155 |
| 102 | + |
| 103 | +A system for managing and executing complex transfers and exchanges of Circles currencies between multiple parties. |
| 104 | + |
| 105 | +### Single TransferThrough for v1 Pathfinder |
| 106 | + |
| 107 | +A mechanism to facilitate transfers using trust pathways, likely a carryover or adaptation from the v1 system. |
| 108 | + |
| 109 | +### Account Abstraction |
| 110 | + |
| 111 | +(Placeholder) Advanced account management features that may simplify user interactions with the system. |
| 112 | + |
| 113 | +### Custom Treasuries |
| 114 | + |
| 115 | +In addition to the Standard Treasury, the system allows for custom treasury implementations to cater to specific group needs. |
| 116 | + |
| 117 | +### Community dApps |
| 118 | + |
| 119 | +The architecture supports the development of community-driven decentralized applications, such as a potential CowSwap v2 integration. |
| 120 | + |
| 121 | +## Conclusion |
| 122 | + |
| 123 | +The Circles v2 architecture represents a significant evolution from its predecessor, offering a more flexible and scalable system for personal and group currencies. By leveraging advanced smart contract standards like ERC1155 and providing multiple token representations, Circles aims to create a robust ecosystem for social money that can integrate seamlessly with the broader DeFi landscape. |
| 124 | + |
| 125 | +This architecture balances the need for a cohesive, centralized hub with the flexibility required for diverse use cases and future extensions. As the system continues to evolve, this modular design will allow for the integration of new features and improvements while maintaining backward compatibility and supporting the migration from v1. |
0 commit comments