@bananapus/omnichain-deployers-v6 0.0.34 → 0.0.37
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bananapus/omnichain-deployers-v6",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"src/"
|
|
17
17
|
],
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": "
|
|
19
|
+
"node": "25.9.0"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"test": "forge test",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@bananapus/core-v6": "0.0.39",
|
|
31
31
|
"@bananapus/ownable-v6": "0.0.24",
|
|
32
32
|
"@bananapus/permission-ids-v6": "0.0.22",
|
|
33
|
-
"@bananapus/suckers-v6": "0.0.
|
|
33
|
+
"@bananapus/suckers-v6": "0.0.34",
|
|
34
34
|
"@openzeppelin/contracts": "5.6.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -32,11 +32,17 @@ import {JBSuckerDeploymentConfig} from "./structs/JBSuckerDeploymentConfig.sol";
|
|
|
32
32
|
import {JBTiered721HookConfig} from "./structs/JBTiered721HookConfig.sol";
|
|
33
33
|
import {mulDiv} from "@prb/math/src/Common.sol";
|
|
34
34
|
|
|
35
|
-
/// @notice
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
/// @notice One-stop deployer and data hook wrapper for omnichain Juicebox projects. Launches a project with a tiered
|
|
36
|
+
/// 721 hook and cross-chain suckers in a single transaction, then inserts itself as every ruleset's data hook so it can
|
|
37
|
+
/// coordinate between the 721 hook, an optional extra hook (e.g. buyback), and the sucker registry at pay/cash-out
|
|
38
|
+
/// time. At pay time it merges weight and hook specifications from both the 721 hook and the extra hook. At cash-out
|
|
39
|
+
/// time it
|
|
40
|
+
/// computes cross-chain total supply and surplus (so the bonding curve reflects all chains), grants suckers 0% cash-out
|
|
41
|
+
/// tax, and delegates tax-rate adjustments to the underlying hooks.
|
|
42
|
+
/// @dev Project NFTs sent to this contract are not recoverable. The deployer does not implement any NFT rescue
|
|
43
|
+
/// mechanism beyond `onERC721Received` for `JBProjects`. This is acceptable because the deployer should never own
|
|
44
|
+
/// project NFTs —
|
|
45
|
+
/// it creates projects and transfers ownership in the same transaction.
|
|
40
46
|
contract JBOmnichainDeployer is
|
|
41
47
|
ERC2771Context,
|
|
42
48
|
JBPermissioned,
|
|
@@ -142,10 +148,12 @@ contract JBOmnichainDeployer is
|
|
|
142
148
|
// ---------------------- external transactions ---------------------- //
|
|
143
149
|
//*********************************************************************//
|
|
144
150
|
|
|
145
|
-
/// @notice Deploy new suckers for an existing project.
|
|
146
|
-
///
|
|
147
|
-
///
|
|
148
|
-
///
|
|
151
|
+
/// @notice Deploy new cross-chain suckers for an existing project. Each sucker enables token bridging between this
|
|
152
|
+
/// chain and a peer chain. The registry also maps configured tokens on each new sucker in the same call.
|
|
153
|
+
/// @dev Only the project's owner or an operator with `JBPermissionIds.DEPLOY_SUCKERS` can call this. The salt
|
|
154
|
+
/// includes `msg.sender` for replay protection — the same sender must call on both chains for deterministic
|
|
155
|
+
/// address
|
|
156
|
+
/// matching.
|
|
149
157
|
/// @param projectId The ID of the project to deploy suckers for.
|
|
150
158
|
/// @param suckerDeploymentConfiguration The suckers to set up for the project.
|
|
151
159
|
function deploySuckersFor(
|
|
@@ -388,8 +396,13 @@ contract JBOmnichainDeployer is
|
|
|
388
396
|
// ------------------------- external views -------------------------- //
|
|
389
397
|
//*********************************************************************//
|
|
390
398
|
|
|
391
|
-
/// @notice
|
|
392
|
-
///
|
|
399
|
+
/// @notice Called by the terminal before recording a cash out. Suckers get 0% tax so bridged tokens redeem at face
|
|
400
|
+
/// value. For all other holders, this function aggregates total supply and surplus across all peer chains so the
|
|
401
|
+
/// bonding curve reflects the project's global state, then delegates to the 721 hook and extra hook for further
|
|
402
|
+
/// adjustments.
|
|
403
|
+
/// @dev Part of `IJBRulesetDataHook`. The 721 hook's returned `totalSupply` and `effectiveSurplusValue` are used
|
|
404
|
+
/// when it handles cash outs (NFT redemptions use local denominators). Otherwise this contract's cross-chain values
|
|
405
|
+
/// take precedence.
|
|
393
406
|
/// @param context Standard Juicebox cash out context. See `JBBeforeCashOutRecordedContext`.
|
|
394
407
|
/// @return cashOutTaxRate The cash out tax rate, which influences the amount of terminal tokens which get cashed
|
|
395
408
|
/// out.
|
|
@@ -503,13 +516,18 @@ contract JBOmnichainDeployer is
|
|
|
503
516
|
return (cashOutTaxRate, cashOutCount, totalSupply, effectiveSurplusValue, hookSpecifications);
|
|
504
517
|
}
|
|
505
518
|
|
|
506
|
-
/// @notice
|
|
507
|
-
///
|
|
519
|
+
/// @notice Called by the terminal before recording a payment. Coordinates the 721 hook (which handles tier-based
|
|
520
|
+
/// NFT minting and split deductions) with the extra hook (e.g. buyback, which may swap for a better token price).
|
|
521
|
+
/// Merges
|
|
522
|
+
/// their weight adjustments and hook specifications into a single response for the terminal.
|
|
523
|
+
/// @dev Part of `IJBRulesetDataHook`. The 721 hook's weight already accounts for tier-split deductions. The extra
|
|
524
|
+
/// hook receives the post-split amount so it only routes funds actually entering the project. If both return
|
|
525
|
+
/// specifications, the 721 spec comes first.
|
|
508
526
|
/// @param context Standard Juicebox payment context. See `JBBeforePayRecordedContext`.
|
|
509
527
|
/// @return weight The weight which project tokens are minted relative to. This can be used to customize how many
|
|
510
528
|
/// tokens get minted by a payment.
|
|
511
|
-
/// @return hookSpecifications Amounts (out of
|
|
512
|
-
///
|
|
529
|
+
/// @return hookSpecifications Amounts (out of the payment) to send to pay hooks instead of the project. Useful for
|
|
530
|
+
/// automatically routing funds from a treasury as payments come in.
|
|
513
531
|
function beforePayRecordedWith(JBBeforePayRecordedContext calldata context)
|
|
514
532
|
external
|
|
515
533
|
view
|
|
@@ -624,8 +642,9 @@ contract JBOmnichainDeployer is
|
|
|
624
642
|
return _extraDataHookOf[projectId][rulesetId];
|
|
625
643
|
}
|
|
626
644
|
|
|
627
|
-
/// @notice
|
|
628
|
-
///
|
|
645
|
+
/// @notice Returns whether an address may mint a project's tokens on-demand. Suckers always get mint permission (so
|
|
646
|
+
/// bridged tokens can be minted on the destination chain). Otherwise delegates to the extra data hook.
|
|
647
|
+
/// @dev Part of `IJBRulesetDataHook`. The 721 hook never grants mint permission, so only the extra hook is checked.
|
|
629
648
|
/// @param projectId The ID of the project whose token can be minted.
|
|
630
649
|
/// @param ruleset The ruleset to check the token minting permission of.
|
|
631
650
|
/// @param addr The address to check the token minting permission of.
|
|
@@ -899,9 +918,11 @@ contract JBOmnichainDeployer is
|
|
|
899
918
|
});
|
|
900
919
|
}
|
|
901
920
|
|
|
902
|
-
/// @notice
|
|
921
|
+
/// @notice Wires up each ruleset so this contract acts as the data hook wrapper. Stores the 721 hook and any extra
|
|
922
|
+
/// data hook (from the ruleset's metadata) in per-project/per-ruleset mappings, then overwrites each ruleset's
|
|
923
|
+
/// metadata to point at this contract with both pay and cash-out delegation enabled.
|
|
903
924
|
/// @dev Stores the 721 hook in `_tiered721HookOf` per-ruleset and any custom hook (from metadata) in
|
|
904
|
-
/// `_extraDataHookOf`.
|
|
925
|
+
/// `_extraDataHookOf`. Ruleset IDs are predicted as `block.timestamp + i`.
|
|
905
926
|
/// @param projectId The ID of the project to set up.
|
|
906
927
|
/// @param rulesetConfigurations The rulesets to set up.
|
|
907
928
|
/// @param hook721 The 721 tiers hook.
|
|
@@ -9,7 +9,10 @@ import {JBDeployerHookConfig} from "../structs/JBDeployerHookConfig.sol";
|
|
|
9
9
|
import {JBOmnichain721Config} from "../structs/JBOmnichain721Config.sol";
|
|
10
10
|
import {JBSuckerDeploymentConfig} from "../structs/JBSuckerDeploymentConfig.sol";
|
|
11
11
|
|
|
12
|
-
/// @notice
|
|
12
|
+
/// @notice Interface for the omnichain deployer — a one-stop contract that launches Juicebox projects with a tiered
|
|
13
|
+
/// 721
|
|
14
|
+
/// hook and cross-chain suckers, then serves as the data hook wrapper that coordinates pay/cash-out logic across all
|
|
15
|
+
/// chains.
|
|
13
16
|
interface IJBOmnichainDeployer {
|
|
14
17
|
/// @notice Get the extra data hook for a project and ruleset.
|
|
15
18
|
/// @param projectId The ID of the project to get the extra data hook for.
|
|
@@ -3,6 +3,11 @@ pragma solidity ^0.8.0;
|
|
|
3
3
|
|
|
4
4
|
import {IJBRulesetDataHook} from "@bananapus/core-v6/src/interfaces/IJBRulesetDataHook.sol";
|
|
5
5
|
|
|
6
|
+
/// @notice Configuration for an extra data hook (e.g. a buyback hook) that the omnichain deployer delegates to
|
|
7
|
+
/// alongside the primary 721 hook. Stored per project per ruleset.
|
|
8
|
+
/// @param dataHook The extra data hook contract to delegate to.
|
|
9
|
+
/// @param useDataHookForPay Whether to call this hook's `beforePayRecordedWith` during payments.
|
|
10
|
+
/// @param useDataHookForCashOut Whether to call this hook's `beforeCashOutRecordedWith` during cash outs.
|
|
6
11
|
struct JBDeployerHookConfig {
|
|
7
12
|
IJBRulesetDataHook dataHook;
|
|
8
13
|
bool useDataHookForPay;
|
|
@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
|
|
|
4
4
|
import {JBDeploy721TiersHookConfig} from "@bananapus/721-hook-v6/src/structs/JBDeploy721TiersHookConfig.sol";
|
|
5
5
|
|
|
6
6
|
/// @notice Configuration for deploying a 721 tiers hook alongside omnichain rulesets.
|
|
7
|
-
/// @param deployTiersHookConfig Configuration which dictates the behavior of the 721 tiers hook
|
|
7
|
+
/// @param deployTiersHookConfig Configuration which dictates the behavior of the 721 tiers hook to deploy.
|
|
8
8
|
/// @param useDataHookForCashOut Whether the 721 hook should handle cash outs (via beforeCashOutRecordedWith).
|
|
9
9
|
/// @param salt A salt to use for the deterministic 721 hook deployment. Combined with `msg.sender` internally, so
|
|
10
10
|
/// cross-chain deterministic addresses require the same sender on each chain.
|
|
@@ -3,6 +3,10 @@ pragma solidity ^0.8.0;
|
|
|
3
3
|
|
|
4
4
|
import {IJB721TiersHook} from "@bananapus/721-hook-v6/src/interfaces/IJB721TiersHook.sol";
|
|
5
5
|
|
|
6
|
+
/// @notice Stored configuration for a project's tiered 721 hook within a specific ruleset.
|
|
7
|
+
/// @param hook The tiered 721 hook contract used for NFT minting on payments.
|
|
8
|
+
/// @param useDataHookForCashOut Whether the 721 hook should participate in cash-out tax calculations and NFT
|
|
9
|
+
/// redemptions.
|
|
6
10
|
struct JBTiered721HookConfig {
|
|
7
11
|
IJB721TiersHook hook;
|
|
8
12
|
bool useDataHookForCashOut;
|