@bananapus/suckers-v6 0.0.33 → 0.0.35
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/script/Deploy.s.sol +9 -8
- package/src/JBArbitrumSucker.sol +3 -2
- package/src/JBBaseSucker.sol +2 -1
- package/src/JBCCIPSucker.sol +3 -2
- package/src/JBCeloSucker.sol +3 -2
- package/src/JBOptimismSucker.sol +3 -2
- package/src/JBSucker.sol +16 -16
- package/src/JBSuckerRegistry.sol +3 -3
- package/src/JBSwapCCIPSucker.sol +6 -5
- package/src/interfaces/IJBPeerChainAdjustedAccounts.sol +1 -1
- package/src/interfaces/IJBSucker.sol +2 -2
- package/src/interfaces/IL1ArbitrumGateway.sol +1 -1
- package/src/libraries/JBCCIPLib.sol +1 -1
- package/src/libraries/JBRelayBeneficiary.sol +1 -1
- package/src/libraries/JBSuckerLib.sol +4 -4
- package/src/libraries/JBSwapLib.sol +2 -2
- package/src/libraries/JBSwapPoolLib.sol +2 -2
- package/src/structs/JBMessageRoot.sol +1 -1
package/package.json
CHANGED
package/script/Deploy.s.sol
CHANGED
|
@@ -4,6 +4,7 @@ pragma solidity 0.8.28;
|
|
|
4
4
|
import {IInbox} from "@arbitrum/nitro-contracts/src/bridge/IInbox.sol";
|
|
5
5
|
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
6
6
|
import {IJBPermissions} from "@bananapus/core-v6/src/interfaces/IJBPermissions.sol";
|
|
7
|
+
import {IJBPrices} from "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
|
|
7
8
|
import {IJBTokens} from "@bananapus/core-v6/src/interfaces/IJBTokens.sol";
|
|
8
9
|
import {CoreDeployment, CoreDeploymentLib} from "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
9
10
|
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
@@ -224,7 +225,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
224
225
|
deployer: _opDeployer,
|
|
225
226
|
directory: core.directory,
|
|
226
227
|
permissions: core.permissions,
|
|
227
|
-
prices:
|
|
228
|
+
prices: core.prices,
|
|
228
229
|
tokens: core.tokens,
|
|
229
230
|
feeProjectId: 1,
|
|
230
231
|
registry: REGISTRY,
|
|
@@ -276,7 +277,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
276
277
|
deployer: _opDeployer,
|
|
277
278
|
directory: core.directory,
|
|
278
279
|
permissions: core.permissions,
|
|
279
|
-
prices:
|
|
280
|
+
prices: core.prices,
|
|
280
281
|
tokens: core.tokens,
|
|
281
282
|
feeProjectId: 1,
|
|
282
283
|
registry: REGISTRY,
|
|
@@ -359,7 +360,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
359
360
|
deployer: _baseDeployer,
|
|
360
361
|
directory: core.directory,
|
|
361
362
|
permissions: core.permissions,
|
|
362
|
-
prices:
|
|
363
|
+
prices: core.prices,
|
|
363
364
|
tokens: core.tokens,
|
|
364
365
|
feeProjectId: 1,
|
|
365
366
|
registry: REGISTRY,
|
|
@@ -411,7 +412,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
411
412
|
deployer: _baseDeployer,
|
|
412
413
|
directory: core.directory,
|
|
413
414
|
permissions: core.permissions,
|
|
414
|
-
prices:
|
|
415
|
+
prices: core.prices,
|
|
415
416
|
tokens: core.tokens,
|
|
416
417
|
feeProjectId: 1,
|
|
417
418
|
registry: REGISTRY,
|
|
@@ -490,7 +491,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
490
491
|
deployer: _arbDeployer,
|
|
491
492
|
directory: core.directory,
|
|
492
493
|
permissions: core.permissions,
|
|
493
|
-
prices:
|
|
494
|
+
prices: core.prices,
|
|
494
495
|
tokens: core.tokens,
|
|
495
496
|
feeProjectId: 1,
|
|
496
497
|
registry: REGISTRY,
|
|
@@ -545,7 +546,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
545
546
|
deployer: _arbDeployer,
|
|
546
547
|
directory: core.directory,
|
|
547
548
|
permissions: core.permissions,
|
|
548
|
-
prices:
|
|
549
|
+
prices: core.prices,
|
|
549
550
|
tokens: core.tokens,
|
|
550
551
|
feeProjectId: 1,
|
|
551
552
|
registry: REGISTRY,
|
|
@@ -721,7 +722,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
721
722
|
salt: salt,
|
|
722
723
|
directory: core.directory,
|
|
723
724
|
permissions: core.permissions,
|
|
724
|
-
prices:
|
|
725
|
+
prices: core.prices,
|
|
725
726
|
tokens: core.tokens,
|
|
726
727
|
configurator: safeAddress(),
|
|
727
728
|
trustedForwarder: TRUSTED_FORWARDER,
|
|
@@ -738,7 +739,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
738
739
|
bytes32 salt,
|
|
739
740
|
IJBDirectory directory,
|
|
740
741
|
IJBPermissions permissions,
|
|
741
|
-
|
|
742
|
+
IJBPrices prices,
|
|
742
743
|
IJBTokens tokens,
|
|
743
744
|
address configurator,
|
|
744
745
|
address trustedForwarder,
|
package/src/JBArbitrumSucker.sol
CHANGED
|
@@ -8,6 +8,7 @@ import {AddressAliasHelper} from "@arbitrum/nitro-contracts/src/libraries/Addres
|
|
|
8
8
|
import {ArbSys} from "@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol";
|
|
9
9
|
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
10
10
|
import {IJBPermissions} from "@bananapus/core-v6/src/interfaces/IJBPermissions.sol";
|
|
11
|
+
import {IJBPrices} from "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
|
|
11
12
|
import {IJBTokens} from "@bananapus/core-v6/src/interfaces/IJBTokens.sol";
|
|
12
13
|
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
13
14
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
@@ -61,7 +62,7 @@ contract JBArbitrumSucker is JBSucker, IJBArbitrumSucker {
|
|
|
61
62
|
JBArbitrumSuckerDeployer deployer,
|
|
62
63
|
IJBDirectory directory,
|
|
63
64
|
IJBPermissions permissions,
|
|
64
|
-
|
|
65
|
+
IJBPrices prices,
|
|
65
66
|
IJBTokens tokens,
|
|
66
67
|
uint256 feeProjectId,
|
|
67
68
|
IJBSuckerRegistry registry,
|
|
@@ -150,7 +151,7 @@ contract JBArbitrumSucker is JBSucker, IJBArbitrumSucker {
|
|
|
150
151
|
/// @notice Uses the L1/L2 gateway to send the root and assets over the bridge to the peer.
|
|
151
152
|
/// @param transportPayment the amount of `msg.value` that is going to get paid for sending this message.
|
|
152
153
|
/// @param token The token to bridge the outbox tree for.
|
|
153
|
-
/// @param remoteToken Information about the remote token
|
|
154
|
+
/// @param remoteToken Information about the remote token to bridge to.
|
|
154
155
|
// forge-lint: disable-next-line(mixed-case-function)
|
|
155
156
|
function _sendRootOverAMB(
|
|
156
157
|
uint256 transportPayment,
|
package/src/JBBaseSucker.sol
CHANGED
|
@@ -3,6 +3,7 @@ pragma solidity 0.8.28;
|
|
|
3
3
|
|
|
4
4
|
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
5
5
|
import {IJBPermissions} from "@bananapus/core-v6/src/interfaces/IJBPermissions.sol";
|
|
6
|
+
import {IJBPrices} from "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
|
|
6
7
|
import {IJBTokens} from "@bananapus/core-v6/src/interfaces/IJBTokens.sol";
|
|
7
8
|
|
|
8
9
|
import {JBOptimismSucker} from "./JBOptimismSucker.sol";
|
|
@@ -24,7 +25,7 @@ contract JBBaseSucker is JBOptimismSucker {
|
|
|
24
25
|
JBOptimismSuckerDeployer deployer,
|
|
25
26
|
IJBDirectory directory,
|
|
26
27
|
IJBPermissions permissions,
|
|
27
|
-
|
|
28
|
+
IJBPrices prices,
|
|
28
29
|
IJBTokens tokens,
|
|
29
30
|
uint256 feeProjectId,
|
|
30
31
|
IJBSuckerRegistry registry,
|
package/src/JBCCIPSucker.sol
CHANGED
|
@@ -4,6 +4,7 @@ pragma solidity 0.8.28;
|
|
|
4
4
|
// External packages (alphabetized)
|
|
5
5
|
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
6
6
|
import {IJBPermissions} from "@bananapus/core-v6/src/interfaces/IJBPermissions.sol";
|
|
7
|
+
import {IJBPrices} from "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
|
|
7
8
|
import {IJBTokens} from "@bananapus/core-v6/src/interfaces/IJBTokens.sol";
|
|
8
9
|
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
9
10
|
import {IAny2EVMMessageReceiver} from "@chainlink/contracts-ccip/contracts/interfaces/IAny2EVMMessageReceiver.sol";
|
|
@@ -86,7 +87,7 @@ contract JBCCIPSucker is JBSucker, IAny2EVMMessageReceiver {
|
|
|
86
87
|
JBCCIPSuckerDeployer deployer,
|
|
87
88
|
IJBDirectory directory,
|
|
88
89
|
IJBPermissions permissions,
|
|
89
|
-
|
|
90
|
+
IJBPrices prices,
|
|
90
91
|
IJBTokens tokens,
|
|
91
92
|
uint256 feeProjectId,
|
|
92
93
|
IJBSuckerRegistry registry,
|
|
@@ -200,7 +201,7 @@ contract JBCCIPSucker is JBSucker, IAny2EVMMessageReceiver {
|
|
|
200
201
|
/// @param transportPayment The amount of `msg.value` that is going to get paid for sending this message.
|
|
201
202
|
/// @param token The token to bridge the outbox tree for.
|
|
202
203
|
/// @param amount The amount of tokens to bridge.
|
|
203
|
-
/// @param remoteToken Information about the remote token
|
|
204
|
+
/// @param remoteToken Information about the remote token to bridge to.
|
|
204
205
|
/// @param sucker_message The message root to send to the remote peer.
|
|
205
206
|
// forge-lint: disable-next-line(mixed-case-function)
|
|
206
207
|
function _sendRootOverAMB(
|
package/src/JBCeloSucker.sol
CHANGED
|
@@ -3,6 +3,7 @@ pragma solidity 0.8.28;
|
|
|
3
3
|
|
|
4
4
|
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
5
5
|
import {IJBPermissions} from "@bananapus/core-v6/src/interfaces/IJBPermissions.sol";
|
|
6
|
+
import {IJBPrices} from "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
|
|
6
7
|
import {IJBTerminal} from "@bananapus/core-v6/src/interfaces/IJBTerminal.sol";
|
|
7
8
|
import {IJBTokens} from "@bananapus/core-v6/src/interfaces/IJBTokens.sol";
|
|
8
9
|
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
@@ -43,7 +44,7 @@ contract JBCeloSucker is JBOptimismSucker {
|
|
|
43
44
|
JBCeloSuckerDeployer deployer,
|
|
44
45
|
IJBDirectory directory,
|
|
45
46
|
IJBPermissions permissions,
|
|
46
|
-
|
|
47
|
+
IJBPrices prices,
|
|
47
48
|
IJBTokens tokens,
|
|
48
49
|
uint256 feeProjectId,
|
|
49
50
|
IJBSuckerRegistry registry,
|
|
@@ -121,7 +122,7 @@ contract JBCeloSucker is JBOptimismSucker {
|
|
|
121
122
|
/// `nativeValue = 0` because Celo's native token is CELO (not ETH), so we never attach ETH as msg.value.
|
|
122
123
|
/// @param transportPayment the amount of `msg.value` that is going to get paid for sending this message.
|
|
123
124
|
/// @param token The token to bridge the outbox tree for.
|
|
124
|
-
/// @param remoteToken Information about the remote token
|
|
125
|
+
/// @param remoteToken Information about the remote token to bridge to.
|
|
125
126
|
// forge-lint: disable-next-line(mixed-case-function)
|
|
126
127
|
function _sendRootOverAMB(
|
|
127
128
|
uint256 transportPayment,
|
package/src/JBOptimismSucker.sol
CHANGED
|
@@ -3,6 +3,7 @@ pragma solidity 0.8.28;
|
|
|
3
3
|
|
|
4
4
|
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
5
5
|
import {IJBPermissions} from "@bananapus/core-v6/src/interfaces/IJBPermissions.sol";
|
|
6
|
+
import {IJBPrices} from "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
|
|
6
7
|
import {IJBTokens} from "@bananapus/core-v6/src/interfaces/IJBTokens.sol";
|
|
7
8
|
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
8
9
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
@@ -44,7 +45,7 @@ contract JBOptimismSucker is JBSucker, IJBOptimismSucker {
|
|
|
44
45
|
JBOptimismSuckerDeployer deployer,
|
|
45
46
|
IJBDirectory directory,
|
|
46
47
|
IJBPermissions permissions,
|
|
47
|
-
|
|
48
|
+
IJBPrices prices,
|
|
48
49
|
IJBTokens tokens,
|
|
49
50
|
uint256 feeProjectId,
|
|
50
51
|
IJBSuckerRegistry registry,
|
|
@@ -86,7 +87,7 @@ contract JBOptimismSucker is JBSucker, IJBOptimismSucker {
|
|
|
86
87
|
/// over the `OPBRIDGE`.
|
|
87
88
|
/// @param transportPayment the amount of `msg.value` that is going to get paid for sending this message.
|
|
88
89
|
/// @param token The token to bridge the outbox tree for.
|
|
89
|
-
/// @param remoteToken Information about the remote token
|
|
90
|
+
/// @param remoteToken Information about the remote token to bridge to.
|
|
90
91
|
// forge-lint: disable-next-line(mixed-case-function)
|
|
91
92
|
function _sendRootOverAMB(
|
|
92
93
|
uint256 transportPayment,
|
package/src/JBSucker.sol
CHANGED
|
@@ -225,7 +225,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
225
225
|
constructor(
|
|
226
226
|
IJBDirectory directory,
|
|
227
227
|
IJBPermissions permissions,
|
|
228
|
-
|
|
228
|
+
IJBPrices prices,
|
|
229
229
|
IJBTokens tokens,
|
|
230
230
|
uint256 feeProjectId,
|
|
231
231
|
IJBSuckerRegistry registry,
|
|
@@ -236,7 +236,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
236
236
|
{
|
|
237
237
|
DIRECTORY = directory;
|
|
238
238
|
FEE_PROJECT_ID = feeProjectId;
|
|
239
|
-
PRICES =
|
|
239
|
+
PRICES = prices;
|
|
240
240
|
PROJECTS = directory.PROJECTS();
|
|
241
241
|
REGISTRY = registry;
|
|
242
242
|
TOKENS = tokens;
|
|
@@ -389,7 +389,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
389
389
|
/// messages time to arrive, accepting roots after deprecation provides a stronger guarantee that users can always
|
|
390
390
|
/// claim their bridged tokens. Double-spend is not a concern because `toRemote` is already disabled in
|
|
391
391
|
/// `SENDING_DISABLED` and `DEPRECATED` states, so no new outbound transfers can occur.
|
|
392
|
-
/// @param root The merkle root, token, and amount
|
|
392
|
+
/// @param root The merkle root, token, and amount to receive.
|
|
393
393
|
function fromRemote(JBMessageRoot calldata root) external payable {
|
|
394
394
|
// Make sure that the message came from our peer.
|
|
395
395
|
// Use msg.sender (not _msgSender()) because bridge messengers never use ERC2771 meta-transactions.
|
|
@@ -620,7 +620,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
620
620
|
/// for the original caller instead of being added back to `transportPayment`. This preserves
|
|
621
621
|
/// `transportPayment = msg.value - fee`, which is critical for zero-cost bridges (OP, Base, Celo, Arb L2->L1)
|
|
622
622
|
/// that revert on non-zero transport payment. The retained fee is excluded from `amountToAddToBalanceOf`.
|
|
623
|
-
/// @param token The terminal token
|
|
623
|
+
/// @param token The terminal token to bridge.
|
|
624
624
|
function toRemote(address token) external payable override {
|
|
625
625
|
JBRemoteToken memory remoteToken = _remoteTokenFor[token];
|
|
626
626
|
|
|
@@ -963,7 +963,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
963
963
|
}
|
|
964
964
|
|
|
965
965
|
/// @notice The action(s) to perform after a user has succesfully proven their claim.
|
|
966
|
-
/// @param terminalToken The terminal token
|
|
966
|
+
/// @param terminalToken The terminal token to suck.
|
|
967
967
|
/// @param terminalTokenAmount The amount of terminal tokens.
|
|
968
968
|
/// @param projectTokenAmount The amount of project tokens.
|
|
969
969
|
/// @param beneficiary The beneficiary of the project tokens (bytes32 for cross-VM compatibility).
|
|
@@ -1000,8 +1000,8 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
1000
1000
|
}
|
|
1001
1001
|
|
|
1002
1002
|
/// @notice Inserts a new leaf into the outbox merkle tree for the specified `token`.
|
|
1003
|
-
/// @param projectTokenCount The amount of project tokens
|
|
1004
|
-
/// @param token The terminal token
|
|
1003
|
+
/// @param projectTokenCount The amount of project tokens to cash out.
|
|
1004
|
+
/// @param token The terminal token to cash out for.
|
|
1005
1005
|
/// @param terminalTokenAmount The amount of terminal tokens reclaimed by cashing out.
|
|
1006
1006
|
/// @param beneficiary The beneficiary of the project tokens on the remote chain (bytes32 for cross-VM
|
|
1007
1007
|
/// compatibility).
|
|
@@ -1127,7 +1127,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
1127
1127
|
}
|
|
1128
1128
|
|
|
1129
1129
|
/// @notice Cash out project tokens for terminal tokens.
|
|
1130
|
-
/// @param projectToken The project token
|
|
1130
|
+
/// @param projectToken The project token to cash out (unused, kept for interface compatibility).
|
|
1131
1131
|
/// @param count The number of project tokens to cash out.
|
|
1132
1132
|
/// @param token The terminal token to cash out for.
|
|
1133
1133
|
/// @param minTokensReclaimed The minimum amount of terminal tokens to reclaim. If the amount reclaimed is less than
|
|
@@ -1245,8 +1245,8 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
1245
1245
|
/// @dev This is chain/sucker/bridge specific logic.
|
|
1246
1246
|
/// @param transportPayment The amount of `msg.value` that is going to get paid for sending this message.
|
|
1247
1247
|
/// @param index The index of the most recent message that is part of the root.
|
|
1248
|
-
/// @param token The terminal token
|
|
1249
|
-
/// @param amount The amount of terminal tokens
|
|
1248
|
+
/// @param token The terminal token to bridge.
|
|
1249
|
+
/// @param amount The amount of terminal tokens to bridge.
|
|
1250
1250
|
/// @param remoteToken The remote token which the terminal token is mapped to.
|
|
1251
1251
|
/// @param message The message/root to send to the remote chain.
|
|
1252
1252
|
// forge-lint: disable-next-line(mixed-case-function)
|
|
@@ -1268,7 +1268,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
1268
1268
|
/// @param terminalToken The terminal token that the project tokens were cashed out for.
|
|
1269
1269
|
/// @param terminalTokenAmount The amount of terminal tokens reclaimed by the cash out.
|
|
1270
1270
|
/// @param beneficiary The beneficiary of the project tokens (bytes32 for cross-VM compatibility).
|
|
1271
|
-
/// @param index The index of the leaf
|
|
1271
|
+
/// @param index The index of the leaf to prove in the terminal token's inbox tree.
|
|
1272
1272
|
/// @param leaves The leaves that prove that the leaf at the `index` is in the tree (i.e. the merkle branch that the
|
|
1273
1273
|
/// leaf is on).
|
|
1274
1274
|
function _validate(
|
|
@@ -1364,7 +1364,7 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
1364
1364
|
/// @param terminalToken The terminal token that the project tokens were cashed out for.
|
|
1365
1365
|
/// @param terminalTokenAmount The amount of terminal tokens reclaimed by the cash out.
|
|
1366
1366
|
/// @param beneficiary The beneficiary of the project tokens (bytes32 for cross-VM compatibility).
|
|
1367
|
-
/// @param index The index of the leaf
|
|
1367
|
+
/// @param index The index of the leaf to prove in the terminal token's inbox tree.
|
|
1368
1368
|
/// @param leaves The leaves that prove that the leaf at the `index` is in the tree (i.e. the merkle branch that the
|
|
1369
1369
|
/// leaf is on).
|
|
1370
1370
|
function _validateForEmergencyExit(
|
|
@@ -1467,8 +1467,8 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
1467
1467
|
}
|
|
1468
1468
|
|
|
1469
1469
|
/// @notice Builds a hash as they are stored in the merkle tree.
|
|
1470
|
-
/// @param projectTokenCount The number of project tokens
|
|
1471
|
-
/// @param terminalTokenAmount The amount of terminal tokens
|
|
1470
|
+
/// @param projectTokenCount The number of project tokens to cash out.
|
|
1471
|
+
/// @param terminalTokenAmount The amount of terminal tokens to reclaim from the cash out.
|
|
1472
1472
|
/// @param beneficiary The beneficiary which will receive the project tokens (bytes32 for cross-VM compatibility).
|
|
1473
1473
|
/// @return hash The keccak256 hash of the leaf data.
|
|
1474
1474
|
function _buildTreeHash(
|
|
@@ -1605,9 +1605,9 @@ abstract contract JBSucker is ERC2771Context, JBPermissioned, Initializable, ERC
|
|
|
1605
1605
|
/// @dev Delegates snapshot construction to JBSuckerLib (deployed library, called via DELEGATECALL) to reduce
|
|
1606
1606
|
/// child contract bytecode.
|
|
1607
1607
|
/// @param transportPayment The amount of `msg.value` that is going to get paid for sending this message.
|
|
1608
|
-
/// @param token The terminal token
|
|
1608
|
+
/// @param token The terminal token to bridge.
|
|
1609
1609
|
/// @param remoteToken The remote token which the terminal token is mapped to.
|
|
1610
|
-
/// @param amount The amount of terminal tokens
|
|
1610
|
+
/// @param amount The amount of terminal tokens to bridge.
|
|
1611
1611
|
/// @param nonce The outbox nonce for this send.
|
|
1612
1612
|
/// @param root The merkle root of the outbox tree.
|
|
1613
1613
|
/// @param index The index of the most recent message that is part of the root.
|
package/src/JBSuckerRegistry.sol
CHANGED
|
@@ -58,7 +58,7 @@ contract JBSuckerRegistry is ERC2771Context, Ownable, JBPermissioned, IJBSuckerR
|
|
|
58
58
|
// --------------- public immutable stored properties ---------------- //
|
|
59
59
|
//*********************************************************************//
|
|
60
60
|
|
|
61
|
-
/// @notice The
|
|
61
|
+
/// @notice The Juicebox directory used to look up project terminals and controllers.
|
|
62
62
|
IJBDirectory public immutable override DIRECTORY;
|
|
63
63
|
|
|
64
64
|
/// @notice A contract which mints ERC-721s that represent project ownership and transfers.
|
|
@@ -401,8 +401,8 @@ contract JBSuckerRegistry is ERC2771Context, Ownable, JBPermissioned, IJBSuckerR
|
|
|
401
401
|
/// @param values The aggregate values recorded so far.
|
|
402
402
|
/// @param hasActiveValue Whether the recorded value for each index came from an active sucker.
|
|
403
403
|
/// @param chainCount The number of populated chain entries.
|
|
404
|
-
/// @param chainId The peer-chain id
|
|
405
|
-
/// @param value The value
|
|
404
|
+
/// @param chainId The peer-chain id to record.
|
|
405
|
+
/// @param value The value to record.
|
|
406
406
|
/// @param isActive Whether the value came from an active sucker.
|
|
407
407
|
/// @return The updated number of populated chain entries.
|
|
408
408
|
function _recordPeerValue(
|
package/src/JBSwapCCIPSucker.sol
CHANGED
|
@@ -4,6 +4,7 @@ pragma solidity 0.8.28;
|
|
|
4
4
|
// Core JB imports.
|
|
5
5
|
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
6
6
|
import {IJBPermissions} from "@bananapus/core-v6/src/interfaces/IJBPermissions.sol";
|
|
7
|
+
import {IJBPrices} from "@bananapus/core-v6/src/interfaces/IJBPrices.sol";
|
|
7
8
|
import {IJBTokens} from "@bananapus/core-v6/src/interfaces/IJBTokens.sol";
|
|
8
9
|
// CCIP imports.
|
|
9
10
|
import {Client} from "@chainlink/contracts-ccip/contracts/libraries/Client.sol";
|
|
@@ -183,7 +184,7 @@ contract JBSwapCCIPSucker is JBCCIPSucker, IUnlockCallback, IUniswapV3SwapCallba
|
|
|
183
184
|
// ------------------- transient stored properties ------------------- //
|
|
184
185
|
//*********************************************************************//
|
|
185
186
|
|
|
186
|
-
/// @notice Leaf index + 1 of the claim currently
|
|
187
|
+
/// @notice Leaf index + 1 of the claim currently in progress (set by the `claim` override).
|
|
187
188
|
/// @dev Transient storage — auto-resets to 0 each transaction, saving ~9,800 gas per claim vs SSTORE.
|
|
188
189
|
/// Value 0 means no active claim (bypass scaling); non-zero means leafIndex = value - 1.
|
|
189
190
|
uint256 transient _currentClaimLeafIndex;
|
|
@@ -209,7 +210,7 @@ contract JBSwapCCIPSucker is JBCCIPSucker, IUnlockCallback, IUniswapV3SwapCallba
|
|
|
209
210
|
JBSwapCCIPSuckerDeployer deployer,
|
|
210
211
|
IJBDirectory directory,
|
|
211
212
|
IJBPermissions permissions,
|
|
212
|
-
|
|
213
|
+
IJBPrices prices,
|
|
213
214
|
IJBTokens tokens,
|
|
214
215
|
uint256 feeProjectId,
|
|
215
216
|
IJBSuckerRegistry registry,
|
|
@@ -369,8 +370,8 @@ contract JBSwapCCIPSucker is JBCCIPSucker, IUnlockCallback, IUniswapV3SwapCallba
|
|
|
369
370
|
}
|
|
370
371
|
|
|
371
372
|
/// @notice Uniswap V3 swap callback — delegates to JBSwapPoolLib (via DELEGATECALL) to reduce bytecode.
|
|
372
|
-
/// @param amount0Delta The amount of token0
|
|
373
|
-
/// @param amount1Delta The amount of token1
|
|
373
|
+
/// @param amount0Delta The amount of token0 used for the swap.
|
|
374
|
+
/// @param amount1Delta The amount of token1 used for the swap.
|
|
374
375
|
/// @param data Encoded (originalTokenIn, normalizedTokenIn, normalizedTokenOut).
|
|
375
376
|
function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external override {
|
|
376
377
|
JBSwapPoolLib.executeV3SwapCallback({
|
|
@@ -501,7 +502,7 @@ contract JBSwapCCIPSucker is JBCCIPSucker, IUnlockCallback, IUniswapV3SwapCallba
|
|
|
501
502
|
/// Delegates CCIP message construction to JBCCIPLib (via DELEGATECALL) to reduce bytecode.
|
|
502
503
|
/// @param transportPayment The ETH sent for CCIP fees.
|
|
503
504
|
/// @param index The last leaf index in the current batch.
|
|
504
|
-
/// @param token The local token
|
|
505
|
+
/// @param token The local token to bridge.
|
|
505
506
|
/// @param amount The amount of local tokens to bridge.
|
|
506
507
|
/// @param remoteToken The remote token configuration (including minGas).
|
|
507
508
|
/// @param sucker_message The merkle root message to send to the remote chain.
|
|
@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
|
|
|
4
4
|
/// @notice Optional data-hook interface for adding project-specific adjusted accounts to peer-chain snapshots.
|
|
5
5
|
interface IJBPeerChainAdjustedAccounts {
|
|
6
6
|
/// @notice Extra supply, surplus, and balance that should be included in cross-chain peer snapshots.
|
|
7
|
-
/// @param projectId The ID of the project
|
|
7
|
+
/// @param projectId The ID of the project to snapshot.
|
|
8
8
|
/// @param decimals The decimals the returned surplus and balance should use.
|
|
9
9
|
/// @param currency The currency the returned surplus and balance should be in terms of.
|
|
10
10
|
/// @return supply The extra supply to include in `sourceTotalSupply`.
|
|
@@ -61,8 +61,8 @@ interface IJBSucker is IERC165 {
|
|
|
61
61
|
event NewInboxTreeRoot(address indexed token, uint64 nonce, bytes32 root, address caller);
|
|
62
62
|
|
|
63
63
|
/// @notice Emitted when the outbox tree root and bridged assets are sent to the remote peer.
|
|
64
|
-
/// @param root The outbox tree root
|
|
65
|
-
/// @param token The terminal token
|
|
64
|
+
/// @param root The outbox tree root sent to the remote peer.
|
|
65
|
+
/// @param token The terminal token to bridge.
|
|
66
66
|
/// @param index The current outbox tree index.
|
|
67
67
|
/// @param nonce The nonce assigned to this root message.
|
|
68
68
|
/// @param caller The address that initiated the send.
|
|
@@ -7,7 +7,7 @@ interface IL1ArbitrumGateway {
|
|
|
7
7
|
/// @param _token The L1 token address.
|
|
8
8
|
/// @param _from The sender on L1.
|
|
9
9
|
/// @param _to The recipient on L2.
|
|
10
|
-
/// @param _amount The amount of tokens
|
|
10
|
+
/// @param _amount The amount of tokens to bridge.
|
|
11
11
|
/// @param _data Additional data (forwarded to the L2 gateway).
|
|
12
12
|
/// @return The ABI-encoded calldata for `finalizeInboundTransfer` on the L2 gateway.
|
|
13
13
|
function getOutboundCalldata(
|
|
@@ -25,7 +25,7 @@ library JBCCIPLib {
|
|
|
25
25
|
/// @param token The token to bridge (may be NATIVE_TOKEN).
|
|
26
26
|
/// @param amount The amount to bridge.
|
|
27
27
|
/// @return tokenAmounts The CCIP token amounts array (length 0 or 1).
|
|
28
|
-
/// @return bridgeToken The actual ERC-20 token address
|
|
28
|
+
/// @return bridgeToken The actual ERC-20 token address to bridge (WETH if native was wrapped).
|
|
29
29
|
function prepareTokenAmounts(
|
|
30
30
|
ICCIPRouter ccipRouter,
|
|
31
31
|
address token,
|
|
@@ -19,7 +19,7 @@ library JBRelayBeneficiary {
|
|
|
19
19
|
/// @dev Returns `beneficiary` unchanged if the payer is not a registered sucker or if no relay data is found.
|
|
20
20
|
/// @param payer The address that called `terminal.pay()` (i.e. `context.payer`).
|
|
21
21
|
/// @param beneficiary The beneficiary set in the payment context (i.e. `context.beneficiary`).
|
|
22
|
-
/// @param projectId The project
|
|
22
|
+
/// @param projectId The project to pay.
|
|
23
23
|
/// @param metadata The payment metadata (`context.payerMetadata` or `context.metadata`).
|
|
24
24
|
/// @param registry The sucker registry used to verify that `payer` is a legitimate sucker.
|
|
25
25
|
/// @return effectiveBeneficiary The resolved beneficiary — the relay address if valid, or the original.
|
|
@@ -227,7 +227,7 @@ library JBSuckerLib {
|
|
|
227
227
|
/// @param prices The price oracle to use for non-ETH terminal-token balances.
|
|
228
228
|
/// @param projectId The project ID.
|
|
229
229
|
/// @param remoteToken The remote token bytes32 address.
|
|
230
|
-
/// @param amount The amount of terminal tokens
|
|
230
|
+
/// @param amount The amount of terminal tokens to bridge.
|
|
231
231
|
/// @param nonce The outbox nonce for this send.
|
|
232
232
|
/// @param root The merkle root of the outbox tree.
|
|
233
233
|
/// @param messageVersion The message format version.
|
|
@@ -269,8 +269,8 @@ library JBSuckerLib {
|
|
|
269
269
|
/// @notice Optional project-specific adjusted accounts to add to peer-chain snapshots.
|
|
270
270
|
/// @dev Reads the current ruleset's data hook and asks it for extra supply/surplus. Non-supporting hooks,
|
|
271
271
|
/// broken hooks, and short return data are ignored so a project's baseline snapshot remains usable.
|
|
272
|
-
/// @param controller The controller for the project
|
|
273
|
-
/// @param projectId The project
|
|
272
|
+
/// @param controller The controller for the project to snapshot.
|
|
273
|
+
/// @param projectId The project to snapshot.
|
|
274
274
|
/// @return additionalSupply The supply to add to `sourceTotalSupply`.
|
|
275
275
|
/// @return additionalSurplus The surplus to add to `sourceSurplus`, denominated in ETH at 18 decimals.
|
|
276
276
|
/// @return additionalBalance The balance to add to `sourceBalance`, denominated in ETH at 18 decimals.
|
|
@@ -308,7 +308,7 @@ library JBSuckerLib {
|
|
|
308
308
|
/// @notice Builds the local accounting values used in outbound peer-chain snapshots.
|
|
309
309
|
/// @param directory The JB directory to look up controllers and terminals.
|
|
310
310
|
/// @param prices The price oracle to use for non-ETH terminal-token balances.
|
|
311
|
-
/// @param projectId The project
|
|
311
|
+
/// @param projectId The project to snapshot.
|
|
312
312
|
/// @return localTotalSupply The total project token supply, including reserved tokens.
|
|
313
313
|
/// @return ethSurplus The terminal surplus denominated in ETH at 18 decimals.
|
|
314
314
|
/// @return ethBalance The terminal balance denominated in ETH at 18 decimals.
|
|
@@ -54,7 +54,7 @@ library JBSwapLib {
|
|
|
54
54
|
//*********************************************************************//
|
|
55
55
|
|
|
56
56
|
/// @notice Estimate the price impact of a swap, scaled by IMPACT_PRECISION.
|
|
57
|
-
/// @param amountIn The amount of tokens
|
|
57
|
+
/// @param amountIn The amount of tokens to swap in.
|
|
58
58
|
/// @param liquidity The pool's in-range liquidity.
|
|
59
59
|
/// @param sqrtP The sqrt price in Q96 format.
|
|
60
60
|
/// @param zeroForOne Whether the swap is token0 -> token1.
|
|
@@ -84,7 +84,7 @@ library JBSwapLib {
|
|
|
84
84
|
|
|
85
85
|
/// @notice Compute a sqrtPriceLimitX96 from input/output amounts so the swap stops
|
|
86
86
|
/// if the execution price would be worse than the minimum acceptable rate.
|
|
87
|
-
/// @param amountIn The amount of tokens
|
|
87
|
+
/// @param amountIn The amount of tokens to swap in.
|
|
88
88
|
/// @param minimumAmountOut The minimum acceptable output.
|
|
89
89
|
/// @param zeroForOne True when selling token0 for token1 (price decreases).
|
|
90
90
|
/// @return sqrtPriceLimit The V3-compatible sqrtPriceLimitX96.
|
|
@@ -260,8 +260,8 @@ library JBSwapPoolLib {
|
|
|
260
260
|
/// `uniswapV3SwapCallback` so the V3 callback logic lives in library bytecode.
|
|
261
261
|
/// @dev DELEGATECALL preserves msg.sender (the V3 pool), allowing pool verification.
|
|
262
262
|
/// @param v3Factory The Uniswap V3 factory for pool verification.
|
|
263
|
-
/// @param amount0Delta The amount of token0
|
|
264
|
-
/// @param amount1Delta The amount of token1
|
|
263
|
+
/// @param amount0Delta The amount of token0 used for the swap.
|
|
264
|
+
/// @param amount1Delta The amount of token1 used for the swap.
|
|
265
265
|
/// @param data Encoded (originalTokenIn, normalizedTokenIn, normalizedTokenOut).
|
|
266
266
|
function executeV3SwapCallback(
|
|
267
267
|
IUniswapV3Factory v3Factory,
|
|
@@ -6,7 +6,7 @@ import {JBInboxTreeRoot} from "./JBInboxTreeRoot.sol";
|
|
|
6
6
|
/// @notice Information about the remote (inbox) tree's root, passed in a message from the remote chain.
|
|
7
7
|
/// @custom:member version The message format version. Used to reject incompatible messages.
|
|
8
8
|
/// @custom:member token The remote token address (bytes32 for cross-VM compatibility with SVM).
|
|
9
|
-
/// @custom:member amount The amount of tokens
|
|
9
|
+
/// @custom:member amount The amount of tokens to send.
|
|
10
10
|
/// @custom:member remoteRoot The root of the merkle tree.
|
|
11
11
|
/// @custom:member sourceTotalSupply The total token supply (including reserved tokens) on the source chain at the
|
|
12
12
|
/// time the message was sent. Used by the receiving chain to track cross-chain supply for cash out tax calculations.
|