@rev-net/core-v6 0.0.33 → 0.0.35
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/ADMINISTRATION.md +38 -51
- package/ARCHITECTURE.md +24 -11
- package/AUDIT_INSTRUCTIONS.md +43 -80
- package/CHANGELOG.md +4 -3
- package/README.md +20 -32
- package/RISKS.md +49 -214
- package/SKILLS.md +10 -17
- package/USER_JOURNEYS.md +47 -66
- package/package.json +1 -1
- package/references/runtime.md +3 -2
- package/src/REVDeployer.sol +13 -2
- package/src/REVHiddenTokens.sol +48 -26
- package/src/REVLoans.sol +2 -2
- package/src/REVOwner.sol +10 -2
- package/src/interfaces/IREVHiddenTokens.sol +21 -6
- package/test/TestAuditFixVerification.t.sol +675 -0
- package/test/TestHiddenTokens.t.sol +51 -8
- package/test/TestTerminalEncodingInHash.t.sol +326 -0
- package/test/audit/CodexCrossChainBuybackRouteMismatch.t.sol +184 -0
- package/test/audit/NemesisOperatorDelegation.t.sol +77 -10
package/ADMINISTRATION.md
CHANGED
|
@@ -4,83 +4,70 @@
|
|
|
4
4
|
|
|
5
5
|
| Item | Details |
|
|
6
6
|
| --- | --- |
|
|
7
|
-
| Scope | Revnet deployment shape,
|
|
8
|
-
| Control posture |
|
|
9
|
-
| Highest-risk actions |
|
|
10
|
-
| Recovery posture |
|
|
7
|
+
| Scope | Revnet deployment shape, bounded runtime operators, loan-owner cosmetics, and optional integration control surfaces |
|
|
8
|
+
| Control posture | Intentionally narrow and mostly deployment-defined |
|
|
9
|
+
| Highest-risk actions | Bad stage design, wrong split-operator assignment, and misunderstanding which runtime surfaces stay live after launch |
|
|
10
|
+
| Recovery posture | Usually replacement, not patching; the design intentionally avoids easy admin escape hatches |
|
|
11
11
|
|
|
12
12
|
## Purpose
|
|
13
13
|
|
|
14
|
-
`revnet-core-v6` is designed to
|
|
14
|
+
`revnet-core-v6` is designed to collapse ordinary post-launch governance into deployment-time decisions plus a small set of bounded runtime roles. The main administration task is understanding which power still exists and which power was intentionally removed.
|
|
15
15
|
|
|
16
16
|
## Control Model
|
|
17
17
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
- `
|
|
21
|
-
-
|
|
22
|
-
-
|
|
18
|
+
- `REVDeployer` holds the project NFT and therefore remains part of the ownership model.
|
|
19
|
+
- Revnet economics are mainly fixed at deployment through staged rulesets.
|
|
20
|
+
- `REVOwner` provides live runtime policy, but not broad human governance.
|
|
21
|
+
- Split operators can hold narrow powers depending on stage and deployment config.
|
|
22
|
+
- `REVLoans` has a cosmetic global owner surface, but loan economics are still bounded by revnet logic.
|
|
23
23
|
|
|
24
24
|
## Roles
|
|
25
25
|
|
|
26
26
|
| Role | How Assigned | Scope | Notes |
|
|
27
27
|
| --- | --- | --- | --- |
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
28
|
+
| `REVDeployer` | Deployed singleton | Global launcher and project-NFT holder | Part of the ownership model |
|
|
29
|
+
| Split operator | Deployment config | Per revnet | Holds only the allowed operator envelope |
|
|
30
|
+
| Auto-issuance beneficiary | Deployment config | Per stage | Can receive preconfigured stage issuance |
|
|
31
|
+
| Borrower or delegated loan operator | Token holder plus permission | Per holder or loan | Can open or manage loans within loan rules |
|
|
32
|
+
| `REVLoans` owner | Constructor owner | Global cosmetic/admin surface | Does not turn Revnets back into ordinary governed projects |
|
|
33
33
|
|
|
34
34
|
## Privileged Surfaces
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
| `REVLoans` | `setTokenUriResolver(...)` | `REVLoans` owner | Cosmetic loan-NFT metadata control |
|
|
42
|
-
| `REVLoans` | `borrowFrom(...)`, `repayLoan(...)`, `reallocateCollateralFromLoan(...)` | Holder or delegated loan operator | Position-level administration, not protocol-level governance |
|
|
36
|
+
- `deployFor(...)` defines the revnet's long-lived shape
|
|
37
|
+
- split-operator paths can manage only the permissions left open by deployment
|
|
38
|
+
- `autoIssueFor(...)` consumes preconfigured stage issuance
|
|
39
|
+
- loan operators can redirect borrowed value if a holder delegates loan permissions
|
|
40
|
+
- hidden-token flows require the holder's permission grant and mint permission wiring through `REVOwner`
|
|
43
41
|
|
|
44
42
|
## Immutable And One-Way
|
|
45
43
|
|
|
46
|
-
- Stage
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
- Expired loans can eventually liquidate into permanently lost collateral if they are not repaid within the long liquidation window.
|
|
44
|
+
- Stage configuration is effectively permanent after deployment.
|
|
45
|
+
- The deployer-held project NFT is not a normal owner-recovery tool.
|
|
46
|
+
- Loan collateral is burned at borrow time and only reminted through repayment or documented flows.
|
|
47
|
+
- Hidden-token balances change visible supply until reveal.
|
|
51
48
|
|
|
52
49
|
## Operational Notes
|
|
53
50
|
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
51
|
+
- Treat revnet launch as the real governance decision.
|
|
52
|
+
- Validate stage timing, split-operator scope, and optional integrations before deployment.
|
|
53
|
+
- Review cash-out delay, hidden-token semantics, and loan permissions together.
|
|
54
|
+
- Do not assume there is a broad admin override for bad economics after launch.
|
|
58
55
|
|
|
59
56
|
## Machine Notes
|
|
60
57
|
|
|
61
|
-
- Do not
|
|
62
|
-
-
|
|
63
|
-
- If
|
|
58
|
+
- Do not describe Revnets as fully adminless if the deployer-held NFT still matters for the trust model.
|
|
59
|
+
- Also do not describe them as ordinary owner-controlled projects. The point is that the available control surface is intentionally narrow.
|
|
60
|
+
- If a question is about runtime cash-outs, buybacks, or mint permissions, inspect `REVOwner` before inferring behavior from deployment prose.
|
|
64
61
|
|
|
65
62
|
## Recovery
|
|
66
63
|
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- Liquidated loan collateral is not an admin-recoverable asset; recovery must happen before liquidation through borrower action.
|
|
64
|
+
- If launch-time economics are wrong, recovery usually means replacement, not in-place repair.
|
|
65
|
+
- If optional integrations are misconfigured, fix only where the code still exposes a valid path.
|
|
66
|
+
- If the design intentionally omitted a recovery path, do not invent one in documentation or ops guidance.
|
|
71
67
|
|
|
72
68
|
## Admin Boundaries
|
|
73
69
|
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
- Nobody can administratively restore collateral after an expired loan has been liquidated.
|
|
79
|
-
|
|
80
|
-
## Source Map
|
|
81
|
-
|
|
82
|
-
- `src/REVDeployer.sol`
|
|
83
|
-
- `src/REVOwner.sol`
|
|
84
|
-
- `src/REVLoans.sol`
|
|
85
|
-
- `src/REVHiddenTokens.sol`
|
|
86
|
-
- `test/`
|
|
70
|
+
- No ordinary owner can casually rewrite staged economics after launch.
|
|
71
|
+
- Split operators are not general-purpose governors.
|
|
72
|
+
- Loan mechanics, hidden-token mechanics, and cash-out policy remain bounded by the deployed revnet logic.
|
|
73
|
+
- This repo should not be documented as if it had a normal mutable project-owner model.
|
package/ARCHITECTURE.md
CHANGED
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
## System Overview
|
|
8
8
|
|
|
9
|
-
`REVDeployer` handles launch-time shape, staged rulesets, hook wiring, and runtime wrapper behavior. `REVOwner` provides the owner-like runtime policy surface for pay and cash-out hooks after launch. `REVLoans` manages burn-collateral loan positions represented as
|
|
9
|
+
`REVDeployer` handles launch-time shape, staged rulesets, hook wiring, and runtime wrapper behavior. `REVOwner` provides the owner-like runtime policy surface for pay and cash-out hooks after launch. `REVLoans` manages burn-collateral loan positions represented as NFTs. `REVHiddenTokens` lets holders burn tokens to exclude them from visible supply until they reveal them again.
|
|
10
10
|
|
|
11
11
|
## Core Invariants
|
|
12
12
|
|
|
13
13
|
- Revnets are intended to be ownerless after deployment; easy admin recovery paths would violate the product model.
|
|
14
14
|
- Stage configuration is effectively permanent once queued.
|
|
15
|
-
- Loan collateral is burned, not escrowed
|
|
16
|
-
- Hidden tokens are burned, not escrowed, and reduce
|
|
15
|
+
- Loan collateral is burned, not escrowed.
|
|
16
|
+
- Hidden tokens are burned, not escrowed, and reduce visible supply until revealed.
|
|
17
17
|
- `REVOwner` and `REVDeployer` are tightly coupled; their setup order matters.
|
|
18
|
-
- Cash-out delay affects both exits and borrowing power.
|
|
18
|
+
- Cash-out delay affects both exits and borrowing power.
|
|
19
19
|
- Cross-chain supply and surplus are part of revnet economics. Local payouts and loans must not ignore remote sucker snapshots.
|
|
20
20
|
|
|
21
21
|
## Modules
|
|
@@ -62,17 +62,17 @@ borrower
|
|
|
62
62
|
|
|
63
63
|
## Accounting Model
|
|
64
64
|
|
|
65
|
-
The repo does not replace core treasury accounting. Its critical economic logic is the interaction between staged revnet
|
|
65
|
+
The repo does not replace core treasury accounting. Its critical economic logic is the interaction between staged revnet config, burned-collateral loan state, hidden-token supply exclusion, and omnichain revnet state imported from suckers.
|
|
66
66
|
|
|
67
|
-
`REVOwner` also composes payment and cash-out hooks. On pay, it
|
|
67
|
+
`REVOwner` also composes payment and cash-out hooks. On pay, it can merge 721-tier split forwarding with buyback-hook behavior and scale mint weight so the terminal only mints against the share that actually enters the project. On cash out, it can use omnichain supply and surplus for reclaim math, exempt trusted suckers, and append fee-hook specs.
|
|
68
68
|
|
|
69
69
|
## Security Model
|
|
70
70
|
|
|
71
71
|
- The highest-risk interactions sit where stage economics, treasury state, and loan borrowability meet.
|
|
72
|
-
- Ownerlessness removes convenient
|
|
72
|
+
- Ownerlessness removes convenient recovery from misconfiguration.
|
|
73
73
|
- Hidden-token and burned-collateral semantics materially affect supply-sensitive pricing.
|
|
74
|
-
- `REVOwner` is a live runtime policy surface, not just a launch helper.
|
|
75
|
-
- Rev cash-out fees stack on top of protocol-fee behavior rather than replacing it.
|
|
74
|
+
- `REVOwner` is a live runtime policy surface, not just a launch helper.
|
|
75
|
+
- Rev cash-out fees stack on top of protocol-fee behavior rather than replacing it.
|
|
76
76
|
|
|
77
77
|
## Safe Change Guide
|
|
78
78
|
|
|
@@ -80,8 +80,19 @@ The repo does not replace core treasury accounting. Its critical economic logic
|
|
|
80
80
|
- If stage semantics change, inspect loan math, cash-out behavior, and downstream fee expectations together.
|
|
81
81
|
- Do not casually add mutable admin escape hatches.
|
|
82
82
|
- If you change borrowability, re-check cash-out-delay gating, omnichain surplus inputs, and local-surplus caps together.
|
|
83
|
-
- If you change hook composition, re-check 721 split handling, buyback
|
|
84
|
-
|
|
83
|
+
- If you change hook composition, re-check 721 split handling, buyback assumptions, and mint-permission flows.
|
|
84
|
+
|
|
85
|
+
## Cross-Chain Configuration Hash
|
|
86
|
+
|
|
87
|
+
`REVDeployer` produces an `encodedConfigurationHash` for each revnet that determines sucker deployment salts. This hash commits the revnet's identity across chains. It includes:
|
|
88
|
+
|
|
89
|
+
- `baseCurrency`, `description.name`, `description.ticker`, `description.salt`
|
|
90
|
+
- Terminal addresses (order-sensitive)
|
|
91
|
+
- Stage parameters (timing, issuance, splits, tax rates, auto-issuances)
|
|
92
|
+
|
|
93
|
+
Terminal addresses are included because they are deployed deterministically at the same address across chains. Accounting contexts (token addresses) are excluded because tokens like USDC legitimately differ per chain.
|
|
94
|
+
|
|
95
|
+
This means a revnet can only expand to a new chain if it uses the exact same terminal contract it used on the host chain. Different terminal addresses produce a different hash, preventing accidental cross-chain mismatches in sucker deployments.
|
|
85
96
|
|
|
86
97
|
## Canonical Checks
|
|
87
98
|
|
|
@@ -91,6 +102,8 @@ The repo does not replace core treasury accounting. Its critical economic logic
|
|
|
91
102
|
`test/TestStageTransitionBorrowable.t.sol`
|
|
92
103
|
- omnichain or phantom-surplus edge cases:
|
|
93
104
|
`test/audit/CodexPhantomSurplusTerminal.t.sol`
|
|
105
|
+
- terminal encoding in configuration hash:
|
|
106
|
+
`test/TestTerminalEncodingInHash.t.sol`
|
|
94
107
|
|
|
95
108
|
## Source Map
|
|
96
109
|
|
package/AUDIT_INSTRUCTIONS.md
CHANGED
|
@@ -1,124 +1,87 @@
|
|
|
1
1
|
# Audit Instructions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Revnet is a staged, owner-minimized product layer on top of Juicebox core. Audit it as an economic system, not just a deployer plus a loan contract.
|
|
4
4
|
|
|
5
5
|
## Audit Objective
|
|
6
6
|
|
|
7
7
|
Find issues that:
|
|
8
|
-
|
|
9
|
-
- break stage
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
8
|
+
|
|
9
|
+
- break stage progression or let users act under the wrong stage assumptions
|
|
10
|
+
- overstate or understate borrowability
|
|
11
|
+
- mis-handle hidden tokens or burned-collateral accounting
|
|
12
|
+
- give operators or integrations more power than the revnet model intends
|
|
13
|
+
- make omnichain supply, surplus, or sucker assumptions drift from runtime behavior
|
|
13
14
|
|
|
14
15
|
## Scope
|
|
15
16
|
|
|
16
17
|
In scope:
|
|
18
|
+
|
|
17
19
|
- `src/REVDeployer.sol`
|
|
18
20
|
- `src/REVOwner.sol`
|
|
19
21
|
- `src/REVLoans.sol`
|
|
20
22
|
- `src/REVHiddenTokens.sol`
|
|
21
|
-
-
|
|
22
|
-
- `src/structs/`
|
|
23
|
-
- deployment scripts in `script/`
|
|
24
|
-
|
|
25
|
-
Key dependencies:
|
|
26
|
-
- `nana-core-v6`
|
|
27
|
-
- `nana-721-hook-v6`
|
|
28
|
-
- `nana-buyback-hook-v6`
|
|
29
|
-
- `nana-suckers-v6`
|
|
30
|
-
- `croptop-core-v6`
|
|
23
|
+
- structs, interfaces, and deployment helpers
|
|
31
24
|
|
|
32
25
|
## Start Here
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
`REVOwner` is the fastest way to understand how a live revnet differs from plain Juicebox behavior.
|
|
40
|
-
`REVDeployer` explains why that behavior exists.
|
|
41
|
-
`REVLoans` is where those economics are turned into extractable collateral value.
|
|
27
|
+
1. `src/REVDeployer.sol`
|
|
28
|
+
2. `src/REVOwner.sol`
|
|
29
|
+
3. `src/REVLoans.sol`
|
|
30
|
+
4. `src/REVHiddenTokens.sol`
|
|
42
31
|
|
|
43
32
|
## Security Model
|
|
44
33
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
34
|
+
Revnet composes several sensitive systems:
|
|
35
|
+
|
|
36
|
+
- staged rulesets and launch-time immutability
|
|
37
|
+
- runtime pay and cash-out policy in `REVOwner`
|
|
38
|
+
- burned-collateral lending in `REVLoans`
|
|
39
|
+
- hidden-token supply exclusion in `REVHiddenTokens`
|
|
50
40
|
|
|
51
|
-
|
|
52
|
-
- revnet payments may be proxied through 721 and buyback hooks
|
|
53
|
-
- cash-out behavior may be altered for suckers or by revnet-specific fee handling
|
|
54
|
-
- loan health depends on bonding-curve value and surplus, so core accounting and stage timing directly matter
|
|
41
|
+
The main audit mindset is composition:
|
|
55
42
|
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
43
|
+
- stage economics affect borrowability
|
|
44
|
+
- hidden supply affects cash-out math
|
|
45
|
+
- omnichain state can affect reclaim and borrowing power
|
|
46
|
+
- optional integrations can widen the effective trust surface
|
|
59
47
|
|
|
60
48
|
## Roles And Privileges
|
|
61
49
|
|
|
62
50
|
| Role | Powers | How constrained |
|
|
63
51
|
|------|--------|-----------------|
|
|
64
|
-
| Revnet
|
|
65
|
-
|
|
|
66
|
-
| Borrower or operator | Open
|
|
52
|
+
| Revnet deployer path | Define long-lived stage and operator shape | Must not retain unexpected mutable governance |
|
|
53
|
+
| Split operator | Use the allowed runtime envelope | Must stay within deployment-defined permissions |
|
|
54
|
+
| Borrower or delegated operator | Open or manage loans | Must not escape collateral, delay, or source limits |
|
|
55
|
+
| Hidden-token user or delegate | Burn and reveal visible supply | Must not create extra supply or break accounting |
|
|
67
56
|
|
|
68
57
|
## Integration Assumptions
|
|
69
58
|
|
|
70
59
|
| Dependency | Assumption | What breaks if wrong |
|
|
71
60
|
|------------|------------|----------------------|
|
|
72
|
-
| `nana-core-v6` |
|
|
73
|
-
| `nana-
|
|
74
|
-
|
|
|
61
|
+
| `nana-core-v6` | Rulesets, reclaim math, and surplus views stay coherent | Stage and cash-out behavior drift |
|
|
62
|
+
| `nana-suckers-v6` | Remote supply/surplus snapshots are authentic | Omnichain reclaim and borrowability drift |
|
|
63
|
+
| Buyback and 721 integrations | Hook composition remains consistent with revnet expectations | Pay-path and mint-permission behavior drift |
|
|
75
64
|
|
|
76
65
|
## Critical Invariants
|
|
77
66
|
|
|
78
|
-
1. Stage
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
3. Loan collateralization is sound
|
|
85
|
-
Borrow, repay, refinance, and liquidation paths must never let a borrower extract more value than the design permits.
|
|
86
|
-
|
|
87
|
-
4. Hook privilege stays narrow
|
|
88
|
-
`REVOwner` and deployer-only setters must not be callable by arbitrary actors or stale deployment helpers.
|
|
89
|
-
|
|
90
|
-
5. Sucker and operator exemptions are precise
|
|
91
|
-
Fee-free or mint-enabled paths meant for registered omnichain components must not be reusable by arbitrary callers.
|
|
92
|
-
|
|
93
|
-
6. Collateral burn/remint symmetry holds
|
|
94
|
-
Loan collateral that is burned on borrow and re-minted on repay must not be duplicable, strandable, or recoverable by the wrong party.
|
|
95
|
-
|
|
96
|
-
7. Hidden token accounting is sound
|
|
97
|
-
Tokens hidden via REVHiddenTokens must be exactly recoverable on reveal. The hidden balance must not allow minting more tokens than were burned, and totalHiddenOf must equal the sum of all per-holder hidden balances.
|
|
98
|
-
|
|
99
|
-
8. Stage transitions do not create hidden refinancing windows
|
|
100
|
-
Changes in issuance or cash-out economics across stages must not let a borrower lock in value that the system intended to become unavailable.
|
|
67
|
+
1. Stage progression stays monotonic and follows deployed timing.
|
|
68
|
+
2. Borrowability respects cash-out delay, surplus, supply, and source limits.
|
|
69
|
+
3. Burned collateral is not accidentally treated like escrowed collateral.
|
|
70
|
+
4. Hidden-token accounting preserves total claims while changing visible supply intentionally.
|
|
71
|
+
5. Optional integrations do not silently widen revnet authority or mint rights.
|
|
101
72
|
|
|
102
73
|
## Attack Surfaces
|
|
103
74
|
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
- `REVLoans` operator delegation: `OPEN_LOAN`, `REPAY_LOAN`, `REALLOCATE_LOAN` inline permission checks — verify holder/owner receives collateral and loan NFTs in all delegation paths
|
|
110
|
-
- any path that assumes a valid tiered 721 hook or sucker mapping exists
|
|
111
|
-
|
|
112
|
-
Replay these sequences:
|
|
113
|
-
1. pay into a revnet with 721 and buyback composition enabled and inspect weight scaling
|
|
114
|
-
2. borrow near a stage boundary, then repay, refinance, or liquidate in the next stage
|
|
115
|
-
3. borrow after surplus inflation, then contract surplus before liquidation
|
|
116
|
-
4. cash out through a legitimate sucker path versus a near-sucker spoof path
|
|
117
|
-
5. hide tokens, let another actor cash out, then reveal
|
|
75
|
+
- stage-transition boundaries
|
|
76
|
+
- live borrowability and cross-currency debt aggregation
|
|
77
|
+
- hidden-token burn and reveal flows
|
|
78
|
+
- omnichain surplus and sucker exemptions
|
|
79
|
+
- payment and cash-out hook composition in `REVOwner`
|
|
118
80
|
|
|
119
81
|
## Accepted Risks Or Behaviors
|
|
120
82
|
|
|
121
|
-
-
|
|
83
|
+
- Revnets intentionally trade recoverability for predictable launch-time economics.
|
|
84
|
+
- Some economic surfaces are conservative by design and may refuse otherwise-valid actions rather than risk an unsafe result.
|
|
122
85
|
|
|
123
86
|
## Verification
|
|
124
87
|
|
package/CHANGELOG.md
CHANGED
|
@@ -26,12 +26,12 @@ This file describes the verified change from `revnet-core-v5` to the current `re
|
|
|
26
26
|
## Operator delegation (permission IDs 35–39)
|
|
27
27
|
|
|
28
28
|
- Added five new `JBPermissionIds` for operator delegation in `@bananapus/permission-ids-v6`:
|
|
29
|
-
- `HIDE_TOKENS` (35) —
|
|
29
|
+
- `HIDE_TOKENS` (35) — lets an authorized operator allow or disallow holders to hide their own tokens via `REVHiddenTokens`
|
|
30
30
|
- `OPEN_LOAN` (36) — open a loan on behalf of a token holder via `REVLoans.borrowFrom`
|
|
31
31
|
- `REALLOCATE_LOAN` (37) — reallocate loan collateral on behalf of a loan owner via `REVLoans.reallocateCollateralFromLoan`
|
|
32
32
|
- `REPAY_LOAN` (38) — repay a loan on behalf of a loan owner via `REVLoans.repayLoan`
|
|
33
|
-
- `REVEAL_TOKENS` (39) —
|
|
34
|
-
- `REVHiddenTokens` now inherits `JBPermissioned` and accepts a `holder` parameter on `hideTokensOf` and `revealTokensOf`.
|
|
33
|
+
- `REVEAL_TOKENS` (39) — legacy permission id; hidden-token reveal no longer depends on it
|
|
34
|
+
- `REVHiddenTokens` now inherits `JBPermissioned` and accepts a `holder` parameter on `hideTokensOf` and `revealTokensOf`. Hiding is available to an operator-managed holder allowlist, and also to the project owner or any operator with `HIDE_TOKENS`. Revealing is holder-only and does not require special permission.
|
|
35
35
|
- `REVLoans.borrowFrom` now accepts a `holder` parameter. The loan NFT is minted to `holder`, and collateral is burned from `holder`. An operator with `OPEN_LOAN` permission can borrow on behalf of a holder.
|
|
36
36
|
- `REVLoans.repayLoan` now allows permissioned operators with `REPAY_LOAN` to repay on behalf of the loan NFT owner. Replacement loans are minted to the original loan owner.
|
|
37
37
|
- `REVLoans.reallocateCollateralFromLoan` now allows permissioned operators with `REALLOCATE_LOAN` to reallocate on behalf of the loan NFT owner. Returned collateral and replacement loans go to the original loan owner.
|
|
@@ -41,6 +41,7 @@ This file describes the verified change from `revnet-core-v5` to the current `re
|
|
|
41
41
|
|
|
42
42
|
- `IREVHiddenTokens.hideTokensOf` signature changed: added `address holder` parameter
|
|
43
43
|
- `IREVHiddenTokens.revealTokensOf` signature changed: added `address holder` parameter
|
|
44
|
+
- `IREVHiddenTokens.setTokenHidingAllowedFor` added for operator-managed holder allowlisting
|
|
44
45
|
- `IREVHiddenTokens.HideTokens` event: added `address holder` field
|
|
45
46
|
- `IREVHiddenTokens.RevealTokens` event: added `address holder` field
|
|
46
47
|
- `IREVLoans.borrowFrom` signature changed: added `address holder` as last parameter
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Revnet Core
|
|
2
2
|
|
|
3
|
-
`@rev-net/core-v6` deploys and operates Revnets: Juicebox project shapes with staged economics, optional tiered NFTs, cross-chain support, buyback integration, and token-collateralized loans.
|
|
3
|
+
`@rev-net/core-v6` deploys and operates Revnets: Juicebox project shapes with staged economics, optional tiered NFTs, cross-chain support, buyback integration, hidden-token mechanics, and token-collateralized loans.
|
|
4
4
|
|
|
5
5
|
Docs: <https://docs.juicebox.money>
|
|
6
6
|
Architecture: [ARCHITECTURE.md](./ARCHITECTURE.md)
|
|
@@ -18,13 +18,12 @@ This package provides:
|
|
|
18
18
|
|
|
19
19
|
- a deployer that launches Revnets and stores their long-lived configuration
|
|
20
20
|
- a runtime hook that mediates pay, cash-out, mint-permission, and delayed-cash-out behavior
|
|
21
|
-
-
|
|
21
|
+
- a loan system that burns token collateral on borrow and remints on repayment
|
|
22
|
+
- a hidden-token system that temporarily removes tokens from visible supply
|
|
22
23
|
|
|
23
24
|
It also composes with the 721 hook stack, buyback hook, router terminal, Croptop, and suckers where needed.
|
|
24
25
|
|
|
25
|
-
Use this repo when the product is a treasury-backed network with encoded stage transitions and a tightly constrained post-launch admin surface. Do not use it when
|
|
26
|
-
|
|
27
|
-
The key point is that a Revnet is not just "a Juicebox project with presets." It is a project shape whose admin surface is intentionally collapsed into deployment-time configuration plus constrained runtime operators, even though the deployer contract still retains the project NFT.
|
|
26
|
+
Use this repo when the product is a treasury-backed network with encoded stage transitions and a tightly constrained post-launch admin surface. Do not use it when the goal is ordinary governance or a simple project deploy.
|
|
28
27
|
|
|
29
28
|
## Key Contracts
|
|
30
29
|
|
|
@@ -33,48 +32,38 @@ The key point is that a Revnet is not just "a Juicebox project with presets." It
|
|
|
33
32
|
| `REVDeployer` | Launches and configures Revnets, stages, split operators, and optional auxiliary features. |
|
|
34
33
|
| `REVOwner` | Runtime data-hook and cash-out-hook surface used by active Revnets. |
|
|
35
34
|
| `REVLoans` | Loan surface that lets users borrow against Revnet tokens with burned collateral and NFT loan positions. |
|
|
36
|
-
| `REVHiddenTokens` | Lets token holders temporarily hide
|
|
35
|
+
| `REVHiddenTokens` | Lets token holders temporarily hide tokens, excluding them from visible supply until reveal. |
|
|
37
36
|
|
|
38
37
|
## Mental Model
|
|
39
38
|
|
|
40
39
|
Read the package in two halves:
|
|
41
40
|
|
|
42
41
|
1. deployment-time shape: `REVDeployer` decides what the network will be allowed to do
|
|
43
|
-
2. runtime enforcement: `REVOwner` and `
|
|
44
|
-
|
|
45
|
-
That split matters because most mistakes are one of these:
|
|
46
|
-
|
|
47
|
-
- assuming a deploy-time parameter can be changed later
|
|
48
|
-
- assuming a runtime hook is only advisory rather than economically binding
|
|
42
|
+
2. runtime enforcement: `REVOwner`, `REVLoans`, and `REVHiddenTokens` decide how that shape behaves over time
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
1. `REVDeployer`
|
|
53
|
-
2. `REVOwner`
|
|
54
|
-
3. `REVLoans`
|
|
55
|
-
4. any integrated hook or bridge repo the deployment enables
|
|
44
|
+
Most mistakes come from assuming a deploy-time parameter can be changed later or that a runtime hook is only advisory.
|
|
56
45
|
|
|
57
46
|
## Read These Files First
|
|
58
47
|
|
|
59
48
|
1. `src/REVDeployer.sol`
|
|
60
49
|
2. `src/REVOwner.sol`
|
|
61
50
|
3. `src/REVLoans.sol`
|
|
62
|
-
4.
|
|
51
|
+
4. `src/REVHiddenTokens.sol`
|
|
52
|
+
5. the integrated hook or bridge repo used by the deployment
|
|
63
53
|
|
|
64
54
|
## Integration Traps
|
|
65
55
|
|
|
66
|
-
- the deployer holding the project NFT is
|
|
56
|
+
- the deployer holding the project NFT is part of the ownership model, not an implementation detail
|
|
67
57
|
- split operators are constrained, not equivalent to general protocol governance
|
|
68
|
-
- the loan system depends on live revnet economics
|
|
69
|
-
- optional integrations like buybacks, 721 hooks, and suckers
|
|
58
|
+
- the loan system depends on live revnet economics and should be reviewed together with the runtime hook
|
|
59
|
+
- optional integrations like buybacks, 721 hooks, and suckers materially change the resulting network
|
|
70
60
|
|
|
71
61
|
## Where State Lives
|
|
72
62
|
|
|
73
63
|
- deployment-time configuration and operator envelope live in `REVDeployer`
|
|
74
64
|
- runtime pay and cash-out behavior live in `REVOwner`
|
|
75
65
|
- loan positions and loan-specific state live in `REVLoans`
|
|
76
|
-
|
|
77
|
-
Do not audit those contracts in isolation if the deployment enables cross-package features; the composed network is the real product.
|
|
66
|
+
- hidden-token state lives in `REVHiddenTokens`
|
|
78
67
|
|
|
79
68
|
## High-Signal Tests
|
|
80
69
|
|
|
@@ -107,7 +96,7 @@ Useful scripts:
|
|
|
107
96
|
|
|
108
97
|
## Deployment Notes
|
|
109
98
|
|
|
110
|
-
Revnet deployment assumes the core protocol, 721 hook, buyback hook, router terminal, suckers, and Croptop packages are available. Revnets are intentionally unowned in the direct human
|
|
99
|
+
Revnet deployment assumes the core protocol, 721 hook, buyback hook, router terminal, suckers, and Croptop packages are available. Revnets are intentionally unowned in the direct human sense after deployment, but the deployer contract itself remains part of the ownership model.
|
|
111
100
|
|
|
112
101
|
## Repository Layout
|
|
113
102
|
|
|
@@ -116,6 +105,7 @@ src/
|
|
|
116
105
|
REVDeployer.sol
|
|
117
106
|
REVOwner.sol
|
|
118
107
|
REVLoans.sol
|
|
108
|
+
REVHiddenTokens.sol
|
|
119
109
|
interfaces/
|
|
120
110
|
structs/
|
|
121
111
|
test/
|
|
@@ -128,14 +118,12 @@ script/
|
|
|
128
118
|
## Risks And Notes
|
|
129
119
|
|
|
130
120
|
- Revnets are intentionally hard to change after launch, so bad stage design is expensive
|
|
131
|
-
- `REVLoans` relies on live treasury conditions and is
|
|
132
|
-
- the deployer and runtime hook
|
|
133
|
-
- burned-collateral lending is operationally different from escrowed-collateral lending
|
|
134
|
-
|
|
135
|
-
The usual review failure mode is to focus on the loans or the stages in isolation. The real system is the combination of stage economics, runtime hook behavior, and who is still allowed to act after deployment.
|
|
121
|
+
- `REVLoans` relies on live treasury conditions and is sensitive to surplus and pricing assumptions
|
|
122
|
+
- the deployer and runtime hook should be treated as one design, not two separate systems
|
|
123
|
+
- burned-collateral lending is operationally different from escrowed-collateral lending
|
|
136
124
|
|
|
137
125
|
## For AI Agents
|
|
138
126
|
|
|
139
|
-
- Describe Revnets as treasury-backed Juicebox project shapes with encoded stage transitions, not as simple
|
|
140
|
-
- Read `REVDeployer`, `REVOwner`, and `
|
|
127
|
+
- Describe Revnets as treasury-backed Juicebox project shapes with encoded stage transitions, not as simple presets.
|
|
128
|
+
- Read `REVDeployer`, `REVOwner`, `REVLoans`, and `REVHiddenTokens` together before answering economic or admin-surface questions.
|
|
141
129
|
- If a deployment enables buybacks, 721 hooks, or suckers, inspect those sibling repos before making definitive claims.
|