@rev-net/core-v6 0.0.66 → 0.0.67
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/package.json +1 -1
- package/references/operations.md +36 -17
- package/references/runtime.md +6 -5
- package/src/REVDeployer.sol +125 -285
- package/src/REVOwner.sol +325 -24
- package/src/interfaces/IREVDeployer.sol +0 -50
- package/src/interfaces/IREVOwner.sol +117 -6
- package/src/structs/REVOwnerAutoIssuance.sol +14 -0
- package/src/structs/REVOwnerExtraGrant.sol +12 -0
- package/src/structs/REVOwnerRevnetInit.sol +29 -0
|
@@ -1,20 +1,131 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
|
+
import {IJB721TiersHook} from "@bananapus/721-hook-v6/src/interfaces/IJB721TiersHook.sol";
|
|
5
|
+
import {IJBBuybackHookRegistry} from "@bananapus/buyback-hook-v6/src/interfaces/IJBBuybackHookRegistry.sol";
|
|
6
|
+
import {IJBController} from "@bananapus/core-v6/src/interfaces/IJBController.sol";
|
|
7
|
+
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
8
|
+
import {IJBPermissions} from "@bananapus/core-v6/src/interfaces/IJBPermissions.sol";
|
|
9
|
+
import {IJBProjects} from "@bananapus/core-v6/src/interfaces/IJBProjects.sol";
|
|
10
|
+
import {IJBSuckerRegistry} from "@bananapus/suckers-v6/src/interfaces/IJBSuckerRegistry.sol";
|
|
11
|
+
|
|
12
|
+
import {REVOwnerRevnetInit} from "../structs/REVOwnerRevnetInit.sol";
|
|
4
13
|
import {IREVDeployer} from "./IREVDeployer.sol";
|
|
14
|
+
import {IREVLoans} from "./IREVLoans.sol";
|
|
5
15
|
|
|
6
|
-
/// @notice
|
|
16
|
+
/// @notice The runtime hook for every revnet and the on-chain owner of the underlying Juicebox project NFTs.
|
|
7
17
|
interface IREVOwner {
|
|
8
|
-
/// @notice
|
|
18
|
+
/// @notice Emitted when tokens are auto-issued for a beneficiary during a stage.
|
|
9
19
|
/// @param revnetId The ID of the revnet.
|
|
10
|
-
/// @
|
|
20
|
+
/// @param stageId The ID of the stage.
|
|
21
|
+
/// @param beneficiary The address receiving the auto-issued tokens.
|
|
22
|
+
/// @param count The number of tokens auto-issued.
|
|
23
|
+
/// @param caller The address that triggered the auto-issuance.
|
|
24
|
+
event AutoIssue(
|
|
25
|
+
uint256 indexed revnetId, uint256 indexed stageId, address indexed beneficiary, uint256 count, address caller
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
/// @notice Emitted when held tokens are burned from this contract.
|
|
29
|
+
/// @param revnetId The ID of the revnet whose tokens were burned.
|
|
30
|
+
/// @param count The number of tokens burned.
|
|
31
|
+
/// @param caller The address that triggered the burn.
|
|
32
|
+
event BurnHeldTokens(uint256 indexed revnetId, uint256 count, address caller);
|
|
33
|
+
|
|
34
|
+
/// @notice Emitted once when a revnet's initial runtime state is bound on this contract.
|
|
35
|
+
/// @param revnetId The ID of the revnet that was initialized.
|
|
36
|
+
/// @param caller The address that initialized the revnet (always the canonical deployer).
|
|
37
|
+
event InitializeRevnet(uint256 indexed revnetId, address caller);
|
|
38
|
+
|
|
39
|
+
/// @notice Emitted when the operator of a revnet is replaced.
|
|
40
|
+
/// @param revnetId The ID of the revnet.
|
|
41
|
+
/// @param newOperator The address of the new operator.
|
|
42
|
+
/// @param caller The address that replaced the operator.
|
|
43
|
+
event ReplaceOperator(uint256 indexed revnetId, address indexed newOperator, address caller);
|
|
44
|
+
|
|
45
|
+
/// @notice The buyback hook used as a data hook to route payments through buyback pools.
|
|
46
|
+
/// @return The buyback hook registry instance.
|
|
47
|
+
function BUYBACK_HOOK() external view returns (IJBBuybackHookRegistry);
|
|
48
|
+
|
|
49
|
+
/// @notice The controller used by every revnet to manage its underlying Juicebox project.
|
|
50
|
+
/// @return The controller instance.
|
|
51
|
+
function CONTROLLER() external view returns (IJBController);
|
|
52
|
+
|
|
53
|
+
/// @notice The directory of terminals and controllers for Juicebox projects.
|
|
54
|
+
/// @return The directory instance.
|
|
55
|
+
function DIRECTORY() external view returns (IJBDirectory);
|
|
56
|
+
|
|
57
|
+
/// @notice The Juicebox project ID of the revnet that receives cash out fees.
|
|
58
|
+
/// @return The fee revnet's Juicebox project ID.
|
|
59
|
+
function FEE_REVNET_ID() external view returns (uint256);
|
|
60
|
+
|
|
61
|
+
/// @notice The loan contract used by every revnet.
|
|
62
|
+
/// @return The loan contract instance.
|
|
63
|
+
function LOANS() external view returns (IREVLoans);
|
|
64
|
+
|
|
65
|
+
/// @notice The permissions registry used to grant operator authority over revnets.
|
|
66
|
+
/// @return The permissions instance.
|
|
67
|
+
function PERMISSIONS() external view returns (IJBPermissions);
|
|
68
|
+
|
|
69
|
+
/// @notice The Juicebox project NFT contract.
|
|
70
|
+
/// @return The projects instance.
|
|
71
|
+
function PROJECTS() external view returns (IJBProjects);
|
|
72
|
+
|
|
73
|
+
/// @notice The registry that deploys and tracks suckers for revnets.
|
|
74
|
+
/// @return The sucker registry instance.
|
|
75
|
+
function SUCKER_REGISTRY() external view returns (IJBSuckerRegistry);
|
|
76
|
+
|
|
77
|
+
/// @notice The amount of project tokens to auto-issue at a given stage to a given beneficiary.
|
|
78
|
+
/// @param revnetId The ID of the revnet.
|
|
79
|
+
/// @param stageId The ID of the stage.
|
|
80
|
+
/// @param beneficiary The address that will receive the auto-issued tokens.
|
|
81
|
+
/// @return The number of tokens available to auto-issue.
|
|
82
|
+
function amountToAutoIssue(uint256 revnetId, uint256 stageId, address beneficiary) external view returns (uint256);
|
|
83
|
+
|
|
84
|
+
/// @notice The timestamp at which cash outs become available for a specific revnet's participants.
|
|
85
|
+
/// @param revnetId The ID of the revnet.
|
|
86
|
+
/// @return The cash out delay timestamp (0 if no delay applies).
|
|
11
87
|
function cashOutDelayOf(uint256 revnetId) external view returns (uint256);
|
|
12
88
|
|
|
13
|
-
/// @notice The canonical deployer
|
|
89
|
+
/// @notice The canonical deployer that manages runtime hook state.
|
|
14
90
|
/// @return The revnet deployer instance.
|
|
15
91
|
function deployer() external view returns (IREVDeployer);
|
|
16
92
|
|
|
17
|
-
/// @notice
|
|
18
|
-
/// @param
|
|
93
|
+
/// @notice Whether an address holds a revnet's operator permissions.
|
|
94
|
+
/// @param revnetId The ID of the revnet.
|
|
95
|
+
/// @param addr The address to check.
|
|
96
|
+
/// @return A flag indicating whether the address is the revnet's operator.
|
|
97
|
+
function isOperatorOf(uint256 revnetId, address addr) external view returns (bool);
|
|
98
|
+
|
|
99
|
+
/// @notice The tiered ERC-721 hook deployed for a revnet (if any).
|
|
100
|
+
/// @param revnetId The ID of the revnet.
|
|
101
|
+
/// @return The tiered ERC-721 hook instance.
|
|
102
|
+
function tiered721HookOf(uint256 revnetId) external view returns (IJB721TiersHook);
|
|
103
|
+
|
|
104
|
+
/// @notice Auto-mint a revnet's tokens from a stage for a beneficiary.
|
|
105
|
+
/// @dev Permissionless once the stage has started.
|
|
106
|
+
/// @param revnetId The ID of the revnet to auto-mint tokens for.
|
|
107
|
+
/// @param stageId The ID of the ruleset stage to auto-mint tokens from.
|
|
108
|
+
/// @param beneficiary The address to send auto-minted tokens to.
|
|
109
|
+
function autoIssueFor(uint256 revnetId, uint256 stageId, address beneficiary) external;
|
|
110
|
+
|
|
111
|
+
/// @notice Burn any of a revnet's project tokens that have accumulated on this contract.
|
|
112
|
+
/// @param revnetId The ID of the revnet to burn tokens for.
|
|
113
|
+
function burnHeldTokensOf(uint256 revnetId) external;
|
|
114
|
+
|
|
115
|
+
/// @notice Bind every piece of revnet-scoped state managed by this contract in a single deployer call. Stores
|
|
116
|
+
/// the cash-out delay, the tiered ERC-721 hook, auto-issuance allocations, extra operator permissions, the
|
|
117
|
+
/// initial operator, and any integration-specific permission grants.
|
|
118
|
+
/// @dev Only callable by the canonical deployer during a revnet's initial configuration.
|
|
119
|
+
/// @param revnetId The ID of the revnet being initialized.
|
|
120
|
+
/// @param init The full initialization payload.
|
|
121
|
+
function initializeRevnet(uint256 revnetId, REVOwnerRevnetInit calldata init) external;
|
|
122
|
+
|
|
123
|
+
/// @notice Bind the canonical deployer address exactly once.
|
|
124
|
+
/// @param newDeployer The canonical deployer that will manage runtime hook state.
|
|
19
125
|
function setDeployer(IREVDeployer newDeployer) external;
|
|
126
|
+
|
|
127
|
+
/// @notice Change a revnet's operator. Only the current operator can call this.
|
|
128
|
+
/// @param revnetId The ID of the revnet to change the operator for.
|
|
129
|
+
/// @param newOperator The new operator's address. Use `address(0)` to relinquish operator powers.
|
|
130
|
+
function setOperatorOf(uint256 revnetId, address newOperator) external;
|
|
20
131
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
/// @notice A flattened auto-issuance allocation passed from `REVDeployer` to `REVOwner` during revnet initialization.
|
|
5
|
+
/// Unlike `REVAutoIssuance`, which is grouped by stage at the deployer-facing config layer, this is the per-record
|
|
6
|
+
/// shape that `REVOwner` actually stores: stage ID is already resolved and chain filtering already applied.
|
|
7
|
+
/// @custom:member stageId The ruleset stage at which the allocation unlocks.
|
|
8
|
+
/// @custom:member beneficiary The address that will receive the auto-issued tokens.
|
|
9
|
+
/// @custom:member count The number of project tokens to issue.
|
|
10
|
+
struct REVOwnerAutoIssuance {
|
|
11
|
+
uint256 stageId;
|
|
12
|
+
address beneficiary;
|
|
13
|
+
uint256 count;
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
/// @notice A single non-operator permission grant scoped to a revnet, applied during `REVOwner.initializeRevnet`. Used
|
|
5
|
+
/// for integrations that need to act on a revnet's behalf without holding full operator authority (e.g., the Croptop
|
|
6
|
+
/// publisher).
|
|
7
|
+
/// @custom:member operator The address being granted the permission.
|
|
8
|
+
/// @custom:member permissionId The permission ID to grant.
|
|
9
|
+
struct REVOwnerExtraGrant {
|
|
10
|
+
address operator;
|
|
11
|
+
uint8 permissionId;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import {IJB721TiersHook} from "@bananapus/721-hook-v6/src/interfaces/IJB721TiersHook.sol";
|
|
5
|
+
|
|
6
|
+
import {REVOwnerAutoIssuance} from "./REVOwnerAutoIssuance.sol";
|
|
7
|
+
import {REVOwnerExtraGrant} from "./REVOwnerExtraGrant.sol";
|
|
8
|
+
|
|
9
|
+
/// @notice The full per-revnet initialization payload that `REVDeployer` sends to `REVOwner` in a single
|
|
10
|
+
/// `initializeRevnet` call. Bundles every runtime-state write required to bring a fresh revnet online so the deployer
|
|
11
|
+
/// crosses the trust boundary into `REVOwner` exactly once.
|
|
12
|
+
/// @custom:member cashOutDelay The timestamp after which cash outs are allowed. Use `0` when no delay applies.
|
|
13
|
+
/// @custom:member tiered721Hook The tiered ERC-721 hook deployed for the revnet. Use `address(0)` when no hook
|
|
14
|
+
/// applies.
|
|
15
|
+
/// @custom:member operator The initial operator address. Use `address(0)` to relinquish operator powers up front.
|
|
16
|
+
/// @custom:member extraOperatorPermissionIds Permission IDs to merge into the revnet's default operator permission
|
|
17
|
+
/// set before the operator is bootstrapped.
|
|
18
|
+
/// @custom:member autoIssuances Auto-issuance allocations recorded on the revnet (already filtered to entries that
|
|
19
|
+
/// belong on this chain).
|
|
20
|
+
/// @custom:member extraGrants Per-revnet permission grants applied after the operator is bootstrapped (e.g., the
|
|
21
|
+
/// Croptop publisher's `ADJUST_721_TIERS` grant).
|
|
22
|
+
struct REVOwnerRevnetInit {
|
|
23
|
+
uint256 cashOutDelay;
|
|
24
|
+
IJB721TiersHook tiered721Hook;
|
|
25
|
+
address operator;
|
|
26
|
+
uint256[] extraOperatorPermissionIds;
|
|
27
|
+
REVOwnerAutoIssuance[] autoIssuances;
|
|
28
|
+
REVOwnerExtraGrant[] extraGrants;
|
|
29
|
+
}
|