From 3eaeaae37a803d84f8d9b88a4155ea3c3dfbbcba Mon Sep 17 00:00:00 2001 From: mejango Date: Fri, 1 Sep 2023 11:45:01 -0400 Subject: [PATCH] added a few relevant context --- .../JBSingleTokenPaymentTerminalStore3_2.sol | 17 ++++--- .../JBPayoutRedemptionPaymentTerminal3_2.sol | 46 +++++++++---------- .../IJBFundingCycleDataSource3_2.sol | 44 ++++++++++++++++++ contracts/interfaces/IJBPayDelegate3_2.sol | 14 ++++++ .../IJBPayoutRedemptionPaymentTerminal3_2.sol | 16 +++---- .../interfaces/IJBRedemptionDelegate3_2.sol | 14 ++++++ .../IJBSingleTokenPaymentTerminalStore3_2.sol | 8 ++-- contracts/structs/JBDidPayData3_2.sol | 31 +++++++++++++ contracts/structs/JBDidRedeemData3_2.sol | 29 ++++++++++++ .../structs/JBPayDelegateAllocation3_2.sol | 13 ++++++ .../JBRedemptionDelegateAllocation3_2.sol | 13 ++++++ 11 files changed, 200 insertions(+), 45 deletions(-) create mode 100644 contracts/interfaces/IJBFundingCycleDataSource3_2.sol create mode 100644 contracts/interfaces/IJBPayDelegate3_2.sol create mode 100644 contracts/interfaces/IJBRedemptionDelegate3_2.sol create mode 100644 contracts/structs/JBDidPayData3_2.sol create mode 100644 contracts/structs/JBDidRedeemData3_2.sol create mode 100644 contracts/structs/JBPayDelegateAllocation3_2.sol create mode 100644 contracts/structs/JBRedemptionDelegateAllocation3_2.sol diff --git a/contracts/JBSingleTokenPaymentTerminalStore3_2.sol b/contracts/JBSingleTokenPaymentTerminalStore3_2.sol index e60a6cc86..d0848953d 100644 --- a/contracts/JBSingleTokenPaymentTerminalStore3_2.sol +++ b/contracts/JBSingleTokenPaymentTerminalStore3_2.sol @@ -6,7 +6,7 @@ import {PRBMath} from '@paulrberg/contracts/math/PRBMath.sol'; import {JBBallotState} from './enums/JBBallotState.sol'; import {IJBController3_1} from './interfaces/IJBController3_1.sol'; import {IJBDirectory} from './interfaces/IJBDirectory.sol'; -import {IJBFundingCycleDataSource3_1_1} from './interfaces/IJBFundingCycleDataSource3_1_1.sol'; +import {IJBFundingCycleDataSource3_2} from './interfaces/IJBFundingCycleDataSource3_2.sol'; import {IJBFundingCycleStore} from './interfaces/IJBFundingCycleStore.sol'; import {IJBPaymentTerminal} from './interfaces/IJBPaymentTerminal.sol'; import {IJBPrices} from './interfaces/IJBPrices.sol'; @@ -17,10 +17,10 @@ import {JBCurrencies} from './libraries/JBCurrencies.sol'; import {JBFixedPointNumber} from './libraries/JBFixedPointNumber.sol'; import {JBFundingCycleMetadataResolver3_2} from './libraries/JBFundingCycleMetadataResolver3_2.sol'; import {JBFundingCycle} from './structs/JBFundingCycle.sol'; -import {JBPayDelegateAllocation3_1_1} from './structs/JBPayDelegateAllocation3_1_1.sol'; +import {JBPayDelegateAllocation3_2} from './structs/JBPayDelegateAllocation3_2.sol'; import {JBPayParamsData} from './structs/JBPayParamsData.sol'; import {JBRedeemParamsData} from './structs/JBRedeemParamsData.sol'; -import {JBRedemptionDelegateAllocation3_1_1} from './structs/JBRedemptionDelegateAllocation3_1_1.sol'; +import {JBRedemptionDelegateAllocation3_2} from './structs/JBRedemptionDelegateAllocation3_2.sol'; import {JBTokenAmount} from './structs/JBTokenAmount.sol'; /// @notice Manages all bookkeeping for inflows and outflows of funds from any ISingleTokenPaymentTerminal. @@ -249,7 +249,7 @@ contract JBSingleTokenPaymentTerminalStore3_1_1 is returns ( JBFundingCycle memory fundingCycle, uint256 tokenCount, - JBPayDelegateAllocation3_1_1[] memory delegateAllocations, + JBPayDelegateAllocation3_2[] memory delegateAllocations, string memory memo ) { @@ -280,9 +280,8 @@ contract JBSingleTokenPaymentTerminalStore3_1_1 is _memo, _metadata ); - (_weight, memo, delegateAllocations) = IJBFundingCycleDataSource3_1_1( - fundingCycle.dataSource() - ).payParams(_data); + (_weight, memo, delegateAllocations) = IJBFundingCycleDataSource3_2(fundingCycle.dataSource()) + .payParams(_data); } // Otherwise use the funding cycle's weight else { @@ -367,7 +366,7 @@ contract JBSingleTokenPaymentTerminalStore3_1_1 is returns ( JBFundingCycle memory fundingCycle, uint256 reclaimAmount, - JBRedemptionDelegateAllocation3_1_1[] memory delegateAllocations, + JBRedemptionDelegateAllocation3_2[] memory delegateAllocations, string memory memo ) { @@ -448,7 +447,7 @@ contract JBSingleTokenPaymentTerminalStore3_1_1 is _memo, _metadata ); - (reclaimAmount, memo, delegateAllocations) = IJBFundingCycleDataSource3_1_1( + (reclaimAmount, memo, delegateAllocations) = IJBFundingCycleDataSource3_2( fundingCycle.dataSource() ).redeemParams(_data); } diff --git a/contracts/abstract/JBPayoutRedemptionPaymentTerminal3_2.sol b/contracts/abstract/JBPayoutRedemptionPaymentTerminal3_2.sol index d59bc6ef7..fa5cffacb 100644 --- a/contracts/abstract/JBPayoutRedemptionPaymentTerminal3_2.sol +++ b/contracts/abstract/JBPayoutRedemptionPaymentTerminal3_2.sol @@ -19,7 +19,7 @@ import {IJBPayoutTerminal3_1} from './../interfaces/IJBPayoutTerminal3_1.sol'; import {IJBPrices} from './../interfaces/IJBPrices.sol'; import {IJBProjects} from './../interfaces/IJBProjects.sol'; import {IJBRedemptionTerminal} from './../interfaces/IJBRedemptionTerminal.sol'; -import {IJBSingleTokenPaymentTerminalStore3_1_1} from './../interfaces/IJBSingleTokenPaymentTerminalStore3_1_1.sol'; +import {IJBSingleTokenPaymentTerminalStore3_2} from './../interfaces/IJBSingleTokenPaymentTerminalStore3_2.sol'; import {IJBSplitAllocator} from './../interfaces/IJBSplitAllocator.sol'; import {JBConstants} from './../libraries/JBConstants.sol'; import {JBCurrencies} from './../libraries/JBCurrencies.sol'; @@ -28,12 +28,12 @@ import {JBFixedPointNumber} from './../libraries/JBFixedPointNumber.sol'; import {JBFundingCycleMetadataResolver3_2} from './../libraries/JBFundingCycleMetadataResolver3_2.sol'; import {JBOperations} from './../libraries/JBOperations.sol'; import {JBTokens} from './../libraries/JBTokens.sol'; -import {JBDidRedeemData3_1_1} from './../structs/JBDidRedeemData3_1_1.sol'; -import {JBDidPayData3_1_1} from './../structs/JBDidPayData3_1_1.sol'; +import {JBDidRedeemData3_2} from './../structs/JBDidRedeemData3_2.sol'; +import {JBDidPayData3_2} from './../structs/JBDidPayData3_2.sol'; import {JBFee} from './../structs/JBFee.sol'; import {JBFundingCycle} from './../structs/JBFundingCycle.sol'; -import {JBPayDelegateAllocation3_1_1} from './../structs/JBPayDelegateAllocation3_1_1.sol'; -import {JBRedemptionDelegateAllocation3_1_1} from './../structs/JBRedemptionDelegateAllocation3_1_1.sol'; +import {JBPayDelegateAllocation3_2} from './../structs/JBPayDelegateAllocation3_2.sol'; +import {JBRedemptionDelegateAllocation3_2} from './../structs/JBRedemptionDelegateAllocation3_2.sol'; import {JBSplit} from './../structs/JBSplit.sol'; import {JBSplitAllocationData} from './../structs/JBSplitAllocationData.sol'; import {JBTokenAmount} from './../structs/JBTokenAmount.sol'; @@ -131,7 +131,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is uint256 _projectId ) external view virtual override returns (uint256) { // Get this terminal's current overflow. - uint256 _overflow = IJBSingleTokenPaymentTerminalStore3_1_1(store).currentOverflowOf( + uint256 _overflow = IJBSingleTokenPaymentTerminalStore3_2(store).currentOverflowOf( this, _projectId ); @@ -411,7 +411,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is if (!_to.acceptsToken(token, _projectId)) revert TERMINAL_TOKENS_INCOMPATIBLE(); // Record the migration in the store. - balance = IJBSingleTokenPaymentTerminalStore3_1_1(store).recordMigration(_projectId); + balance = IJBSingleTokenPaymentTerminalStore3_2(store).recordMigration(_projectId); // Transfer the balance if needed. if (balance != 0) { @@ -638,7 +638,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is // Scoped section prevents stack too deep. `_delegateAllocations` only used within scope. { - JBRedemptionDelegateAllocation3_1_1[] memory _delegateAllocations; + JBRedemptionDelegateAllocation3_2[] memory _delegateAllocations; // Record the redemption. ( @@ -646,7 +646,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is reclaimAmount, _delegateAllocations, _memo - ) = IJBSingleTokenPaymentTerminalStore3_1_1(store).recordRedemptionFor( + ) = IJBSingleTokenPaymentTerminalStore3_2(store).recordRedemptionFor( _holder, _projectId, _tokenCount, @@ -656,8 +656,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is // Set the reference to the fee discount to apply. No fee if the beneficiary is feeless or if the redemption rate is at its max. _feeDiscount = isFeelessAddress[_beneficiary] || - (_fundingCycle.redemptionRate() == JBConstants.MAX_REDEMPTION_RATE && - _fundingCycle.ballotRedemptionRate() == JBConstants.MAX_REDEMPTION_RATE) || + _fundingCycle.redemptionRate() == JBConstants.MAX_REDEMPTION_RATE || _feePercent == 0 ? JBConstants.MAX_FEE_DISCOUNT : _currentFeeDiscount(_projectId, JBFeeType.REDEMPTION); @@ -677,13 +676,14 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is // If delegate allocations were specified by the data source, fulfill them. if (_delegateAllocations.length != 0) { - JBDidRedeemData3_1_1 memory _data = JBDidRedeemData3_1_1( + JBDidRedeemData3_2 memory _data = JBDidRedeemData3_2( _holder, _projectId, _fundingCycle.configuration, _tokenCount, JBTokenAmount(token, reclaimAmount, decimals, currency), JBTokenAmount(token, 0, decimals, currency), + _fundingCycle.redemptionRate(), _beneficiary, _memo, bytes(''), @@ -691,7 +691,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is ); // Keep a reference to the allocation. - JBRedemptionDelegateAllocation3_1_1 memory _delegateAllocation; + JBRedemptionDelegateAllocation3_2 memory _delegateAllocation; // Keep a reference to the fee. uint256 _delegatedAmountFee; @@ -806,7 +806,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is ( JBFundingCycle memory _fundingCycle, uint256 _distributedAmount - ) = IJBSingleTokenPaymentTerminalStore3_1_1(store).recordDistributionFor( + ) = IJBSingleTokenPaymentTerminalStore3_2(store).recordDistributionFor( _projectId, _amount, _currency @@ -924,7 +924,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is ( JBFundingCycle memory _fundingCycle, uint256 _distributedAmount - ) = IJBSingleTokenPaymentTerminalStore3_1_1(store).recordUsedAllowanceOf( + ) = IJBSingleTokenPaymentTerminalStore3_2(store).recordUsedAllowanceOf( _projectId, _amount, _currency @@ -1308,10 +1308,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is if (_allowanceAmount != 0) _cancelTransferTo(_expectedDestination, _allowanceAmount); // Add undistributed amount back to project's balance. - IJBSingleTokenPaymentTerminalStore3_1_1(store).recordAddedBalanceFor( - _projectId, - _depositAmount - ); + IJBSingleTokenPaymentTerminalStore3_2(store).recordAddedBalanceFor(_projectId, _depositAmount); } /// @notice Contribute tokens to a project. @@ -1343,7 +1340,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is // Scoped section prevents stack too deep. `_delegateAllocations` and `_tokenCount` only used within scope. { - JBPayDelegateAllocation3_1_1[] memory _delegateAllocations; + JBPayDelegateAllocation3_2[] memory _delegateAllocations; uint256 _tokenCount; // Bundle the amount info into a JBTokenAmount struct. @@ -1355,7 +1352,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is _tokenCount, _delegateAllocations, _memo - ) = IJBSingleTokenPaymentTerminalStore3_1_1(store).recordPaymentFrom( + ) = IJBSingleTokenPaymentTerminalStore3_2(store).recordPaymentFrom( _payer, _bundledAmount, _projectId, @@ -1381,12 +1378,13 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is // If delegate allocations were specified by the data source, fulfill them. if (_delegateAllocations.length != 0) { - JBDidPayData3_1_1 memory _data = JBDidPayData3_1_1( + JBDidPayData3_2 memory _data = JBDidPayData3_2( _payer, _projectId, _fundingCycle.configuration, _bundledAmount, JBTokenAmount(token, 0, decimals, currency), + _fundingCycle.weight, beneficiaryTokenCount, _beneficiary, _preferClaimedTokens, @@ -1399,7 +1397,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is uint256 _numDelegates = _delegateAllocations.length; // Keep a reference to the allocation. - JBPayDelegateAllocation3_1_1 memory _delegateAllocation; + JBPayDelegateAllocation3_2 memory _delegateAllocation; for (uint256 _i; _i < _numDelegates; ) { // Get a reference to the delegate being iterated on. @@ -1463,7 +1461,7 @@ abstract contract JBPayoutRedemptionPaymentTerminal3_2 is uint256 _refundedFees = _shouldRefundHeldFees ? _refundHeldFees(_projectId, _amount) : 0; // Record the added funds with any refunded fees. - IJBSingleTokenPaymentTerminalStore3_1_1(store).recordAddedBalanceFor( + IJBSingleTokenPaymentTerminalStore3_2(store).recordAddedBalanceFor( _projectId, _amount + _refundedFees ); diff --git a/contracts/interfaces/IJBFundingCycleDataSource3_2.sol b/contracts/interfaces/IJBFundingCycleDataSource3_2.sol new file mode 100644 index 000000000..6342a64ee --- /dev/null +++ b/contracts/interfaces/IJBFundingCycleDataSource3_2.sol @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IERC165} from '@openzeppelin/contracts/utils/introspection/IERC165.sol'; +import {JBPayDelegateAllocation3_2} from './../structs/JBPayDelegateAllocation3_2.sol'; +import {JBPayParamsData} from './../structs/JBPayParamsData.sol'; +import {JBRedeemParamsData} from './../structs/JBRedeemParamsData.sol'; +import {JBRedemptionDelegateAllocation3_2} from './../structs/JBRedemptionDelegateAllocation3_2.sol'; + +/// @title Datasource +/// @notice The datasource is called by JBPayoutRedemptionPaymentTerminals on pay and redemption, and provide an extra layer of logic to use a custom weight, a custom memo and/or a pay/redeem delegate +interface IJBFundingCycleDataSource3_2 is IERC165 { + /// @notice The datasource implementation for JBPaymentTerminal.pay(..) + /// @param data the data passed to the data source in terminal.pay(..), as a JBPayParamsData struct: + /// @return weight the weight to use to override the funding cycle weight + /// @return memo the memo to override the pay(..) memo + /// @return delegateAllocations The amount to send to delegates instead of adding to the local balance. + function payParams( + JBPayParamsData calldata data + ) + external + view + returns ( + uint256 weight, + string memory memo, + JBPayDelegateAllocation3_2[] memory delegateAllocations + ); + + /// @notice The datasource implementation for JBPaymentTerminal.redeemTokensOf(..) + /// @param data the data passed to the data source in terminal.redeemTokensOf(..), as a JBRedeemParamsData struct: + /// @return reclaimAmount The amount to claim, overriding the terminal logic. + /// @return memo The memo to override the redeemTokensOf(..) memo. + /// @return delegateAllocations The amount to send to delegates instead of adding to the beneficiary. + function redeemParams( + JBRedeemParamsData calldata data + ) + external + view + returns ( + uint256 reclaimAmount, + string memory memo, + JBRedemptionDelegateAllocation3_2[] memory delegateAllocations + ); +} diff --git a/contracts/interfaces/IJBPayDelegate3_2.sol b/contracts/interfaces/IJBPayDelegate3_2.sol new file mode 100644 index 000000000..d4658c035 --- /dev/null +++ b/contracts/interfaces/IJBPayDelegate3_2.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IERC165} from '@openzeppelin/contracts/utils/introspection/IERC165.sol'; +import {JBDidPayData3_2} from './../structs/JBDidPayData3_2.sol'; + +/// @title Pay delegate +/// @notice Delegate called after JBTerminal.pay(..) logic completion (if passed by the funding cycle datasource) +interface IJBPayDelegate3_2 is IERC165 { + /// @notice This function is called by JBPaymentTerminal.pay(..), after the execution of its logic + /// @dev Critical business logic should be protected by an appropriate access control + /// @param data the data passed by the terminal, as a JBDidPayData3_2 struct: + function didPay(JBDidPayData3_2 calldata data) external payable; +} diff --git a/contracts/interfaces/IJBPayoutRedemptionPaymentTerminal3_2.sol b/contracts/interfaces/IJBPayoutRedemptionPaymentTerminal3_2.sol index 248091340..d211a7112 100644 --- a/contracts/interfaces/IJBPayoutRedemptionPaymentTerminal3_2.sol +++ b/contracts/interfaces/IJBPayoutRedemptionPaymentTerminal3_2.sol @@ -5,16 +5,16 @@ import {JBFee} from './../structs/JBFee.sol'; import {IJBAllowanceTerminal3_1} from './IJBAllowanceTerminal3_1.sol'; import {IJBDirectory} from './IJBDirectory.sol'; import {IJBFeeHoldingTerminal} from './IJBFeeHoldingTerminal.sol'; -import {IJBPayDelegate3_1_1} from './IJBPayDelegate3_1_1.sol'; +import {IJBPayDelegate3_2} from './IJBPayDelegate3_2.sol'; import {IJBPaymentTerminal} from './IJBPaymentTerminal.sol'; import {IJBPayoutTerminal3_1} from './IJBPayoutTerminal3_1.sol'; import {IJBPrices} from './IJBPrices.sol'; import {IJBProjects} from './IJBProjects.sol'; -import {IJBRedemptionDelegate3_1_1} from './IJBRedemptionDelegate3_1_1.sol'; +import {IJBRedemptionDelegate3_2} from './IJBRedemptionDelegate3_2.sol'; import {IJBRedemptionTerminal} from './IJBRedemptionTerminal.sol'; import {IJBSplitsStore} from './IJBSplitsStore.sol'; -import {JBDidPayData3_1_1} from './../structs/JBDidPayData3_1_1.sol'; -import {JBDidRedeemData3_1_1} from './../structs/JBDidRedeemData3_1_1.sol'; +import {JBDidPayData3_2} from './../structs/JBDidPayData3_2.sol'; +import {JBDidRedeemData3_2} from './../structs/JBDidRedeemData3_2.sol'; import {JBSplit} from './../structs/JBSplit.sol'; interface IJBPayoutRedemptionPaymentTerminal3_2 is @@ -150,16 +150,16 @@ interface IJBPayoutRedemptionPaymentTerminal3_2 is ); event DelegateDidRedeem( - IJBRedemptionDelegate3_1_1 indexed delegate, - JBDidRedeemData3_1_1 data, + IJBRedemptionDelegate3_2 indexed delegate, + JBDidRedeemData3_2 data, uint256 delegatedAmount, uint256 fee, address caller ); event DelegateDidPay( - IJBPayDelegate3_1_1 indexed delegate, - JBDidPayData3_1_1 data, + IJBPayDelegate3_2 indexed delegate, + JBDidPayData3_2 data, uint256 delegatedAmount, address caller ); diff --git a/contracts/interfaces/IJBRedemptionDelegate3_2.sol b/contracts/interfaces/IJBRedemptionDelegate3_2.sol new file mode 100644 index 000000000..d686b3de3 --- /dev/null +++ b/contracts/interfaces/IJBRedemptionDelegate3_2.sol @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IERC165} from '@openzeppelin/contracts/utils/introspection/IERC165.sol'; +import {JBDidRedeemData3_2} from './../structs/JBDidRedeemData3_2.sol'; + +/// @title Redemption delegate +/// @notice Delegate called after JBTerminal.redeemTokensOf(..) logic completion (if passed by the funding cycle datasource) +interface IJBRedemptionDelegate3_2 is IERC165 { + /// @notice This function is called by JBPaymentTerminal.redeemTokensOf(..), after the execution of its logic + /// @dev Critical business logic should be protected by an appropriate access control + /// @param data the data passed by the terminal, as a JBDidRedeemData struct: + function didRedeem(JBDidRedeemData3_2 calldata data) external payable; +} diff --git a/contracts/interfaces/IJBSingleTokenPaymentTerminalStore3_2.sol b/contracts/interfaces/IJBSingleTokenPaymentTerminalStore3_2.sol index df2db4f6d..c738a8528 100644 --- a/contracts/interfaces/IJBSingleTokenPaymentTerminalStore3_2.sol +++ b/contracts/interfaces/IJBSingleTokenPaymentTerminalStore3_2.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.0; import {JBFundingCycle} from './../structs/JBFundingCycle.sol'; -import {JBPayDelegateAllocation3_1_1} from './../structs/JBPayDelegateAllocation3_1_1.sol'; -import {JBRedemptionDelegateAllocation3_1_1} from './../structs/JBRedemptionDelegateAllocation3_1_1.sol'; +import {JBPayDelegateAllocation3_2} from './../structs/JBPayDelegateAllocation3_2.sol'; +import {JBRedemptionDelegateAllocation3_2} from './../structs/JBRedemptionDelegateAllocation3_2.sol'; import {JBTokenAmount} from './../structs/JBTokenAmount.sol'; import {IJBDirectory} from './IJBDirectory.sol'; import {IJBFundingCycleStore} from './IJBFundingCycleStore.sol'; @@ -71,7 +71,7 @@ interface IJBSingleTokenPaymentTerminalStore3_2 { returns ( JBFundingCycle memory fundingCycle, uint256 tokenCount, - JBPayDelegateAllocation3_1_1[] memory delegateAllocations, + JBPayDelegateAllocation3_2[] memory delegateAllocations, string memory outputMemo ); @@ -86,7 +86,7 @@ interface IJBSingleTokenPaymentTerminalStore3_2 { returns ( JBFundingCycle memory fundingCycle, uint256 reclaimAmount, - JBRedemptionDelegateAllocation3_1_1[] memory delegateAllocations, + JBRedemptionDelegateAllocation3_2[] memory delegateAllocations, string memory outputMemo ); diff --git a/contracts/structs/JBDidPayData3_2.sol b/contracts/structs/JBDidPayData3_2.sol new file mode 100644 index 000000000..273ce6301 --- /dev/null +++ b/contracts/structs/JBDidPayData3_2.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {JBTokenAmount} from './JBTokenAmount.sol'; + +/// @custom:member payer The address from which the payment originated. +/// @custom:member projectId The ID of the project for which the payment was made. +/// @custom:member currentFundingCycleConfiguration The configuration of the funding cycle during which the payment is being made. +/// @custom:member amount The amount of the payment. Includes the token being paid, the value, the number of decimals included, and the currency of the amount. +/// @custom:member forwardedAmount The amount of the payment that is being sent to the delegate. Includes the token being paid, the value, the number of decimals included, and the currency of the amount. +/// @custom:member weight The current funding cycle's weight used to determine how many tokens are being minted. +/// @custom:member projectTokenCount The number of project tokens minted for the beneficiary. +/// @custom:member beneficiary The address to which the tokens were minted. +/// @custom:member preferClaimedTokens A flag indicating whether the request prefered to mint project tokens into the beneficiaries wallet rather than leaving them unclaimed. This is only possible if the project has an attached token contract. +/// @custom:member memo The memo that is being emitted alongside the payment. +/// @custom:member dataSourceMetadata Extra data to send to the delegate sent by the data source. +/// @custom:member payerMetadata Extra data to send to the delegate sent by the payer. +struct JBDidPayData3_2 { + address payer; + uint256 projectId; + uint256 currentFundingCycleConfiguration; + JBTokenAmount amount; + JBTokenAmount forwardedAmount; + uint256 weight; + uint256 projectTokenCount; + address beneficiary; + bool preferClaimedTokens; + string memo; + bytes dataSourceMetadata; + bytes payerMetadata; +} diff --git a/contracts/structs/JBDidRedeemData3_2.sol b/contracts/structs/JBDidRedeemData3_2.sol new file mode 100644 index 000000000..898188e10 --- /dev/null +++ b/contracts/structs/JBDidRedeemData3_2.sol @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {JBTokenAmount} from './JBTokenAmount.sol'; + +/// @custom:member holder The holder of the tokens being redeemed. +/// @custom:member projectId The ID of the project with which the redeemed tokens are associated. +/// @custom:member currentFundingCycleConfiguration The configuration of the funding cycle during which the redemption is being made. +/// @custom:member projectTokenCount The number of project tokens being redeemed. +/// @custom:member redemptionRate The current funding cycle's redemption rate. +/// @custom:member reclaimedAmount The amount reclaimed from the treasury. Includes the token being reclaimed, the value, the number of decimals included, and the currency of the amount. +/// @custom:member forwardedAmount The amount of the payment that is being sent to the delegate. Includes the token being paid, the value, the number of decimals included, and the currency of the amount. +/// @custom:member beneficiary The address to which the reclaimed amount will be sent. +/// @custom:member memo The memo that is being emitted alongside the redemption. +/// @custom:member dataSourceMetadata Extra data to send to the delegate sent by the data source. +/// @custom:member redeemerMetadata Extra data to send to the delegate sent by the redeemer. +struct JBDidRedeemData3_2 { + address holder; + uint256 projectId; + uint256 currentFundingCycleConfiguration; + uint256 projectTokenCount; + JBTokenAmount reclaimedAmount; + JBTokenAmount forwardedAmount; + uint256 redemptionRate; + address payable beneficiary; + string memo; + bytes dataSourceMetadata; + bytes redeemerMetadata; +} diff --git a/contracts/structs/JBPayDelegateAllocation3_2.sol b/contracts/structs/JBPayDelegateAllocation3_2.sol new file mode 100644 index 000000000..0e2769720 --- /dev/null +++ b/contracts/structs/JBPayDelegateAllocation3_2.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IJBPayDelegate3_2} from '../interfaces/IJBPayDelegate3_2.sol'; + +/// @custom:member delegate A delegate contract to use for subsequent calls. +/// @custom:member amount The amount to send to the delegate. +/// @custom:member metadata Metadata to pass the delegate. +struct JBPayDelegateAllocation3_2 { + IJBPayDelegate3_2 delegate; + uint256 amount; + bytes metadata; +} diff --git a/contracts/structs/JBRedemptionDelegateAllocation3_2.sol b/contracts/structs/JBRedemptionDelegateAllocation3_2.sol new file mode 100644 index 000000000..4df3a47bd --- /dev/null +++ b/contracts/structs/JBRedemptionDelegateAllocation3_2.sol @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +import {IJBRedemptionDelegate3_2} from '../interfaces/IJBRedemptionDelegate3_2.sol'; + +/// @custom:member delegate A delegate contract to use for subsequent calls. +/// @custom:member amount The amount to send to the delegate. +/// @custom:member metadata Metadata to pass the delegate. +struct JBRedemptionDelegateAllocation3_2 { + IJBRedemptionDelegate3_2 delegate; + uint256 amount; + bytes metadata; +}