@rev-net/core-v6 0.0.13 → 0.0.15
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/CHANGE_LOG.md +8 -3
- package/SKILLS.md +1 -1
- package/foundry.toml +7 -0
- package/package.json +8 -9
- package/src/REVDeployer.sol +34 -12
- package/src/REVLoans.sol +1 -5
- package/test/REVDeployerRegressions.t.sol +6 -3
- package/test/REVInvincibility.t.sol +6 -18
- package/test/REVLoansAttacks.t.sol +19 -11
- package/test/REVLoansFeeRecovery.t.sol +19 -11
- package/test/REVLoansFindings.t.sol +19 -11
- package/test/REVLoansRegressions.t.sol +19 -11
- package/test/REVLoansSourced.t.sol +0 -8
- package/test/TestCashOutCallerValidation.t.sol +74 -0
- package/test/TestLowFindings.t.sol +3 -1
- package/test/TestMixedFixes.t.sol +6 -4
- package/test/TestSplitWeightAdjustment.t.sol +10 -5
- package/test/fork/TestAutoIssuanceFork.t.sol +148 -0
- package/test/fork/TestCashOutFork.t.sol +22 -21
- package/test/fork/TestIssuanceDecayFork.t.sol +158 -0
- package/test/fork/TestLoanERC20Fork.t.sol +463 -0
- package/test/fork/TestLoanRepayFork.t.sol +2 -2
- package/test/fork/TestPermit2PaymentFork.t.sol +299 -0
- package/test/helpers/MaliciousContracts.sol +36 -22
- package/test/mock/MockBuybackDataHook.sol +50 -6
- package/deployments/revnet-core-v5/arbitrum/REVDeployer.json +0 -2821
- package/deployments/revnet-core-v5/arbitrum/REVLoans.json +0 -2260
- package/deployments/revnet-core-v5/arbitrum_sepolia/REVDeployer.json +0 -2821
- package/deployments/revnet-core-v5/arbitrum_sepolia/REVLoans.json +0 -2260
- package/deployments/revnet-core-v5/base/REVDeployer.json +0 -2825
- package/deployments/revnet-core-v5/base/REVLoans.json +0 -2264
- package/deployments/revnet-core-v5/base_sepolia/REVDeployer.json +0 -2825
- package/deployments/revnet-core-v5/base_sepolia/REVLoans.json +0 -2264
- package/deployments/revnet-core-v5/ethereum/REVDeployer.json +0 -2825
- package/deployments/revnet-core-v5/ethereum/REVLoans.json +0 -2264
- package/deployments/revnet-core-v5/optimism/REVDeployer.json +0 -2821
- package/deployments/revnet-core-v5/optimism/REVLoans.json +0 -2260
- package/deployments/revnet-core-v5/optimism_sepolia/REVDeployer.json +0 -2825
- package/deployments/revnet-core-v5/optimism_sepolia/REVLoans.json +0 -2264
- package/deployments/revnet-core-v5/sepolia/REVDeployer.json +0 -2825
- package/deployments/revnet-core-v5/sepolia/REVLoans.json +0 -2264
- package/docs/book.css +0 -13
- package/docs/book.toml +0 -13
- package/docs/solidity.min.js +0 -74
- package/docs/src/README.md +0 -185
- package/docs/src/SUMMARY.md +0 -18
- package/docs/src/src/README.md +0 -7
- package/docs/src/src/REVDeployer.sol/contract.REVDeployer.md +0 -999
- package/docs/src/src/REVLoans.sol/contract.REVLoans.md +0 -1108
- package/docs/src/src/interfaces/IREVDeployer.sol/interface.IREVDeployer.md +0 -525
- package/docs/src/src/interfaces/IREVLoans.sol/interface.IREVLoans.md +0 -598
- package/docs/src/src/interfaces/README.md +0 -5
- package/docs/src/src/structs/README.md +0 -12
- package/docs/src/src/structs/REVAutoIssuance.sol/struct.REVAutoIssuance.md +0 -19
- package/docs/src/src/structs/REVBuybackHookConfig.sol/struct.REVBuybackHookConfig.md +0 -19
- package/docs/src/src/structs/REVBuybackPoolConfig.sol/struct.REVBuybackPoolConfig.md +0 -21
- package/docs/src/src/structs/REVConfig.sol/struct.REVConfig.md +0 -23
- package/docs/src/src/structs/REVCroptopAllowedPost.sol/struct.REVCroptopAllowedPost.md +0 -32
- package/docs/src/src/structs/REVDeploy721TiersHookConfig.sol/struct.REVDeploy721TiersHookConfig.md +0 -34
- package/docs/src/src/structs/REVDescription.sol/struct.REVDescription.md +0 -23
- package/docs/src/src/structs/REVLoan.sol/struct.REVLoan.md +0 -28
- package/docs/src/src/structs/REVLoanSource.sol/struct.REVLoanSource.md +0 -16
- package/docs/src/src/structs/REVStageConfig.sol/struct.REVStageConfig.md +0 -44
- package/docs/src/src/structs/REVSuckerDeploymentConfig.sol/struct.REVSuckerDeploymentConfig.md +0 -16
package/docs/book.css
DELETED
package/docs/book.toml
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
[book]
|
|
2
|
-
src = "src"
|
|
3
|
-
title = ""
|
|
4
|
-
|
|
5
|
-
[output.html]
|
|
6
|
-
no-section-label = true
|
|
7
|
-
additional-js = ["solidity.min.js"]
|
|
8
|
-
additional-css = ["book.css"]
|
|
9
|
-
mathjax-support = true
|
|
10
|
-
git-repository-url = "https://github.com/rev-net/revnet-core-v6"
|
|
11
|
-
|
|
12
|
-
[output.html.fold]
|
|
13
|
-
enable = true
|
package/docs/solidity.min.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
hljs.registerLanguage("solidity",(()=>{"use strict";function e(){try{return!0
|
|
2
|
-
}catch(e){return!1}}
|
|
3
|
-
var a=/-?(\b0[xX]([a-fA-F0-9]_?)*[a-fA-F0-9]|(\b[1-9](_?\d)*(\.((\d_?)*\d)?)?|\.\d(_?\d)*)([eE][-+]?\d(_?\d)*)?|\b0)(?!\w|\$)/
|
|
4
|
-
;e()&&(a=a.source.replace(/\\b/g,"(?<!\\$)\\b"));var s={className:"number",
|
|
5
|
-
begin:a,relevance:0},n={
|
|
6
|
-
keyword:"assembly let function if switch case default for leave break continue u256 jump jumpi stop return revert selfdestruct invalid",
|
|
7
|
-
built_in:"add sub mul div sdiv mod smod exp not lt gt slt sgt eq iszero and or xor byte shl shr sar addmod mulmod signextend keccak256 pc pop dup1 dup2 dup3 dup4 dup5 dup6 dup7 dup8 dup9 dup10 dup11 dup12 dup13 dup14 dup15 dup16 swap1 swap2 swap3 swap4 swap5 swap6 swap7 swap8 swap9 swap10 swap11 swap12 swap13 swap14 swap15 swap16 mload mstore mstore8 sload sstore msize gas address balance selfbalance caller callvalue calldataload calldatasize calldatacopy codesize codecopy extcodesize extcodecopy returndatasize returndatacopy extcodehash create create2 call callcode delegatecall staticcall log0 log1 log2 log3 log4 chainid origin gasprice basefee blockhash coinbase timestamp number difficulty gaslimit",
|
|
8
|
-
literal:"true false"},i={className:"string",
|
|
9
|
-
begin:/\bhex'(([0-9a-fA-F]{2}_?)*[0-9a-fA-F]{2})?'/},t={className:"string",
|
|
10
|
-
begin:/\bhex"(([0-9a-fA-F]{2}_?)*[0-9a-fA-F]{2})?"/};function r(e){
|
|
11
|
-
return e.inherit(e.APOS_STRING_MODE,{begin:/(\bunicode)?'/})}function l(e){
|
|
12
|
-
return e.inherit(e.QUOTE_STRING_MODE,{begin:/(\bunicode)?"/})}var o={
|
|
13
|
-
SOL_ASSEMBLY_KEYWORDS:n,baseAssembly:e=>{
|
|
14
|
-
var a=r(e),o=l(e),c=/[A-Za-z_$][A-Za-z_$0-9.]*/,d=e.inherit(e.TITLE_MODE,{
|
|
15
|
-
begin:/[A-Za-z$_][0-9A-Za-z$_]*/,lexemes:c,keywords:n}),u={className:"params",
|
|
16
|
-
begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,lexemes:c,keywords:n,
|
|
17
|
-
contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,o,s]},_={
|
|
18
|
-
className:"operator",begin:/:=|->/};return{keywords:n,lexemes:c,
|
|
19
|
-
contains:[a,o,i,t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s,_,{
|
|
20
|
-
className:"function",lexemes:c,beginKeywords:"function",end:"{",excludeEnd:!0,
|
|
21
|
-
contains:[d,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,_]}]}},
|
|
22
|
-
solAposStringMode:r,solQuoteStringMode:l,HEX_APOS_STRING_MODE:i,
|
|
23
|
-
HEX_QUOTE_STRING_MODE:t,SOL_NUMBER:s,isNegativeLookbehindAvailable:e}
|
|
24
|
-
;const{baseAssembly:c,solAposStringMode:d,solQuoteStringMode:u,HEX_APOS_STRING_MODE:_,HEX_QUOTE_STRING_MODE:m,SOL_NUMBER:b,isNegativeLookbehindAvailable:E}=o
|
|
25
|
-
;return e=>{for(var a=d(e),s=u(e),n=[],i=0;i<32;i++)n[i]=i+1
|
|
26
|
-
;var t=n.map((e=>8*e)),r=[];for(i=0;i<=80;i++)r[i]=i
|
|
27
|
-
;var l=n.map((e=>"bytes"+e)).join(" ")+" ",o=t.map((e=>"uint"+e)).join(" ")+" ",g=t.map((e=>"int"+e)).join(" ")+" ",M=[].concat.apply([],t.map((e=>r.map((a=>e+"x"+a))))),p={
|
|
28
|
-
keyword:"var bool string int uint "+g+o+"byte bytes "+l+"fixed ufixed "+M.map((e=>"fixed"+e)).join(" ")+" "+M.map((e=>"ufixed"+e)).join(" ")+" enum struct mapping address new delete if else for while continue break return throw emit try catch revert unchecked _ function modifier event constructor fallback receive error virtual override constant immutable anonymous indexed storage memory calldata external public internal payable pure view private returns import from as using pragma contract interface library is abstract type assembly",
|
|
29
|
-
literal:"true false wei gwei szabo finney ether seconds minutes hours days weeks years",
|
|
30
|
-
built_in:"self this super selfdestruct suicide now msg block tx abi blockhash gasleft assert require Error Panic sha3 sha256 keccak256 ripemd160 ecrecover addmod mulmod log0 log1 log2 log3 log4"
|
|
31
|
-
},O={className:"operator",begin:/[+\-!~*\/%<>&^|=]/
|
|
32
|
-
},C=/[A-Za-z_$][A-Za-z_$0-9]*/,N={className:"params",begin:/\(/,end:/\)/,
|
|
33
|
-
excludeBegin:!0,excludeEnd:!0,lexemes:C,keywords:p,
|
|
34
|
-
contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,s,b,"self"]},f={
|
|
35
|
-
begin:/\.\s*/,end:/[^A-Za-z0-9$_\.]/,excludeBegin:!0,excludeEnd:!0,keywords:{
|
|
36
|
-
built_in:"gas value selector address length push pop send transfer call callcode delegatecall staticcall balance code codehash wrap unwrap name creationCode runtimeCode interfaceId min max"
|
|
37
|
-
},relevance:2},y=e.inherit(e.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/,
|
|
38
|
-
lexemes:C,keywords:p}),w={className:"built_in",
|
|
39
|
-
begin:(E()?"(?<!\\$)\\b":"\\b")+"(gas|value|salt)(?=:)"};function x(e,a){return{
|
|
40
|
-
begin:(E()?"(?<!\\$)\\b":"\\b")+e+"\\.\\s*",end:/[^A-Za-z0-9$_\.]/,
|
|
41
|
-
excludeBegin:!1,excludeEnd:!0,lexemes:C,keywords:{built_in:e+" "+a},
|
|
42
|
-
contains:[f],relevance:10}}var h=c(e),v=e.inherit(h,{
|
|
43
|
-
contains:h.contains.concat([{begin:/\./,end:/[^A-Za-z0-9$.]/,excludeBegin:!0,
|
|
44
|
-
excludeEnd:!0,keywords:{built_in:"slot offset length address selector"},
|
|
45
|
-
relevance:2},{begin:/_/,end:/[^A-Za-z0-9$.]/,excludeBegin:!0,excludeEnd:!0,
|
|
46
|
-
keywords:{built_in:"slot offset"},relevance:2}])});return{aliases:["sol"],
|
|
47
|
-
keywords:p,lexemes:C,
|
|
48
|
-
contains:[a,s,_,m,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,w,O,{
|
|
49
|
-
className:"function",lexemes:C,
|
|
50
|
-
beginKeywords:"function modifier event constructor fallback receive error",
|
|
51
|
-
end:/[{;]/,excludeEnd:!0,
|
|
52
|
-
contains:[y,N,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:/%/
|
|
53
|
-
},x("msg","gas value data sender sig"),x("block","blockhash coinbase difficulty gaslimit basefee number timestamp chainid"),x("tx","gasprice origin"),x("abi","decode encode encodePacked encodeWithSelector encodeWithSignature encodeCall"),x("bytes","concat"),f,{
|
|
54
|
-
className:"class",lexemes:C,beginKeywords:"contract interface library",end:"{",
|
|
55
|
-
excludeEnd:!0,illegal:/[:"\[\]]/,contains:[{beginKeywords:"is",lexemes:C
|
|
56
|
-
},y,N,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{lexemes:C,
|
|
57
|
-
beginKeywords:"struct enum",end:"{",excludeEnd:!0,illegal:/[:"\[\]]/,
|
|
58
|
-
contains:[y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{
|
|
59
|
-
beginKeywords:"import",end:";",lexemes:C,keywords:"import from as",
|
|
60
|
-
contains:[y,a,s,_,m,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,O]},{
|
|
61
|
-
beginKeywords:"using",end:";",lexemes:C,keywords:"using for",
|
|
62
|
-
contains:[y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,O]},{className:"meta",
|
|
63
|
-
beginKeywords:"pragma",end:";",lexemes:C,keywords:{
|
|
64
|
-
keyword:"pragma solidity experimental abicoder",
|
|
65
|
-
built_in:"ABIEncoderV2 SMTChecker v1 v2"},
|
|
66
|
-
contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.inherit(a,{
|
|
67
|
-
className:"meta-string"}),e.inherit(s,{className:"meta-string"})]},{
|
|
68
|
-
beginKeywords:"assembly",end:/\b\B/,
|
|
69
|
-
contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.inherit(v,{begin:"{",
|
|
70
|
-
end:"}",endsParent:!0,contains:v.contains.concat([e.inherit(v,{begin:"{",
|
|
71
|
-
end:"}",contains:v.contains.concat(["self"])})])})]}],illegal:/#/}}})());
|
|
72
|
-
|
|
73
|
-
// Ugly hack to reload HLJS
|
|
74
|
-
hljs.initHighlightingOnLoad();
|
package/docs/src/README.md
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
# Revnet Core
|
|
2
|
-
|
|
3
|
-
Deploy and operate Revnets: unowned Juicebox projects that run autonomously according to predefined stages, with built-in token-collateralized loans.
|
|
4
|
-
|
|
5
|
-
[Docs](https://docs.juicebox.money) | [Discord](https://discord.gg/nT3XqbzNEr)
|
|
6
|
-
|
|
7
|
-
## What is a Revnet?
|
|
8
|
-
|
|
9
|
-
A Revnet is a treasury-backed token that runs itself. No owners, no governors, no multisigs. Once deployed, a revnet follows its predefined stages forever, backed by the Juicebox and Uniswap protocols.
|
|
10
|
-
|
|
11
|
-
## Conceptual Overview
|
|
12
|
-
|
|
13
|
-
Revnets are autonomous Juicebox projects with predetermined economic stages. Each stage defines issuance rates, decay schedules, cash-out taxes, reserved splits, and auto-issuance allocations. Once deployed, these parameters cannot be changed -- the revnet operates on its own forever.
|
|
14
|
-
|
|
15
|
-
### Stage-Based Lifecycle
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
1. Deploy revnet with stage configurations
|
|
19
|
-
→ REVDeployer.deployFor(revnetId=0, config, terminals, ...)
|
|
20
|
-
→ Creates Juicebox project owned by REVDeployer (permanently)
|
|
21
|
-
→ Deploys ERC-20 token, configures buyback pools, deploys suckers
|
|
22
|
-
|
|
|
23
|
-
2. Stage 1 begins (startsAtOrAfter or block.timestamp)
|
|
24
|
-
→ Tokens issued at initialIssuance rate per unit of base currency
|
|
25
|
-
→ Issuance decays by issuanceCutPercent every issuanceCutFrequency
|
|
26
|
-
→ splitPercent of new tokens go to reserved splits
|
|
27
|
-
→ Cash outs taxed at cashOutTaxRate (2.5% fee to fee revnet)
|
|
28
|
-
|
|
|
29
|
-
3. Stage transitions happen automatically
|
|
30
|
-
→ When startsAtOrAfter timestamp is reached for next stage
|
|
31
|
-
→ New issuance rate, tax rate, splits, etc. take effect
|
|
32
|
-
→ No governance, no votes, no owner action required
|
|
33
|
-
|
|
|
34
|
-
4. Participants can borrow against their tokens
|
|
35
|
-
→ REVLoans.borrowFrom(revnetId, source, collateral, ...)
|
|
36
|
-
→ Collateral tokens are burned, funds pulled from treasury
|
|
37
|
-
→ Loan is an ERC-721 NFT, liquidates after 10 years
|
|
38
|
-
|
|
|
39
|
-
5. Ongoing operations (permissionless or split operator)
|
|
40
|
-
→ Auto-issuance claims (permissionless)
|
|
41
|
-
→ Buyback pool configuration (split operator)
|
|
42
|
-
→ Sucker deployment (split operator, if ruleset allows)
|
|
43
|
-
→ Split group updates (split operator)
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Token-Collateralized Loans
|
|
47
|
-
|
|
48
|
-
`REVLoans` lets participants borrow against their revnet tokens. Unlike traditional lending:
|
|
49
|
-
|
|
50
|
-
- **Collateral is burned, not held.** Tokens are destroyed on borrow and re-minted on repay. This keeps the token supply accurate -- collateral tokens don't exist during the loan.
|
|
51
|
-
- **Borrowable amount = cash-out value.** The bonding curve determines how much you can borrow for a given amount of collateral.
|
|
52
|
-
- **Prepaid fee model.** Borrowers choose a prepaid fee (2.5%-50%) that buys an interest-free window. After that window, a time-proportional source fee accrues.
|
|
53
|
-
- **Each loan is an ERC-721 NFT.** Loans can be transferred, and expired loans (10 years) can be liquidated by anyone.
|
|
54
|
-
|
|
55
|
-
### Deployer Variants
|
|
56
|
-
|
|
57
|
-
- **Basic revnet** -- `deployFor` with stage configurations mapped to Juicebox rulesets.
|
|
58
|
-
- **Tiered 721 revnet** -- `deployWith721sFor` adds a tiered 721 pay hook that mints NFTs as people pay.
|
|
59
|
-
- **Croptop revnet** -- A tiered 721 revnet with Croptop posting criteria, allowing the public to post content.
|
|
60
|
-
|
|
61
|
-
## Architecture
|
|
62
|
-
|
|
63
|
-
| Contract | Description |
|
|
64
|
-
|----------|-------------|
|
|
65
|
-
| `REVDeployer` | Deploys revnets as Juicebox projects owned by the deployer contract itself (no human owner). Translates stage configurations into Juicebox rulesets, manages buyback hooks, tiered 721 hooks, suckers, split operators, auto-issuance, and cash-out fees. Acts as the ruleset data hook and cash-out hook for every revnet it deploys. |
|
|
66
|
-
| `REVLoans` | Lets participants borrow against their revnet tokens. Collateral tokens are burned on borrow and re-minted on repayment. Each loan is an ERC-721 NFT. Charges a prepaid fee (2.5% min, 50% max) that determines the interest-free duration; after that window, a time-proportional source fee accrues. Loans liquidate after 10 years. |
|
|
67
|
-
|
|
68
|
-
### How They Relate
|
|
69
|
-
|
|
70
|
-
`REVDeployer` owns every revnet's Juicebox project NFT and holds all administrative permissions. During deployment it grants `REVLoans` the `USE_ALLOWANCE` permission so loans can pull funds from the revnet's terminal. `REVLoans` verifies that a revnet was deployed by its expected `REVDeployer` before issuing any loan.
|
|
71
|
-
|
|
72
|
-
### Interfaces
|
|
73
|
-
|
|
74
|
-
| Interface | Description |
|
|
75
|
-
|-----------|-------------|
|
|
76
|
-
| `IREVDeployer` | Deployment, data hooks, auto-issuance, split operator management, sucker deployment, plus events. |
|
|
77
|
-
| `IREVLoans` | Borrow, repay, refinance, liquidate, views, plus events. |
|
|
78
|
-
|
|
79
|
-
## Install
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
npm install @rev-net/core-v6
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
If using Forge directly:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npm install && forge install
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
If `forge install` has issues, try `git submodule update --init --recursive`.
|
|
92
|
-
|
|
93
|
-
## Develop
|
|
94
|
-
|
|
95
|
-
| Command | Description |
|
|
96
|
-
|---------|-------------|
|
|
97
|
-
| `forge build` | Compile contracts |
|
|
98
|
-
| `forge test` | Run tests (20+ test files covering deployment, lifecycle, loans, attacks, invariants) |
|
|
99
|
-
| `forge test -vvvv` | Run tests with full traces |
|
|
100
|
-
|
|
101
|
-
## Repository Layout
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
src/
|
|
105
|
-
REVDeployer.sol # Revnet deployer + data hook (~1,256 lines)
|
|
106
|
-
REVLoans.sol # Token-collateralized lending (~1,333 lines)
|
|
107
|
-
interfaces/
|
|
108
|
-
IREVDeployer.sol # Deployer interface + events
|
|
109
|
-
IREVLoans.sol # Loans interface + events
|
|
110
|
-
structs/
|
|
111
|
-
REVConfig.sol # Top-level deployment config
|
|
112
|
-
REVDescription.sol # ERC-20 metadata (name, ticker, uri, salt)
|
|
113
|
-
REVStageConfig.sol # Economic stage parameters
|
|
114
|
-
REVAutoIssuance.sol # Per-stage cross-chain premint
|
|
115
|
-
REVLoan.sol # Loan state
|
|
116
|
-
REVLoanSource.sol # Terminal + token pair for loans
|
|
117
|
-
REVDeploy721TiersHookConfig.sol # 721 hook deployment config
|
|
118
|
-
REVCroptopAllowedPost.sol # Croptop posting criteria
|
|
119
|
-
REVSuckerDeploymentConfig.sol # Cross-chain sucker deployment
|
|
120
|
-
test/
|
|
121
|
-
REV.integrations.t.sol # Deployment, payments, cash-outs
|
|
122
|
-
REVLifecycle.t.sol # Stage transitions, weight decay
|
|
123
|
-
REVAutoIssuanceFuzz.t.sol # Auto-issuance fuzz tests
|
|
124
|
-
REVInvincibility.t.sol # Economic property fuzzing
|
|
125
|
-
REVInvincibilityHandler.sol # Fuzz handler
|
|
126
|
-
REVDeployerRegressions.t.sol # Deployer regressions
|
|
127
|
-
REVLoansSourced.t.sol # Multi-source loan tests
|
|
128
|
-
REVLoansUnSourced.t.sol # Loan error cases
|
|
129
|
-
REVLoansFeeRecovery.t.sol # Fee calculation tests
|
|
130
|
-
REVLoansAttacks.t.sol # Flash loan, reentrancy scenarios
|
|
131
|
-
REVLoans.invariants.t.sol # Loan fuzzing invariants
|
|
132
|
-
REVLoansRegressions.t.sol # Loan regressions
|
|
133
|
-
TestPR09-32_*.t.sol # Per-PR regression tests
|
|
134
|
-
helpers/
|
|
135
|
-
MaliciousContracts.sol # Attack contract mocks
|
|
136
|
-
mock/
|
|
137
|
-
MockBuybackDataHook.sol # Mock for buyback hook tests
|
|
138
|
-
script/
|
|
139
|
-
Deploy.s.sol # Sphinx multi-chain deployment
|
|
140
|
-
helpers/
|
|
141
|
-
RevnetCoreDeploymentLib.sol # Deployment artifact reader
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Permissions
|
|
145
|
-
|
|
146
|
-
### Split Operator (per-revnet)
|
|
147
|
-
|
|
148
|
-
The split operator has these default permissions:
|
|
149
|
-
|
|
150
|
-
| Permission | Purpose |
|
|
151
|
-
|------------|---------|
|
|
152
|
-
| `SET_SPLIT_GROUPS` | Change reserved token splits |
|
|
153
|
-
| `SET_BUYBACK_POOL` | Configure Uniswap buyback pool |
|
|
154
|
-
| `SET_BUYBACK_TWAP` | Adjust TWAP window for buyback |
|
|
155
|
-
| `SET_PROJECT_URI` | Update project metadata |
|
|
156
|
-
| `ADD_PRICE_FEED` | Add price oracle |
|
|
157
|
-
| `SUCKER_SAFETY` | Emergency sucker functions |
|
|
158
|
-
| `SET_BUYBACK_HOOK` | Swap buyback hook |
|
|
159
|
-
| `SET_ROUTER_TERMINAL` | Swap terminal |
|
|
160
|
-
|
|
161
|
-
Plus optional from 721 hook config: `ADJUST_721_TIERS`, `SET_721_METADATA`, `MINT_721`, `SET_721_DISCOUNT_PERCENT`.
|
|
162
|
-
|
|
163
|
-
### Global Permissions
|
|
164
|
-
|
|
165
|
-
| Grantee | Permission | Scope |
|
|
166
|
-
|---------|------------|-------|
|
|
167
|
-
| `SUCKER_REGISTRY` | `MAP_SUCKER_TOKEN` | All revnets (wildcard projectId=0) |
|
|
168
|
-
| `REVLoans` | `USE_ALLOWANCE` | All revnets (wildcard projectId=0) |
|
|
169
|
-
|
|
170
|
-
### Permissionless Operations
|
|
171
|
-
|
|
172
|
-
- `autoIssueFor` -- claim auto-issuance tokens (anyone)
|
|
173
|
-
- `burnHeldTokensOf` -- burn reserved tokens held by deployer (anyone)
|
|
174
|
-
|
|
175
|
-
## Risks
|
|
176
|
-
|
|
177
|
-
- **No human owner.** `REVDeployer` permanently holds the project NFT. There is no function to release it. This is by design -- revnets are ownerless. But it means bugs in stage configurations cannot be fixed after deployment.
|
|
178
|
-
- **Loan flash-loan exposure.** `borrowableAmountFrom` reads live surplus, which can be inflated via flash loans. A borrower could temporarily inflate the treasury to borrow more than the sustained value would support.
|
|
179
|
-
- **uint112 truncation.** `REVLoan.amount` and `REVLoan.collateral` are `uint112` -- values above ~5.19e33 truncate silently.
|
|
180
|
-
- **Cash-out fee stacking.** Cash outs incur both the Juicebox terminal fee (2.5%) and the revnet cash-out fee (2.5% to fee revnet). These compound.
|
|
181
|
-
- **Auto-issuance stage ID mismatch.** Stage IDs are computed as `block.timestamp + i` during deployment, but actual Juicebox ruleset IDs depend on queuing logic. If timestamps don't align, auto-issuance for later stages may be unclaimed.
|
|
182
|
-
- **NATIVE_TOKEN on non-ETH chains.** Using `JBConstants.NATIVE_TOKEN` on Celo or Polygon means CELO/MATIC, not ETH. Use ERC-20 WETH instead. The matching hash does NOT catch this -- it covers economic parameters but NOT terminal configurations.
|
|
183
|
-
- **30-day cash-out delay.** When deploying an existing revnet to a new chain where the first stage has already started, a 30-day delay is imposed before cash outs are allowed, preventing cross-chain liquidity arbitrage.
|
|
184
|
-
- **Loan source array growth.** `_loanSourcesOf[revnetId]` is unbounded. If an attacker creates loans from many different terminals/tokens, the array grows without limit.
|
|
185
|
-
- **10-year loan liquidation.** Expired loans (10+ years) can be liquidated by anyone. The burned collateral is permanently lost -- it was destroyed at borrow time.
|
package/docs/src/SUMMARY.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# Summary
|
|
2
|
-
- [Home](README.md)
|
|
3
|
-
# src
|
|
4
|
-
- [❱ interfaces](src/interfaces/README.md)
|
|
5
|
-
- [IREVDeployer](src/interfaces/IREVDeployer.sol/interface.IREVDeployer.md)
|
|
6
|
-
- [IREVLoans](src/interfaces/IREVLoans.sol/interface.IREVLoans.md)
|
|
7
|
-
- [❱ structs](src/structs/README.md)
|
|
8
|
-
- [REVAutoIssuance](src/structs/REVAutoIssuance.sol/struct.REVAutoIssuance.md)
|
|
9
|
-
- [REVConfig](src/structs/REVConfig.sol/struct.REVConfig.md)
|
|
10
|
-
- [REVCroptopAllowedPost](src/structs/REVCroptopAllowedPost.sol/struct.REVCroptopAllowedPost.md)
|
|
11
|
-
- [REVDeploy721TiersHookConfig](src/structs/REVDeploy721TiersHookConfig.sol/struct.REVDeploy721TiersHookConfig.md)
|
|
12
|
-
- [REVDescription](src/structs/REVDescription.sol/struct.REVDescription.md)
|
|
13
|
-
- [REVLoan](src/structs/REVLoan.sol/struct.REVLoan.md)
|
|
14
|
-
- [REVLoanSource](src/structs/REVLoanSource.sol/struct.REVLoanSource.md)
|
|
15
|
-
- [REVStageConfig](src/structs/REVStageConfig.sol/struct.REVStageConfig.md)
|
|
16
|
-
- [REVSuckerDeploymentConfig](src/structs/REVSuckerDeploymentConfig.sol/struct.REVSuckerDeploymentConfig.md)
|
|
17
|
-
- [REVDeployer](src/REVDeployer.sol/contract.REVDeployer.md)
|
|
18
|
-
- [REVLoans](src/REVLoans.sol/contract.REVLoans.md)
|