dotdog 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +679 -111
- package/kits/defi/SPEC.dog +21 -0
- package/kits/defi/constitution.dog +8 -0
- package/kits/defi/data-model.dog +131 -0
- package/kits/erc20/SPEC.dog +20 -0
- package/kits/erc20/constitution.dog +8 -0
- package/kits/erc20/data-model.dog +97 -0
- package/kits/hackathon/SPEC.dog +20 -0
- package/kits/hackathon/constitution.dog +8 -0
- package/kits/hackathon/data-model.dog +64 -0
- package/kits/nft/SPEC.dog +21 -0
- package/kits/nft/constitution.dog +8 -0
- package/kits/nft/data-model.dog +131 -0
- package/package.json +3 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# DeFi Protocol
|
|
2
|
+
|
|
3
|
+
> Yield-bearing vault. Users deposit tokens, earn yield via strategies, withdraw with returns.
|
|
4
|
+
|
|
5
|
+
## Product
|
|
6
|
+
|
|
7
|
+
A yield vault. Users deposit USDC, vault deploys capital into strategies, users withdraw with accrued yield.
|
|
8
|
+
|
|
9
|
+
### Flow
|
|
10
|
+
```
|
|
11
|
+
User approves Vault → deposit(amount) → Vault mints Shares → Strategy earns yield → User withdraws with returns
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Architecture
|
|
15
|
+
|
|
16
|
+
| Component | Role |
|
|
17
|
+
|-----------|------|
|
|
18
|
+
| Vault | ERC-4626 vault. Deposits, withdrawals, share minting. |
|
|
19
|
+
| Strategy | Yield source. Lending, LP, staking. |
|
|
20
|
+
| Share | ERC-20 token representing vault ownership. |
|
|
21
|
+
| Yield | Accrued returns distributed to shareholders. |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Constitution — DeFi
|
|
2
|
+
|
|
3
|
+
## Principles
|
|
4
|
+
|
|
5
|
+
1. **ERC-4626 compliance** — standard vault interface
|
|
6
|
+
2. **No admin withdrawal** — owner cannot drain user deposits
|
|
7
|
+
3. **Slippage protection** — deposits and withdrawals respect bounds
|
|
8
|
+
4. **Strategy isolation** — one strategy failure cannot drain vault
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Data Model — DeFi
|
|
2
|
+
|
|
3
|
+
## Entities
|
|
4
|
+
|
|
5
|
+
### Entity: Vault
|
|
6
|
+
|
|
7
|
+
ERC-4626 compliant yield vault.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
entity: Vault
|
|
11
|
+
type: contract
|
|
12
|
+
properties:
|
|
13
|
+
name:
|
|
14
|
+
type: string
|
|
15
|
+
required: true
|
|
16
|
+
symbol:
|
|
17
|
+
type: string
|
|
18
|
+
required: true
|
|
19
|
+
underlying:
|
|
20
|
+
type: string
|
|
21
|
+
required: true
|
|
22
|
+
totalAssets:
|
|
23
|
+
type: number
|
|
24
|
+
required: true
|
|
25
|
+
performanceFee:
|
|
26
|
+
type: number
|
|
27
|
+
required: false
|
|
28
|
+
states: [initialized, active, paused, emergency]
|
|
29
|
+
lifecycle: initialized → active → paused → emergency
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Entity: Strategy
|
|
33
|
+
|
|
34
|
+
Yield-generating strategy.
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
entity: Strategy
|
|
38
|
+
type: contract
|
|
39
|
+
properties:
|
|
40
|
+
name:
|
|
41
|
+
type: string
|
|
42
|
+
required: true
|
|
43
|
+
vault:
|
|
44
|
+
type: string
|
|
45
|
+
required: true
|
|
46
|
+
apy:
|
|
47
|
+
type: number
|
|
48
|
+
required: true
|
|
49
|
+
tvl:
|
|
50
|
+
type: number
|
|
51
|
+
required: true
|
|
52
|
+
risk:
|
|
53
|
+
type: enum
|
|
54
|
+
required: true
|
|
55
|
+
states: [proposed, active, harvesting, closed]
|
|
56
|
+
lifecycle: proposed → active → harvesting → closed
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Entity: Share
|
|
60
|
+
|
|
61
|
+
ERC-20 token representing vault ownership.
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
entity: Share
|
|
65
|
+
type: contract
|
|
66
|
+
properties:
|
|
67
|
+
vault:
|
|
68
|
+
type: string
|
|
69
|
+
required: true
|
|
70
|
+
totalSupply:
|
|
71
|
+
type: number
|
|
72
|
+
required: true
|
|
73
|
+
pricePerShare:
|
|
74
|
+
type: number
|
|
75
|
+
required: true
|
|
76
|
+
states: [active]
|
|
77
|
+
lifecycle: active → active
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Entity: Yield
|
|
81
|
+
|
|
82
|
+
Accrued returns from strategies.
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
entity: Yield
|
|
86
|
+
type: event
|
|
87
|
+
properties:
|
|
88
|
+
amount:
|
|
89
|
+
type: number
|
|
90
|
+
required: true
|
|
91
|
+
strategy:
|
|
92
|
+
type: string
|
|
93
|
+
required: true
|
|
94
|
+
timestamp:
|
|
95
|
+
type: number
|
|
96
|
+
required: true
|
|
97
|
+
states: [harvested, distributed]
|
|
98
|
+
lifecycle: harvested → distributed
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Relationships
|
|
102
|
+
|
|
103
|
+
### Relationship: Vault → Strategy
|
|
104
|
+
|
|
105
|
+
```yaml
|
|
106
|
+
relationship: Vault -> Strategy
|
|
107
|
+
verb: deploys
|
|
108
|
+
cardinality: 1:N
|
|
109
|
+
required: true
|
|
110
|
+
description: Vault deploys capital into strategies
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Relationship: Strategy → Yield
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
relationship: Strategy -> Yield
|
|
117
|
+
verb: produces
|
|
118
|
+
cardinality: 1:N
|
|
119
|
+
required: true
|
|
120
|
+
description: Strategy harvests yield
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Relationship: Vault → Share
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
relationship: Vault -> Share
|
|
127
|
+
verb: mints
|
|
128
|
+
cardinality: 1:1
|
|
129
|
+
required: true
|
|
130
|
+
description: Vault mints shares on deposit
|
|
131
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# ERC20 Token
|
|
2
|
+
|
|
3
|
+
> Fungible token spec. ERC20 compliant. Mint, burn, transfer, approve.
|
|
4
|
+
|
|
5
|
+
## Product
|
|
6
|
+
|
|
7
|
+
A standard ERC20 token. Users hold balances, transfer tokens, approve spenders.
|
|
8
|
+
|
|
9
|
+
### Flow: User transfers tokens
|
|
10
|
+
```
|
|
11
|
+
User calls transfer(to, amount) → Token updates balances → Transfer event emitted
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Architecture
|
|
15
|
+
|
|
16
|
+
| Component | Role |
|
|
17
|
+
|-----------|------|
|
|
18
|
+
| Token | ERC20 contract: mint, burn, transfer, approve |
|
|
19
|
+
| Balance | Per-address token balance |
|
|
20
|
+
| Allowance | Per-spender approved amount |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Constitution — ERC20
|
|
2
|
+
|
|
3
|
+
## Principles
|
|
4
|
+
|
|
5
|
+
1. **ERC20 compliance** — implements IERC20 interface
|
|
6
|
+
2. **No admin rug** — owner cannot seize user balances
|
|
7
|
+
3. **Zero-address protection** — cannot transfer to address(0)
|
|
8
|
+
4. **Event emission** — all state changes emit events
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Data Model — ERC20
|
|
2
|
+
|
|
3
|
+
## Entities
|
|
4
|
+
|
|
5
|
+
### Entity: Token
|
|
6
|
+
|
|
7
|
+
An ERC20-compliant fungible token.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
entity: Token
|
|
11
|
+
type: contract
|
|
12
|
+
properties:
|
|
13
|
+
name:
|
|
14
|
+
type: string
|
|
15
|
+
required: true
|
|
16
|
+
symbol:
|
|
17
|
+
type: string
|
|
18
|
+
required: true
|
|
19
|
+
decimals:
|
|
20
|
+
type: number
|
|
21
|
+
required: true
|
|
22
|
+
totalSupply:
|
|
23
|
+
type: number
|
|
24
|
+
required: true
|
|
25
|
+
owner:
|
|
26
|
+
type: string
|
|
27
|
+
required: true
|
|
28
|
+
states: [deployed, active, paused]
|
|
29
|
+
lifecycle: deployed → active → paused
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Entity: Transfer
|
|
33
|
+
|
|
34
|
+
A token transfer between two addresses.
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
entity: Transfer
|
|
38
|
+
type: event
|
|
39
|
+
properties:
|
|
40
|
+
from:
|
|
41
|
+
type: string
|
|
42
|
+
required: true
|
|
43
|
+
to:
|
|
44
|
+
type: string
|
|
45
|
+
required: true
|
|
46
|
+
amount:
|
|
47
|
+
type: number
|
|
48
|
+
required: true
|
|
49
|
+
timestamp:
|
|
50
|
+
type: number
|
|
51
|
+
required: true
|
|
52
|
+
states: [pending, confirmed]
|
|
53
|
+
lifecycle: pending → confirmed
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Entity: Approval
|
|
57
|
+
|
|
58
|
+
An allowance for a spender to transfer tokens.
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
entity: Approval
|
|
62
|
+
type: event
|
|
63
|
+
properties:
|
|
64
|
+
owner:
|
|
65
|
+
type: string
|
|
66
|
+
required: true
|
|
67
|
+
spender:
|
|
68
|
+
type: string
|
|
69
|
+
required: true
|
|
70
|
+
amount:
|
|
71
|
+
type: number
|
|
72
|
+
required: true
|
|
73
|
+
states: [pending, confirmed]
|
|
74
|
+
lifecycle: pending → confirmed
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Relationships
|
|
78
|
+
|
|
79
|
+
### Relationship: Transfer → Token
|
|
80
|
+
|
|
81
|
+
```yaml
|
|
82
|
+
relationship: Transfer -> Token
|
|
83
|
+
verb: modifies
|
|
84
|
+
cardinality: N:1
|
|
85
|
+
required: true
|
|
86
|
+
description: Transfer modifies token balances
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Relationship: Approval → Token
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
relationship: Approval -> Token
|
|
93
|
+
verb: authorizes
|
|
94
|
+
cardinality: N:1
|
|
95
|
+
required: true
|
|
96
|
+
description: Approval authorizes spender for token
|
|
97
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Hackathon Starter
|
|
2
|
+
|
|
3
|
+
> Build fast. Ship working. This is your foundation.
|
|
4
|
+
|
|
5
|
+
## Product
|
|
6
|
+
|
|
7
|
+
A web3 application. Built for a hackathon. Works in a live demo.
|
|
8
|
+
|
|
9
|
+
### Flow
|
|
10
|
+
```
|
|
11
|
+
User connects wallet → App reads chain state → User submits transaction → App confirms onchain → Demo complete
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Architecture
|
|
15
|
+
|
|
16
|
+
| Component | Role |
|
|
17
|
+
|-----------|------|
|
|
18
|
+
| UI | Frontend: wallet connection, transaction button |
|
|
19
|
+
| Contract | Onchain logic: storage, verification |
|
|
20
|
+
| RPC | Chain connection: read state, submit tx |
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Data Model — Hackathon
|
|
2
|
+
|
|
3
|
+
## Entities
|
|
4
|
+
|
|
5
|
+
### Entity: User
|
|
6
|
+
|
|
7
|
+
A connected wallet. The app's user.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
entity: User
|
|
11
|
+
type: entity
|
|
12
|
+
properties:
|
|
13
|
+
address:
|
|
14
|
+
type: string
|
|
15
|
+
required: true
|
|
16
|
+
chainId:
|
|
17
|
+
type: number
|
|
18
|
+
required: true
|
|
19
|
+
balance:
|
|
20
|
+
type: number
|
|
21
|
+
required: false
|
|
22
|
+
states: [disconnected, connected, transacting]
|
|
23
|
+
lifecycle: disconnected → connected → transacting
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Entity: Transaction
|
|
27
|
+
|
|
28
|
+
An onchain action by the user.
|
|
29
|
+
|
|
30
|
+
```yaml
|
|
31
|
+
entity: Transaction
|
|
32
|
+
type: event
|
|
33
|
+
properties:
|
|
34
|
+
hash:
|
|
35
|
+
type: string
|
|
36
|
+
required: true
|
|
37
|
+
from:
|
|
38
|
+
type: string
|
|
39
|
+
required: true
|
|
40
|
+
to:
|
|
41
|
+
type: string
|
|
42
|
+
required: true
|
|
43
|
+
value:
|
|
44
|
+
type: number
|
|
45
|
+
required: true
|
|
46
|
+
status:
|
|
47
|
+
type: enum
|
|
48
|
+
required: true
|
|
49
|
+
states: [pending, confirmed, failed]
|
|
50
|
+
lifecycle: pending → confirmed
|
|
51
|
+
lifecycle: pending → failed
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Relationships
|
|
55
|
+
|
|
56
|
+
### Relationship: User → Transaction
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
relationship: User -> Transaction
|
|
60
|
+
verb: submits
|
|
61
|
+
cardinality: 1:N
|
|
62
|
+
required: true
|
|
63
|
+
description: User submits transactions
|
|
64
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# NFT Collection
|
|
2
|
+
|
|
3
|
+
> Non-fungible token collection. ERC-721 compliant. Mint, transfer, metadata.
|
|
4
|
+
|
|
5
|
+
## Product
|
|
6
|
+
|
|
7
|
+
An NFT collection. Users mint tokens with metadata. Tokens are unique, transferable, and have royalty support.
|
|
8
|
+
|
|
9
|
+
### Flow
|
|
10
|
+
```
|
|
11
|
+
Creator deploys Collection → User mints Token → Token has metadata → User transfers Token → Royalty paid to creator
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Architecture
|
|
15
|
+
|
|
16
|
+
| Component | Role |
|
|
17
|
+
|-----------|------|
|
|
18
|
+
| Collection | ERC-721 contract. Mint, burn, transfer. |
|
|
19
|
+
| Token | Unique NFT with metadata URI. |
|
|
20
|
+
| Metadata | JSON: name, description, image, attributes. |
|
|
21
|
+
| Royalty | Secondary sale fee paid to creator. |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Constitution — NFT
|
|
2
|
+
|
|
3
|
+
## Principles
|
|
4
|
+
|
|
5
|
+
1. **ERC-721 compliance** — implements IERC721 interface
|
|
6
|
+
2. **Metadata permanence** — tokenURI must be immutable or IPFS-backed
|
|
7
|
+
3. **Royalty enforcement** — EIP-2981 compliant
|
|
8
|
+
4. **No admin rug** — owner cannot seize tokens
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Data Model — NFT
|
|
2
|
+
|
|
3
|
+
## Entities
|
|
4
|
+
|
|
5
|
+
### Entity: Collection
|
|
6
|
+
|
|
7
|
+
ERC-721 compliant NFT collection.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
entity: Collection
|
|
11
|
+
type: contract
|
|
12
|
+
properties:
|
|
13
|
+
name:
|
|
14
|
+
type: string
|
|
15
|
+
required: true
|
|
16
|
+
symbol:
|
|
17
|
+
type: string
|
|
18
|
+
required: true
|
|
19
|
+
totalSupply:
|
|
20
|
+
type: number
|
|
21
|
+
required: true
|
|
22
|
+
owner:
|
|
23
|
+
type: string
|
|
24
|
+
required: true
|
|
25
|
+
royaltyBps:
|
|
26
|
+
type: number
|
|
27
|
+
required: false
|
|
28
|
+
states: [deployed, active, paused]
|
|
29
|
+
lifecycle: deployed → active → paused
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Entity: Token
|
|
33
|
+
|
|
34
|
+
A unique NFT within a collection.
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
entity: Token
|
|
38
|
+
type: entity
|
|
39
|
+
properties:
|
|
40
|
+
tokenId:
|
|
41
|
+
type: number
|
|
42
|
+
required: true
|
|
43
|
+
owner:
|
|
44
|
+
type: string
|
|
45
|
+
required: true
|
|
46
|
+
tokenURI:
|
|
47
|
+
type: string
|
|
48
|
+
required: true
|
|
49
|
+
collection:
|
|
50
|
+
type: string
|
|
51
|
+
required: true
|
|
52
|
+
states: [unminted, minted, transferred, burned]
|
|
53
|
+
lifecycle: unminted → minted → transferred → burned
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Entity: Metadata
|
|
57
|
+
|
|
58
|
+
JSON metadata for an NFT token.
|
|
59
|
+
|
|
60
|
+
```yaml
|
|
61
|
+
entity: Metadata
|
|
62
|
+
type: entity
|
|
63
|
+
properties:
|
|
64
|
+
name:
|
|
65
|
+
type: string
|
|
66
|
+
required: true
|
|
67
|
+
description:
|
|
68
|
+
type: string
|
|
69
|
+
required: true
|
|
70
|
+
image:
|
|
71
|
+
type: string
|
|
72
|
+
required: true
|
|
73
|
+
attributes:
|
|
74
|
+
type: json
|
|
75
|
+
required: false
|
|
76
|
+
states: [draft, published]
|
|
77
|
+
lifecycle: draft → published
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Entity: Royalty
|
|
81
|
+
|
|
82
|
+
Secondary sale royalty payment.
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
entity: Royalty
|
|
86
|
+
type: event
|
|
87
|
+
properties:
|
|
88
|
+
creator:
|
|
89
|
+
type: string
|
|
90
|
+
required: true
|
|
91
|
+
amount:
|
|
92
|
+
type: number
|
|
93
|
+
required: true
|
|
94
|
+
salePrice:
|
|
95
|
+
type: number
|
|
96
|
+
required: true
|
|
97
|
+
states: [pending, paid]
|
|
98
|
+
lifecycle: pending → paid
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Relationships
|
|
102
|
+
|
|
103
|
+
### Relationship: Collection → Token
|
|
104
|
+
|
|
105
|
+
```yaml
|
|
106
|
+
relationship: Collection -> Token
|
|
107
|
+
verb: mints
|
|
108
|
+
cardinality: 1:N
|
|
109
|
+
required: true
|
|
110
|
+
description: Collection mints unique tokens
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Relationship: Token → Metadata
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
relationship: Token -> Metadata
|
|
117
|
+
verb: references
|
|
118
|
+
cardinality: 1:1
|
|
119
|
+
required: true
|
|
120
|
+
description: Token references its metadata
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Relationship: Token → Royalty
|
|
124
|
+
|
|
125
|
+
```yaml
|
|
126
|
+
relationship: Token -> Royalty
|
|
127
|
+
verb: triggers
|
|
128
|
+
cardinality: 1:N
|
|
129
|
+
required: false
|
|
130
|
+
description: Transfer triggers royalty payment
|
|
131
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotdog",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "CLI tool for structured software specifications. Validate .dog files, compile .dag graphs, query via MCP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cli.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"dist/",
|
|
13
13
|
"README.md",
|
|
14
14
|
"CHANGELOG.md",
|
|
15
|
-
"LICENSE"
|
|
15
|
+
"LICENSE",
|
|
16
|
+
"kits/"
|
|
16
17
|
],
|
|
17
18
|
"keywords": [
|
|
18
19
|
"specification",
|