-
Notifications
You must be signed in to change notification settings - Fork 2
/
macros.iuml
538 lines (449 loc) · 11.6 KB
/
macros.iuml
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
skinparam defaultMonospacedFontName Andale Mono
!define TBD [//to be completed <&warning>//]
!define directory(name) class name << (D,cyan) Directory >>
!define file(name) class name << (F,turquoise) File >>
!define hashIdField(h1) - {field} <&key> id: ID //= hash(// ""h1"" //)//
!define hashIdField(h1,h2) - {field} <&key> id: ID //= hash(// ""h1""//,// ""h2"" //)//
!define hashIdField(h1,h2,h3) - {field} <&key> id: ID //= hash(// ""h1""//,// ""h2""//,// ""h3"" //)//
!define hashIdField(h1,h2,h3,h4) - {field} <&key> id: ID //= hash(// ""h1""//,// ""h2""//,// ""h3"" //,// ""h4"" //)//
!define UNKNOWN_ID - {field} <&key> id: ID = TBD
!define object(name) class name << (O,lawngreen) Data Object >>
!define interface(name) class name << (I,blueviolet) Interface >>
!define enum(name) class name << (E,yellow) Enum >>
!define resource(name) class name << (R,orchid) Resource >>
!define extern(name) class name << (R,darkorange) External Resource >>
!define externObject(name) class name << (O,khaki) External Object >>
!define collection(name) class name << (C,deeppink) Collection >>
'
' Resources
'
!ifdef SHOW_PROJECT
!ifdef EXTERN_PROJECT
extern(Project) {
+ directory: String
+ {method} resolve (\n\ttype: String,\n\tname: String\n): Array<NameRecord>
}
!else
resource(Project) {
+ directory: String
+ {method} resolve (\n\ttype: String,\n\tname: String\n): Array<NameRecord>
..
hashIdField(directory)
}
!endif
!endif
!ifdef SHOW_NAME_RECORD
!ifdef EXTERN_NAME_RECORD
extern(NameRecord) {
+ type: String
+ name: String
+ {method} resource: T
+ {method} previous: Maybe<NameRecord<T>>
}
!else
class NameRecord< T: Resource > << (R,orchid) Resource >> {
+ type: String
+ name: String
+ {method} resource: T
+ {method} previous: Maybe<NameRecord<T>>
..
hashIdField(type,name,resource,previous)
- resourceId: ID
- previousId: ID
}
interface(Named) {
+ name: String
}
NameRecord o-- "1" Named
NameRecord o-- "0..1" NameRecord
!ifdef SHOW_NAME_RECORD_INTERNAL
class T << (R,motivation) Resource >> {
+ name: String
..
- <&key> id: ID
}
T .right.|> Named : << implements >>
!endif
!endif
!endif
!ifdef SHOW_CONTRACT
!ifdef EXTERN_CONTRACT
extern(Contract) {
+ name: String
+ abi: ABI
+ {method} createBytecode: Maybe<Bytecode>
+ {method} callBytecode: Maybe<Bytecode>
+ {method} compilation: Maybe<Compilation>
+ {method} processedSource: Maybe<ProcessedSource>
+ {method} interface: ContractInterface
}
!else
resource(Contract) {
+ name: String
+ abi: ABI
+ {method} createBytecode: Maybe<Bytecode>
+ {method} callBytecode: Maybe<Bytecode>
+ {method} compilation: Maybe<Compilation>
+ {method} processedSource: Maybe<ProcessedSource>
+ {method} interface: ContractInterface
..
hashIdField(name,abi,processedSource,compilation)
- createBytecodeId
- callBytecodeId
}
!endif
!endif
!ifdef SHOW_INSTANCE
!define SHOW_INSTANCE_CREATION
!define SHOW_LINKED_BYTECODE
resource(ContractInstance) {
+ address : Address
+ network : Network
+ creation : Maybe<ContractInstanceCreation>
+ callBytecode : LinkedBytecode
+ {method} contract : Maybe<Contract>
..
hashIdField(network,address)
- contractId: ID
}
ContractInstanceCreation "0..1" ---* ContractInstance
!endif
!ifdef SHOW_INTERFACE
resource(ContractInterface) {
+ constructor : Maybe<Constructor>
+ fallback : Maybe<Fallback>
+ functions : Set<Function>
+ events : Set<Event>
..
UNKNOWN_ID
}
ContractInterface o-- "n" ContractInterface
!ifdef SHOW_INTERFACE_INTERNAL
object(ConstructorInterface) {
+ inputs : Array<Parameter>
+ stateMutability : StateMutability
}
object(FallbackInterface) {
+ stateMutability : StateMutability
}
object(FunctionInterface) {
+ name : String
+ inputs : Array<Parameter>
+ outputs : Array<Parameter>
+ stateMutability : StateMutability
}
object(EventInterface) {
+ name : String
+ inputs : Array<EventParameter>
+ anonymous : Boolean
}
ContractInterface *-- "0..1" ConstructorInterface
ContractInterface *-- "0..1" FallbackInterface
ContractInterface *-- "n" FunctionInterface
ContractInterface *-- "n" EventInterface
object(Parameter) {
+ name : String
+ type : Type
}
object(EventParameter) {
+ name : String
+ type : Type
+ indexed : Boolean
}
enum(StateMutability) {
+ pure
+ view
+ nonpayable
+ payable
}
ConstructorInterface *-- "n" Parameter
ConstructorInterface *-- "1" StateMutability
FallbackInterface *-- "1" StateMutability
FunctionInterface *-- "n" Parameter
FunctionInterface *-- "1" StateMutability
EventInterface *-- "n" EventParameter
!endif
!endif
!ifdef SHOW_CONSTRUCTOR
!define SHOW_LINKED_BYTECODE
object(Constructor) {
+ createBytecode: LinkedBytecode
}
!endif
!ifdef SHOW_BYTECODE
!define SHOW_LINK_REFERENCE
!ifdef EXTERN_BYTECODE
extern(Bytecode) {
+ bytes: Bytes
+ linkReferences : Set<LinkReference>
+ {method} instructions: Array<Instruction>
..
}
!else
resource(Bytecode) {
+ bytes: Bytes
+ linkReferences : Set<LinkReference>
+ {method} instructions: Array<Instruction>
..
hashIdField(bytes)
}
!endif
!ifdef SHOW_SOURCE_MAP || SHOW_BYTECODE_INTERNAL
object(Instruction) {
+ programCounter: Integer
+ opcode: String
+ pushData: Bytes
+ meta: InstructionMeta
}
object(InstructionMeta) {
+ cost: Integer
+ pops: Integer
+ pushes: Integer
+ dynamic: Integer
}
Instruction *-right- "1" InstructionMeta
Instruction "n" --* Bytecode
!endif
!endif
!ifdef SHOW_SOURCE
resource(Source) {
+ contents: String
+ sourcePath: Maybe<String>
..
hashIdField(contents,sourcePath)
}
!endif
!ifdef SHOW_COMPILATION
!define SHOW_PROCESSED_SOURCE
!define SHOW_METADATA
!ifdef EXTERN_COMPILATION
extern(Compilation) {
+ compiler : Compiler
+ {method} sources : Array<Maybe<Source>>
+ {method} processedSources : Array<ProcessedSource>
+ sourceMaps: Array<SourceMap>
+ metadata: Metadata
..
}
!else
resource(Compilation) {
+ compiler : Compiler
+ {method} sources : Array<Maybe<Source>>
+ {method} processedSources : Array<ProcessedSource>
+ sourceMaps: Array<SourceMap>
+ metadata: Metadata
..
hashIdField(compiler,sourceIds)
- sourceIds: Array<Maybe<ID>>
- contractIds : Array<Maybe<ID>>
}
!endif
ProcessedSource "n" --* Compilation
!endif
!ifdef SHOW_NETWORK
!ifdef EXTERN_NETWORK
extern(Network) {
+ name : String
+ networkId : NetworkID
+ historicBlock: Block
..
}
!else
resource(Network) {
+ name : String
+ networkId : NetworkID
+ historicBlock: Block
..
hashIdField(networkId,historicBlock)
}
!endif
!ifdef SHOW_NETWORK_INTERNAL
object(Block) {
+ height : Integer
+ hash : BlockHash
}
resource(NetworkGenealogy) {
+ ancestor: Network
+ descendant: Network
..
hashIdField(ancestor, descendant)
}
NetworkGenealogy o-- "2" Network
Network o-- "0..1" Network : <<refines>>
Network *-- "1" Block
!endif
!endif
'
' Shared Data Objects
'
!ifdef (SHOW_BYTECODE && SHOW_INSTANCE) || (SHOW_BYTECODE && SHOW_CONSTRUCTOR)
!define SHOW_LINKED_BYTECODE
!endif
!ifdef SHOW_LINKED_BYTECODE
!define SHOW_LINK_VALUE
object(LinkedBytecode) {
+ bytecode : Bytecode
+ linkValues : Set<LinkValue>
}
!endif
!ifdef SHOW_COMPILER
object(Compiler) {
+ name : String
+ version : String
+ settings : Object
}
!endif
!ifdef SHOW_INSTANCE_CREATION
object(ContractInstanceCreation) {
+ transactionHash: TransactionHash
+ constructorArgs: Array<Value>
+ {method} constructor: Constructor
}
!endif
!ifdef SHOW_LINK_VALUE
!define SHOW_LINK_REFERENCE
object(LinkValue) {
+ value: Bytes
+ {method} linkReference: LinkReference
..
- bytecodeIds: Array<Maybe<ID>>
- index: Integer
}
!endif
!ifdef SHOW_LINK_REFERENCE
!ifdef EXTERN_BYTECODE
externObject(LinkReference) {
+ offsets: Array<ByteOffset>
+ name: Maybe<String>
+ length: Integer
}
!else
object(LinkReference) {
+ offsets: Array<ByteOffset>
+ name: Maybe<String>
+ length: Integer
}
!endif
!endif
!ifdef SHOW_SOURCE_MAP
object(SourceMap) {
+ json: String
}
!endif
!ifdef SHOW_SOURCE_RANGE
object(SourceRange) {
+ start: ByteOffset
+ length: Length
+ meta: Object
+ {method} source: Source
..
- sourceId: ID
}
!endif
!ifdef SHOW_PROCESSED_SOURCE
!ifdef EXTERN_COMPILATION
externObject(ProcessedSource) {
+ ast: AST
+ {method} source: Source
..
}
!else
object(ProcessedSource) {
+ ast: AST
+ {method} source: Source
..
- sourceId: ID
}
!endif
!endif
!ifdef SHOW_ABI
object(ABI) {
+ json: String
}
!endif
!ifdef SHOW_AST
object(AST) {
+ json: String
}
!endif
!ifdef SHOW_METADATA
object(Metadata) {
+ json: String
}
!endif
'
' Relations
'
!ifdef SHOW_PROJECT && SHOW_NAME_RECORD
Project o-- "n" NameRecord
!endif
!ifdef SHOW_CONTRACT && SHOW_NAME_RECORD
Named <|.. Contract : << implements >>
!endif
!ifdef SHOW_NAME_RECORD && SHOW_NETWORK
Named <|.. Network : << implements >>
!endif
!ifdef SHOW_CONTRACT && SHOW_ABI
Contract *-right- "1" ABI
!endif
!ifdef SHOW_CONTRACT && SHOW_INSTANCE
ContractInstance "n" o--- "0..1" Contract
!endif
!ifdef SHOW_CONTRACT && SHOW_BYTECODE
Contract o-- "0..2" Bytecode
!endif
!ifdef SHOW_CONTRACT && SHOW_INTERFACE
ContractInterface "1" ---o Contract
!endif
!ifdef SHOW_CONTRACT && SHOW_PROCESSED_SOURCE
Contract o-- "0..1" Compilation
Contract o.. "1" ProcessedSource
!endif
!ifdef SHOW_LINKED_BYTECODE && SHOW_BYTECODE
LinkedBytecode o---- "1" Bytecode
!endif
!ifdef SHOW_LINKED_BYTECODE && SHOW_LINK_VALUE
LinkedBytecode *-- "n" LinkValue
!endif
!ifdef SHOW_BYTECODE && SHOW_LINK_REFERENCE
LinkReference "n" -* Bytecode
!endif
!ifdef SHOW_LINK_VALUE && SHOW_LINK_REFERENCE
LinkValue ....> "1" LinkReference
!endif
!ifdef SHOW_PROCESSED_SOURCE && SHOW_SOURCE
ProcessedSource o-- "1" Source
!endif
!ifdef SHOW_INSTANCE && SHOW_NETWORK
Network "1" ---o ContractInstance
!endif
!ifdef SHOW_INSTANCE_CREATION && SHOW_CONSTRUCTOR
ContractInstanceCreation o-- "1" Constructor
!endif
!ifdef SHOW_INSTANCE && SHOW_LINKED_BYTECODE
ContractInstance *-- "1" LinkedBytecode
!endif
!ifdef SHOW_CONSTRUCTOR && SHOW_LINKED_BYTECODE
Constructor *-- "1" LinkedBytecode
!endif
!ifdef SHOW_COMPILATION && SHOW_COMPILER
Compilation *-left- "1" Compiler
!endif
!ifdef SHOW_COMPILATION && SHOW_SOURCE
Compilation o-right- "n" Source
!endif
!ifdef SHOW_COMPILATION && SHOW_SOURCE_MAP
Compilation *-- "0..1" SourceMap
!endif
!ifdef SHOW_COMPILATION && SHOW_METADATA
Compilation *-- "0..1" Metadata
!endif
!ifdef SHOW_PROCESSED_SOURCE && SHOW_AST
ProcessedSource *-left- "0..1" AST
!endif
!ifdef SHOW_SOURCE_RANGE && SHOW_BYTECODE
SourceRange o-- "1" Instruction
!endif
!ifdef SHOW_SOURCE_RANGE && SHOW_SOURCE
Source "1" --o SourceRange
!endif