-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodebase.d2
More file actions
176 lines (154 loc) · 4.18 KB
/
Copy pathcodebase.d2
File metadata and controls
176 lines (154 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# D2 Configuration
theme: 200
vars: {
d2-config: {
layout-engine: elk
}
}
# Global Styles
classes: {
contract: {
shape: rectangle
style: {
stroke-width: 2
3d: true
}
}
token: {
shape: cylinder
style: {
fill: "#e3f2fd"
3d: true
}
}
plugin: {
shape: package
style: {
fill: "#f1f8e9"
3d: true
}
}
}
# Actors
User: {
shape: person
style: { fill: "#f8f9fa" }
}
# Central Dispatcher
DAO_Core: {
style: { fill: "#eeeeee"; stroke: "#212121" }
Aragon_DAO: {
class: contract
label: "Aragon DAO (Executor)"
execute: "execute(uint256 callId, Action[] actions)"
hasPermission: "hasPermission(address who, address where, bytes32 permissionId)"
}
}
# Column 1: Assets & Lifecycle
Assets_And_Setup: {
grid-rows: 2
Tokens: {
DummyCoin: {
class: token
mint: "mint(address to, uint256 amount)"
}
VeDummyV2: {
class: token
label: "VeDummyV2 (Staking)"
deposit: "deposit(uint256 amount, uint256 duration)"
getVotes: "getVotes(address account)"
}
}
Setup: {
label: "Plugin Lifecycle"
PluginSetup: {
class: contract
label: "VeTokenVotingPluginSetup"
prepareInstallation: "prepareInstallation(address _dao, bytes _data)"
prepareUninstallation: "prepareUninstallation(...)"
}
}
}
# Column 2: Governance & Logic
Governance_Layer: {
VotingPlugin: {
class: plugin
label: "VeTokenVotingPlugin"
createProposal: "createProposal(...)"
vote: "vote(uint256 proposalId, ...)"
executeProposal: "executeProposal(uint256 proposalId)"
}
Condition: {
class: contract
label: "VeVotingPowerCondition"
checkCondition: "checkCondition(address _who)"
}
}
# Column 3: Councils & Treasury
Operations_Layer: {
grid-rows: 2
Councils: {
ElectedCouncil: {
class: contract
startElection: "startElection()"
vote: "vote(address[] candidates)"
spend: "spend(...)"
}
SecurityCouncil: {
class: contract
proposeVeto: "proposeVeto(uint256 proposalId)"
executeAction: "executeAction(uint256 actionId)"
}
}
Treasury: {
SecondaryTreasury: {
class: contract
proposeWithdrawal: "proposeWithdrawal(...)"
approveWithdrawal: "approveWithdrawal(...)"
emergencyWithdraw: "emergencyWithdraw(...)"
}
DEXAggregator: {
class: plugin
label: "DEXAggregatorPluginV3"
executeSwap: "executeSwap(...)"
proposeLargeSwap: "proposeLargeSwap(...)"
}
}
}
# External Integrations
Adapters: {
style: { fill: "#fafafa" }
UniswapV2: { class: contract }
UniswapV3: { class: contract }
}
# --- INTERACTIONS ---
# User Entry Points
User -> Assets_And_Setup.Tokens.VeDummyV2: "Stake Tokens"
User -> Governance_Layer.VotingPlugin: "Propose & Vote"
User -> Operations_Layer.Councils.ElectedCouncil: "Candidate & Vote"
# Core Logic Flow
Governance_Layer.VotingPlugin -> DAO_Core.Aragon_DAO: "EXECUTE_PERMISSION" {
style: { stroke-dash: 5 }
}
# Permission & Control Flow
DAO_Core.Aragon_DAO -> Governance_Layer.VotingPlugin: "SET_VOTING_SETTINGS_PERMISSION"
DAO_Core.Aragon_DAO -> Operations_Layer.Councils.SecurityCouncil: "ADMIN_ROLE"
DAO_Core.Aragon_DAO -> Operations_Layer.Treasury.SecondaryTreasury: "MANAGE_ALLOCATIONS"
# Inter-component Calls
Operations_Layer.Councils.SecurityCouncil -> Governance_Layer.VotingPlugin: "VETO_PERMISSION"
Operations_Layer.Treasury.SecondaryTreasury -> Operations_Layer.Councils.ElectedCouncil: "WITHDRAWAL_APPROVAL_PERMISSION"
Operations_Layer.Councils.ElectedCouncil -> Assets_And_Setup.Tokens.VeDummyV2: "Query Voting Power"
# Operations to Adapters
Operations_Layer.Treasury.DEXAggregator -> Adapters.UniswapV2: "Swap"
Operations_Layer.Treasury.DEXAggregator -> Adapters.UniswapV3: "Swap"
# Setup interactions
Assets_And_Setup.Setup.PluginSetup -> Governance_Layer.VotingPlugin: "Deploys & Configures"
# Asset Flow
Assets_And_Setup.Tokens.DummyCoin -> Assets_And_Setup.Tokens.VeDummyV2: "Staked Assets" {
style: { stroke: "#1565c0"; stroke-width: 4 }
}
# Layout constraints for NxN
Assets_And_Setup --- Governance_Layer
Governance_Layer --- Operations_Layer
Operations_Layer --- DAO_Core
DAO_Core --- Adapters