@bananapus/721-hook-v6 1.0.0 → 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 +4 -0
- package/package.json +2 -2
- package/src/JB721TiersHookProjectDeployer.sol +20 -0
package/README.md
CHANGED
|
@@ -63,6 +63,10 @@ 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
|
|
67
71
|
- reserve beneficiary defaults are mutable hook state, so operators should not rely on later same-batch updates when
|
|
68
72
|
computing who receives reserve NFTs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bananapus/721-hook-v6",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@bananapus/address-registry-v6": "^1.0.0",
|
|
29
|
-
"@bananapus/core-v6": "^1.0.
|
|
29
|
+
"@bananapus/core-v6": "^1.0.2",
|
|
30
30
|
"@bananapus/ownable-v6": "^1.0.0",
|
|
31
31
|
"@bananapus/permission-ids-v6": "^1.0.0",
|
|
32
32
|
"@openzeppelin/contracts": "5.6.1",
|
|
@@ -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,
|