@bananapus/721-hook-v6 0.0.77 → 1.0.1
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/README.md +9 -0
- package/package.json +5 -5
- package/src/JB721TiersHookProjectDeployer.sol +20 -0
package/README.md
CHANGED
|
@@ -63,7 +63,14 @@ If a bug affects supply, reserve minting, or tier lookup, it usually lives in th
|
|
|
63
63
|
- this hook participates in treasury-facing execution, not only metadata
|
|
64
64
|
- custom token URI resolvers should be treated as part of the trusted surface
|
|
65
65
|
- adding a 721 hook through a deployer is easy; carrying the right ruleset behavior forward is where mistakes happen
|
|
66
|
+
- `JB721TiersHookProjectDeployer` forwards the creation fee on a project launch and advertises the resolved fee payer
|
|
67
|
+
via `IJBPayerTracker.originalPayer`, so a `pay`-routing fee receiver credits the launching user rather than the
|
|
68
|
+
deployer. The deployer reads the payer from `_msgSender()` (ERC-2771), so a trusted forwarder still attributes the fee
|
|
69
|
+
to the relayed user.
|
|
66
70
|
- projects should be explicit about whether the hook affects pay, cash out, or only metadata-facing paths
|
|
71
|
+
- reserve beneficiary defaults are mutable hook state, so operators should not rely on later same-batch updates when
|
|
72
|
+
computing who receives reserve NFTs
|
|
73
|
+
- future token-URI resolver slots are metadata authority; treat resolver changes like collection-facing admin actions
|
|
67
74
|
- per-tier owner-tracked voting units are queryable via `getPastTierVotingUnits(tierId, blockNumber)`: mints, transfers, and burns write ownership history, so the trace follows owned units regardless of delegation
|
|
68
75
|
- active delegated vote totals are queryable globally via `getPastTotalActiveVotes(blockNumber)` / `getTotalActiveVotes()` and per tier via `getPastTotalTierActiveVotes(tierId, blockNumber)` / `getTotalTierActiveVotes(tierId)`. These totals include only voting units held by accounts with a nonzero delegate, so a token in undelegated custody does not count and returned tokens become active again if the holder's delegation is still set.
|
|
69
76
|
- per-account active tier voting units are queryable via `getPastAccountTierActiveVotes(account, tierId, blockNumber)`. This follows the account holding the tier units, not the delegate receiving voting power, so reward distributors can cap tier-scoped claims against the holder's active units even when votes are delegated to another address.
|
|
@@ -139,6 +146,8 @@ script/
|
|
|
139
146
|
- custom token URI resolvers are part of the security surface
|
|
140
147
|
- projects need to be deliberate about whether the hook participates in pay, cash out, or both paths
|
|
141
148
|
- tier mutations after launch are powerful and should be permissioned carefully
|
|
149
|
+
- distributors and curated drops that depend on historical 721 ownership should pre-warm checkpoints before relying on
|
|
150
|
+
snapshot-based eligibility
|
|
142
151
|
|
|
143
152
|
When people say "the 721 hook," they often mean three different things: the hook contract, the store, and the metadata resolver plugged into it.
|
|
144
153
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bananapus/721-hook-v6",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"artifacts": "source ./.env && npx sphinx artifacts --org-id 'ea165b21-7cdc-4d7b-be59-ecdd4c26bee4' --project-name 'nana-721-hook-v6'"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@bananapus/address-registry-v6": "^0.0
|
|
29
|
-
"@bananapus/core-v6": "^
|
|
30
|
-
"@bananapus/ownable-v6": "^0.0
|
|
31
|
-
"@bananapus/permission-ids-v6": "^0.0
|
|
28
|
+
"@bananapus/address-registry-v6": "^1.0.0",
|
|
29
|
+
"@bananapus/core-v6": "^1.0.2",
|
|
30
|
+
"@bananapus/ownable-v6": "^1.0.0",
|
|
31
|
+
"@bananapus/permission-ids-v6": "^1.0.0",
|
|
32
32
|
"@openzeppelin/contracts": "5.6.1",
|
|
33
33
|
"@prb/math": "4.1.2",
|
|
34
34
|
"solady": "0.1.26"
|
|
@@ -4,8 +4,10 @@ pragma solidity 0.8.28;
|
|
|
4
4
|
import {JBPermissioned} from "@bananapus/core-v6/src/abstract/JBPermissioned.sol";
|
|
5
5
|
import {IJBController} from "@bananapus/core-v6/src/interfaces/IJBController.sol";
|
|
6
6
|
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
7
|
+
import {IJBPayerTracker} from "@bananapus/core-v6/src/interfaces/IJBPayerTracker.sol";
|
|
7
8
|
import {IJBPermissions} from "@bananapus/core-v6/src/interfaces/IJBPermissions.sol";
|
|
8
9
|
import {IJBProjects} from "@bananapus/core-v6/src/interfaces/IJBProjects.sol";
|
|
10
|
+
import {JBPayerTrackerLib} from "@bananapus/core-v6/src/libraries/JBPayerTrackerLib.sol";
|
|
9
11
|
import {JBRulesetConfig} from "@bananapus/core-v6/src/structs/JBRulesetConfig.sol";
|
|
10
12
|
import {JBRulesetMetadata} from "@bananapus/core-v6/src/structs/JBRulesetMetadata.sol";
|
|
11
13
|
import {JBOwnable} from "@bananapus/ownable-v6/src/JBOwnable.sol";
|
|
@@ -31,6 +33,7 @@ contract JB721TiersHookProjectDeployer is
|
|
|
31
33
|
ERC2771Context,
|
|
32
34
|
JBPermissioned,
|
|
33
35
|
IERC721Receiver,
|
|
36
|
+
IJBPayerTracker,
|
|
34
37
|
IJB721TiersHookProjectDeployer
|
|
35
38
|
{
|
|
36
39
|
//*********************************************************************//
|
|
@@ -43,6 +46,16 @@ contract JB721TiersHookProjectDeployer is
|
|
|
43
46
|
/// @notice The deployer contract used to create new 721 tiers hook instances via clone.
|
|
44
47
|
IJB721TiersHookDeployer public immutable override HOOK_DEPLOYER;
|
|
45
48
|
|
|
49
|
+
//*********************************************************************//
|
|
50
|
+
// ------------------- public transient properties ------------------- //
|
|
51
|
+
//*********************************************************************//
|
|
52
|
+
|
|
53
|
+
/// @notice The account that paid the creation fee for the project currently being launched.
|
|
54
|
+
/// @dev Set to the resolved fee payer (this contract's caller, or that caller's upstream payer when the caller is
|
|
55
|
+
/// itself an `IJBPayerTracker`) while `JBProjects.createFor` runs, so `JBProjects` attributes the fee to the true
|
|
56
|
+
/// payer. Cleared back to `address(0)` once the call returns.
|
|
57
|
+
address public transient override originalPayer;
|
|
58
|
+
|
|
46
59
|
//*********************************************************************//
|
|
47
60
|
// -------------------------- constructor ---------------------------- //
|
|
48
61
|
//*********************************************************************//
|
|
@@ -92,8 +105,15 @@ contract JB721TiersHookProjectDeployer is
|
|
|
92
105
|
{
|
|
93
106
|
// Reserve the project ID up front so permissionless project creations cannot invalidate hook deployment.
|
|
94
107
|
IJBProjects projects = DIRECTORY.PROJECTS();
|
|
108
|
+
|
|
109
|
+
// Expose the resolved fee payer so `JBProjects` attributes the creation fee to the true payer, not this
|
|
110
|
+
// contract. Cleared immediately after.
|
|
111
|
+
originalPayer = JBPayerTrackerLib.resolve(_msgSender());
|
|
112
|
+
|
|
95
113
|
projectId = projects.createFor{value: msg.value}(address(this));
|
|
96
114
|
|
|
115
|
+
originalPayer = address(0);
|
|
116
|
+
|
|
97
117
|
// Deploy the hook.
|
|
98
118
|
hook = HOOK_DEPLOYER.deployHookFor({
|
|
99
119
|
projectId: projectId,
|