From ac66c536332390db963d8d81ea5a137ef8dc67e6 Mon Sep 17 00:00:00 2001 From: FHieser Date: Tue, 1 Aug 2023 10:58:40 +0200 Subject: [PATCH 1/7] Rename to ERC20PaymentClient --- ...ymentClient.sol => ERC20PaymentClient.sol} | 28 +- ...mentClient.sol => IERC20PaymentClient.sol} | 14 +- src/modules/logicModule/BountyManager.sol | 20 +- src/modules/logicModule/IBountyManager.sol | 4 +- src/modules/logicModule/IMilestoneManager.sol | 4 +- src/modules/logicModule/MilestoneManager.sol | 22 +- .../logicModule/RecurringPaymentManager.sol | 20 +- .../paymentProcessor/IPaymentProcessor.sol | 18 +- .../IStreamingPaymentProcessor.sol | 54 ++-- .../SimplePaymentProcessor.sol | 14 +- .../StreamingPaymentProcessor.sol | 38 +-- test/e2e/BountyManagerLifecycle.t.sol | 4 +- test/e2e/MilestoneLifecycle.t.sol | 2 +- test/e2e/RecurringPayments.t.sol | 4 +- test/modules/base/mixins/PaymentClient.t.sol | 84 +++--- test/modules/logicModule/BountyManager.t.sol | 4 +- .../logicModule/MilestoneManager.t.sol | 10 +- .../logicModule/RecurringPaymentManager.t.sol | 14 +- .../SimplePaymentProcessor.t.sol | 48 +-- .../StreamingPaymentProcessor.t.sol | 284 +++++++++--------- .../mocks/modules/PaymentProcessorMock.sol | 8 +- ...entMock.sol => ERC20PaymentClientMock.sol} | 18 +- 22 files changed, 358 insertions(+), 358 deletions(-) rename src/modules/base/mixins/{PaymentClient.sol => ERC20PaymentClient.sol} (89%) rename src/modules/base/mixins/{IPaymentClient.sol => IERC20PaymentClient.sol} (84%) rename test/utils/mocks/modules/mixins/{PaymentClientMock.sol => ERC20PaymentClientMock.sol} (85%) diff --git a/src/modules/base/mixins/PaymentClient.sol b/src/modules/base/mixins/ERC20PaymentClient.sol similarity index 89% rename from src/modules/base/mixins/PaymentClient.sol rename to src/modules/base/mixins/ERC20PaymentClient.sol index ae9d74ba3..b9aee69b7 100644 --- a/src/modules/base/mixins/PaymentClient.sol +++ b/src/modules/base/mixins/ERC20PaymentClient.sol @@ -6,19 +6,19 @@ import {ContextUpgradeable} from "@oz-up/utils/ContextUpgradeable.sol"; // Internal Dependencies import { - IPaymentClient, + IERC20PaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/IPaymentClient.sol"; +} from "src/modules/base/mixins/IERC20PaymentClient.sol"; /** - * @title PaymentClient + * @title ERC20PaymentClient * - * @dev The PaymentClient mixin enables modules to create payment orders that + * @dev The ERC20PaymentClient mixin enables modules to create payment orders that * are processable by a proposal's {IPaymentProcessor} module. * * @author Inverter Network */ -abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { +abstract contract ERC20PaymentClient is IERC20PaymentClient, ContextUpgradeable { //-------------------------------------------------------------------------- // Modifiers @@ -122,9 +122,9 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { } //-------------------------------------------------------------------------- - // IPaymentClient Functions + // IERC20PaymentClient Functions - /// @inheritdoc IPaymentClient + /// @inheritdoc IERC20PaymentClient function collectPaymentOrders() external virtual @@ -133,7 +133,7 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { // Ensure caller is authorized to act as payment processor. // Note that function is implemented in downstream contract. if (!_isAuthorizedPaymentProcessor(IPaymentProcessor(_msgSender()))) { - revert Module__PaymentClient__CallerNotAuthorized(); + revert Module__ERC20PaymentClient__CallerNotAuthorized(); } // Ensure payment processor is able to fetch the tokens from @@ -169,7 +169,7 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { return (copy, outstandingTokenAmountCache); } - /// @inheritdoc IPaymentClient + /// @inheritdoc IERC20PaymentClient function paymentOrders() external view @@ -179,7 +179,7 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { return _orders; } - /// @inheritdoc IPaymentClient + /// @inheritdoc IERC20PaymentClient function outstandingTokenAmount() external view virtual returns (uint) { return _outstandingTokenAmount; } @@ -189,20 +189,20 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { function _ensureValidRecipient(address recipient) private view { if (recipient == address(0) || recipient == address(this)) { - revert Module__PaymentClient__InvalidRecipient(); + revert Module__ERC20PaymentClient__InvalidRecipient(); } } function _ensureValidAmount(uint amount) private pure { - if (amount == 0) revert Module__PaymentClient__InvalidAmount(); + if (amount == 0) revert Module__ERC20PaymentClient__InvalidAmount(); } function _ensureValidPaymentOrder(PaymentOrder memory order) private view { if (order.amount == 0) { - revert Module__PaymentClient__InvalidAmount(); + revert Module__ERC20PaymentClient__InvalidAmount(); } if (order.recipient == address(0) || order.recipient == address(this)) { - revert Module__PaymentClient__InvalidRecipient(); + revert Module__ERC20PaymentClient__InvalidRecipient(); } } } diff --git a/src/modules/base/mixins/IPaymentClient.sol b/src/modules/base/mixins/IERC20PaymentClient.sol similarity index 84% rename from src/modules/base/mixins/IPaymentClient.sol rename to src/modules/base/mixins/IERC20PaymentClient.sol index 1d640ee94..aff0d9844 100644 --- a/src/modules/base/mixins/IPaymentClient.sol +++ b/src/modules/base/mixins/IERC20PaymentClient.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; -interface IPaymentClient { +interface IERC20PaymentClient { struct PaymentOrder { /// @dev The recipient of the payment. address recipient; @@ -21,22 +21,22 @@ interface IPaymentClient { // Errors /// @notice Function is only callable by authorized address. - error Module__PaymentClient__CallerNotAuthorized(); + error Module__ERC20PaymentClient__CallerNotAuthorized(); /// @notice ERC20 token transfer failed. - error Module__PaymentClient__TokenTransferFailed(); + error Module__ERC20PaymentClient__TokenTransferFailed(); /// @notice Given recipient invalid. - error Module__PaymentClient__InvalidRecipient(); + error Module__ERC20PaymentClient__InvalidRecipient(); /// @notice Given amount invalid. - error Module__PaymentClient__InvalidAmount(); + error Module__ERC20PaymentClient__InvalidAmount(); /// @notice Given dueTo invalid. - error Module__PaymentClient__InvalidDueTo(); + error Module__ERC20PaymentClient__InvalidDueTo(); /// @notice Given arrays' length mismatch. - error Module__PaymentClient__ArrayLengthMismatch(); + error Module__ERC20PaymentClient__ArrayLengthMismatch(); //-------------------------------------------------------------------------- // Events diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index 0e35fa47a..748112962 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -11,7 +11,7 @@ import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; // Internal Dependencies import {Module} from "src/modules/base/Module.sol"; -import {PaymentClient} from "src/modules/base/mixins/PaymentClient.sol"; +import {ERC20PaymentClient} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces import {IProposal} from "src/proposal/IProposal.sol"; @@ -19,9 +19,9 @@ import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; import {IBountyManager} from "src/modules/logicModule/IBountyManager.sol"; import { - IPaymentClient, + IERC20PaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/PaymentClient.sol"; +} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Libraries import {LinkedIdList} from "src/common/LinkedIdList.sol"; @@ -32,7 +32,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; //This will be changed in the coming future, //but till then the RoleAuthorizer has to be selected as the Authorizer Module of the proposal if the BountyManager is to be used -contract BountyManager is IBountyManager, Module, PaymentClient { +contract BountyManager is IBountyManager, Module, ERC20PaymentClient { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; using LinkedIdList for LinkedIdList.List; @@ -453,7 +453,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { //when done process the Payments correctly __Module_proposal.paymentProcessor().processPayments( - IPaymentClient(address(this)) + IERC20PaymentClient(address(this)) ); //Set completed to true @@ -509,11 +509,11 @@ contract BountyManager is IBountyManager, Module, PaymentClient { } //-------------------------------------------------------------------------- - // {PaymentClient} Function Implementations + // {ERC20PaymentClient} Function Implementations function _ensureTokenBalance(uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { uint balance = __Module_proposal.token().balanceOf(address(this)); @@ -531,14 +531,14 @@ contract BountyManager is IBountyManager, Module, PaymentClient { ); if (!ok) { - revert Module__PaymentClient__TokenTransferFailed(); + revert Module__ERC20PaymentClient__TokenTransferFailed(); } } } function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { IERC20 token = __Module_proposal.token(); uint allowance = token.allowance(address(this), address(spender)); @@ -551,7 +551,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { function _isAuthorizedPaymentProcessor(IPaymentProcessor who) internal view - override(PaymentClient) + override(ERC20PaymentClient) returns (bool) { return __Module_proposal.paymentProcessor() == who; diff --git a/src/modules/logicModule/IBountyManager.sol b/src/modules/logicModule/IBountyManager.sol index 5e04b0642..add21f5aa 100644 --- a/src/modules/logicModule/IBountyManager.sol +++ b/src/modules/logicModule/IBountyManager.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; -interface IBountyManager is IPaymentClient { +interface IBountyManager is IERC20PaymentClient { //-------------------------------------------------------------------------- // Enums diff --git a/src/modules/logicModule/IMilestoneManager.sol b/src/modules/logicModule/IMilestoneManager.sol index e0aac4e99..645885353 100644 --- a/src/modules/logicModule/IMilestoneManager.sol +++ b/src/modules/logicModule/IMilestoneManager.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; -interface IMilestoneManager is IPaymentClient { +interface IMilestoneManager is IERC20PaymentClient { //-------------------------------------------------------------------------- // Types diff --git a/src/modules/logicModule/MilestoneManager.sol b/src/modules/logicModule/MilestoneManager.sol index 5a0020386..fb2b3c2fc 100644 --- a/src/modules/logicModule/MilestoneManager.sol +++ b/src/modules/logicModule/MilestoneManager.sol @@ -10,10 +10,10 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Internal Dependencies import {Module, ContextUpgradeable} from "src/modules/base/Module.sol"; import { - IPaymentClient, - PaymentClient, + IERC20PaymentClient, + ERC20PaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/PaymentClient.sol"; +} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces import {IMilestoneManager} from "src/modules/logicModule/IMilestoneManager.sol"; @@ -45,7 +45,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; * * @author Inverter Network */ -contract MilestoneManager is IMilestoneManager, Module, PaymentClient { +contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { using SafeERC20 for IERC20; using LinkedIdList for LinkedIdList.List; @@ -376,7 +376,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { // stop all currently running payments __Module_proposal.paymentProcessor().cancelRunningPayments( - IPaymentClient(address(this)) + IERC20PaymentClient(address(this)) ); emit MilestoneStopped(id); @@ -468,7 +468,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { } __Module_proposal.paymentProcessor().processPayments( - IPaymentClient(address(this)) + IERC20PaymentClient(address(this)) ); emit MilestoneStarted(_last); @@ -690,11 +690,11 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { } //-------------------------------------------------------------------------- - // {PaymentClient} Function Implementations + // {ERC20PaymentClient} Function Implementations function _ensureTokenBalance(uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { uint balance = __Module_proposal.token().balanceOf(address(this)); @@ -712,14 +712,14 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { ); if (!ok) { - revert Module__PaymentClient__TokenTransferFailed(); + revert Module__ERC20PaymentClient__TokenTransferFailed(); } } } function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { IERC20 token = __Module_proposal.token(); uint allowance = token.allowance(address(this), address(spender)); @@ -732,7 +732,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { function _isAuthorizedPaymentProcessor(IPaymentProcessor who) internal view - override(PaymentClient) + override(ERC20PaymentClient) returns (bool) { return __Module_proposal.paymentProcessor() == who; diff --git a/src/modules/logicModule/RecurringPaymentManager.sol b/src/modules/logicModule/RecurringPaymentManager.sol index 33fa547d6..2e35c1414 100644 --- a/src/modules/logicModule/RecurringPaymentManager.sol +++ b/src/modules/logicModule/RecurringPaymentManager.sol @@ -10,7 +10,7 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Internal Dependencies import {Module} from "src/modules/base/Module.sol"; -import {PaymentClient} from "src/modules/base/mixins/PaymentClient.sol"; +import {ERC20PaymentClient} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces import {IProposal} from "src/proposal/IProposal.sol"; @@ -18,9 +18,9 @@ import {IRecurringPaymentManager} from "src/modules/logicModule/IRecurringPaymentManager.sol"; import { - IPaymentClient, + IERC20PaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/PaymentClient.sol"; +} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Libraries import {LinkedIdList} from "src/common/LinkedIdList.sol"; @@ -28,7 +28,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; contract RecurringPaymentManager is IRecurringPaymentManager, Module, - PaymentClient + ERC20PaymentClient { using SafeERC20 for IERC20; using LinkedIdList for LinkedIdList.List; @@ -355,17 +355,17 @@ contract RecurringPaymentManager is //when done process the Payments correctly __Module_proposal.paymentProcessor().processPayments( - IPaymentClient(address(this)) + IERC20PaymentClient(address(this)) ); emit RecurringPaymentsTriggered(currentEpoch); } //-------------------------------------------------------------------------- - // {PaymentClient} Function Implementations + // {ERC20PaymentClient} Function Implementations function _ensureTokenBalance(uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { uint balance = __Module_proposal.token().balanceOf(address(this)); @@ -383,14 +383,14 @@ contract RecurringPaymentManager is ); if (!ok) { - revert Module__PaymentClient__TokenTransferFailed(); + revert Module__ERC20PaymentClient__TokenTransferFailed(); } } } function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { IERC20 token = __Module_proposal.token(); uint allowance = token.allowance(address(this), address(spender)); @@ -403,7 +403,7 @@ contract RecurringPaymentManager is function _isAuthorizedPaymentProcessor(IPaymentProcessor who) internal view - override(PaymentClient) + override(ERC20PaymentClient) returns (bool) { return __Module_proposal.paymentProcessor() == who; diff --git a/src/modules/paymentProcessor/IPaymentProcessor.sol b/src/modules/paymentProcessor/IPaymentProcessor.sol index 5b0b431c0..ff8f59f3f 100644 --- a/src/modules/paymentProcessor/IPaymentProcessor.sol +++ b/src/modules/paymentProcessor/IPaymentProcessor.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; interface IPaymentProcessor { //-------------------------------------------------------------------------- @@ -19,13 +19,13 @@ interface IPaymentProcessor { // Events /// @notice Emitted when a payment gets processed for execution. - /// @param paymentClient The payment client that originated the order. + /// @param ERC20PaymentClient The payment client that originated the order. /// @param recipient The address that will receive the payment. /// @param amount The amount of tokens the payment consists of. /// @param createdAt Timestamp at which the order was created. /// @param dueTo Timestamp at which the full amount should be payed out/claimable. event PaymentOrderProcessed( - address indexed paymentClient, + address indexed ERC20PaymentClient, address indexed recipient, uint amount, uint createdAt, @@ -42,17 +42,17 @@ interface IPaymentProcessor { //-------------------------------------------------------------------------- // Functions - /// @notice Processes all payments from an {IPaymentClient} instance. + /// @notice Processes all payments from an {IERC20PaymentClient} instance. /// @dev It's up to the the implementation to keep up with what has been /// paid out or not. - /// @param client The {IPaymentClient} instance to process its to payments. - function processPayments(IPaymentClient client) external; + /// @param client The {IERC20PaymentClient} instance to process its to payments. + function processPayments(IERC20PaymentClient client) external; - /// @notice Cancels all unfinished payments from an {IPaymentClient} instance. + /// @notice Cancels all unfinished payments from an {IERC20PaymentClient} instance. /// @dev It's up to the the implementation to keep up with what has been /// paid out or not. - /// @param client The {IPaymentClient} instance to process its to payments. - function cancelRunningPayments(IPaymentClient client) external; + /// @param client The {IERC20PaymentClient} instance to process its to payments. + function cancelRunningPayments(IERC20PaymentClient client) external; /// @notice Returns the IERC20 token the payment processor can process. function token() external view returns (IERC20); diff --git a/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol b/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol index e571cebc6..2b1834a76 100644 --- a/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; @@ -17,7 +17,7 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { /// @param _released: The amount that has been claimed by the contributor till now /// @param _start: The start date of the vesting period /// @param _dueTo: The ending of the vesting period - /// @param _vestingWalletID: A unique identifier of a wallet for a specific paymentClient and contributor combination + /// @param _vestingWalletID: A unique identifier of a wallet for a specific ERC20PaymentClient and contributor combination struct VestingWallet { uint _salary; uint _released; @@ -35,7 +35,7 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { /// @param dueTo Timestamp at which the full amount should be claimable. /// @param walletId ID of the payment order that was added event StreamingPaymentAdded( - address indexed paymentClient, + address indexed ERC20PaymentClient, address indexed recipient, uint amount, uint start, @@ -47,7 +47,7 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { /// @param recipient The address that will stop receiving payment. /// @param walletId ID of the payment order removed event StreamingPaymentRemoved( - address indexed paymentClient, + address indexed ERC20PaymentClient, address indexed recipient, uint indexed walletId ); @@ -68,14 +68,14 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { ); /// @notice Emitted when a payment gets processed for execution. - /// @param paymentClient The payment client that originated the order. + /// @param ERC20PaymentClient The payment client that originated the order. /// @param recipient The address that will receive the payment. /// @param amount The amount of tokens the payment consists of. /// @param createdAt Timestamp at which the order was created. /// @param dueTo Timestamp at which the full amount should be payed out/claimable. /// @param walletId ID of the payment order that was processed event PaymentOrderProcessed( - address indexed paymentClient, + address indexed ERC20PaymentClient, address indexed recipient, uint amount, uint createdAt, @@ -89,68 +89,68 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { /// @notice insufficient tokens in the client to do payments error Module__PaymentProcessor__InsufficientTokenBalanceInClient(); - /// @notice the contributor is not owed any money by the paymentClient + /// @notice the contributor is not owed any money by the ERC20PaymentClient error Module__PaymentProcessor__NothingToClaim( - address paymentClient, address contributor + address ERC20PaymentClient, address contributor ); - /// @notice contributor's walletId for the paymentClient is not valid + /// @notice contributor's walletId for the ERC20PaymentClient is not valid error Module__PaymentProcessor__InvalidWallet( - address paymentClient, address contributor, uint walletId + address ERC20PaymentClient, address contributor, uint walletId ); - /// @notice contributor's walletId for the paymentClient is no longer active + /// @notice contributor's walletId for the ERC20PaymentClient is no longer active error Module__PaymentProcessor__InactiveWallet( - address paymentClient, address contributor, uint walletId + address ERC20PaymentClient, address contributor, uint walletId ); - /// @notice the contributor for the given paymentClient does not exist (anymore) + /// @notice the contributor for the given ERC20PaymentClient does not exist (anymore) error Module__PaymentProcessor__InvalidContributor( - address paymentClient, address contributor + address ERC20PaymentClient, address contributor ); //-------------------------------------------------------------------------- // Functions - /// @notice claim everything that the paymentClient owes to the _msgSender till the current timestamp + /// @notice claim everything that the ERC20PaymentClient owes to the _msgSender till the current timestamp /// @dev This function should be callable if the _msgSender is either an activeContributor or has some unclaimedAmounts - /// @param client The {IPaymentClient} instance to process all claims from _msgSender - function claimAll(IPaymentClient client) external; + /// @param client The {IERC20PaymentClient} instance to process all claims from _msgSender + function claimAll(IERC20PaymentClient client) external; /// @notice claim the salary uptil block.timestamp from the client for a payment order with id = walletId by _msgSender /// @dev If for a specific walletId, the tokens could not be transferred for some reason, it will added to the unclaimableAmounts /// of the contributor, and the amount would no longer hold any co-relation with the specific walletId of the contributor. - /// @param client The {IPaymentClient} instance to process the walletId claim from _msgSender + /// @param client The {IERC20PaymentClient} instance to process the walletId claim from _msgSender /// @param walletId The ID of the payment order for which claim is being made /// @param retryForUnclaimableAmounts boolean which determines if the function will try to pay the unclaimable amounts from earlier /// along with the vested salary from the payment order with id = walletId function claimForSpecificWalletId( - IPaymentClient client, + IERC20PaymentClient client, uint walletId, bool retryForUnclaimableAmounts ) external; - /// @notice Deletes all payments related to a contributor & leaves unvested tokens in the PaymentClient. + /// @notice Deletes all payments related to a contributor & leaves unvested tokens in the ERC20PaymentClient. /// @dev this function calls _removePayment which goes through all the payment orders for a contributor. For the payment orders /// that are completely vested, their details are deleted in the _claimForSpecificWalletId function and for others it is - /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the paymentClient itself. - /// @param client The {IPaymentClient} instance from which we will remove the payments + /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the ERC20PaymentClient itself. + /// @param client The {IERC20PaymentClient} instance from which we will remove the payments /// @param contributor Contributor's address. function removeAllContributorPayments( - IPaymentClient client, + IERC20PaymentClient client, address contributor ) external; - /// @notice Deletes a specific payment with id = walletId for a contributor & leaves unvested tokens in the PaymentClient. + /// @notice Deletes a specific payment with id = walletId for a contributor & leaves unvested tokens in the ERC20PaymentClient. /// @dev the detail of the wallet that is being removed is either deleted in the _claimForSpecificWalletId or later down in this /// function itself depending on the timestamp of when this function was called - /// @param client The {IPaymentClient} instance from which we will remove the payment + /// @param client The {IERC20PaymentClient} instance from which we will remove the payment /// @param contributor address of the contributor whose payment order is to be removed /// @param walletId The ID of the contributor's payment order which is to be removed /// @param retryForUnclaimableAmounts boolean that determines whether the function would try to return the unclaimableAmounts along /// with the vested amounts from the payment order with id = walletId to the contributor function removePaymentForSpecificWalletId( - IPaymentClient client, + IERC20PaymentClient client, address contributor, uint walletId, bool retryForUnclaimableAmounts @@ -216,7 +216,7 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { view returns (uint); - /// @notice see all active payment orders for a paymentClient associated with a particular contributor + /// @notice see all active payment orders for a ERC20PaymentClient associated with a particular contributor /// @dev the contributor must be an active contributor for the particular payment client /// @param client Address of the payment client /// @param contributor Address of the contributor diff --git a/src/modules/paymentProcessor/SimplePaymentProcessor.sol b/src/modules/paymentProcessor/SimplePaymentProcessor.sol index 1ef51339b..3bfebf9cb 100644 --- a/src/modules/paymentProcessor/SimplePaymentProcessor.sol +++ b/src/modules/paymentProcessor/SimplePaymentProcessor.sol @@ -10,7 +10,7 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Internal Dependencies import { IPaymentProcessor, - IPaymentClient + IERC20PaymentClient } from "src/modules/paymentProcessor/IPaymentProcessor.sol"; import {Module} from "src/modules/base/Module.sol"; @@ -22,7 +22,7 @@ import {IProposal} from "src/proposal/IProposal.sol"; * * @dev The SimplePaymentProcessor is a module to process payment orders from other * modules. In order to process a module's payment orders, the module must - * implement the {IPaymentClient} interface. + * implement the {IERC20PaymentClient} interface. * * @author Inverter Network */ @@ -41,7 +41,7 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { } /// @notice checks that the client is calling for itself - modifier validClient(IPaymentClient client) { + modifier validClient(IERC20PaymentClient client) { if (_msgSender() != address(client)) { revert Module__PaymentManager__CannotCallOnOtherClientsOrders(); } @@ -66,20 +66,20 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { } /// @inheritdoc IPaymentProcessor - function processPayments(IPaymentClient client) + function processPayments(IERC20PaymentClient client) external onlyModule validClient(client) { // Collect outstanding orders and their total token amount. - IPaymentClient.PaymentOrder[] memory orders; + IERC20PaymentClient.PaymentOrder[] memory orders; uint totalAmount; (orders, totalAmount) = client.collectPaymentOrders(); // Cache token. IERC20 token_ = token(); - // Transfer tokens from {IPaymentClient} to order recipients. + // Transfer tokens from {IERC20PaymentClient} to order recipients. address recipient; uint amount; uint len = orders.length; @@ -101,7 +101,7 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { } } - function cancelRunningPayments(IPaymentClient client) + function cancelRunningPayments(IERC20PaymentClient client) external onlyModule validClient(client) diff --git a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol index 58c6bbd99..142c60663 100644 --- a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.19; import { IStreamingPaymentProcessor, IPaymentProcessor, - IPaymentClient + IERC20PaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; import {Module} from "src/modules/base/Module.sol"; @@ -30,23 +30,23 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { // Storage /// @notice provides a unique id for new payment orders added for a specific client & contributor combo - /// @dev paymentClient => contributor => walletId(uint) + /// @dev ERC20PaymentClient => contributor => walletId(uint) mapping(address => mapping(address => uint)) public numVestingWallets; - /// @notice tracks all vesting details for all payment orders of a contributor for a specific paymentClient - /// @dev paymentClient => contributor => vestingWalletID => Wallet + /// @notice tracks all vesting details for all payment orders of a contributor for a specific ERC20PaymentClient + /// @dev ERC20PaymentClient => contributor => vestingWalletID => Wallet mapping(address => mapping(address => mapping(uint => VestingWallet))) private vestings; /// @notice tracks all payments that could not be made to the contributor due to any reason - /// @dev paymentClient => contributor => unclaimableAmount + /// @dev ERC20PaymentClient => contributor => unclaimableAmount mapping(address => mapping(address => uint)) private unclaimableAmounts; - /// @notice list of addresses with open payment Orders per paymentClient - /// @dev paymentClient => listOfContributors(address[]). Duplicates are not allowed. + /// @notice list of addresses with open payment Orders per ERC20PaymentClient + /// @dev ERC20PaymentClient => listOfContributors(address[]). Duplicates are not allowed. mapping(address => address[]) private activeContributors; - /// @notice list of walletIDs of all payment orders of a particular contributor for a particular paymentClient + /// @notice list of walletIDs of all payment orders of a particular contributor for a particular ERC20PaymentClient /// @dev client => contributor => arrayOfWalletIdsWithPendingPayment(uint[]) mapping(address => mapping(address => uint[])) private activeVestingWallets; @@ -62,7 +62,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @notice checks that the client is calling for itself - modifier validClient(IPaymentClient client) { + modifier validClient(IERC20PaymentClient client) { if (_msgSender() != address(client)) { revert Module__PaymentManager__CannotCallOnOtherClientsOrders(); } @@ -91,7 +91,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @inheritdoc IStreamingPaymentProcessor - function claimAll(IPaymentClient client) external { + function claimAll(IERC20PaymentClient client) external { if ( !( unclaimable(address(client), _msgSender()) > 0 @@ -109,7 +109,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function claimForSpecificWalletId( - IPaymentClient client, + IERC20PaymentClient client, uint walletId, bool retryForUnclaimableAmounts ) external { @@ -137,7 +137,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @inheritdoc IPaymentProcessor - function processPayments(IPaymentClient client) + function processPayments(IERC20PaymentClient client) external onlyModule validClient(client) @@ -145,7 +145,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { //We check if there are any new paymentOrders, without processing them if (client.paymentOrders().length > 0) { // Collect outstanding orders and their total token amount. - IPaymentClient.PaymentOrder[] memory orders; + IERC20PaymentClient.PaymentOrder[] memory orders; uint totalAmount; (orders, totalAmount) = client.collectPaymentOrders(); @@ -196,7 +196,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @inheritdoc IPaymentProcessor - function cancelRunningPayments(IPaymentClient client) + function cancelRunningPayments(IERC20PaymentClient client) external onlyModule validClient(client) @@ -206,7 +206,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function removeAllContributorPayments( - IPaymentClient client, + IERC20PaymentClient client, address contributor ) external onlyAuthorized { if ( @@ -222,7 +222,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function removePaymentForSpecificWalletId( - IPaymentClient client, + IERC20PaymentClient client, address contributor, uint walletId, bool retryForUnclaimableAmounts @@ -403,7 +403,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { return type(uint).max; } - /// @notice used to find whether a particular payment order associated with a contributor and paymentClient with id = walletId is active or not + /// @notice used to find whether a particular payment order associated with a contributor and ERC20PaymentClient with id = walletId is active or not /// @dev active means that the particular payment order is still to be paid out/claimed. This function returns the first instance of the walletId /// in the activeVestingWallets[client][contributor] array, but that is fine as the array does not allow duplicates. /// @param client address of the payment client @@ -450,10 +450,10 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } } - /// @notice Deletes all payments related to a contributor & leaves unvested tokens in the PaymentClient. + /// @notice Deletes all payments related to a contributor & leaves unvested tokens in the ERC20PaymentClient. /// @dev this function calls _removePayment which goes through all the payment orders for a contributor. For the payment orders /// that are completely vested, their details are deleted in the _claimForSpecificWalletId function and for others it is - /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the paymentClient itself. + /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the ERC20PaymentClient itself. /// @param client address of the payment client /// @param contributor address of the contributor function _removePayment(address client, address contributor) internal { diff --git a/test/e2e/BountyManagerLifecycle.t.sol b/test/e2e/BountyManagerLifecycle.t.sol index 118f914e3..5622fe45a 100644 --- a/test/e2e/BountyManagerLifecycle.t.sol +++ b/test/e2e/BountyManagerLifecycle.t.sol @@ -18,7 +18,7 @@ import {RebasingFundingManager} from import { BountyManager, IBountyManager, - IPaymentClient + IERC20PaymentClient } from "src/modules/logicModule/BountyManager.sol"; import {StreamingPaymentProcessor} from @@ -26,7 +26,7 @@ import {StreamingPaymentProcessor} from import { IStreamingPaymentProcessor, - IPaymentClient + IERC20PaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; // Mocks diff --git a/test/e2e/MilestoneLifecycle.t.sol b/test/e2e/MilestoneLifecycle.t.sol index 14782e658..772ee23d3 100644 --- a/test/e2e/MilestoneLifecycle.t.sol +++ b/test/e2e/MilestoneLifecycle.t.sol @@ -16,7 +16,7 @@ import {RebasingFundingManager} from import {SimplePaymentProcessor} from "src/modules/paymentProcessor/SimplePaymentProcessor.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; diff --git a/test/e2e/RecurringPayments.t.sol b/test/e2e/RecurringPayments.t.sol index 30afb7a35..6008a2830 100644 --- a/test/e2e/RecurringPayments.t.sol +++ b/test/e2e/RecurringPayments.t.sol @@ -18,7 +18,7 @@ import {RebasingFundingManager} from import { RecurringPaymentManager, IRecurringPaymentManager, - IPaymentClient + IERC20PaymentClient } from "src/modules/logicModule/RecurringPaymentManager.sol"; import {StreamingPaymentProcessor} from @@ -26,7 +26,7 @@ import {StreamingPaymentProcessor} from import { IStreamingPaymentProcessor, - IPaymentClient + IERC20PaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; // Mocks diff --git a/test/modules/base/mixins/PaymentClient.t.sol b/test/modules/base/mixins/PaymentClient.t.sol index 692a6d736..0ca87bb12 100644 --- a/test/modules/base/mixins/PaymentClient.t.sol +++ b/test/modules/base/mixins/PaymentClient.t.sol @@ -5,16 +5,16 @@ import "forge-std/Test.sol"; // SuT import { - PaymentClientMock, - IPaymentClient -} from "test/utils/mocks/modules/mixins/PaymentClientMock.sol"; + ERC20PaymentClientMock, + IERC20PaymentClient +} from "test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol"; // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; -contract PaymentClientTest is Test { +contract ERC20PaymentClientTest is Test { // SuT - PaymentClientMock paymentClient; + ERC20PaymentClientMock ERC20PaymentClient; // Mocks ERC20Mock token; @@ -22,8 +22,8 @@ contract PaymentClientTest is Test { function setUp() public { token = new ERC20Mock("Mock", "MOCK"); - paymentClient = new PaymentClientMock(token); - paymentClient.setIsAuthorized(address(this), true); + ERC20PaymentClient = new ERC20PaymentClientMock(token); + ERC20PaymentClient.setIsAuthorized(address(this), true); } //---------------------------------- @@ -51,8 +51,8 @@ contract PaymentClientTest is Test { } for (uint i; i < orderAmount; ++i) { - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -61,8 +61,8 @@ contract PaymentClientTest is Test { ); } - IPaymentClient.PaymentOrder[] memory orders = - paymentClient.paymentOrders(); + IERC20PaymentClient.PaymentOrder[] memory orders = + ERC20PaymentClient.paymentOrders(); assertEq(orders.length, orderAmount); for (uint i; i < orderAmount; ++i) { @@ -71,7 +71,7 @@ contract PaymentClientTest is Test { assertEq(orders[i].dueTo, dueTo); } - assertEq(paymentClient.outstandingTokenAmount(), amount * orderAmount); + assertEq(ERC20PaymentClient.outstandingTokenAmount(), amount * orderAmount); } function testAddPaymentOrderFailsForInvalidRecipient() public { @@ -81,10 +81,10 @@ contract PaymentClientTest is Test { for (uint i; i < invalids.length; ++i) { vm.expectRevert( - IPaymentClient.Module__PaymentClient__InvalidRecipient.selector + IERC20PaymentClient.Module__ERC20PaymentClient__InvalidRecipient.selector ); - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: invalids[0], amount: amount, createdAt: block.timestamp, @@ -101,10 +101,10 @@ contract PaymentClientTest is Test { for (uint i; i < invalids.length; ++i) { vm.expectRevert( - IPaymentClient.Module__PaymentClient__InvalidAmount.selector + IERC20PaymentClient.Module__ERC20PaymentClient__InvalidAmount.selector ); - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: invalids[0], createdAt: block.timestamp, @@ -118,31 +118,31 @@ contract PaymentClientTest is Test { // Test: addPaymentOrders() function testAddPaymentOrders() public { - IPaymentClient.PaymentOrder[] memory ordersToAdd = - new IPaymentClient.PaymentOrder[](3); - ordersToAdd[0] = IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder[] memory ordersToAdd = + new IERC20PaymentClient.PaymentOrder[](3); + ordersToAdd[0] = IERC20PaymentClient.PaymentOrder({ recipient: address(0xCAFE1), amount: 100e18, createdAt: block.timestamp, dueTo: block.timestamp }); - ordersToAdd[1] = IPaymentClient.PaymentOrder({ + ordersToAdd[1] = IERC20PaymentClient.PaymentOrder({ recipient: address(0xCAFE2), amount: 100e18, createdAt: block.timestamp, dueTo: block.timestamp + 1 }); - ordersToAdd[2] = IPaymentClient.PaymentOrder({ + ordersToAdd[2] = IERC20PaymentClient.PaymentOrder({ recipient: address(0xCAFE3), amount: 100e18, createdAt: block.timestamp, dueTo: block.timestamp + 2 }); - paymentClient.addPaymentOrders(ordersToAdd); + ERC20PaymentClient.addPaymentOrders(ordersToAdd); - IPaymentClient.PaymentOrder[] memory orders = - paymentClient.paymentOrders(); + IERC20PaymentClient.PaymentOrder[] memory orders = + ERC20PaymentClient.paymentOrders(); assertEq(orders.length, 3); for (uint i; i < 3; ++i) { @@ -151,7 +151,7 @@ contract PaymentClientTest is Test { assertEq(orders[i].dueTo, ordersToAdd[i].dueTo); } - assertEq(paymentClient.outstandingTokenAmount(), 300e18); + assertEq(ERC20PaymentClient.outstandingTokenAmount(), 300e18); } //---------------------------------- @@ -179,8 +179,8 @@ contract PaymentClientTest is Test { } for (uint i; i < orderAmount; ++i) { - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -189,9 +189,9 @@ contract PaymentClientTest is Test { ); } - IPaymentClient.PaymentOrder[] memory orders; + IERC20PaymentClient.PaymentOrder[] memory orders; uint totalOutstandingAmount; - (orders, totalOutstandingAmount) = paymentClient.collectPaymentOrders(); + (orders, totalOutstandingAmount) = ERC20PaymentClient.collectPaymentOrders(); // Check that orders are correct. assertEq(orders.length, orderAmount); @@ -204,28 +204,28 @@ contract PaymentClientTest is Test { // Check that total outstanding token amount is correct. assertEq(totalOutstandingAmount, orderAmount * amount); - // Check that orders in PaymentClient got reset. - IPaymentClient.PaymentOrder[] memory updatedOrders; - updatedOrders = paymentClient.paymentOrders(); + // Check that orders in ERC20PaymentClient got reset. + IERC20PaymentClient.PaymentOrder[] memory updatedOrders; + updatedOrders = ERC20PaymentClient.paymentOrders(); assertEq(updatedOrders.length, 0); - // Check that outstanding token amount in PaymentClient got reset. - assertEq(paymentClient.outstandingTokenAmount(), 0); + // Check that outstanding token amount in ERC20PaymentClient got reset. + assertEq(ERC20PaymentClient.outstandingTokenAmount(), 0); - // Check that we received allowance to fetch tokens from PaymentClient. + // Check that we received allowance to fetch tokens from ERC20PaymentClient. assertTrue( - token.allowance(address(paymentClient), address(this)) + token.allowance(address(ERC20PaymentClient), address(this)) >= totalOutstandingAmount ); } function testCollectPaymentOrdersFailsCallerNotAuthorized() public { - paymentClient.setIsAuthorized(address(this), false); + ERC20PaymentClient.setIsAuthorized(address(this), false); vm.expectRevert( - IPaymentClient.Module__PaymentClient__CallerNotAuthorized.selector + IERC20PaymentClient.Module__ERC20PaymentClient__CallerNotAuthorized.selector ); - paymentClient.collectPaymentOrders(); + ERC20PaymentClient.collectPaymentOrders(); } //-------------------------------------------------------------------------- @@ -257,7 +257,7 @@ contract PaymentClientTest is Test { address[] memory invalids = new address[](2); invalids[0] = address(0); - invalids[1] = address(paymentClient); + invalids[1] = address(ERC20PaymentClient); return invalids; } diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 00580c540..495d45128 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -16,7 +16,7 @@ import {OZErrors} from "test/utils/errors/OZErrors.sol"; import { BountyManager, IBountyManager, - IPaymentClient + IERC20PaymentClient } from "src/modules/logicModule/BountyManager.sol"; contract BountyManagerTest is ModuleTest { @@ -715,7 +715,7 @@ contract BountyManagerTest is ModuleTest { bountyManager.verifyClaim(claimId, bountyId); - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = bountyManager.paymentOrders(); assertEq(length, orders.length); diff --git a/test/modules/logicModule/MilestoneManager.t.sol b/test/modules/logicModule/MilestoneManager.t.sol index e3bae86c3..9751b3419 100644 --- a/test/modules/logicModule/MilestoneManager.t.sol +++ b/test/modules/logicModule/MilestoneManager.t.sol @@ -14,7 +14,7 @@ import { IMilestoneManager } from "src/modules/logicModule/MilestoneManager.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -905,7 +905,7 @@ contract MilestoneManagerTest is ModuleTest { ); // Check that payment orders were added correctly. - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = milestoneManager.paymentOrders(); assertEq(orders.length, contributors.length); @@ -984,7 +984,7 @@ contract MilestoneManagerTest is ModuleTest { vm.warp(block.timestamp + TIMELOCK + 1); vm.expectRevert( - IPaymentClient.Module__PaymentClient__TokenTransferFailed.selector + IERC20PaymentClient.Module__ERC20PaymentClient__TokenTransferFailed.selector ); milestoneManager.startNextMilestone(); } @@ -1847,7 +1847,7 @@ contract MilestoneManagerTest is ModuleTest { //Make sure the values in the payment orders are the same // Check that payment orders were added correctly. - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = milestoneManager.paymentOrders(); for (uint i = 1; i < orders.length; ++i) { @@ -1895,7 +1895,7 @@ contract MilestoneManagerTest is ModuleTest { //Make sure the values in the payment orders are the same // Check that payment orders were added correctly. - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = milestoneManager.paymentOrders(); for (uint i = 1; i < orders.length; ++i) { diff --git a/test/modules/logicModule/RecurringPaymentManager.t.sol b/test/modules/logicModule/RecurringPaymentManager.t.sol index 0ba51ba9c..e8832473c 100644 --- a/test/modules/logicModule/RecurringPaymentManager.t.sol +++ b/test/modules/logicModule/RecurringPaymentManager.t.sol @@ -16,7 +16,7 @@ import {OZErrors} from "test/utils/errors/OZErrors.sol"; import { RecurringPaymentManager, IRecurringPaymentManager, - IPaymentClient + IERC20PaymentClient } from "src/modules/logicModule/RecurringPaymentManager.sol"; contract RecurringPaymentManagerTest is ModuleTest { @@ -259,7 +259,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //validAmount vm.expectRevert( - IPaymentClient.Module__PaymentClient__InvalidAmount.selector + IERC20PaymentClient.Module__ERC20PaymentClient__InvalidAmount.selector ); recurringPaymentManager.addRecurringPayment(0, 2 weeks, address(0xBEEF)); @@ -275,7 +275,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //validRecipient vm.expectRevert( - IPaymentClient.Module__PaymentClient__InvalidRecipient.selector + IERC20PaymentClient.Module__ERC20PaymentClient__InvalidRecipient.selector ); recurringPaymentManager.addRecurringPayment(1, 2 weeks, address(0)); } @@ -399,7 +399,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //remove tokens and orders from recurringPaymentManager for easier testing _paymentProcessor.deleteAllPayments( - IPaymentClient(address(recurringPaymentManager)) + IERC20PaymentClient(address(recurringPaymentManager)) ); _token.burn( address(recurringPaymentManager), @@ -435,7 +435,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //remove tokens and orders from recurringPaymentManager for easier testing _paymentProcessor.deleteAllPayments( - IPaymentClient(address(recurringPaymentManager)) + IERC20PaymentClient(address(recurringPaymentManager)) ); _token.burn( address(recurringPaymentManager), @@ -657,7 +657,7 @@ contract RecurringPaymentManagerTest is ModuleTest { ) internal { uint length = recurringPaymentsToBeChecked.length; - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = recurringPaymentManager.paymentOrders(); assertEq(length, currentRecurringPayments.length); @@ -731,7 +731,7 @@ contract RecurringPaymentManagerTest is ModuleTest { } function assertOrder( - IPaymentClient.PaymentOrder memory order, + IERC20PaymentClient.PaymentOrder memory order, address recipient, uint amount, uint createdAt, diff --git a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol index f51db11ff..8bab08470 100644 --- a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol @@ -14,9 +14,9 @@ import { // Mocks import { - IPaymentClient, - PaymentClientMock -} from "test/utils/mocks/modules/mixins/PaymentClientMock.sol"; + IERC20PaymentClient, + ERC20PaymentClientMock +} from "test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -29,7 +29,7 @@ contract SimplePaymentProcessorTest is ModuleTest { SimplePaymentProcessor paymentProcessor; // Mocks - PaymentClientMock paymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock ERC20PaymentClient = new ERC20PaymentClientMock(_token); function setUp() public { address impl = address(new SimplePaymentProcessor()); @@ -39,11 +39,11 @@ contract SimplePaymentProcessorTest is ModuleTest { _authorizer.setIsAuthorized(address(this), true); - _proposal.addModule(address(paymentClient)); + _proposal.addModule(address(ERC20PaymentClient)); paymentProcessor.init(_proposal, _METADATA, bytes("")); - paymentClient.setIsAuthorized(address(paymentProcessor), true); + ERC20PaymentClient.setIsAuthorized(address(paymentProcessor), true); } //-------------------------------------------------------------------------- @@ -90,13 +90,13 @@ contract SimplePaymentProcessorTest is ModuleTest { function testProcessPayments(address recipient, uint amount) public { vm.assume(recipient != address(paymentProcessor)); - vm.assume(recipient != address(paymentClient)); + vm.assume(recipient != address(ERC20PaymentClient)); vm.assume(recipient != address(0)); vm.assume(amount != 0); // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -105,12 +105,12 @@ contract SimplePaymentProcessorTest is ModuleTest { ); // Call processPayments. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); // Check correct balances. assertEq(_token.balanceOf(address(recipient)), amount); - assertEq(_token.balanceOf(address(paymentClient)), 0); + assertEq(_token.balanceOf(address(ERC20PaymentClient)), 0); // Invariant: Payment processor does not hold funds. assertEq(_token.balanceOf(address(paymentProcessor)), 0); @@ -120,7 +120,7 @@ contract SimplePaymentProcessorTest is ModuleTest { public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(paymentClient)); + vm.assume(nonModule != address(ERC20PaymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. @@ -135,23 +135,23 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(paymentClient); + paymentProcessor.processPayments(ERC20PaymentClient); } function testProcessPaymentsFailsWhenCalledOnOtherClient(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(paymentClient)); + vm.assume(nonModule != address(ERC20PaymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock otherERC20PaymentClient = new ERC20PaymentClientMock(_token); - vm.prank(address(paymentClient)); + vm.prank(address(ERC20PaymentClient)); vm.expectRevert( abi.encodeWithSelector( IPaymentProcessor @@ -159,14 +159,14 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(otherPaymentClient); + paymentProcessor.processPayments(otherERC20PaymentClient); } function testCancelPaymentsFailsWhenCalledByNonModule(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(paymentClient)); + vm.assume(nonModule != address(ERC20PaymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. @@ -181,23 +181,23 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(paymentClient); + paymentProcessor.cancelRunningPayments(ERC20PaymentClient); } function testCancelPaymentsFailsWhenCalledOnOtherClient(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(paymentClient)); + vm.assume(nonModule != address(ERC20PaymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock otherERC20PaymentClient = new ERC20PaymentClientMock(_token); - vm.prank(address(paymentClient)); + vm.prank(address(ERC20PaymentClient)); vm.expectRevert( abi.encodeWithSelector( IPaymentProcessor @@ -205,6 +205,6 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(otherPaymentClient); + paymentProcessor.cancelRunningPayments(otherERC20PaymentClient); } } diff --git a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol index 3c42eff75..7480f3b01 100644 --- a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol @@ -17,9 +17,9 @@ import { // Mocks import { - IPaymentClient, - PaymentClientMock -} from "test/utils/mocks/modules/mixins/PaymentClientMock.sol"; + IERC20PaymentClient, + ERC20PaymentClientMock +} from "test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -32,14 +32,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { StreamingPaymentProcessor paymentProcessor; // Mocks - PaymentClientMock paymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock ERC20PaymentClient = new ERC20PaymentClientMock(_token); event InvalidStreamingOrderDiscarded( address indexed recipient, uint amount, uint start, uint dueTo ); event StreamingPaymentAdded( - address indexed paymentClient, + address indexed ERC20PaymentClient, address indexed recipient, uint amount, uint start, @@ -48,7 +48,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); event StreamingPaymentRemoved( - address indexed paymentClient, + address indexed ERC20PaymentClient, address indexed recipient, uint indexed walletId ); @@ -61,11 +61,11 @@ contract StreamingPaymentProcessorTest is ModuleTest { _authorizer.setIsAuthorized(address(this), true); - _proposal.addModule(address(paymentClient)); + _proposal.addModule(address(ERC20PaymentClient)); paymentProcessor.init(_proposal, _METADATA, bytes("")); - paymentClient.setIsAuthorized(address(paymentProcessor), true); + ERC20PaymentClient.setIsAuthorized(address(paymentProcessor), true); } //-------------------------------------------------------------------------- @@ -133,8 +133,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: amount, createdAt: block.timestamp, @@ -146,18 +146,18 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); for (uint i; i < recipients.length;) { assertTrue( paymentProcessor.isActiveContributor( - address(paymentClient), recipients[i] + address(ERC20PaymentClient), recipients[i] ) ); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), + address(ERC20PaymentClient), recipients[i], 1 // 1 is the first default wallet ID for all unique recepients ), @@ -169,7 +169,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { } } - assertEq(totalAmount, _token.balanceOf(address(paymentClient))); + assertEq(totalAmount, _token.balanceOf(address(ERC20PaymentClient))); } function test_claimVestedAmounts_fullVesting( @@ -195,8 +195,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: amount, createdAt: block.timestamp, @@ -208,18 +208,18 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); for (uint i; i < recipients.length;) { assertTrue( paymentProcessor.isActiveContributor( - address(paymentClient), recipients[i] + address(ERC20PaymentClient), recipients[i] ) ); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), + address(ERC20PaymentClient), recipients[i], 1 // 1 is the first default wallet ID for all unique recepients ), @@ -231,7 +231,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { } } - assertEq(totalAmount, _token.balanceOf(address(paymentClient))); + assertEq(totalAmount, _token.balanceOf(address(ERC20PaymentClient))); // Moving ahead in time, past the longest vesting period vm.warp(block.timestamp + (max_time + 1)); @@ -239,7 +239,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // All recepients try to claim their vested tokens for (uint i; i < recipients.length;) { vm.prank(recipients[i]); - paymentProcessor.claimAll(paymentClient); + paymentProcessor.claimAll(ERC20PaymentClient); unchecked { ++i; } @@ -256,7 +256,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), + address(ERC20PaymentClient), recipients[i], 1 // 1 is the first default wallet ID for all unique recepients ), @@ -289,8 +289,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { for (uint i; i < length; i++) { // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: payoutAmount, createdAt: block.timestamp, @@ -299,34 +299,34 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); } - IPaymentClient.PaymentOrder[] memory orders = - paymentClient.paymentOrders(); + IERC20PaymentClient.PaymentOrder[] memory orders = + ERC20PaymentClient.paymentOrders(); // Call processPayments - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); for (uint i; i < length; i++) { address recipient = recipients[i]; - IPaymentClient.PaymentOrder memory order = orders[i]; + IERC20PaymentClient.PaymentOrder memory order = orders[i]; //If dueTo is before currentTimestamp evereything should be releasable if (order.dueTo <= block.timestamp) { assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), address(recipient), 1 + address(ERC20PaymentClient), address(recipient), 1 ), payoutAmount ); vm.prank(recipient); - paymentProcessor.claimAll(paymentClient); + paymentProcessor.claimAll(ERC20PaymentClient); // Check correct balances. assertEq(_token.balanceOf(recipient), payoutAmount); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); @@ -340,11 +340,11 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint invalidAmt = 0; vm.warp(1000); - vm.startPrank(address(paymentClient)); + vm.startPrank(address(ERC20PaymentClient)); //we don't mind about adding address(this)in this case for (uint i = 0; i < recipients.length - 1; ++i) { - paymentClient.addPaymentOrderUnchecked( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrderUnchecked( + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: 100, createdAt: block.timestamp, @@ -361,10 +361,10 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments and expect emits - paymentProcessor.processPayments(paymentClient); + paymentProcessor.processPayments(ERC20PaymentClient); - paymentClient.addPaymentOrderUnchecked( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrderUnchecked( + IERC20PaymentClient.PaymentOrder({ recipient: address(0xB0B), amount: invalidAmt, createdAt: block.timestamp, @@ -375,7 +375,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { emit InvalidStreamingOrderDiscarded( address(0xB0B), invalidAmt, block.timestamp, block.timestamp + 100 ); - paymentProcessor.processPayments(paymentClient); + paymentProcessor.processPayments(ERC20PaymentClient); vm.stopPrank(); } @@ -394,8 +394,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { speedRunStreamingAndClaim(recipients, amounts, durations); //We run process payments again, but since there are no new orders, nothing should happen. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); for (uint i; i < recipients.length; i++) { address recipient = recipients[i]; @@ -403,7 +403,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Check that the vesting information is deleted once vested tokens are claimed after total vesting duration assertEq( paymentProcessor.vestedAmountForSpecificWalletId( - address(paymentClient), + address(ERC20PaymentClient), address(recipient), block.timestamp, 1 @@ -451,8 +451,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint time = durations_1[i]; // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -462,8 +462,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); // Let's travel in time, to the point after contributor1's tokens are fully vested. // Also, remember, nothing is claimed yet @@ -492,8 +492,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint time = durations_2[i]; // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -503,14 +503,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); // Now, let's check whether all vesting informations exist or not // checking for contributor2 IStreamingPaymentProcessor.VestingWallet[] memory contributorWallets; contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(paymentClient), contributor2 + address(ERC20PaymentClient), contributor2 ); assertTrue(contributorWallets.length == 2); @@ -522,7 +522,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // checking for contributor3 contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(paymentClient), contributor3 + address(ERC20PaymentClient), contributor3 ); assertTrue(contributorWallets.length == 2); @@ -534,7 +534,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // checking for contributor 4 contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(paymentClient), contributor4 + address(ERC20PaymentClient), contributor4 ); assertTrue(contributorWallets.length == 1); @@ -546,7 +546,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // checking for contributor 1 contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(paymentClient), contributor1 + address(ERC20PaymentClient), contributor1 ); assertTrue(contributorWallets.length == 1); @@ -604,8 +604,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint time = durations[i]; // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -615,8 +615,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); // Let's travel in time, to the point after contributor1's tokens for the second payment order // are 1/2 vested. @@ -626,7 +626,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // contributor by 1/2 of the vested token amount IStreamingPaymentProcessor.VestingWallet[] memory contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(paymentClient), contributor1 + address(ERC20PaymentClient), contributor1 ); // We are interested in finding the details of the 2nd wallet of contributor1 @@ -641,11 +641,11 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyAuthorized can call the next function paymentProcessor.removePaymentForSpecificWalletId( - paymentClient, contributor1, walletId, false + ERC20PaymentClient, contributor1, walletId, false ); contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(paymentClient), contributor1 + address(ERC20PaymentClient), contributor1 ); finalNumWallets = contributorWallets.length; @@ -711,8 +711,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint time = durations[i]; // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -722,8 +722,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); // Let's travel in time, to the point after contributor1's tokens for the second payment order // are 1/2 vested, or the complete vesting of duration of the first payment order @@ -734,7 +734,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { IStreamingPaymentProcessor.VestingWallet[] memory contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(paymentClient), contributor1 + address(ERC20PaymentClient), contributor1 ); salary1 = contributorWallets[0]._salary; @@ -742,7 +742,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Now we claim the entire salary from the first payment order vm.prank(contributor1); paymentProcessor.claimForSpecificWalletId( - paymentClient, contributorWallets[0]._vestingWalletID, false + ERC20PaymentClient, contributorWallets[0]._vestingWalletID, false ); // Now we note down the balance of the contributor1 again after claiming for the first wallet. @@ -758,14 +758,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyAuthorized can call the next function paymentProcessor.removePaymentForSpecificWalletId( - paymentClient, + ERC20PaymentClient, contributor1, contributorWallets[1]._vestingWalletID, false ); contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(paymentClient), contributor1 + address(ERC20PaymentClient), contributor1 ); finalNumWallets = contributorWallets.length; @@ -782,7 +782,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.prank(contributor1); paymentProcessor.claimForSpecificWalletId( - paymentClient, contributorWallets[0]._vestingWalletID, false + ERC20PaymentClient, contributorWallets[0]._vestingWalletID, false ); finalContributorBalance = _token.balanceOf(contributor1); @@ -794,7 +794,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(paymentClient)); + vm.assume(nonModule != address(ERC20PaymentClient)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); @@ -809,23 +809,23 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(paymentClient); + paymentProcessor.processPayments(ERC20PaymentClient); } function testProcessPaymentsFailsWhenCalledOnOtherClient(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(paymentClient)); + vm.assume(nonModule != address(ERC20PaymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock otherERC20PaymentClient = new ERC20PaymentClientMock(_token); - vm.prank(address(paymentClient)); + vm.prank(address(ERC20PaymentClient)); vm.expectRevert( abi.encodeWithSelector( IPaymentProcessor @@ -833,7 +833,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(otherPaymentClient); + paymentProcessor.processPayments(otherERC20PaymentClient); } function test_cancelRunningPayments_allCreatedOrdersGetCancelled( @@ -848,8 +848,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint duration = 4 weeks; for (uint i = 0; i < length; ++i) { - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: amounts[i], createdAt: block.timestamp, @@ -861,7 +861,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { for (uint i = 0; i < length; ++i) { vm.expectEmit(true, true, true, true); emit StreamingPaymentAdded( - address(paymentClient), + address(ERC20PaymentClient), recipients[i], amounts[i], block.timestamp, @@ -871,8 +871,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments and expect emits - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); // FF to half the max_duration vm.warp(block.timestamp + 2 weeks); @@ -883,13 +883,13 @@ contract StreamingPaymentProcessorTest is ModuleTest { // we can expect all recipient to be unique due to the call to assumeValidRecipients. // Therefore, the walletId of all these contributors would be 1. emit StreamingPaymentRemoved( - address(paymentClient), recipients[i], 1 + address(ERC20PaymentClient), recipients[i], 1 ); } // calling cancelRunningPayments - vm.prank(address(paymentClient)); - paymentProcessor.cancelRunningPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.cancelRunningPayments(ERC20PaymentClient); // make sure the payments have been reset @@ -898,31 +898,31 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq( paymentProcessor.startForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); assertEq( paymentProcessor.dueToForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); assertEq( paymentProcessor.releasedForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); assertEq( paymentProcessor.vestedAmountForSpecificWalletId( - address(paymentClient), recipient, block.timestamp, 1 + address(ERC20PaymentClient), recipient, block.timestamp, 1 ), 0 ); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); @@ -933,7 +933,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(paymentClient)); + vm.assume(nonModule != address(ERC20PaymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. @@ -948,23 +948,23 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(paymentClient); + paymentProcessor.cancelRunningPayments(ERC20PaymentClient); } function testCancelPaymentsFailsWhenCalledOnOtherClient(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(paymentClient)); + vm.assume(nonModule != address(ERC20PaymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock otherERC20PaymentClient = new ERC20PaymentClientMock(_token); - vm.prank(address(paymentClient)); + vm.prank(address(ERC20PaymentClient)); vm.expectRevert( abi.encodeWithSelector( IPaymentProcessor @@ -972,7 +972,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(otherPaymentClient); + paymentProcessor.cancelRunningPayments(otherERC20PaymentClient); } //This test creates a new set of payments in a client which finished all running payments. @@ -1000,8 +1000,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amounts[i], createdAt: block.timestamp, @@ -1010,19 +1010,19 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); } - // make sure all the balances are transfered to paymentClient - assertTrue(_token.balanceOf(address(paymentClient)) == total_amount); + // make sure all the balances are transfered to ERC20PaymentClient + assertTrue(_token.balanceOf(address(ERC20PaymentClient)) == total_amount); // Call processPayments. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); // FF to half the max_duration vm.warp(max_duration / 2); // calling cancelRunningPayments also calls claim() so no need to repeat? - vm.prank(address(paymentClient)); - paymentProcessor.cancelRunningPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.cancelRunningPayments(ERC20PaymentClient); // measure recipients balances before attempting second claim. uint[] memory balancesBefore = new uint256[](recipients.length); @@ -1044,11 +1044,11 @@ contract StreamingPaymentProcessorTest is ModuleTest { IStreamingPaymentProcessor .Module__PaymentProcessor__NothingToClaim .selector, - address(paymentClient), + address(ERC20PaymentClient), recipient ) ); - paymentProcessor.claimAll(paymentClient); + paymentProcessor.claimAll(ERC20PaymentClient); vm.stopPrank(); uint balanceAfter = _token.balanceOf(recipient); @@ -1056,7 +1056,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq(balancesBefore[i], balanceAfter); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); @@ -1082,8 +1082,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint amount = amounts[i]; // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -1092,8 +1092,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); } - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); for (uint z = 0; z <= duration; z += 1 hours) { //we check each hour @@ -1106,7 +1106,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq( claimableAmt, paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ) ); } @@ -1138,14 +1138,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq(_token.balanceOf(address(recipient)), amount); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), address(recipient), 1 + address(ERC20PaymentClient), address(recipient), 1 ), 0 ); } - // No funds left in the PaymentClient - assertEq(_token.balanceOf(address(paymentClient)), 0); + // No funds left in the ERC20PaymentClient + assertEq(_token.balanceOf(address(ERC20PaymentClient)), 0); // Invariant: Payment processor does not hold funds. assertEq(_token.balanceOf(address(paymentProcessor)), 0); @@ -1165,33 +1165,33 @@ contract StreamingPaymentProcessorTest is ModuleTest { blockAddress(recipient); // Add payment order to client and call processPayments. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, dueTo: block.timestamp + duration }) ); - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); // FF 25% and claim. vm.warp(block.timestamp + duration / 4); vm.prank(recipient); - paymentProcessor.claimAll(paymentClient); + paymentProcessor.claimAll(ERC20PaymentClient); // after failed claim attempt receiver should receive 0 token, // while VPP should move recipient's balances from 'releasable' to 'unclaimable' assertEq(_token.balanceOf(address(recipient)), 0); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); assertEq( - paymentProcessor.unclaimable(address(paymentClient), recipient), + paymentProcessor.unclaimable(address(ERC20PaymentClient), recipient), amount / 4 ); @@ -1201,19 +1201,19 @@ contract StreamingPaymentProcessorTest is ModuleTest { // FF 25% and claim. vm.warp(block.timestamp + duration / 4); vm.prank(recipient); - paymentProcessor.claimAll(paymentClient); + paymentProcessor.claimAll(ERC20PaymentClient); // after successful claim attempt receiver should 50% total, // while both 'releasable' and 'unclaimable' recipient's amounts should be 0 assertEq(_token.balanceOf(address(recipient)), amount / 2); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); assertEq( - paymentProcessor.unclaimable(address(paymentClient), recipient), 0 + paymentProcessor.unclaimable(address(ERC20PaymentClient), recipient), 0 ); } @@ -1228,16 +1228,16 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint duration = 10 days; // Add payment order to client and call processPayments. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, dueTo: block.timestamp + duration }) ); - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); // transfers will fail by returning false now _token.toggleReturnFalse(); @@ -1245,19 +1245,19 @@ contract StreamingPaymentProcessorTest is ModuleTest { // FF 25% and claim. vm.warp(block.timestamp + duration / 4); vm.prank(recipient); - paymentProcessor.claimAll(paymentClient); + paymentProcessor.claimAll(ERC20PaymentClient); // after failed claim attempt receiver should receive 0 token, // while VPP should move recipient's balances from 'releasable' to 'unclaimable' assertEq(_token.balanceOf(address(recipient)), 0); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); assertEq( - paymentProcessor.unclaimable(address(paymentClient), recipient), + paymentProcessor.unclaimable(address(ERC20PaymentClient), recipient), amount / 4 ); @@ -1267,19 +1267,19 @@ contract StreamingPaymentProcessorTest is ModuleTest { // FF 25% and claim. vm.warp(block.timestamp + duration / 4); vm.prank(recipient); - paymentProcessor.claimAll(paymentClient); + paymentProcessor.claimAll(ERC20PaymentClient); // after successful claim attempt receiver should 50% total, // while both 'releasable' and 'unclaimable' recipient's amounts should be 0 assertEq(_token.balanceOf(address(recipient)), amount / 2); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(paymentClient), recipient, 1 + address(ERC20PaymentClient), recipient, 1 ), 0 ); assertEq( - paymentProcessor.unclaimable(address(paymentClient), recipient), 0 + paymentProcessor.unclaimable(address(ERC20PaymentClient), recipient), 0 ); } @@ -1303,8 +1303,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Add payment order to client. - paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + ERC20PaymentClient.addPaymentOrder( + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: amounts[i], createdAt: block.timestamp, @@ -1314,14 +1314,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(paymentClient)); - paymentProcessor.processPayments(paymentClient); + vm.prank(address(ERC20PaymentClient)); + paymentProcessor.processPayments(ERC20PaymentClient); vm.warp(block.timestamp + max_time + 1); for (uint i; i < recipients.length; i++) { vm.prank(address(recipients[i])); - paymentProcessor.claimAll(paymentClient); + paymentProcessor.claimAll(ERC20PaymentClient); } } @@ -1369,7 +1369,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { invalids[0] = address(0); invalids[1] = address(_proposal); invalids[2] = address(paymentProcessor); - invalids[3] = address(paymentClient); + invalids[3] = address(ERC20PaymentClient); invalids[4] = address(this); return invalids; diff --git a/test/utils/mocks/modules/PaymentProcessorMock.sol b/test/utils/mocks/modules/PaymentProcessorMock.sol index 85d1671a7..102eb64a5 100644 --- a/test/utils/mocks/modules/PaymentProcessorMock.sol +++ b/test/utils/mocks/modules/PaymentProcessorMock.sol @@ -5,21 +5,21 @@ import {IERC20} from "@oz/token/ERC20/IERC20.sol"; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; contract PaymentProcessorMock is IPaymentProcessor { //-------------------------------------------------------------------------- // IPaymentProcessor Functions - function processPayments(IPaymentClient client) external {} + function processPayments(IERC20PaymentClient client) external {} - function cancelRunningPayments(IPaymentClient client) external {} + function cancelRunningPayments(IERC20PaymentClient client) external {} function token() external pure returns (IERC20) { return IERC20(address(0)); } - function deleteAllPayments(IPaymentClient client) external { + function deleteAllPayments(IERC20PaymentClient client) external { client.collectPaymentOrders(); } } diff --git a/test/utils/mocks/modules/mixins/PaymentClientMock.sol b/test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol similarity index 85% rename from test/utils/mocks/modules/mixins/PaymentClientMock.sol rename to test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol index 091180a90..7c470f7d3 100644 --- a/test/utils/mocks/modules/mixins/PaymentClientMock.sol +++ b/test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol @@ -3,9 +3,9 @@ pragma solidity ^0.8.0; // SuT import { - PaymentClient, - IPaymentClient -} from "src/modules/base/mixins/PaymentClient.sol"; + ERC20PaymentClient, + IERC20PaymentClient +} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces import {IPaymentProcessor} from @@ -14,7 +14,7 @@ import {IPaymentProcessor} from // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; -contract PaymentClientMock is PaymentClient { +contract ERC20PaymentClientMock is ERC20PaymentClient { ERC20Mock token; mapping(address => bool) authorized; @@ -31,7 +31,7 @@ contract PaymentClientMock is PaymentClient { } //-------------------------------------------------------------------------- - // IPaymentClient Wrapper Functions + // IERC20PaymentClient Wrapper Functions function addPaymentOrder(PaymentOrder memory order) external { _addPaymentOrder(order); @@ -57,11 +57,11 @@ contract PaymentClientMock is PaymentClient { } //-------------------------------------------------------------------------- - // IPaymentClient Overriden Functions + // IERC20PaymentClient Overriden Functions function _ensureTokenBalance(uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { if (token.balanceOf(address(this)) >= amount) { return; @@ -73,7 +73,7 @@ contract PaymentClientMock is PaymentClient { function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { token.approve(address(spender), amount); } @@ -81,7 +81,7 @@ contract PaymentClientMock is PaymentClient { function _isAuthorizedPaymentProcessor(IPaymentProcessor) internal view - override(PaymentClient) + override(ERC20PaymentClient) returns (bool) { return authorized[_msgSender()]; From 7b433221fc19cfb2c8cd937c54d7343ca0640ba5 Mon Sep 17 00:00:00 2001 From: FHieser Date: Tue, 1 Aug 2023 12:17:33 +0200 Subject: [PATCH 2/7] Revert "Rename to ERC20PaymentClient" This reverts commit ac66c536332390db963d8d81ea5a137ef8dc67e6. --- ...20PaymentClient.sol => IPaymentClient.sol} | 14 +- ...C20PaymentClient.sol => PaymentClient.sol} | 28 +- src/modules/logicModule/BountyManager.sol | 20 +- src/modules/logicModule/IBountyManager.sol | 4 +- src/modules/logicModule/IMilestoneManager.sol | 4 +- src/modules/logicModule/MilestoneManager.sol | 22 +- .../logicModule/RecurringPaymentManager.sol | 20 +- .../paymentProcessor/IPaymentProcessor.sol | 18 +- .../IStreamingPaymentProcessor.sol | 54 ++-- .../SimplePaymentProcessor.sol | 14 +- .../StreamingPaymentProcessor.sol | 38 +-- test/e2e/BountyManagerLifecycle.t.sol | 4 +- test/e2e/MilestoneLifecycle.t.sol | 2 +- test/e2e/RecurringPayments.t.sol | 4 +- test/modules/base/mixins/PaymentClient.t.sol | 84 +++--- test/modules/logicModule/BountyManager.t.sol | 4 +- .../logicModule/MilestoneManager.t.sol | 10 +- .../logicModule/RecurringPaymentManager.t.sol | 14 +- .../SimplePaymentProcessor.t.sol | 48 +-- .../StreamingPaymentProcessor.t.sol | 284 +++++++++--------- .../mocks/modules/PaymentProcessorMock.sol | 8 +- ...ntClientMock.sol => PaymentClientMock.sol} | 18 +- 22 files changed, 358 insertions(+), 358 deletions(-) rename src/modules/base/mixins/{IERC20PaymentClient.sol => IPaymentClient.sol} (84%) rename src/modules/base/mixins/{ERC20PaymentClient.sol => PaymentClient.sol} (89%) rename test/utils/mocks/modules/mixins/{ERC20PaymentClientMock.sol => PaymentClientMock.sol} (85%) diff --git a/src/modules/base/mixins/IERC20PaymentClient.sol b/src/modules/base/mixins/IPaymentClient.sol similarity index 84% rename from src/modules/base/mixins/IERC20PaymentClient.sol rename to src/modules/base/mixins/IPaymentClient.sol index aff0d9844..1d640ee94 100644 --- a/src/modules/base/mixins/IERC20PaymentClient.sol +++ b/src/modules/base/mixins/IPaymentClient.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; -interface IERC20PaymentClient { +interface IPaymentClient { struct PaymentOrder { /// @dev The recipient of the payment. address recipient; @@ -21,22 +21,22 @@ interface IERC20PaymentClient { // Errors /// @notice Function is only callable by authorized address. - error Module__ERC20PaymentClient__CallerNotAuthorized(); + error Module__PaymentClient__CallerNotAuthorized(); /// @notice ERC20 token transfer failed. - error Module__ERC20PaymentClient__TokenTransferFailed(); + error Module__PaymentClient__TokenTransferFailed(); /// @notice Given recipient invalid. - error Module__ERC20PaymentClient__InvalidRecipient(); + error Module__PaymentClient__InvalidRecipient(); /// @notice Given amount invalid. - error Module__ERC20PaymentClient__InvalidAmount(); + error Module__PaymentClient__InvalidAmount(); /// @notice Given dueTo invalid. - error Module__ERC20PaymentClient__InvalidDueTo(); + error Module__PaymentClient__InvalidDueTo(); /// @notice Given arrays' length mismatch. - error Module__ERC20PaymentClient__ArrayLengthMismatch(); + error Module__PaymentClient__ArrayLengthMismatch(); //-------------------------------------------------------------------------- // Events diff --git a/src/modules/base/mixins/ERC20PaymentClient.sol b/src/modules/base/mixins/PaymentClient.sol similarity index 89% rename from src/modules/base/mixins/ERC20PaymentClient.sol rename to src/modules/base/mixins/PaymentClient.sol index b9aee69b7..ae9d74ba3 100644 --- a/src/modules/base/mixins/ERC20PaymentClient.sol +++ b/src/modules/base/mixins/PaymentClient.sol @@ -6,19 +6,19 @@ import {ContextUpgradeable} from "@oz-up/utils/ContextUpgradeable.sol"; // Internal Dependencies import { - IERC20PaymentClient, + IPaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/IERC20PaymentClient.sol"; +} from "src/modules/base/mixins/IPaymentClient.sol"; /** - * @title ERC20PaymentClient + * @title PaymentClient * - * @dev The ERC20PaymentClient mixin enables modules to create payment orders that + * @dev The PaymentClient mixin enables modules to create payment orders that * are processable by a proposal's {IPaymentProcessor} module. * * @author Inverter Network */ -abstract contract ERC20PaymentClient is IERC20PaymentClient, ContextUpgradeable { +abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { //-------------------------------------------------------------------------- // Modifiers @@ -122,9 +122,9 @@ abstract contract ERC20PaymentClient is IERC20PaymentClient, ContextUpgradeable } //-------------------------------------------------------------------------- - // IERC20PaymentClient Functions + // IPaymentClient Functions - /// @inheritdoc IERC20PaymentClient + /// @inheritdoc IPaymentClient function collectPaymentOrders() external virtual @@ -133,7 +133,7 @@ abstract contract ERC20PaymentClient is IERC20PaymentClient, ContextUpgradeable // Ensure caller is authorized to act as payment processor. // Note that function is implemented in downstream contract. if (!_isAuthorizedPaymentProcessor(IPaymentProcessor(_msgSender()))) { - revert Module__ERC20PaymentClient__CallerNotAuthorized(); + revert Module__PaymentClient__CallerNotAuthorized(); } // Ensure payment processor is able to fetch the tokens from @@ -169,7 +169,7 @@ abstract contract ERC20PaymentClient is IERC20PaymentClient, ContextUpgradeable return (copy, outstandingTokenAmountCache); } - /// @inheritdoc IERC20PaymentClient + /// @inheritdoc IPaymentClient function paymentOrders() external view @@ -179,7 +179,7 @@ abstract contract ERC20PaymentClient is IERC20PaymentClient, ContextUpgradeable return _orders; } - /// @inheritdoc IERC20PaymentClient + /// @inheritdoc IPaymentClient function outstandingTokenAmount() external view virtual returns (uint) { return _outstandingTokenAmount; } @@ -189,20 +189,20 @@ abstract contract ERC20PaymentClient is IERC20PaymentClient, ContextUpgradeable function _ensureValidRecipient(address recipient) private view { if (recipient == address(0) || recipient == address(this)) { - revert Module__ERC20PaymentClient__InvalidRecipient(); + revert Module__PaymentClient__InvalidRecipient(); } } function _ensureValidAmount(uint amount) private pure { - if (amount == 0) revert Module__ERC20PaymentClient__InvalidAmount(); + if (amount == 0) revert Module__PaymentClient__InvalidAmount(); } function _ensureValidPaymentOrder(PaymentOrder memory order) private view { if (order.amount == 0) { - revert Module__ERC20PaymentClient__InvalidAmount(); + revert Module__PaymentClient__InvalidAmount(); } if (order.recipient == address(0) || order.recipient == address(this)) { - revert Module__ERC20PaymentClient__InvalidRecipient(); + revert Module__PaymentClient__InvalidRecipient(); } } } diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index 748112962..0e35fa47a 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -11,7 +11,7 @@ import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; // Internal Dependencies import {Module} from "src/modules/base/Module.sol"; -import {ERC20PaymentClient} from "src/modules/base/mixins/ERC20PaymentClient.sol"; +import {PaymentClient} from "src/modules/base/mixins/PaymentClient.sol"; // Internal Interfaces import {IProposal} from "src/proposal/IProposal.sol"; @@ -19,9 +19,9 @@ import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; import {IBountyManager} from "src/modules/logicModule/IBountyManager.sol"; import { - IERC20PaymentClient, + IPaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/ERC20PaymentClient.sol"; +} from "src/modules/base/mixins/PaymentClient.sol"; // Internal Libraries import {LinkedIdList} from "src/common/LinkedIdList.sol"; @@ -32,7 +32,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; //This will be changed in the coming future, //but till then the RoleAuthorizer has to be selected as the Authorizer Module of the proposal if the BountyManager is to be used -contract BountyManager is IBountyManager, Module, ERC20PaymentClient { +contract BountyManager is IBountyManager, Module, PaymentClient { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; using LinkedIdList for LinkedIdList.List; @@ -453,7 +453,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { //when done process the Payments correctly __Module_proposal.paymentProcessor().processPayments( - IERC20PaymentClient(address(this)) + IPaymentClient(address(this)) ); //Set completed to true @@ -509,11 +509,11 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { } //-------------------------------------------------------------------------- - // {ERC20PaymentClient} Function Implementations + // {PaymentClient} Function Implementations function _ensureTokenBalance(uint amount) internal - override(ERC20PaymentClient) + override(PaymentClient) { uint balance = __Module_proposal.token().balanceOf(address(this)); @@ -531,14 +531,14 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { ); if (!ok) { - revert Module__ERC20PaymentClient__TokenTransferFailed(); + revert Module__PaymentClient__TokenTransferFailed(); } } } function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(ERC20PaymentClient) + override(PaymentClient) { IERC20 token = __Module_proposal.token(); uint allowance = token.allowance(address(this), address(spender)); @@ -551,7 +551,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { function _isAuthorizedPaymentProcessor(IPaymentProcessor who) internal view - override(ERC20PaymentClient) + override(PaymentClient) returns (bool) { return __Module_proposal.paymentProcessor() == who; diff --git a/src/modules/logicModule/IBountyManager.sol b/src/modules/logicModule/IBountyManager.sol index add21f5aa..5e04b0642 100644 --- a/src/modules/logicModule/IBountyManager.sol +++ b/src/modules/logicModule/IBountyManager.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; +import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; -interface IBountyManager is IERC20PaymentClient { +interface IBountyManager is IPaymentClient { //-------------------------------------------------------------------------- // Enums diff --git a/src/modules/logicModule/IMilestoneManager.sol b/src/modules/logicModule/IMilestoneManager.sol index 645885353..e0aac4e99 100644 --- a/src/modules/logicModule/IMilestoneManager.sol +++ b/src/modules/logicModule/IMilestoneManager.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; +import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; -interface IMilestoneManager is IERC20PaymentClient { +interface IMilestoneManager is IPaymentClient { //-------------------------------------------------------------------------- // Types diff --git a/src/modules/logicModule/MilestoneManager.sol b/src/modules/logicModule/MilestoneManager.sol index fb2b3c2fc..5a0020386 100644 --- a/src/modules/logicModule/MilestoneManager.sol +++ b/src/modules/logicModule/MilestoneManager.sol @@ -10,10 +10,10 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Internal Dependencies import {Module, ContextUpgradeable} from "src/modules/base/Module.sol"; import { - IERC20PaymentClient, - ERC20PaymentClient, + IPaymentClient, + PaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/ERC20PaymentClient.sol"; +} from "src/modules/base/mixins/PaymentClient.sol"; // Internal Interfaces import {IMilestoneManager} from "src/modules/logicModule/IMilestoneManager.sol"; @@ -45,7 +45,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; * * @author Inverter Network */ -contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { +contract MilestoneManager is IMilestoneManager, Module, PaymentClient { using SafeERC20 for IERC20; using LinkedIdList for LinkedIdList.List; @@ -376,7 +376,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { // stop all currently running payments __Module_proposal.paymentProcessor().cancelRunningPayments( - IERC20PaymentClient(address(this)) + IPaymentClient(address(this)) ); emit MilestoneStopped(id); @@ -468,7 +468,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { } __Module_proposal.paymentProcessor().processPayments( - IERC20PaymentClient(address(this)) + IPaymentClient(address(this)) ); emit MilestoneStarted(_last); @@ -690,11 +690,11 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { } //-------------------------------------------------------------------------- - // {ERC20PaymentClient} Function Implementations + // {PaymentClient} Function Implementations function _ensureTokenBalance(uint amount) internal - override(ERC20PaymentClient) + override(PaymentClient) { uint balance = __Module_proposal.token().balanceOf(address(this)); @@ -712,14 +712,14 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { ); if (!ok) { - revert Module__ERC20PaymentClient__TokenTransferFailed(); + revert Module__PaymentClient__TokenTransferFailed(); } } } function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(ERC20PaymentClient) + override(PaymentClient) { IERC20 token = __Module_proposal.token(); uint allowance = token.allowance(address(this), address(spender)); @@ -732,7 +732,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { function _isAuthorizedPaymentProcessor(IPaymentProcessor who) internal view - override(ERC20PaymentClient) + override(PaymentClient) returns (bool) { return __Module_proposal.paymentProcessor() == who; diff --git a/src/modules/logicModule/RecurringPaymentManager.sol b/src/modules/logicModule/RecurringPaymentManager.sol index 2e35c1414..33fa547d6 100644 --- a/src/modules/logicModule/RecurringPaymentManager.sol +++ b/src/modules/logicModule/RecurringPaymentManager.sol @@ -10,7 +10,7 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Internal Dependencies import {Module} from "src/modules/base/Module.sol"; -import {ERC20PaymentClient} from "src/modules/base/mixins/ERC20PaymentClient.sol"; +import {PaymentClient} from "src/modules/base/mixins/PaymentClient.sol"; // Internal Interfaces import {IProposal} from "src/proposal/IProposal.sol"; @@ -18,9 +18,9 @@ import {IRecurringPaymentManager} from "src/modules/logicModule/IRecurringPaymentManager.sol"; import { - IERC20PaymentClient, + IPaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/ERC20PaymentClient.sol"; +} from "src/modules/base/mixins/PaymentClient.sol"; // Internal Libraries import {LinkedIdList} from "src/common/LinkedIdList.sol"; @@ -28,7 +28,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; contract RecurringPaymentManager is IRecurringPaymentManager, Module, - ERC20PaymentClient + PaymentClient { using SafeERC20 for IERC20; using LinkedIdList for LinkedIdList.List; @@ -355,17 +355,17 @@ contract RecurringPaymentManager is //when done process the Payments correctly __Module_proposal.paymentProcessor().processPayments( - IERC20PaymentClient(address(this)) + IPaymentClient(address(this)) ); emit RecurringPaymentsTriggered(currentEpoch); } //-------------------------------------------------------------------------- - // {ERC20PaymentClient} Function Implementations + // {PaymentClient} Function Implementations function _ensureTokenBalance(uint amount) internal - override(ERC20PaymentClient) + override(PaymentClient) { uint balance = __Module_proposal.token().balanceOf(address(this)); @@ -383,14 +383,14 @@ contract RecurringPaymentManager is ); if (!ok) { - revert Module__ERC20PaymentClient__TokenTransferFailed(); + revert Module__PaymentClient__TokenTransferFailed(); } } } function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(ERC20PaymentClient) + override(PaymentClient) { IERC20 token = __Module_proposal.token(); uint allowance = token.allowance(address(this), address(spender)); @@ -403,7 +403,7 @@ contract RecurringPaymentManager is function _isAuthorizedPaymentProcessor(IPaymentProcessor who) internal view - override(ERC20PaymentClient) + override(PaymentClient) returns (bool) { return __Module_proposal.paymentProcessor() == who; diff --git a/src/modules/paymentProcessor/IPaymentProcessor.sol b/src/modules/paymentProcessor/IPaymentProcessor.sol index ff8f59f3f..5b0b431c0 100644 --- a/src/modules/paymentProcessor/IPaymentProcessor.sol +++ b/src/modules/paymentProcessor/IPaymentProcessor.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.0; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; +import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; interface IPaymentProcessor { //-------------------------------------------------------------------------- @@ -19,13 +19,13 @@ interface IPaymentProcessor { // Events /// @notice Emitted when a payment gets processed for execution. - /// @param ERC20PaymentClient The payment client that originated the order. + /// @param paymentClient The payment client that originated the order. /// @param recipient The address that will receive the payment. /// @param amount The amount of tokens the payment consists of. /// @param createdAt Timestamp at which the order was created. /// @param dueTo Timestamp at which the full amount should be payed out/claimable. event PaymentOrderProcessed( - address indexed ERC20PaymentClient, + address indexed paymentClient, address indexed recipient, uint amount, uint createdAt, @@ -42,17 +42,17 @@ interface IPaymentProcessor { //-------------------------------------------------------------------------- // Functions - /// @notice Processes all payments from an {IERC20PaymentClient} instance. + /// @notice Processes all payments from an {IPaymentClient} instance. /// @dev It's up to the the implementation to keep up with what has been /// paid out or not. - /// @param client The {IERC20PaymentClient} instance to process its to payments. - function processPayments(IERC20PaymentClient client) external; + /// @param client The {IPaymentClient} instance to process its to payments. + function processPayments(IPaymentClient client) external; - /// @notice Cancels all unfinished payments from an {IERC20PaymentClient} instance. + /// @notice Cancels all unfinished payments from an {IPaymentClient} instance. /// @dev It's up to the the implementation to keep up with what has been /// paid out or not. - /// @param client The {IERC20PaymentClient} instance to process its to payments. - function cancelRunningPayments(IERC20PaymentClient client) external; + /// @param client The {IPaymentClient} instance to process its to payments. + function cancelRunningPayments(IPaymentClient client) external; /// @notice Returns the IERC20 token the payment processor can process. function token() external view returns (IERC20); diff --git a/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol b/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol index 2b1834a76..e571cebc6 100644 --- a/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; +import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; @@ -17,7 +17,7 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { /// @param _released: The amount that has been claimed by the contributor till now /// @param _start: The start date of the vesting period /// @param _dueTo: The ending of the vesting period - /// @param _vestingWalletID: A unique identifier of a wallet for a specific ERC20PaymentClient and contributor combination + /// @param _vestingWalletID: A unique identifier of a wallet for a specific paymentClient and contributor combination struct VestingWallet { uint _salary; uint _released; @@ -35,7 +35,7 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { /// @param dueTo Timestamp at which the full amount should be claimable. /// @param walletId ID of the payment order that was added event StreamingPaymentAdded( - address indexed ERC20PaymentClient, + address indexed paymentClient, address indexed recipient, uint amount, uint start, @@ -47,7 +47,7 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { /// @param recipient The address that will stop receiving payment. /// @param walletId ID of the payment order removed event StreamingPaymentRemoved( - address indexed ERC20PaymentClient, + address indexed paymentClient, address indexed recipient, uint indexed walletId ); @@ -68,14 +68,14 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { ); /// @notice Emitted when a payment gets processed for execution. - /// @param ERC20PaymentClient The payment client that originated the order. + /// @param paymentClient The payment client that originated the order. /// @param recipient The address that will receive the payment. /// @param amount The amount of tokens the payment consists of. /// @param createdAt Timestamp at which the order was created. /// @param dueTo Timestamp at which the full amount should be payed out/claimable. /// @param walletId ID of the payment order that was processed event PaymentOrderProcessed( - address indexed ERC20PaymentClient, + address indexed paymentClient, address indexed recipient, uint amount, uint createdAt, @@ -89,68 +89,68 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { /// @notice insufficient tokens in the client to do payments error Module__PaymentProcessor__InsufficientTokenBalanceInClient(); - /// @notice the contributor is not owed any money by the ERC20PaymentClient + /// @notice the contributor is not owed any money by the paymentClient error Module__PaymentProcessor__NothingToClaim( - address ERC20PaymentClient, address contributor + address paymentClient, address contributor ); - /// @notice contributor's walletId for the ERC20PaymentClient is not valid + /// @notice contributor's walletId for the paymentClient is not valid error Module__PaymentProcessor__InvalidWallet( - address ERC20PaymentClient, address contributor, uint walletId + address paymentClient, address contributor, uint walletId ); - /// @notice contributor's walletId for the ERC20PaymentClient is no longer active + /// @notice contributor's walletId for the paymentClient is no longer active error Module__PaymentProcessor__InactiveWallet( - address ERC20PaymentClient, address contributor, uint walletId + address paymentClient, address contributor, uint walletId ); - /// @notice the contributor for the given ERC20PaymentClient does not exist (anymore) + /// @notice the contributor for the given paymentClient does not exist (anymore) error Module__PaymentProcessor__InvalidContributor( - address ERC20PaymentClient, address contributor + address paymentClient, address contributor ); //-------------------------------------------------------------------------- // Functions - /// @notice claim everything that the ERC20PaymentClient owes to the _msgSender till the current timestamp + /// @notice claim everything that the paymentClient owes to the _msgSender till the current timestamp /// @dev This function should be callable if the _msgSender is either an activeContributor or has some unclaimedAmounts - /// @param client The {IERC20PaymentClient} instance to process all claims from _msgSender - function claimAll(IERC20PaymentClient client) external; + /// @param client The {IPaymentClient} instance to process all claims from _msgSender + function claimAll(IPaymentClient client) external; /// @notice claim the salary uptil block.timestamp from the client for a payment order with id = walletId by _msgSender /// @dev If for a specific walletId, the tokens could not be transferred for some reason, it will added to the unclaimableAmounts /// of the contributor, and the amount would no longer hold any co-relation with the specific walletId of the contributor. - /// @param client The {IERC20PaymentClient} instance to process the walletId claim from _msgSender + /// @param client The {IPaymentClient} instance to process the walletId claim from _msgSender /// @param walletId The ID of the payment order for which claim is being made /// @param retryForUnclaimableAmounts boolean which determines if the function will try to pay the unclaimable amounts from earlier /// along with the vested salary from the payment order with id = walletId function claimForSpecificWalletId( - IERC20PaymentClient client, + IPaymentClient client, uint walletId, bool retryForUnclaimableAmounts ) external; - /// @notice Deletes all payments related to a contributor & leaves unvested tokens in the ERC20PaymentClient. + /// @notice Deletes all payments related to a contributor & leaves unvested tokens in the PaymentClient. /// @dev this function calls _removePayment which goes through all the payment orders for a contributor. For the payment orders /// that are completely vested, their details are deleted in the _claimForSpecificWalletId function and for others it is - /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the ERC20PaymentClient itself. - /// @param client The {IERC20PaymentClient} instance from which we will remove the payments + /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the paymentClient itself. + /// @param client The {IPaymentClient} instance from which we will remove the payments /// @param contributor Contributor's address. function removeAllContributorPayments( - IERC20PaymentClient client, + IPaymentClient client, address contributor ) external; - /// @notice Deletes a specific payment with id = walletId for a contributor & leaves unvested tokens in the ERC20PaymentClient. + /// @notice Deletes a specific payment with id = walletId for a contributor & leaves unvested tokens in the PaymentClient. /// @dev the detail of the wallet that is being removed is either deleted in the _claimForSpecificWalletId or later down in this /// function itself depending on the timestamp of when this function was called - /// @param client The {IERC20PaymentClient} instance from which we will remove the payment + /// @param client The {IPaymentClient} instance from which we will remove the payment /// @param contributor address of the contributor whose payment order is to be removed /// @param walletId The ID of the contributor's payment order which is to be removed /// @param retryForUnclaimableAmounts boolean that determines whether the function would try to return the unclaimableAmounts along /// with the vested amounts from the payment order with id = walletId to the contributor function removePaymentForSpecificWalletId( - IERC20PaymentClient client, + IPaymentClient client, address contributor, uint walletId, bool retryForUnclaimableAmounts @@ -216,7 +216,7 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { view returns (uint); - /// @notice see all active payment orders for a ERC20PaymentClient associated with a particular contributor + /// @notice see all active payment orders for a paymentClient associated with a particular contributor /// @dev the contributor must be an active contributor for the particular payment client /// @param client Address of the payment client /// @param contributor Address of the contributor diff --git a/src/modules/paymentProcessor/SimplePaymentProcessor.sol b/src/modules/paymentProcessor/SimplePaymentProcessor.sol index 3bfebf9cb..1ef51339b 100644 --- a/src/modules/paymentProcessor/SimplePaymentProcessor.sol +++ b/src/modules/paymentProcessor/SimplePaymentProcessor.sol @@ -10,7 +10,7 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Internal Dependencies import { IPaymentProcessor, - IERC20PaymentClient + IPaymentClient } from "src/modules/paymentProcessor/IPaymentProcessor.sol"; import {Module} from "src/modules/base/Module.sol"; @@ -22,7 +22,7 @@ import {IProposal} from "src/proposal/IProposal.sol"; * * @dev The SimplePaymentProcessor is a module to process payment orders from other * modules. In order to process a module's payment orders, the module must - * implement the {IERC20PaymentClient} interface. + * implement the {IPaymentClient} interface. * * @author Inverter Network */ @@ -41,7 +41,7 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { } /// @notice checks that the client is calling for itself - modifier validClient(IERC20PaymentClient client) { + modifier validClient(IPaymentClient client) { if (_msgSender() != address(client)) { revert Module__PaymentManager__CannotCallOnOtherClientsOrders(); } @@ -66,20 +66,20 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { } /// @inheritdoc IPaymentProcessor - function processPayments(IERC20PaymentClient client) + function processPayments(IPaymentClient client) external onlyModule validClient(client) { // Collect outstanding orders and their total token amount. - IERC20PaymentClient.PaymentOrder[] memory orders; + IPaymentClient.PaymentOrder[] memory orders; uint totalAmount; (orders, totalAmount) = client.collectPaymentOrders(); // Cache token. IERC20 token_ = token(); - // Transfer tokens from {IERC20PaymentClient} to order recipients. + // Transfer tokens from {IPaymentClient} to order recipients. address recipient; uint amount; uint len = orders.length; @@ -101,7 +101,7 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { } } - function cancelRunningPayments(IERC20PaymentClient client) + function cancelRunningPayments(IPaymentClient client) external onlyModule validClient(client) diff --git a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol index 142c60663..58c6bbd99 100644 --- a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.19; import { IStreamingPaymentProcessor, IPaymentProcessor, - IERC20PaymentClient + IPaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; import {Module} from "src/modules/base/Module.sol"; @@ -30,23 +30,23 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { // Storage /// @notice provides a unique id for new payment orders added for a specific client & contributor combo - /// @dev ERC20PaymentClient => contributor => walletId(uint) + /// @dev paymentClient => contributor => walletId(uint) mapping(address => mapping(address => uint)) public numVestingWallets; - /// @notice tracks all vesting details for all payment orders of a contributor for a specific ERC20PaymentClient - /// @dev ERC20PaymentClient => contributor => vestingWalletID => Wallet + /// @notice tracks all vesting details for all payment orders of a contributor for a specific paymentClient + /// @dev paymentClient => contributor => vestingWalletID => Wallet mapping(address => mapping(address => mapping(uint => VestingWallet))) private vestings; /// @notice tracks all payments that could not be made to the contributor due to any reason - /// @dev ERC20PaymentClient => contributor => unclaimableAmount + /// @dev paymentClient => contributor => unclaimableAmount mapping(address => mapping(address => uint)) private unclaimableAmounts; - /// @notice list of addresses with open payment Orders per ERC20PaymentClient - /// @dev ERC20PaymentClient => listOfContributors(address[]). Duplicates are not allowed. + /// @notice list of addresses with open payment Orders per paymentClient + /// @dev paymentClient => listOfContributors(address[]). Duplicates are not allowed. mapping(address => address[]) private activeContributors; - /// @notice list of walletIDs of all payment orders of a particular contributor for a particular ERC20PaymentClient + /// @notice list of walletIDs of all payment orders of a particular contributor for a particular paymentClient /// @dev client => contributor => arrayOfWalletIdsWithPendingPayment(uint[]) mapping(address => mapping(address => uint[])) private activeVestingWallets; @@ -62,7 +62,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @notice checks that the client is calling for itself - modifier validClient(IERC20PaymentClient client) { + modifier validClient(IPaymentClient client) { if (_msgSender() != address(client)) { revert Module__PaymentManager__CannotCallOnOtherClientsOrders(); } @@ -91,7 +91,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @inheritdoc IStreamingPaymentProcessor - function claimAll(IERC20PaymentClient client) external { + function claimAll(IPaymentClient client) external { if ( !( unclaimable(address(client), _msgSender()) > 0 @@ -109,7 +109,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function claimForSpecificWalletId( - IERC20PaymentClient client, + IPaymentClient client, uint walletId, bool retryForUnclaimableAmounts ) external { @@ -137,7 +137,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @inheritdoc IPaymentProcessor - function processPayments(IERC20PaymentClient client) + function processPayments(IPaymentClient client) external onlyModule validClient(client) @@ -145,7 +145,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { //We check if there are any new paymentOrders, without processing them if (client.paymentOrders().length > 0) { // Collect outstanding orders and their total token amount. - IERC20PaymentClient.PaymentOrder[] memory orders; + IPaymentClient.PaymentOrder[] memory orders; uint totalAmount; (orders, totalAmount) = client.collectPaymentOrders(); @@ -196,7 +196,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @inheritdoc IPaymentProcessor - function cancelRunningPayments(IERC20PaymentClient client) + function cancelRunningPayments(IPaymentClient client) external onlyModule validClient(client) @@ -206,7 +206,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function removeAllContributorPayments( - IERC20PaymentClient client, + IPaymentClient client, address contributor ) external onlyAuthorized { if ( @@ -222,7 +222,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function removePaymentForSpecificWalletId( - IERC20PaymentClient client, + IPaymentClient client, address contributor, uint walletId, bool retryForUnclaimableAmounts @@ -403,7 +403,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { return type(uint).max; } - /// @notice used to find whether a particular payment order associated with a contributor and ERC20PaymentClient with id = walletId is active or not + /// @notice used to find whether a particular payment order associated with a contributor and paymentClient with id = walletId is active or not /// @dev active means that the particular payment order is still to be paid out/claimed. This function returns the first instance of the walletId /// in the activeVestingWallets[client][contributor] array, but that is fine as the array does not allow duplicates. /// @param client address of the payment client @@ -450,10 +450,10 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } } - /// @notice Deletes all payments related to a contributor & leaves unvested tokens in the ERC20PaymentClient. + /// @notice Deletes all payments related to a contributor & leaves unvested tokens in the PaymentClient. /// @dev this function calls _removePayment which goes through all the payment orders for a contributor. For the payment orders /// that are completely vested, their details are deleted in the _claimForSpecificWalletId function and for others it is - /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the ERC20PaymentClient itself. + /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the paymentClient itself. /// @param client address of the payment client /// @param contributor address of the contributor function _removePayment(address client, address contributor) internal { diff --git a/test/e2e/BountyManagerLifecycle.t.sol b/test/e2e/BountyManagerLifecycle.t.sol index 5622fe45a..118f914e3 100644 --- a/test/e2e/BountyManagerLifecycle.t.sol +++ b/test/e2e/BountyManagerLifecycle.t.sol @@ -18,7 +18,7 @@ import {RebasingFundingManager} from import { BountyManager, IBountyManager, - IERC20PaymentClient + IPaymentClient } from "src/modules/logicModule/BountyManager.sol"; import {StreamingPaymentProcessor} from @@ -26,7 +26,7 @@ import {StreamingPaymentProcessor} from import { IStreamingPaymentProcessor, - IERC20PaymentClient + IPaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; // Mocks diff --git a/test/e2e/MilestoneLifecycle.t.sol b/test/e2e/MilestoneLifecycle.t.sol index 772ee23d3..14782e658 100644 --- a/test/e2e/MilestoneLifecycle.t.sol +++ b/test/e2e/MilestoneLifecycle.t.sol @@ -16,7 +16,7 @@ import {RebasingFundingManager} from import {SimplePaymentProcessor} from "src/modules/paymentProcessor/SimplePaymentProcessor.sol"; -import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; +import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; diff --git a/test/e2e/RecurringPayments.t.sol b/test/e2e/RecurringPayments.t.sol index 6008a2830..30afb7a35 100644 --- a/test/e2e/RecurringPayments.t.sol +++ b/test/e2e/RecurringPayments.t.sol @@ -18,7 +18,7 @@ import {RebasingFundingManager} from import { RecurringPaymentManager, IRecurringPaymentManager, - IERC20PaymentClient + IPaymentClient } from "src/modules/logicModule/RecurringPaymentManager.sol"; import {StreamingPaymentProcessor} from @@ -26,7 +26,7 @@ import {StreamingPaymentProcessor} from import { IStreamingPaymentProcessor, - IERC20PaymentClient + IPaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; // Mocks diff --git a/test/modules/base/mixins/PaymentClient.t.sol b/test/modules/base/mixins/PaymentClient.t.sol index 0ca87bb12..692a6d736 100644 --- a/test/modules/base/mixins/PaymentClient.t.sol +++ b/test/modules/base/mixins/PaymentClient.t.sol @@ -5,16 +5,16 @@ import "forge-std/Test.sol"; // SuT import { - ERC20PaymentClientMock, - IERC20PaymentClient -} from "test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol"; + PaymentClientMock, + IPaymentClient +} from "test/utils/mocks/modules/mixins/PaymentClientMock.sol"; // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; -contract ERC20PaymentClientTest is Test { +contract PaymentClientTest is Test { // SuT - ERC20PaymentClientMock ERC20PaymentClient; + PaymentClientMock paymentClient; // Mocks ERC20Mock token; @@ -22,8 +22,8 @@ contract ERC20PaymentClientTest is Test { function setUp() public { token = new ERC20Mock("Mock", "MOCK"); - ERC20PaymentClient = new ERC20PaymentClientMock(token); - ERC20PaymentClient.setIsAuthorized(address(this), true); + paymentClient = new PaymentClientMock(token); + paymentClient.setIsAuthorized(address(this), true); } //---------------------------------- @@ -51,8 +51,8 @@ contract ERC20PaymentClientTest is Test { } for (uint i; i < orderAmount; ++i) { - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -61,8 +61,8 @@ contract ERC20PaymentClientTest is Test { ); } - IERC20PaymentClient.PaymentOrder[] memory orders = - ERC20PaymentClient.paymentOrders(); + IPaymentClient.PaymentOrder[] memory orders = + paymentClient.paymentOrders(); assertEq(orders.length, orderAmount); for (uint i; i < orderAmount; ++i) { @@ -71,7 +71,7 @@ contract ERC20PaymentClientTest is Test { assertEq(orders[i].dueTo, dueTo); } - assertEq(ERC20PaymentClient.outstandingTokenAmount(), amount * orderAmount); + assertEq(paymentClient.outstandingTokenAmount(), amount * orderAmount); } function testAddPaymentOrderFailsForInvalidRecipient() public { @@ -81,10 +81,10 @@ contract ERC20PaymentClientTest is Test { for (uint i; i < invalids.length; ++i) { vm.expectRevert( - IERC20PaymentClient.Module__ERC20PaymentClient__InvalidRecipient.selector + IPaymentClient.Module__PaymentClient__InvalidRecipient.selector ); - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: invalids[0], amount: amount, createdAt: block.timestamp, @@ -101,10 +101,10 @@ contract ERC20PaymentClientTest is Test { for (uint i; i < invalids.length; ++i) { vm.expectRevert( - IERC20PaymentClient.Module__ERC20PaymentClient__InvalidAmount.selector + IPaymentClient.Module__PaymentClient__InvalidAmount.selector ); - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: invalids[0], createdAt: block.timestamp, @@ -118,31 +118,31 @@ contract ERC20PaymentClientTest is Test { // Test: addPaymentOrders() function testAddPaymentOrders() public { - IERC20PaymentClient.PaymentOrder[] memory ordersToAdd = - new IERC20PaymentClient.PaymentOrder[](3); - ordersToAdd[0] = IERC20PaymentClient.PaymentOrder({ + IPaymentClient.PaymentOrder[] memory ordersToAdd = + new IPaymentClient.PaymentOrder[](3); + ordersToAdd[0] = IPaymentClient.PaymentOrder({ recipient: address(0xCAFE1), amount: 100e18, createdAt: block.timestamp, dueTo: block.timestamp }); - ordersToAdd[1] = IERC20PaymentClient.PaymentOrder({ + ordersToAdd[1] = IPaymentClient.PaymentOrder({ recipient: address(0xCAFE2), amount: 100e18, createdAt: block.timestamp, dueTo: block.timestamp + 1 }); - ordersToAdd[2] = IERC20PaymentClient.PaymentOrder({ + ordersToAdd[2] = IPaymentClient.PaymentOrder({ recipient: address(0xCAFE3), amount: 100e18, createdAt: block.timestamp, dueTo: block.timestamp + 2 }); - ERC20PaymentClient.addPaymentOrders(ordersToAdd); + paymentClient.addPaymentOrders(ordersToAdd); - IERC20PaymentClient.PaymentOrder[] memory orders = - ERC20PaymentClient.paymentOrders(); + IPaymentClient.PaymentOrder[] memory orders = + paymentClient.paymentOrders(); assertEq(orders.length, 3); for (uint i; i < 3; ++i) { @@ -151,7 +151,7 @@ contract ERC20PaymentClientTest is Test { assertEq(orders[i].dueTo, ordersToAdd[i].dueTo); } - assertEq(ERC20PaymentClient.outstandingTokenAmount(), 300e18); + assertEq(paymentClient.outstandingTokenAmount(), 300e18); } //---------------------------------- @@ -179,8 +179,8 @@ contract ERC20PaymentClientTest is Test { } for (uint i; i < orderAmount; ++i) { - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -189,9 +189,9 @@ contract ERC20PaymentClientTest is Test { ); } - IERC20PaymentClient.PaymentOrder[] memory orders; + IPaymentClient.PaymentOrder[] memory orders; uint totalOutstandingAmount; - (orders, totalOutstandingAmount) = ERC20PaymentClient.collectPaymentOrders(); + (orders, totalOutstandingAmount) = paymentClient.collectPaymentOrders(); // Check that orders are correct. assertEq(orders.length, orderAmount); @@ -204,28 +204,28 @@ contract ERC20PaymentClientTest is Test { // Check that total outstanding token amount is correct. assertEq(totalOutstandingAmount, orderAmount * amount); - // Check that orders in ERC20PaymentClient got reset. - IERC20PaymentClient.PaymentOrder[] memory updatedOrders; - updatedOrders = ERC20PaymentClient.paymentOrders(); + // Check that orders in PaymentClient got reset. + IPaymentClient.PaymentOrder[] memory updatedOrders; + updatedOrders = paymentClient.paymentOrders(); assertEq(updatedOrders.length, 0); - // Check that outstanding token amount in ERC20PaymentClient got reset. - assertEq(ERC20PaymentClient.outstandingTokenAmount(), 0); + // Check that outstanding token amount in PaymentClient got reset. + assertEq(paymentClient.outstandingTokenAmount(), 0); - // Check that we received allowance to fetch tokens from ERC20PaymentClient. + // Check that we received allowance to fetch tokens from PaymentClient. assertTrue( - token.allowance(address(ERC20PaymentClient), address(this)) + token.allowance(address(paymentClient), address(this)) >= totalOutstandingAmount ); } function testCollectPaymentOrdersFailsCallerNotAuthorized() public { - ERC20PaymentClient.setIsAuthorized(address(this), false); + paymentClient.setIsAuthorized(address(this), false); vm.expectRevert( - IERC20PaymentClient.Module__ERC20PaymentClient__CallerNotAuthorized.selector + IPaymentClient.Module__PaymentClient__CallerNotAuthorized.selector ); - ERC20PaymentClient.collectPaymentOrders(); + paymentClient.collectPaymentOrders(); } //-------------------------------------------------------------------------- @@ -257,7 +257,7 @@ contract ERC20PaymentClientTest is Test { address[] memory invalids = new address[](2); invalids[0] = address(0); - invalids[1] = address(ERC20PaymentClient); + invalids[1] = address(paymentClient); return invalids; } diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 495d45128..00580c540 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -16,7 +16,7 @@ import {OZErrors} from "test/utils/errors/OZErrors.sol"; import { BountyManager, IBountyManager, - IERC20PaymentClient + IPaymentClient } from "src/modules/logicModule/BountyManager.sol"; contract BountyManagerTest is ModuleTest { @@ -715,7 +715,7 @@ contract BountyManagerTest is ModuleTest { bountyManager.verifyClaim(claimId, bountyId); - IERC20PaymentClient.PaymentOrder[] memory orders = + IPaymentClient.PaymentOrder[] memory orders = bountyManager.paymentOrders(); assertEq(length, orders.length); diff --git a/test/modules/logicModule/MilestoneManager.t.sol b/test/modules/logicModule/MilestoneManager.t.sol index 9751b3419..e3bae86c3 100644 --- a/test/modules/logicModule/MilestoneManager.t.sol +++ b/test/modules/logicModule/MilestoneManager.t.sol @@ -14,7 +14,7 @@ import { IMilestoneManager } from "src/modules/logicModule/MilestoneManager.sol"; -import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; +import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -905,7 +905,7 @@ contract MilestoneManagerTest is ModuleTest { ); // Check that payment orders were added correctly. - IERC20PaymentClient.PaymentOrder[] memory orders = + IPaymentClient.PaymentOrder[] memory orders = milestoneManager.paymentOrders(); assertEq(orders.length, contributors.length); @@ -984,7 +984,7 @@ contract MilestoneManagerTest is ModuleTest { vm.warp(block.timestamp + TIMELOCK + 1); vm.expectRevert( - IERC20PaymentClient.Module__ERC20PaymentClient__TokenTransferFailed.selector + IPaymentClient.Module__PaymentClient__TokenTransferFailed.selector ); milestoneManager.startNextMilestone(); } @@ -1847,7 +1847,7 @@ contract MilestoneManagerTest is ModuleTest { //Make sure the values in the payment orders are the same // Check that payment orders were added correctly. - IERC20PaymentClient.PaymentOrder[] memory orders = + IPaymentClient.PaymentOrder[] memory orders = milestoneManager.paymentOrders(); for (uint i = 1; i < orders.length; ++i) { @@ -1895,7 +1895,7 @@ contract MilestoneManagerTest is ModuleTest { //Make sure the values in the payment orders are the same // Check that payment orders were added correctly. - IERC20PaymentClient.PaymentOrder[] memory orders = + IPaymentClient.PaymentOrder[] memory orders = milestoneManager.paymentOrders(); for (uint i = 1; i < orders.length; ++i) { diff --git a/test/modules/logicModule/RecurringPaymentManager.t.sol b/test/modules/logicModule/RecurringPaymentManager.t.sol index e8832473c..0ba51ba9c 100644 --- a/test/modules/logicModule/RecurringPaymentManager.t.sol +++ b/test/modules/logicModule/RecurringPaymentManager.t.sol @@ -16,7 +16,7 @@ import {OZErrors} from "test/utils/errors/OZErrors.sol"; import { RecurringPaymentManager, IRecurringPaymentManager, - IERC20PaymentClient + IPaymentClient } from "src/modules/logicModule/RecurringPaymentManager.sol"; contract RecurringPaymentManagerTest is ModuleTest { @@ -259,7 +259,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //validAmount vm.expectRevert( - IERC20PaymentClient.Module__ERC20PaymentClient__InvalidAmount.selector + IPaymentClient.Module__PaymentClient__InvalidAmount.selector ); recurringPaymentManager.addRecurringPayment(0, 2 weeks, address(0xBEEF)); @@ -275,7 +275,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //validRecipient vm.expectRevert( - IERC20PaymentClient.Module__ERC20PaymentClient__InvalidRecipient.selector + IPaymentClient.Module__PaymentClient__InvalidRecipient.selector ); recurringPaymentManager.addRecurringPayment(1, 2 weeks, address(0)); } @@ -399,7 +399,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //remove tokens and orders from recurringPaymentManager for easier testing _paymentProcessor.deleteAllPayments( - IERC20PaymentClient(address(recurringPaymentManager)) + IPaymentClient(address(recurringPaymentManager)) ); _token.burn( address(recurringPaymentManager), @@ -435,7 +435,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //remove tokens and orders from recurringPaymentManager for easier testing _paymentProcessor.deleteAllPayments( - IERC20PaymentClient(address(recurringPaymentManager)) + IPaymentClient(address(recurringPaymentManager)) ); _token.burn( address(recurringPaymentManager), @@ -657,7 +657,7 @@ contract RecurringPaymentManagerTest is ModuleTest { ) internal { uint length = recurringPaymentsToBeChecked.length; - IERC20PaymentClient.PaymentOrder[] memory orders = + IPaymentClient.PaymentOrder[] memory orders = recurringPaymentManager.paymentOrders(); assertEq(length, currentRecurringPayments.length); @@ -731,7 +731,7 @@ contract RecurringPaymentManagerTest is ModuleTest { } function assertOrder( - IERC20PaymentClient.PaymentOrder memory order, + IPaymentClient.PaymentOrder memory order, address recipient, uint amount, uint createdAt, diff --git a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol index 8bab08470..f51db11ff 100644 --- a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol @@ -14,9 +14,9 @@ import { // Mocks import { - IERC20PaymentClient, - ERC20PaymentClientMock -} from "test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol"; + IPaymentClient, + PaymentClientMock +} from "test/utils/mocks/modules/mixins/PaymentClientMock.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -29,7 +29,7 @@ contract SimplePaymentProcessorTest is ModuleTest { SimplePaymentProcessor paymentProcessor; // Mocks - ERC20PaymentClientMock ERC20PaymentClient = new ERC20PaymentClientMock(_token); + PaymentClientMock paymentClient = new PaymentClientMock(_token); function setUp() public { address impl = address(new SimplePaymentProcessor()); @@ -39,11 +39,11 @@ contract SimplePaymentProcessorTest is ModuleTest { _authorizer.setIsAuthorized(address(this), true); - _proposal.addModule(address(ERC20PaymentClient)); + _proposal.addModule(address(paymentClient)); paymentProcessor.init(_proposal, _METADATA, bytes("")); - ERC20PaymentClient.setIsAuthorized(address(paymentProcessor), true); + paymentClient.setIsAuthorized(address(paymentProcessor), true); } //-------------------------------------------------------------------------- @@ -90,13 +90,13 @@ contract SimplePaymentProcessorTest is ModuleTest { function testProcessPayments(address recipient, uint amount) public { vm.assume(recipient != address(paymentProcessor)); - vm.assume(recipient != address(ERC20PaymentClient)); + vm.assume(recipient != address(paymentClient)); vm.assume(recipient != address(0)); vm.assume(amount != 0); // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -105,12 +105,12 @@ contract SimplePaymentProcessorTest is ModuleTest { ); // Call processPayments. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); // Check correct balances. assertEq(_token.balanceOf(address(recipient)), amount); - assertEq(_token.balanceOf(address(ERC20PaymentClient)), 0); + assertEq(_token.balanceOf(address(paymentClient)), 0); // Invariant: Payment processor does not hold funds. assertEq(_token.balanceOf(address(paymentProcessor)), 0); @@ -120,7 +120,7 @@ contract SimplePaymentProcessorTest is ModuleTest { public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(ERC20PaymentClient)); + vm.assume(nonModule != address(paymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. @@ -135,23 +135,23 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(ERC20PaymentClient); + paymentProcessor.processPayments(paymentClient); } function testProcessPaymentsFailsWhenCalledOnOtherClient(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(ERC20PaymentClient)); + vm.assume(nonModule != address(paymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - ERC20PaymentClientMock otherERC20PaymentClient = new ERC20PaymentClientMock(_token); + PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); - vm.prank(address(ERC20PaymentClient)); + vm.prank(address(paymentClient)); vm.expectRevert( abi.encodeWithSelector( IPaymentProcessor @@ -159,14 +159,14 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(otherERC20PaymentClient); + paymentProcessor.processPayments(otherPaymentClient); } function testCancelPaymentsFailsWhenCalledByNonModule(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(ERC20PaymentClient)); + vm.assume(nonModule != address(paymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. @@ -181,23 +181,23 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(ERC20PaymentClient); + paymentProcessor.cancelRunningPayments(paymentClient); } function testCancelPaymentsFailsWhenCalledOnOtherClient(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(ERC20PaymentClient)); + vm.assume(nonModule != address(paymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - ERC20PaymentClientMock otherERC20PaymentClient = new ERC20PaymentClientMock(_token); + PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); - vm.prank(address(ERC20PaymentClient)); + vm.prank(address(paymentClient)); vm.expectRevert( abi.encodeWithSelector( IPaymentProcessor @@ -205,6 +205,6 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(otherERC20PaymentClient); + paymentProcessor.cancelRunningPayments(otherPaymentClient); } } diff --git a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol index 7480f3b01..3c42eff75 100644 --- a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol @@ -17,9 +17,9 @@ import { // Mocks import { - IERC20PaymentClient, - ERC20PaymentClientMock -} from "test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol"; + IPaymentClient, + PaymentClientMock +} from "test/utils/mocks/modules/mixins/PaymentClientMock.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -32,14 +32,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { StreamingPaymentProcessor paymentProcessor; // Mocks - ERC20PaymentClientMock ERC20PaymentClient = new ERC20PaymentClientMock(_token); + PaymentClientMock paymentClient = new PaymentClientMock(_token); event InvalidStreamingOrderDiscarded( address indexed recipient, uint amount, uint start, uint dueTo ); event StreamingPaymentAdded( - address indexed ERC20PaymentClient, + address indexed paymentClient, address indexed recipient, uint amount, uint start, @@ -48,7 +48,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); event StreamingPaymentRemoved( - address indexed ERC20PaymentClient, + address indexed paymentClient, address indexed recipient, uint indexed walletId ); @@ -61,11 +61,11 @@ contract StreamingPaymentProcessorTest is ModuleTest { _authorizer.setIsAuthorized(address(this), true); - _proposal.addModule(address(ERC20PaymentClient)); + _proposal.addModule(address(paymentClient)); paymentProcessor.init(_proposal, _METADATA, bytes("")); - ERC20PaymentClient.setIsAuthorized(address(paymentProcessor), true); + paymentClient.setIsAuthorized(address(paymentProcessor), true); } //-------------------------------------------------------------------------- @@ -133,8 +133,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipients[i], amount: amount, createdAt: block.timestamp, @@ -146,18 +146,18 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); for (uint i; i < recipients.length;) { assertTrue( paymentProcessor.isActiveContributor( - address(ERC20PaymentClient), recipients[i] + address(paymentClient), recipients[i] ) ); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), + address(paymentClient), recipients[i], 1 // 1 is the first default wallet ID for all unique recepients ), @@ -169,7 +169,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { } } - assertEq(totalAmount, _token.balanceOf(address(ERC20PaymentClient))); + assertEq(totalAmount, _token.balanceOf(address(paymentClient))); } function test_claimVestedAmounts_fullVesting( @@ -195,8 +195,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipients[i], amount: amount, createdAt: block.timestamp, @@ -208,18 +208,18 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); for (uint i; i < recipients.length;) { assertTrue( paymentProcessor.isActiveContributor( - address(ERC20PaymentClient), recipients[i] + address(paymentClient), recipients[i] ) ); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), + address(paymentClient), recipients[i], 1 // 1 is the first default wallet ID for all unique recepients ), @@ -231,7 +231,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { } } - assertEq(totalAmount, _token.balanceOf(address(ERC20PaymentClient))); + assertEq(totalAmount, _token.balanceOf(address(paymentClient))); // Moving ahead in time, past the longest vesting period vm.warp(block.timestamp + (max_time + 1)); @@ -239,7 +239,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // All recepients try to claim their vested tokens for (uint i; i < recipients.length;) { vm.prank(recipients[i]); - paymentProcessor.claimAll(ERC20PaymentClient); + paymentProcessor.claimAll(paymentClient); unchecked { ++i; } @@ -256,7 +256,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), + address(paymentClient), recipients[i], 1 // 1 is the first default wallet ID for all unique recepients ), @@ -289,8 +289,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { for (uint i; i < length; i++) { // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipients[i], amount: payoutAmount, createdAt: block.timestamp, @@ -299,34 +299,34 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); } - IERC20PaymentClient.PaymentOrder[] memory orders = - ERC20PaymentClient.paymentOrders(); + IPaymentClient.PaymentOrder[] memory orders = + paymentClient.paymentOrders(); // Call processPayments - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); for (uint i; i < length; i++) { address recipient = recipients[i]; - IERC20PaymentClient.PaymentOrder memory order = orders[i]; + IPaymentClient.PaymentOrder memory order = orders[i]; //If dueTo is before currentTimestamp evereything should be releasable if (order.dueTo <= block.timestamp) { assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), address(recipient), 1 + address(paymentClient), address(recipient), 1 ), payoutAmount ); vm.prank(recipient); - paymentProcessor.claimAll(ERC20PaymentClient); + paymentProcessor.claimAll(paymentClient); // Check correct balances. assertEq(_token.balanceOf(recipient), payoutAmount); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); @@ -340,11 +340,11 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint invalidAmt = 0; vm.warp(1000); - vm.startPrank(address(ERC20PaymentClient)); + vm.startPrank(address(paymentClient)); //we don't mind about adding address(this)in this case for (uint i = 0; i < recipients.length - 1; ++i) { - ERC20PaymentClient.addPaymentOrderUnchecked( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrderUnchecked( + IPaymentClient.PaymentOrder({ recipient: recipients[i], amount: 100, createdAt: block.timestamp, @@ -361,10 +361,10 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments and expect emits - paymentProcessor.processPayments(ERC20PaymentClient); + paymentProcessor.processPayments(paymentClient); - ERC20PaymentClient.addPaymentOrderUnchecked( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrderUnchecked( + IPaymentClient.PaymentOrder({ recipient: address(0xB0B), amount: invalidAmt, createdAt: block.timestamp, @@ -375,7 +375,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { emit InvalidStreamingOrderDiscarded( address(0xB0B), invalidAmt, block.timestamp, block.timestamp + 100 ); - paymentProcessor.processPayments(ERC20PaymentClient); + paymentProcessor.processPayments(paymentClient); vm.stopPrank(); } @@ -394,8 +394,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { speedRunStreamingAndClaim(recipients, amounts, durations); //We run process payments again, but since there are no new orders, nothing should happen. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); for (uint i; i < recipients.length; i++) { address recipient = recipients[i]; @@ -403,7 +403,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Check that the vesting information is deleted once vested tokens are claimed after total vesting duration assertEq( paymentProcessor.vestedAmountForSpecificWalletId( - address(ERC20PaymentClient), + address(paymentClient), address(recipient), block.timestamp, 1 @@ -451,8 +451,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint time = durations_1[i]; // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -462,8 +462,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); // Let's travel in time, to the point after contributor1's tokens are fully vested. // Also, remember, nothing is claimed yet @@ -492,8 +492,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint time = durations_2[i]; // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -503,14 +503,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); // Now, let's check whether all vesting informations exist or not // checking for contributor2 IStreamingPaymentProcessor.VestingWallet[] memory contributorWallets; contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(ERC20PaymentClient), contributor2 + address(paymentClient), contributor2 ); assertTrue(contributorWallets.length == 2); @@ -522,7 +522,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // checking for contributor3 contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(ERC20PaymentClient), contributor3 + address(paymentClient), contributor3 ); assertTrue(contributorWallets.length == 2); @@ -534,7 +534,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // checking for contributor 4 contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(ERC20PaymentClient), contributor4 + address(paymentClient), contributor4 ); assertTrue(contributorWallets.length == 1); @@ -546,7 +546,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // checking for contributor 1 contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(ERC20PaymentClient), contributor1 + address(paymentClient), contributor1 ); assertTrue(contributorWallets.length == 1); @@ -604,8 +604,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint time = durations[i]; // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -615,8 +615,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); // Let's travel in time, to the point after contributor1's tokens for the second payment order // are 1/2 vested. @@ -626,7 +626,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // contributor by 1/2 of the vested token amount IStreamingPaymentProcessor.VestingWallet[] memory contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(ERC20PaymentClient), contributor1 + address(paymentClient), contributor1 ); // We are interested in finding the details of the 2nd wallet of contributor1 @@ -641,11 +641,11 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyAuthorized can call the next function paymentProcessor.removePaymentForSpecificWalletId( - ERC20PaymentClient, contributor1, walletId, false + paymentClient, contributor1, walletId, false ); contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(ERC20PaymentClient), contributor1 + address(paymentClient), contributor1 ); finalNumWallets = contributorWallets.length; @@ -711,8 +711,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint time = durations[i]; // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -722,8 +722,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); // Let's travel in time, to the point after contributor1's tokens for the second payment order // are 1/2 vested, or the complete vesting of duration of the first payment order @@ -734,7 +734,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { IStreamingPaymentProcessor.VestingWallet[] memory contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(ERC20PaymentClient), contributor1 + address(paymentClient), contributor1 ); salary1 = contributorWallets[0]._salary; @@ -742,7 +742,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Now we claim the entire salary from the first payment order vm.prank(contributor1); paymentProcessor.claimForSpecificWalletId( - ERC20PaymentClient, contributorWallets[0]._vestingWalletID, false + paymentClient, contributorWallets[0]._vestingWalletID, false ); // Now we note down the balance of the contributor1 again after claiming for the first wallet. @@ -758,14 +758,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.prank(address(this)); // stupid line, ik, but it's just here to show that onlyAuthorized can call the next function paymentProcessor.removePaymentForSpecificWalletId( - ERC20PaymentClient, + paymentClient, contributor1, contributorWallets[1]._vestingWalletID, false ); contributorWallets = paymentProcessor.viewAllPaymentOrders( - address(ERC20PaymentClient), contributor1 + address(paymentClient), contributor1 ); finalNumWallets = contributorWallets.length; @@ -782,7 +782,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.prank(contributor1); paymentProcessor.claimForSpecificWalletId( - ERC20PaymentClient, contributorWallets[0]._vestingWalletID, false + paymentClient, contributorWallets[0]._vestingWalletID, false ); finalContributorBalance = _token.balanceOf(contributor1); @@ -794,7 +794,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(ERC20PaymentClient)); + vm.assume(nonModule != address(paymentClient)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); @@ -809,23 +809,23 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(ERC20PaymentClient); + paymentProcessor.processPayments(paymentClient); } function testProcessPaymentsFailsWhenCalledOnOtherClient(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(ERC20PaymentClient)); + vm.assume(nonModule != address(paymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - ERC20PaymentClientMock otherERC20PaymentClient = new ERC20PaymentClientMock(_token); + PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); - vm.prank(address(ERC20PaymentClient)); + vm.prank(address(paymentClient)); vm.expectRevert( abi.encodeWithSelector( IPaymentProcessor @@ -833,7 +833,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(otherERC20PaymentClient); + paymentProcessor.processPayments(otherPaymentClient); } function test_cancelRunningPayments_allCreatedOrdersGetCancelled( @@ -848,8 +848,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint duration = 4 weeks; for (uint i = 0; i < length; ++i) { - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipients[i], amount: amounts[i], createdAt: block.timestamp, @@ -861,7 +861,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { for (uint i = 0; i < length; ++i) { vm.expectEmit(true, true, true, true); emit StreamingPaymentAdded( - address(ERC20PaymentClient), + address(paymentClient), recipients[i], amounts[i], block.timestamp, @@ -871,8 +871,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments and expect emits - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); // FF to half the max_duration vm.warp(block.timestamp + 2 weeks); @@ -883,13 +883,13 @@ contract StreamingPaymentProcessorTest is ModuleTest { // we can expect all recipient to be unique due to the call to assumeValidRecipients. // Therefore, the walletId of all these contributors would be 1. emit StreamingPaymentRemoved( - address(ERC20PaymentClient), recipients[i], 1 + address(paymentClient), recipients[i], 1 ); } // calling cancelRunningPayments - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.cancelRunningPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.cancelRunningPayments(paymentClient); // make sure the payments have been reset @@ -898,31 +898,31 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq( paymentProcessor.startForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); assertEq( paymentProcessor.dueToForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); assertEq( paymentProcessor.releasedForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); assertEq( paymentProcessor.vestedAmountForSpecificWalletId( - address(ERC20PaymentClient), recipient, block.timestamp, 1 + address(paymentClient), recipient, block.timestamp, 1 ), 0 ); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); @@ -933,7 +933,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(ERC20PaymentClient)); + vm.assume(nonModule != address(paymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. @@ -948,23 +948,23 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(ERC20PaymentClient); + paymentProcessor.cancelRunningPayments(paymentClient); } function testCancelPaymentsFailsWhenCalledOnOtherClient(address nonModule) public { vm.assume(nonModule != address(paymentProcessor)); - vm.assume(nonModule != address(ERC20PaymentClient)); + vm.assume(nonModule != address(paymentClient)); vm.assume(nonModule != address(_authorizer)); // PaymentProcessorMock gets deployed and initialized in ModuleTest, // if deployed address is same as nonModule, this test will fail. vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - ERC20PaymentClientMock otherERC20PaymentClient = new ERC20PaymentClientMock(_token); + PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); - vm.prank(address(ERC20PaymentClient)); + vm.prank(address(paymentClient)); vm.expectRevert( abi.encodeWithSelector( IPaymentProcessor @@ -972,7 +972,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(otherERC20PaymentClient); + paymentProcessor.cancelRunningPayments(otherPaymentClient); } //This test creates a new set of payments in a client which finished all running payments. @@ -1000,8 +1000,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amounts[i], createdAt: block.timestamp, @@ -1010,19 +1010,19 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); } - // make sure all the balances are transfered to ERC20PaymentClient - assertTrue(_token.balanceOf(address(ERC20PaymentClient)) == total_amount); + // make sure all the balances are transfered to paymentClient + assertTrue(_token.balanceOf(address(paymentClient)) == total_amount); // Call processPayments. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); // FF to half the max_duration vm.warp(max_duration / 2); // calling cancelRunningPayments also calls claim() so no need to repeat? - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.cancelRunningPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.cancelRunningPayments(paymentClient); // measure recipients balances before attempting second claim. uint[] memory balancesBefore = new uint256[](recipients.length); @@ -1044,11 +1044,11 @@ contract StreamingPaymentProcessorTest is ModuleTest { IStreamingPaymentProcessor .Module__PaymentProcessor__NothingToClaim .selector, - address(ERC20PaymentClient), + address(paymentClient), recipient ) ); - paymentProcessor.claimAll(ERC20PaymentClient); + paymentProcessor.claimAll(paymentClient); vm.stopPrank(); uint balanceAfter = _token.balanceOf(recipient); @@ -1056,7 +1056,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq(balancesBefore[i], balanceAfter); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); @@ -1082,8 +1082,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint amount = amounts[i]; // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -1092,8 +1092,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); } - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); for (uint z = 0; z <= duration; z += 1 hours) { //we check each hour @@ -1106,7 +1106,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq( claimableAmt, paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ) ); } @@ -1138,14 +1138,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { assertEq(_token.balanceOf(address(recipient)), amount); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), address(recipient), 1 + address(paymentClient), address(recipient), 1 ), 0 ); } - // No funds left in the ERC20PaymentClient - assertEq(_token.balanceOf(address(ERC20PaymentClient)), 0); + // No funds left in the PaymentClient + assertEq(_token.balanceOf(address(paymentClient)), 0); // Invariant: Payment processor does not hold funds. assertEq(_token.balanceOf(address(paymentProcessor)), 0); @@ -1165,33 +1165,33 @@ contract StreamingPaymentProcessorTest is ModuleTest { blockAddress(recipient); // Add payment order to client and call processPayments. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, dueTo: block.timestamp + duration }) ); - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); // FF 25% and claim. vm.warp(block.timestamp + duration / 4); vm.prank(recipient); - paymentProcessor.claimAll(ERC20PaymentClient); + paymentProcessor.claimAll(paymentClient); // after failed claim attempt receiver should receive 0 token, // while VPP should move recipient's balances from 'releasable' to 'unclaimable' assertEq(_token.balanceOf(address(recipient)), 0); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); assertEq( - paymentProcessor.unclaimable(address(ERC20PaymentClient), recipient), + paymentProcessor.unclaimable(address(paymentClient), recipient), amount / 4 ); @@ -1201,19 +1201,19 @@ contract StreamingPaymentProcessorTest is ModuleTest { // FF 25% and claim. vm.warp(block.timestamp + duration / 4); vm.prank(recipient); - paymentProcessor.claimAll(ERC20PaymentClient); + paymentProcessor.claimAll(paymentClient); // after successful claim attempt receiver should 50% total, // while both 'releasable' and 'unclaimable' recipient's amounts should be 0 assertEq(_token.balanceOf(address(recipient)), amount / 2); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); assertEq( - paymentProcessor.unclaimable(address(ERC20PaymentClient), recipient), 0 + paymentProcessor.unclaimable(address(paymentClient), recipient), 0 ); } @@ -1228,16 +1228,16 @@ contract StreamingPaymentProcessorTest is ModuleTest { uint duration = 10 days; // Add payment order to client and call processPayments. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, dueTo: block.timestamp + duration }) ); - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); // transfers will fail by returning false now _token.toggleReturnFalse(); @@ -1245,19 +1245,19 @@ contract StreamingPaymentProcessorTest is ModuleTest { // FF 25% and claim. vm.warp(block.timestamp + duration / 4); vm.prank(recipient); - paymentProcessor.claimAll(ERC20PaymentClient); + paymentProcessor.claimAll(paymentClient); // after failed claim attempt receiver should receive 0 token, // while VPP should move recipient's balances from 'releasable' to 'unclaimable' assertEq(_token.balanceOf(address(recipient)), 0); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); assertEq( - paymentProcessor.unclaimable(address(ERC20PaymentClient), recipient), + paymentProcessor.unclaimable(address(paymentClient), recipient), amount / 4 ); @@ -1267,19 +1267,19 @@ contract StreamingPaymentProcessorTest is ModuleTest { // FF 25% and claim. vm.warp(block.timestamp + duration / 4); vm.prank(recipient); - paymentProcessor.claimAll(ERC20PaymentClient); + paymentProcessor.claimAll(paymentClient); // after successful claim attempt receiver should 50% total, // while both 'releasable' and 'unclaimable' recipient's amounts should be 0 assertEq(_token.balanceOf(address(recipient)), amount / 2); assertEq( paymentProcessor.releasableForSpecificWalletId( - address(ERC20PaymentClient), recipient, 1 + address(paymentClient), recipient, 1 ), 0 ); assertEq( - paymentProcessor.unclaimable(address(ERC20PaymentClient), recipient), 0 + paymentProcessor.unclaimable(address(paymentClient), recipient), 0 ); } @@ -1303,8 +1303,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Add payment order to client. - ERC20PaymentClient.addPaymentOrder( - IERC20PaymentClient.PaymentOrder({ + paymentClient.addPaymentOrder( + IPaymentClient.PaymentOrder({ recipient: recipients[i], amount: amounts[i], createdAt: block.timestamp, @@ -1314,14 +1314,14 @@ contract StreamingPaymentProcessorTest is ModuleTest { } // Call processPayments. - vm.prank(address(ERC20PaymentClient)); - paymentProcessor.processPayments(ERC20PaymentClient); + vm.prank(address(paymentClient)); + paymentProcessor.processPayments(paymentClient); vm.warp(block.timestamp + max_time + 1); for (uint i; i < recipients.length; i++) { vm.prank(address(recipients[i])); - paymentProcessor.claimAll(ERC20PaymentClient); + paymentProcessor.claimAll(paymentClient); } } @@ -1369,7 +1369,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { invalids[0] = address(0); invalids[1] = address(_proposal); invalids[2] = address(paymentProcessor); - invalids[3] = address(ERC20PaymentClient); + invalids[3] = address(paymentClient); invalids[4] = address(this); return invalids; diff --git a/test/utils/mocks/modules/PaymentProcessorMock.sol b/test/utils/mocks/modules/PaymentProcessorMock.sol index 102eb64a5..85d1671a7 100644 --- a/test/utils/mocks/modules/PaymentProcessorMock.sol +++ b/test/utils/mocks/modules/PaymentProcessorMock.sol @@ -5,21 +5,21 @@ import {IERC20} from "@oz/token/ERC20/IERC20.sol"; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; -import {IERC20PaymentClient} from "src/modules/base/mixins/IERC20PaymentClient.sol"; +import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; contract PaymentProcessorMock is IPaymentProcessor { //-------------------------------------------------------------------------- // IPaymentProcessor Functions - function processPayments(IERC20PaymentClient client) external {} + function processPayments(IPaymentClient client) external {} - function cancelRunningPayments(IERC20PaymentClient client) external {} + function cancelRunningPayments(IPaymentClient client) external {} function token() external pure returns (IERC20) { return IERC20(address(0)); } - function deleteAllPayments(IERC20PaymentClient client) external { + function deleteAllPayments(IPaymentClient client) external { client.collectPaymentOrders(); } } diff --git a/test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol b/test/utils/mocks/modules/mixins/PaymentClientMock.sol similarity index 85% rename from test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol rename to test/utils/mocks/modules/mixins/PaymentClientMock.sol index 7c470f7d3..091180a90 100644 --- a/test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol +++ b/test/utils/mocks/modules/mixins/PaymentClientMock.sol @@ -3,9 +3,9 @@ pragma solidity ^0.8.0; // SuT import { - ERC20PaymentClient, - IERC20PaymentClient -} from "src/modules/base/mixins/ERC20PaymentClient.sol"; + PaymentClient, + IPaymentClient +} from "src/modules/base/mixins/PaymentClient.sol"; // Internal Interfaces import {IPaymentProcessor} from @@ -14,7 +14,7 @@ import {IPaymentProcessor} from // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; -contract ERC20PaymentClientMock is ERC20PaymentClient { +contract PaymentClientMock is PaymentClient { ERC20Mock token; mapping(address => bool) authorized; @@ -31,7 +31,7 @@ contract ERC20PaymentClientMock is ERC20PaymentClient { } //-------------------------------------------------------------------------- - // IERC20PaymentClient Wrapper Functions + // IPaymentClient Wrapper Functions function addPaymentOrder(PaymentOrder memory order) external { _addPaymentOrder(order); @@ -57,11 +57,11 @@ contract ERC20PaymentClientMock is ERC20PaymentClient { } //-------------------------------------------------------------------------- - // IERC20PaymentClient Overriden Functions + // IPaymentClient Overriden Functions function _ensureTokenBalance(uint amount) internal - override(ERC20PaymentClient) + override(PaymentClient) { if (token.balanceOf(address(this)) >= amount) { return; @@ -73,7 +73,7 @@ contract ERC20PaymentClientMock is ERC20PaymentClient { function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(ERC20PaymentClient) + override(PaymentClient) { token.approve(address(spender), amount); } @@ -81,7 +81,7 @@ contract ERC20PaymentClientMock is ERC20PaymentClient { function _isAuthorizedPaymentProcessor(IPaymentProcessor) internal view - override(ERC20PaymentClient) + override(PaymentClient) returns (bool) { return authorized[_msgSender()]; From 197dd791f6f5b55855fe41818946548c07d23833 Mon Sep 17 00:00:00 2001 From: FHieser Date: Tue, 1 Aug 2023 12:25:42 +0200 Subject: [PATCH 3/7] Rename to ERC20PaymentClient --- ...ymentClient.sol => ERC20PaymentClient.sol} | 31 +++++----- ...mentClient.sol => IERC20PaymentClient.sol} | 14 ++--- src/modules/logicModule/BountyManager.sol | 21 +++---- src/modules/logicModule/IBountyManager.sol | 5 +- src/modules/logicModule/IMilestoneManager.sol | 5 +- src/modules/logicModule/MilestoneManager.sol | 22 ++++---- .../logicModule/RecurringPaymentManager.sol | 21 +++---- .../paymentProcessor/IPaymentProcessor.sol | 15 ++--- .../IStreamingPaymentProcessor.sol | 23 ++++---- .../SimplePaymentProcessor.sol | 14 ++--- .../StreamingPaymentProcessor.sol | 20 +++---- test/e2e/BountyManagerLifecycle.t.sol | 4 +- test/e2e/MilestoneLifecycle.t.sol | 3 +- test/e2e/RecurringPayments.t.sol | 4 +- test/modules/base/mixins/PaymentClient.t.sol | 56 ++++++++++--------- test/modules/logicModule/BountyManager.t.sol | 4 +- .../logicModule/MilestoneManager.t.sol | 13 +++-- .../logicModule/RecurringPaymentManager.t.sol | 18 +++--- .../SimplePaymentProcessor.t.sol | 20 ++++--- .../StreamingPaymentProcessor.t.sol | 54 +++++++++--------- .../mocks/modules/PaymentProcessorMock.sol | 9 +-- ...entMock.sol => ERC20PaymentClientMock.sol} | 18 +++--- 22 files changed, 211 insertions(+), 183 deletions(-) rename src/modules/base/mixins/{PaymentClient.sol => ERC20PaymentClient.sol} (89%) rename src/modules/base/mixins/{IPaymentClient.sol => IERC20PaymentClient.sol} (84%) rename test/utils/mocks/modules/mixins/{PaymentClientMock.sol => ERC20PaymentClientMock.sol} (85%) diff --git a/src/modules/base/mixins/PaymentClient.sol b/src/modules/base/mixins/ERC20PaymentClient.sol similarity index 89% rename from src/modules/base/mixins/PaymentClient.sol rename to src/modules/base/mixins/ERC20PaymentClient.sol index ae9d74ba3..8bc3dfe03 100644 --- a/src/modules/base/mixins/PaymentClient.sol +++ b/src/modules/base/mixins/ERC20PaymentClient.sol @@ -6,19 +6,22 @@ import {ContextUpgradeable} from "@oz-up/utils/ContextUpgradeable.sol"; // Internal Dependencies import { - IPaymentClient, + IERC20PaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/IPaymentClient.sol"; +} from "src/modules/base/mixins/IERC20PaymentClient.sol"; /** - * @title PaymentClient + * @title ERC20PaymentClient * - * @dev The PaymentClient mixin enables modules to create payment orders that + * @dev The ERC20PaymentClient mixin enables modules to create payment orders that * are processable by a proposal's {IPaymentProcessor} module. * * @author Inverter Network */ -abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { +abstract contract ERC20PaymentClient is + IERC20PaymentClient, + ContextUpgradeable +{ //-------------------------------------------------------------------------- // Modifiers @@ -122,9 +125,9 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { } //-------------------------------------------------------------------------- - // IPaymentClient Functions + // IERC20PaymentClient Functions - /// @inheritdoc IPaymentClient + /// @inheritdoc IERC20PaymentClient function collectPaymentOrders() external virtual @@ -133,7 +136,7 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { // Ensure caller is authorized to act as payment processor. // Note that function is implemented in downstream contract. if (!_isAuthorizedPaymentProcessor(IPaymentProcessor(_msgSender()))) { - revert Module__PaymentClient__CallerNotAuthorized(); + revert Module__ERC20PaymentClient__CallerNotAuthorized(); } // Ensure payment processor is able to fetch the tokens from @@ -169,7 +172,7 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { return (copy, outstandingTokenAmountCache); } - /// @inheritdoc IPaymentClient + /// @inheritdoc IERC20PaymentClient function paymentOrders() external view @@ -179,7 +182,7 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { return _orders; } - /// @inheritdoc IPaymentClient + /// @inheritdoc IERC20PaymentClient function outstandingTokenAmount() external view virtual returns (uint) { return _outstandingTokenAmount; } @@ -189,20 +192,20 @@ abstract contract PaymentClient is IPaymentClient, ContextUpgradeable { function _ensureValidRecipient(address recipient) private view { if (recipient == address(0) || recipient == address(this)) { - revert Module__PaymentClient__InvalidRecipient(); + revert Module__ERC20PaymentClient__InvalidRecipient(); } } function _ensureValidAmount(uint amount) private pure { - if (amount == 0) revert Module__PaymentClient__InvalidAmount(); + if (amount == 0) revert Module__ERC20PaymentClient__InvalidAmount(); } function _ensureValidPaymentOrder(PaymentOrder memory order) private view { if (order.amount == 0) { - revert Module__PaymentClient__InvalidAmount(); + revert Module__ERC20PaymentClient__InvalidAmount(); } if (order.recipient == address(0) || order.recipient == address(this)) { - revert Module__PaymentClient__InvalidRecipient(); + revert Module__ERC20PaymentClient__InvalidRecipient(); } } } diff --git a/src/modules/base/mixins/IPaymentClient.sol b/src/modules/base/mixins/IERC20PaymentClient.sol similarity index 84% rename from src/modules/base/mixins/IPaymentClient.sol rename to src/modules/base/mixins/IERC20PaymentClient.sol index 1d640ee94..aff0d9844 100644 --- a/src/modules/base/mixins/IPaymentClient.sol +++ b/src/modules/base/mixins/IERC20PaymentClient.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; -interface IPaymentClient { +interface IERC20PaymentClient { struct PaymentOrder { /// @dev The recipient of the payment. address recipient; @@ -21,22 +21,22 @@ interface IPaymentClient { // Errors /// @notice Function is only callable by authorized address. - error Module__PaymentClient__CallerNotAuthorized(); + error Module__ERC20PaymentClient__CallerNotAuthorized(); /// @notice ERC20 token transfer failed. - error Module__PaymentClient__TokenTransferFailed(); + error Module__ERC20PaymentClient__TokenTransferFailed(); /// @notice Given recipient invalid. - error Module__PaymentClient__InvalidRecipient(); + error Module__ERC20PaymentClient__InvalidRecipient(); /// @notice Given amount invalid. - error Module__PaymentClient__InvalidAmount(); + error Module__ERC20PaymentClient__InvalidAmount(); /// @notice Given dueTo invalid. - error Module__PaymentClient__InvalidDueTo(); + error Module__ERC20PaymentClient__InvalidDueTo(); /// @notice Given arrays' length mismatch. - error Module__PaymentClient__ArrayLengthMismatch(); + error Module__ERC20PaymentClient__ArrayLengthMismatch(); //-------------------------------------------------------------------------- // Events diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index 0e35fa47a..4e096023d 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -11,7 +11,8 @@ import {EnumerableSet} from "@oz/utils/structs/EnumerableSet.sol"; // Internal Dependencies import {Module} from "src/modules/base/Module.sol"; -import {PaymentClient} from "src/modules/base/mixins/PaymentClient.sol"; +import {ERC20PaymentClient} from + "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces import {IProposal} from "src/proposal/IProposal.sol"; @@ -19,9 +20,9 @@ import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; import {IBountyManager} from "src/modules/logicModule/IBountyManager.sol"; import { - IPaymentClient, + IERC20PaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/PaymentClient.sol"; +} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Libraries import {LinkedIdList} from "src/common/LinkedIdList.sol"; @@ -32,7 +33,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; //This will be changed in the coming future, //but till then the RoleAuthorizer has to be selected as the Authorizer Module of the proposal if the BountyManager is to be used -contract BountyManager is IBountyManager, Module, PaymentClient { +contract BountyManager is IBountyManager, Module, ERC20PaymentClient { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; using LinkedIdList for LinkedIdList.List; @@ -453,7 +454,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { //when done process the Payments correctly __Module_proposal.paymentProcessor().processPayments( - IPaymentClient(address(this)) + IERC20PaymentClient(address(this)) ); //Set completed to true @@ -509,11 +510,11 @@ contract BountyManager is IBountyManager, Module, PaymentClient { } //-------------------------------------------------------------------------- - // {PaymentClient} Function Implementations + // {ERC20PaymentClient} Function Implementations function _ensureTokenBalance(uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { uint balance = __Module_proposal.token().balanceOf(address(this)); @@ -531,14 +532,14 @@ contract BountyManager is IBountyManager, Module, PaymentClient { ); if (!ok) { - revert Module__PaymentClient__TokenTransferFailed(); + revert Module__ERC20PaymentClient__TokenTransferFailed(); } } } function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { IERC20 token = __Module_proposal.token(); uint allowance = token.allowance(address(this), address(spender)); @@ -551,7 +552,7 @@ contract BountyManager is IBountyManager, Module, PaymentClient { function _isAuthorizedPaymentProcessor(IPaymentProcessor who) internal view - override(PaymentClient) + override(ERC20PaymentClient) returns (bool) { return __Module_proposal.paymentProcessor() == who; diff --git a/src/modules/logicModule/IBountyManager.sol b/src/modules/logicModule/IBountyManager.sol index 5e04b0642..359c57bc4 100644 --- a/src/modules/logicModule/IBountyManager.sol +++ b/src/modules/logicModule/IBountyManager.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from + "src/modules/base/mixins/IERC20PaymentClient.sol"; -interface IBountyManager is IPaymentClient { +interface IBountyManager is IERC20PaymentClient { //-------------------------------------------------------------------------- // Enums diff --git a/src/modules/logicModule/IMilestoneManager.sol b/src/modules/logicModule/IMilestoneManager.sol index e0aac4e99..bd7abfa0a 100644 --- a/src/modules/logicModule/IMilestoneManager.sol +++ b/src/modules/logicModule/IMilestoneManager.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from + "src/modules/base/mixins/IERC20PaymentClient.sol"; -interface IMilestoneManager is IPaymentClient { +interface IMilestoneManager is IERC20PaymentClient { //-------------------------------------------------------------------------- // Types diff --git a/src/modules/logicModule/MilestoneManager.sol b/src/modules/logicModule/MilestoneManager.sol index 5a0020386..fb2b3c2fc 100644 --- a/src/modules/logicModule/MilestoneManager.sol +++ b/src/modules/logicModule/MilestoneManager.sol @@ -10,10 +10,10 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Internal Dependencies import {Module, ContextUpgradeable} from "src/modules/base/Module.sol"; import { - IPaymentClient, - PaymentClient, + IERC20PaymentClient, + ERC20PaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/PaymentClient.sol"; +} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces import {IMilestoneManager} from "src/modules/logicModule/IMilestoneManager.sol"; @@ -45,7 +45,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; * * @author Inverter Network */ -contract MilestoneManager is IMilestoneManager, Module, PaymentClient { +contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { using SafeERC20 for IERC20; using LinkedIdList for LinkedIdList.List; @@ -376,7 +376,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { // stop all currently running payments __Module_proposal.paymentProcessor().cancelRunningPayments( - IPaymentClient(address(this)) + IERC20PaymentClient(address(this)) ); emit MilestoneStopped(id); @@ -468,7 +468,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { } __Module_proposal.paymentProcessor().processPayments( - IPaymentClient(address(this)) + IERC20PaymentClient(address(this)) ); emit MilestoneStarted(_last); @@ -690,11 +690,11 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { } //-------------------------------------------------------------------------- - // {PaymentClient} Function Implementations + // {ERC20PaymentClient} Function Implementations function _ensureTokenBalance(uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { uint balance = __Module_proposal.token().balanceOf(address(this)); @@ -712,14 +712,14 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { ); if (!ok) { - revert Module__PaymentClient__TokenTransferFailed(); + revert Module__ERC20PaymentClient__TokenTransferFailed(); } } } function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { IERC20 token = __Module_proposal.token(); uint allowance = token.allowance(address(this), address(spender)); @@ -732,7 +732,7 @@ contract MilestoneManager is IMilestoneManager, Module, PaymentClient { function _isAuthorizedPaymentProcessor(IPaymentProcessor who) internal view - override(PaymentClient) + override(ERC20PaymentClient) returns (bool) { return __Module_proposal.paymentProcessor() == who; diff --git a/src/modules/logicModule/RecurringPaymentManager.sol b/src/modules/logicModule/RecurringPaymentManager.sol index 33fa547d6..1ca7d53ac 100644 --- a/src/modules/logicModule/RecurringPaymentManager.sol +++ b/src/modules/logicModule/RecurringPaymentManager.sol @@ -10,7 +10,8 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Internal Dependencies import {Module} from "src/modules/base/Module.sol"; -import {PaymentClient} from "src/modules/base/mixins/PaymentClient.sol"; +import {ERC20PaymentClient} from + "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces import {IProposal} from "src/proposal/IProposal.sol"; @@ -18,9 +19,9 @@ import {IRecurringPaymentManager} from "src/modules/logicModule/IRecurringPaymentManager.sol"; import { - IPaymentClient, + IERC20PaymentClient, IPaymentProcessor -} from "src/modules/base/mixins/PaymentClient.sol"; +} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Libraries import {LinkedIdList} from "src/common/LinkedIdList.sol"; @@ -28,7 +29,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; contract RecurringPaymentManager is IRecurringPaymentManager, Module, - PaymentClient + ERC20PaymentClient { using SafeERC20 for IERC20; using LinkedIdList for LinkedIdList.List; @@ -355,17 +356,17 @@ contract RecurringPaymentManager is //when done process the Payments correctly __Module_proposal.paymentProcessor().processPayments( - IPaymentClient(address(this)) + IERC20PaymentClient(address(this)) ); emit RecurringPaymentsTriggered(currentEpoch); } //-------------------------------------------------------------------------- - // {PaymentClient} Function Implementations + // {ERC20PaymentClient} Function Implementations function _ensureTokenBalance(uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { uint balance = __Module_proposal.token().balanceOf(address(this)); @@ -383,14 +384,14 @@ contract RecurringPaymentManager is ); if (!ok) { - revert Module__PaymentClient__TokenTransferFailed(); + revert Module__ERC20PaymentClient__TokenTransferFailed(); } } } function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { IERC20 token = __Module_proposal.token(); uint allowance = token.allowance(address(this), address(spender)); @@ -403,7 +404,7 @@ contract RecurringPaymentManager is function _isAuthorizedPaymentProcessor(IPaymentProcessor who) internal view - override(PaymentClient) + override(ERC20PaymentClient) returns (bool) { return __Module_proposal.paymentProcessor() == who; diff --git a/src/modules/paymentProcessor/IPaymentProcessor.sol b/src/modules/paymentProcessor/IPaymentProcessor.sol index 5b0b431c0..c142920bb 100644 --- a/src/modules/paymentProcessor/IPaymentProcessor.sol +++ b/src/modules/paymentProcessor/IPaymentProcessor.sol @@ -3,7 +3,8 @@ pragma solidity ^0.8.0; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from + "src/modules/base/mixins/IERC20PaymentClient.sol"; interface IPaymentProcessor { //-------------------------------------------------------------------------- @@ -42,17 +43,17 @@ interface IPaymentProcessor { //-------------------------------------------------------------------------- // Functions - /// @notice Processes all payments from an {IPaymentClient} instance. + /// @notice Processes all payments from an {IERC20PaymentClient} instance. /// @dev It's up to the the implementation to keep up with what has been /// paid out or not. - /// @param client The {IPaymentClient} instance to process its to payments. - function processPayments(IPaymentClient client) external; + /// @param client The {IERC20PaymentClient} instance to process its to payments. + function processPayments(IERC20PaymentClient client) external; - /// @notice Cancels all unfinished payments from an {IPaymentClient} instance. + /// @notice Cancels all unfinished payments from an {IERC20PaymentClient} instance. /// @dev It's up to the the implementation to keep up with what has been /// paid out or not. - /// @param client The {IPaymentClient} instance to process its to payments. - function cancelRunningPayments(IPaymentClient client) external; + /// @param client The {IERC20PaymentClient} instance to process its to payments. + function cancelRunningPayments(IERC20PaymentClient client) external; /// @notice Returns the IERC20 token the payment processor can process. function token() external view returns (IERC20); diff --git a/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol b/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol index 4559eee7f..e3cabf500 100644 --- a/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/IStreamingPaymentProcessor.sol @@ -2,7 +2,8 @@ pragma solidity ^0.8.0; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from + "src/modules/base/mixins/IERC20PaymentClient.sol"; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; @@ -114,43 +115,43 @@ interface IStreamingPaymentProcessor is IPaymentProcessor { /// @notice claim everything that the paymentClient owes to the _msgSender till the current timestamp /// @dev This function should be callable if the _msgSender is either an activePaymentReceiver or has some unclaimedAmounts - /// @param client The {IPaymentClient} instance to process all claims from _msgSender - function claimAll(IPaymentClient client) external; + /// @param client The {IERC20PaymentClient} instance to process all claims from _msgSender + function claimAll(IERC20PaymentClient client) external; /// @notice claim the salary uptil block.timestamp from the client for a payment order with id = walletId by _msgSender /// @dev If for a specific walletId, the tokens could not be transferred for some reason, it will added to the unclaimableAmounts /// of the paymentReceiver, and the amount would no longer hold any co-relation with the specific walletId of the paymentReceiver. - /// @param client The {IPaymentClient} instance to process the walletId claim from _msgSender + /// @param client The {IERC20PaymentClient} instance to process the walletId claim from _msgSender /// @param walletId The ID of the payment order for which claim is being made /// @param retryForUnclaimableAmounts boolean which determines if the function will try to pay the unclaimable amounts from earlier /// along with the vested salary from the payment order with id = walletId function claimForSpecificWalletId( - IPaymentClient client, + IERC20PaymentClient client, uint walletId, bool retryForUnclaimableAmounts ) external; - /// @notice Deletes all payments related to a paymentReceiver & leaves unvested tokens in the PaymentClient. + /// @notice Deletes all payments related to a paymentReceiver & leaves unvested tokens in the ERC20PaymentClient. /// @dev this function calls _removePayment which goes through all the payment orders for a paymentReceiver. For the payment orders /// that are completely vested, their details are deleted in the _claimForSpecificWalletId function and for others it is /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the paymentClient itself. - /// @param client The {IPaymentClient} instance from which we will remove the payments + /// @param client The {IERC20PaymentClient} instance from which we will remove the payments /// @param paymentReceiver PaymentReceiver's address. function removeAllPaymentReceiverPayments( - IPaymentClient client, + IERC20PaymentClient client, address paymentReceiver ) external; - /// @notice Deletes a specific payment with id = walletId for a paymentReceiver & leaves unvested tokens in the PaymentClient. + /// @notice Deletes a specific payment with id = walletId for a paymentReceiver & leaves unvested tokens in the ERC20PaymentClient. /// @dev the detail of the wallet that is being removed is either deleted in the _claimForSpecificWalletId or later down in this /// function itself depending on the timestamp of when this function was called - /// @param client The {IPaymentClient} instance from which we will remove the payment + /// @param client The {IERC20PaymentClient} instance from which we will remove the payment /// @param paymentReceiver address of the paymentReceiver whose payment order is to be removed /// @param walletId The ID of the paymentReceiver's payment order which is to be removed /// @param retryForUnclaimableAmounts boolean that determines whether the function would try to return the unclaimableAmounts along /// with the vested amounts from the payment order with id = walletId to the paymentReceiver function removePaymentForSpecificWalletId( - IPaymentClient client, + IERC20PaymentClient client, address paymentReceiver, uint walletId, bool retryForUnclaimableAmounts diff --git a/src/modules/paymentProcessor/SimplePaymentProcessor.sol b/src/modules/paymentProcessor/SimplePaymentProcessor.sol index 1ef51339b..3bfebf9cb 100644 --- a/src/modules/paymentProcessor/SimplePaymentProcessor.sol +++ b/src/modules/paymentProcessor/SimplePaymentProcessor.sol @@ -10,7 +10,7 @@ import {SafeERC20} from "@oz/token/ERC20/utils/SafeERC20.sol"; // Internal Dependencies import { IPaymentProcessor, - IPaymentClient + IERC20PaymentClient } from "src/modules/paymentProcessor/IPaymentProcessor.sol"; import {Module} from "src/modules/base/Module.sol"; @@ -22,7 +22,7 @@ import {IProposal} from "src/proposal/IProposal.sol"; * * @dev The SimplePaymentProcessor is a module to process payment orders from other * modules. In order to process a module's payment orders, the module must - * implement the {IPaymentClient} interface. + * implement the {IERC20PaymentClient} interface. * * @author Inverter Network */ @@ -41,7 +41,7 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { } /// @notice checks that the client is calling for itself - modifier validClient(IPaymentClient client) { + modifier validClient(IERC20PaymentClient client) { if (_msgSender() != address(client)) { revert Module__PaymentManager__CannotCallOnOtherClientsOrders(); } @@ -66,20 +66,20 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { } /// @inheritdoc IPaymentProcessor - function processPayments(IPaymentClient client) + function processPayments(IERC20PaymentClient client) external onlyModule validClient(client) { // Collect outstanding orders and their total token amount. - IPaymentClient.PaymentOrder[] memory orders; + IERC20PaymentClient.PaymentOrder[] memory orders; uint totalAmount; (orders, totalAmount) = client.collectPaymentOrders(); // Cache token. IERC20 token_ = token(); - // Transfer tokens from {IPaymentClient} to order recipients. + // Transfer tokens from {IERC20PaymentClient} to order recipients. address recipient; uint amount; uint len = orders.length; @@ -101,7 +101,7 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { } } - function cancelRunningPayments(IPaymentClient client) + function cancelRunningPayments(IERC20PaymentClient client) external onlyModule validClient(client) diff --git a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol index 530538277..747e84dc1 100644 --- a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.19; import { IStreamingPaymentProcessor, IPaymentProcessor, - IPaymentClient + IERC20PaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; import {Module} from "src/modules/base/Module.sol"; @@ -62,7 +62,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @notice checks that the client is calling for itself - modifier validClient(IPaymentClient client) { + modifier validClient(IERC20PaymentClient client) { if (_msgSender() != address(client)) { revert Module__PaymentManager__CannotCallOnOtherClientsOrders(); } @@ -91,7 +91,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @inheritdoc IStreamingPaymentProcessor - function claimAll(IPaymentClient client) external { + function claimAll(IERC20PaymentClient client) external { if ( !( unclaimable(address(client), _msgSender()) > 0 @@ -109,7 +109,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function claimForSpecificWalletId( - IPaymentClient client, + IERC20PaymentClient client, uint walletId, bool retryForUnclaimableAmounts ) external { @@ -137,7 +137,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @inheritdoc IPaymentProcessor - function processPayments(IPaymentClient client) + function processPayments(IERC20PaymentClient client) external onlyModule validClient(client) @@ -145,7 +145,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { //We check if there are any new paymentOrders, without processing them if (client.paymentOrders().length > 0) { // Collect outstanding orders and their total token amount. - IPaymentClient.PaymentOrder[] memory orders; + IERC20PaymentClient.PaymentOrder[] memory orders; uint totalAmount; (orders, totalAmount) = client.collectPaymentOrders(); @@ -196,7 +196,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } /// @inheritdoc IPaymentProcessor - function cancelRunningPayments(IPaymentClient client) + function cancelRunningPayments(IERC20PaymentClient client) external onlyModule validClient(client) @@ -206,7 +206,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function removeAllPaymentReceiverPayments( - IPaymentClient client, + IERC20PaymentClient client, address paymentReceiver ) external onlyAuthorized { if ( @@ -222,7 +222,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IStreamingPaymentProcessor function removePaymentForSpecificWalletId( - IPaymentClient client, + IERC20PaymentClient client, address paymentReceiver, uint walletId, bool retryForUnclaimableAmounts @@ -454,7 +454,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { } } - /// @notice Deletes all payments related to a paymentReceiver & leaves unvested tokens in the PaymentClient. + /// @notice Deletes all payments related to a paymentReceiver & leaves unvested tokens in the ERC20PaymentClient. /// @dev this function calls _removePayment which goes through all the payment orders for a paymentReceiver. For the payment orders /// that are completely vested, their details are deleted in the _claimForSpecificWalletId function and for others it is /// deleted in the _removePayment function only, leaving the unvested tokens as balance of the paymentClient itself. diff --git a/test/e2e/BountyManagerLifecycle.t.sol b/test/e2e/BountyManagerLifecycle.t.sol index 118f914e3..5622fe45a 100644 --- a/test/e2e/BountyManagerLifecycle.t.sol +++ b/test/e2e/BountyManagerLifecycle.t.sol @@ -18,7 +18,7 @@ import {RebasingFundingManager} from import { BountyManager, IBountyManager, - IPaymentClient + IERC20PaymentClient } from "src/modules/logicModule/BountyManager.sol"; import {StreamingPaymentProcessor} from @@ -26,7 +26,7 @@ import {StreamingPaymentProcessor} from import { IStreamingPaymentProcessor, - IPaymentClient + IERC20PaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; // Mocks diff --git a/test/e2e/MilestoneLifecycle.t.sol b/test/e2e/MilestoneLifecycle.t.sol index 14782e658..38472122a 100644 --- a/test/e2e/MilestoneLifecycle.t.sol +++ b/test/e2e/MilestoneLifecycle.t.sol @@ -16,7 +16,8 @@ import {RebasingFundingManager} from import {SimplePaymentProcessor} from "src/modules/paymentProcessor/SimplePaymentProcessor.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from + "src/modules/base/mixins/IERC20PaymentClient.sol"; // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; diff --git a/test/e2e/RecurringPayments.t.sol b/test/e2e/RecurringPayments.t.sol index d2b93b196..f64efcc32 100644 --- a/test/e2e/RecurringPayments.t.sol +++ b/test/e2e/RecurringPayments.t.sol @@ -18,7 +18,7 @@ import {RebasingFundingManager} from import { RecurringPaymentManager, IRecurringPaymentManager, - IPaymentClient + IERC20PaymentClient } from "src/modules/logicModule/RecurringPaymentManager.sol"; import {StreamingPaymentProcessor} from @@ -26,7 +26,7 @@ import {StreamingPaymentProcessor} from import { IStreamingPaymentProcessor, - IPaymentClient + IERC20PaymentClient } from "src/modules/paymentProcessor/IStreamingPaymentProcessor.sol"; // Mocks diff --git a/test/modules/base/mixins/PaymentClient.t.sol b/test/modules/base/mixins/PaymentClient.t.sol index 692a6d736..549ab7a14 100644 --- a/test/modules/base/mixins/PaymentClient.t.sol +++ b/test/modules/base/mixins/PaymentClient.t.sol @@ -5,16 +5,16 @@ import "forge-std/Test.sol"; // SuT import { - PaymentClientMock, - IPaymentClient -} from "test/utils/mocks/modules/mixins/PaymentClientMock.sol"; + ERC20PaymentClientMock, + IERC20PaymentClient +} from "test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol"; // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; -contract PaymentClientTest is Test { +contract ERC20PaymentClientTest is Test { // SuT - PaymentClientMock paymentClient; + ERC20PaymentClientMock paymentClient; // Mocks ERC20Mock token; @@ -22,7 +22,7 @@ contract PaymentClientTest is Test { function setUp() public { token = new ERC20Mock("Mock", "MOCK"); - paymentClient = new PaymentClientMock(token); + paymentClient = new ERC20PaymentClientMock(token); paymentClient.setIsAuthorized(address(this), true); } @@ -52,7 +52,7 @@ contract PaymentClientTest is Test { for (uint i; i < orderAmount; ++i) { paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -61,7 +61,7 @@ contract PaymentClientTest is Test { ); } - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = paymentClient.paymentOrders(); assertEq(orders.length, orderAmount); @@ -81,10 +81,12 @@ contract PaymentClientTest is Test { for (uint i; i < invalids.length; ++i) { vm.expectRevert( - IPaymentClient.Module__PaymentClient__InvalidRecipient.selector + IERC20PaymentClient + .Module__ERC20PaymentClient__InvalidRecipient + .selector ); paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: invalids[0], amount: amount, createdAt: block.timestamp, @@ -101,10 +103,12 @@ contract PaymentClientTest is Test { for (uint i; i < invalids.length; ++i) { vm.expectRevert( - IPaymentClient.Module__PaymentClient__InvalidAmount.selector + IERC20PaymentClient + .Module__ERC20PaymentClient__InvalidAmount + .selector ); paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: invalids[0], createdAt: block.timestamp, @@ -118,21 +122,21 @@ contract PaymentClientTest is Test { // Test: addPaymentOrders() function testAddPaymentOrders() public { - IPaymentClient.PaymentOrder[] memory ordersToAdd = - new IPaymentClient.PaymentOrder[](3); - ordersToAdd[0] = IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder[] memory ordersToAdd = + new IERC20PaymentClient.PaymentOrder[](3); + ordersToAdd[0] = IERC20PaymentClient.PaymentOrder({ recipient: address(0xCAFE1), amount: 100e18, createdAt: block.timestamp, dueTo: block.timestamp }); - ordersToAdd[1] = IPaymentClient.PaymentOrder({ + ordersToAdd[1] = IERC20PaymentClient.PaymentOrder({ recipient: address(0xCAFE2), amount: 100e18, createdAt: block.timestamp, dueTo: block.timestamp + 1 }); - ordersToAdd[2] = IPaymentClient.PaymentOrder({ + ordersToAdd[2] = IERC20PaymentClient.PaymentOrder({ recipient: address(0xCAFE3), amount: 100e18, createdAt: block.timestamp, @@ -141,7 +145,7 @@ contract PaymentClientTest is Test { paymentClient.addPaymentOrders(ordersToAdd); - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = paymentClient.paymentOrders(); assertEq(orders.length, 3); @@ -180,7 +184,7 @@ contract PaymentClientTest is Test { for (uint i; i < orderAmount; ++i) { paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -189,7 +193,7 @@ contract PaymentClientTest is Test { ); } - IPaymentClient.PaymentOrder[] memory orders; + IERC20PaymentClient.PaymentOrder[] memory orders; uint totalOutstandingAmount; (orders, totalOutstandingAmount) = paymentClient.collectPaymentOrders(); @@ -204,15 +208,15 @@ contract PaymentClientTest is Test { // Check that total outstanding token amount is correct. assertEq(totalOutstandingAmount, orderAmount * amount); - // Check that orders in PaymentClient got reset. - IPaymentClient.PaymentOrder[] memory updatedOrders; + // Check that orders in ERC20PaymentClient got reset. + IERC20PaymentClient.PaymentOrder[] memory updatedOrders; updatedOrders = paymentClient.paymentOrders(); assertEq(updatedOrders.length, 0); - // Check that outstanding token amount in PaymentClient got reset. + // Check that outstanding token amount in ERC20PaymentClient got reset. assertEq(paymentClient.outstandingTokenAmount(), 0); - // Check that we received allowance to fetch tokens from PaymentClient. + // Check that we received allowance to fetch tokens from ERC20PaymentClient. assertTrue( token.allowance(address(paymentClient), address(this)) >= totalOutstandingAmount @@ -223,7 +227,9 @@ contract PaymentClientTest is Test { paymentClient.setIsAuthorized(address(this), false); vm.expectRevert( - IPaymentClient.Module__PaymentClient__CallerNotAuthorized.selector + IERC20PaymentClient + .Module__ERC20PaymentClient__CallerNotAuthorized + .selector ); paymentClient.collectPaymentOrders(); } diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 00580c540..495d45128 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -16,7 +16,7 @@ import {OZErrors} from "test/utils/errors/OZErrors.sol"; import { BountyManager, IBountyManager, - IPaymentClient + IERC20PaymentClient } from "src/modules/logicModule/BountyManager.sol"; contract BountyManagerTest is ModuleTest { @@ -715,7 +715,7 @@ contract BountyManagerTest is ModuleTest { bountyManager.verifyClaim(claimId, bountyId); - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = bountyManager.paymentOrders(); assertEq(length, orders.length); diff --git a/test/modules/logicModule/MilestoneManager.t.sol b/test/modules/logicModule/MilestoneManager.t.sol index e3bae86c3..d9ce57ed0 100644 --- a/test/modules/logicModule/MilestoneManager.t.sol +++ b/test/modules/logicModule/MilestoneManager.t.sol @@ -14,7 +14,8 @@ import { IMilestoneManager } from "src/modules/logicModule/MilestoneManager.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from + "src/modules/base/mixins/IERC20PaymentClient.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -905,7 +906,7 @@ contract MilestoneManagerTest is ModuleTest { ); // Check that payment orders were added correctly. - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = milestoneManager.paymentOrders(); assertEq(orders.length, contributors.length); @@ -984,7 +985,9 @@ contract MilestoneManagerTest is ModuleTest { vm.warp(block.timestamp + TIMELOCK + 1); vm.expectRevert( - IPaymentClient.Module__PaymentClient__TokenTransferFailed.selector + IERC20PaymentClient + .Module__ERC20PaymentClient__TokenTransferFailed + .selector ); milestoneManager.startNextMilestone(); } @@ -1847,7 +1850,7 @@ contract MilestoneManagerTest is ModuleTest { //Make sure the values in the payment orders are the same // Check that payment orders were added correctly. - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = milestoneManager.paymentOrders(); for (uint i = 1; i < orders.length; ++i) { @@ -1895,7 +1898,7 @@ contract MilestoneManagerTest is ModuleTest { //Make sure the values in the payment orders are the same // Check that payment orders were added correctly. - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = milestoneManager.paymentOrders(); for (uint i = 1; i < orders.length; ++i) { diff --git a/test/modules/logicModule/RecurringPaymentManager.t.sol b/test/modules/logicModule/RecurringPaymentManager.t.sol index 0ba51ba9c..abd2cee21 100644 --- a/test/modules/logicModule/RecurringPaymentManager.t.sol +++ b/test/modules/logicModule/RecurringPaymentManager.t.sol @@ -16,7 +16,7 @@ import {OZErrors} from "test/utils/errors/OZErrors.sol"; import { RecurringPaymentManager, IRecurringPaymentManager, - IPaymentClient + IERC20PaymentClient } from "src/modules/logicModule/RecurringPaymentManager.sol"; contract RecurringPaymentManagerTest is ModuleTest { @@ -259,7 +259,9 @@ contract RecurringPaymentManagerTest is ModuleTest { //validAmount vm.expectRevert( - IPaymentClient.Module__PaymentClient__InvalidAmount.selector + IERC20PaymentClient + .Module__ERC20PaymentClient__InvalidAmount + .selector ); recurringPaymentManager.addRecurringPayment(0, 2 weeks, address(0xBEEF)); @@ -275,7 +277,9 @@ contract RecurringPaymentManagerTest is ModuleTest { //validRecipient vm.expectRevert( - IPaymentClient.Module__PaymentClient__InvalidRecipient.selector + IERC20PaymentClient + .Module__ERC20PaymentClient__InvalidRecipient + .selector ); recurringPaymentManager.addRecurringPayment(1, 2 weeks, address(0)); } @@ -399,7 +403,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //remove tokens and orders from recurringPaymentManager for easier testing _paymentProcessor.deleteAllPayments( - IPaymentClient(address(recurringPaymentManager)) + IERC20PaymentClient(address(recurringPaymentManager)) ); _token.burn( address(recurringPaymentManager), @@ -435,7 +439,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //remove tokens and orders from recurringPaymentManager for easier testing _paymentProcessor.deleteAllPayments( - IPaymentClient(address(recurringPaymentManager)) + IERC20PaymentClient(address(recurringPaymentManager)) ); _token.burn( address(recurringPaymentManager), @@ -657,7 +661,7 @@ contract RecurringPaymentManagerTest is ModuleTest { ) internal { uint length = recurringPaymentsToBeChecked.length; - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = recurringPaymentManager.paymentOrders(); assertEq(length, currentRecurringPayments.length); @@ -731,7 +735,7 @@ contract RecurringPaymentManagerTest is ModuleTest { } function assertOrder( - IPaymentClient.PaymentOrder memory order, + IERC20PaymentClient.PaymentOrder memory order, address recipient, uint amount, uint createdAt, diff --git a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol index f51db11ff..76976fd5b 100644 --- a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol @@ -14,9 +14,9 @@ import { // Mocks import { - IPaymentClient, - PaymentClientMock -} from "test/utils/mocks/modules/mixins/PaymentClientMock.sol"; + IERC20PaymentClient, + ERC20PaymentClientMock +} from "test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -29,7 +29,7 @@ contract SimplePaymentProcessorTest is ModuleTest { SimplePaymentProcessor paymentProcessor; // Mocks - PaymentClientMock paymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock paymentClient = new ERC20PaymentClientMock(_token); function setUp() public { address impl = address(new SimplePaymentProcessor()); @@ -96,7 +96,7 @@ contract SimplePaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -149,7 +149,8 @@ contract SimplePaymentProcessorTest is ModuleTest { vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock otherERC20PaymentClient = + new ERC20PaymentClientMock(_token); vm.prank(address(paymentClient)); vm.expectRevert( @@ -159,7 +160,7 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(otherPaymentClient); + paymentProcessor.processPayments(otherERC20PaymentClient); } function testCancelPaymentsFailsWhenCalledByNonModule(address nonModule) @@ -195,7 +196,8 @@ contract SimplePaymentProcessorTest is ModuleTest { vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock otherERC20PaymentClient = + new ERC20PaymentClientMock(_token); vm.prank(address(paymentClient)); vm.expectRevert( @@ -205,6 +207,6 @@ contract SimplePaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(otherPaymentClient); + paymentProcessor.cancelRunningPayments(otherERC20PaymentClient); } } diff --git a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol index 7ea4d0bdb..2d2f9b3f5 100644 --- a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol @@ -17,9 +17,9 @@ import { // Mocks import { - IPaymentClient, - PaymentClientMock -} from "test/utils/mocks/modules/mixins/PaymentClientMock.sol"; + IERC20PaymentClient, + ERC20PaymentClientMock +} from "test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -32,7 +32,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { StreamingPaymentProcessor paymentProcessor; // Mocks - PaymentClientMock paymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock paymentClient = new ERC20PaymentClientMock(_token); event InvalidStreamingOrderDiscarded( address indexed recipient, uint amount, uint start, uint dueTo @@ -134,7 +134,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: amount, createdAt: block.timestamp, @@ -196,7 +196,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: amount, createdAt: block.timestamp, @@ -290,7 +290,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { for (uint i; i < length; i++) { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: payoutAmount, createdAt: block.timestamp, @@ -299,7 +299,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); } - IPaymentClient.PaymentOrder[] memory orders = + IERC20PaymentClient.PaymentOrder[] memory orders = paymentClient.paymentOrders(); // Call processPayments @@ -308,7 +308,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { for (uint i; i < length; i++) { address recipient = recipients[i]; - IPaymentClient.PaymentOrder memory order = orders[i]; + IERC20PaymentClient.PaymentOrder memory order = orders[i]; //If dueTo is before currentTimestamp evereything should be releasable if (order.dueTo <= block.timestamp) { @@ -344,7 +344,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { //we don't mind about adding address(this)in this case for (uint i = 0; i < recipients.length - 1; ++i) { paymentClient.addPaymentOrderUnchecked( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: 100, createdAt: block.timestamp, @@ -364,7 +364,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { paymentProcessor.processPayments(paymentClient); paymentClient.addPaymentOrderUnchecked( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: address(0xB0B), amount: invalidAmt, createdAt: block.timestamp, @@ -452,7 +452,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -493,7 +493,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -611,7 +611,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -719,7 +719,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -839,7 +839,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock otherERC20PaymentClient = + new ERC20PaymentClientMock(_token); vm.prank(address(paymentClient)); vm.expectRevert( @@ -849,7 +850,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.processPayments(otherPaymentClient); + paymentProcessor.processPayments(otherERC20PaymentClient); } function test_cancelRunningPayments_allCreatedOrdersGetCancelled( @@ -865,7 +866,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { for (uint i = 0; i < length; ++i) { paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: amounts[i], createdAt: block.timestamp, @@ -978,7 +979,8 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.assume(nonModule != address(_paymentProcessor)); vm.assume(nonModule != address(_fundingManager)); - PaymentClientMock otherPaymentClient = new PaymentClientMock(_token); + ERC20PaymentClientMock otherERC20PaymentClient = + new ERC20PaymentClientMock(_token); vm.prank(address(paymentClient)); vm.expectRevert( @@ -988,7 +990,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { .selector ) ); - paymentProcessor.cancelRunningPayments(otherPaymentClient); + paymentProcessor.cancelRunningPayments(otherERC20PaymentClient); } //This test creates a new set of payments in a client which finished all running payments. @@ -1017,7 +1019,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amounts[i], createdAt: block.timestamp, @@ -1099,7 +1101,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -1160,7 +1162,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { ); } - // No funds left in the PaymentClient + // No funds left in the ERC20PaymentClient assertEq(_token.balanceOf(address(paymentClient)), 0); // Invariant: Payment processor does not hold funds. @@ -1182,7 +1184,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client and call processPayments. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -1245,7 +1247,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client and call processPayments. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipient, amount: amount, createdAt: block.timestamp, @@ -1320,7 +1322,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Add payment order to client. paymentClient.addPaymentOrder( - IPaymentClient.PaymentOrder({ + IERC20PaymentClient.PaymentOrder({ recipient: recipients[i], amount: amounts[i], createdAt: block.timestamp, diff --git a/test/utils/mocks/modules/PaymentProcessorMock.sol b/test/utils/mocks/modules/PaymentProcessorMock.sol index 85d1671a7..9d3094cc3 100644 --- a/test/utils/mocks/modules/PaymentProcessorMock.sol +++ b/test/utils/mocks/modules/PaymentProcessorMock.sol @@ -5,21 +5,22 @@ import {IERC20} from "@oz/token/ERC20/IERC20.sol"; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; -import {IPaymentClient} from "src/modules/base/mixins/IPaymentClient.sol"; +import {IERC20PaymentClient} from + "src/modules/base/mixins/IERC20PaymentClient.sol"; contract PaymentProcessorMock is IPaymentProcessor { //-------------------------------------------------------------------------- // IPaymentProcessor Functions - function processPayments(IPaymentClient client) external {} + function processPayments(IERC20PaymentClient client) external {} - function cancelRunningPayments(IPaymentClient client) external {} + function cancelRunningPayments(IERC20PaymentClient client) external {} function token() external pure returns (IERC20) { return IERC20(address(0)); } - function deleteAllPayments(IPaymentClient client) external { + function deleteAllPayments(IERC20PaymentClient client) external { client.collectPaymentOrders(); } } diff --git a/test/utils/mocks/modules/mixins/PaymentClientMock.sol b/test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol similarity index 85% rename from test/utils/mocks/modules/mixins/PaymentClientMock.sol rename to test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol index 091180a90..7c470f7d3 100644 --- a/test/utils/mocks/modules/mixins/PaymentClientMock.sol +++ b/test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol @@ -3,9 +3,9 @@ pragma solidity ^0.8.0; // SuT import { - PaymentClient, - IPaymentClient -} from "src/modules/base/mixins/PaymentClient.sol"; + ERC20PaymentClient, + IERC20PaymentClient +} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces import {IPaymentProcessor} from @@ -14,7 +14,7 @@ import {IPaymentProcessor} from // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; -contract PaymentClientMock is PaymentClient { +contract ERC20PaymentClientMock is ERC20PaymentClient { ERC20Mock token; mapping(address => bool) authorized; @@ -31,7 +31,7 @@ contract PaymentClientMock is PaymentClient { } //-------------------------------------------------------------------------- - // IPaymentClient Wrapper Functions + // IERC20PaymentClient Wrapper Functions function addPaymentOrder(PaymentOrder memory order) external { _addPaymentOrder(order); @@ -57,11 +57,11 @@ contract PaymentClientMock is PaymentClient { } //-------------------------------------------------------------------------- - // IPaymentClient Overriden Functions + // IERC20PaymentClient Overriden Functions function _ensureTokenBalance(uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { if (token.balanceOf(address(this)) >= amount) { return; @@ -73,7 +73,7 @@ contract PaymentClientMock is PaymentClient { function _ensureTokenAllowance(IPaymentProcessor spender, uint amount) internal - override(PaymentClient) + override(ERC20PaymentClient) { token.approve(address(spender), amount); } @@ -81,7 +81,7 @@ contract PaymentClientMock is PaymentClient { function _isAuthorizedPaymentProcessor(IPaymentProcessor) internal view - override(PaymentClient) + override(ERC20PaymentClient) returns (bool) { return authorized[_msgSender()]; From e1a19d696d6af2d9e450d9f1df8b24589a58eb7e Mon Sep 17 00:00:00 2001 From: FHieser Date: Tue, 1 Aug 2023 12:34:15 +0200 Subject: [PATCH 4/7] Rename Proposal to Orchestrator --- Makefile | 24 +- dev.env | 12 +- script/deployment/DeploymentScript.s.sol | 24 +- script/deployment/HowToSetup.md | 2 +- script/factories/DeployModuleFactory.s.sol | 2 +- .../factories/DeployOrchestratorFactory.s.sol | 67 ++++++ script/factories/DeployProposalFactory.s.sol | 66 ------ script/modules/DeployMilestoneManager.s.sol | 2 +- .../DeployRebasingFundingManager.s.sol | 2 +- .../governance/DeployRoleAuthorizer.s.sol | 2 +- .../governance/DeploySingleVoteGovernor.s.sol | 2 +- .../DeploySimplePaymentProcessor.s.sol | 2 +- .../DeployStreamingPaymentProcessor.s.sol | 2 +- script/orchestrator/DeployOrchestrator.s.sol | 42 ++++ script/proposal/DeployProposal.s.sol | 42 ---- script/proxies/DeployAndSetUpBeacon.s.sol | 2 +- script/proxies/DeployBeacon.s.sol | 2 +- script/setup/SetupToyProposalScript.s.sol | 128 ++++++----- src/factories/IModuleFactory.sol | 10 +- ...alFactory.sol => IOrchestratorFactory.sol} | 40 ++-- src/factories/ModuleFactory.sol | 10 +- ...salFactory.sol => OrchestratorFactory.sol} | 92 ++++---- src/modules/IMetadataManager.sol | 6 +- src/modules/MetadataManager.sol | 50 ++--- src/modules/authorizer/IRoleAuthorizer.sol | 4 +- src/modules/authorizer/RoleAuthorizer.sol | 54 ++--- src/modules/authorizer/SingleVoteGovernor.sol | 12 +- .../authorizer/TokenGatedRoleAuthorizer.sol | 4 +- src/modules/base/IModule.sol | 29 +-- src/modules/base/Module.sol | 70 +++--- .../base/mixins/ERC20PaymentClient.sol | 2 +- .../fundingManager/IFundingManager.sol | 6 +- .../fundingManager/RebasingFundingManager.sol | 33 +-- src/modules/logicModule/BountyManager.sol | 54 ++--- src/modules/logicModule/IMilestoneManager.sol | 4 +- src/modules/logicModule/MilestoneManager.sol | 34 +-- .../logicModule/RecurringPaymentManager.sol | 22 +- .../SimplePaymentProcessor.sol | 10 +- .../StreamingPaymentProcessor.sol | 12 +- .../IOrchestrator.sol} | 28 +-- .../Orchestrator.sol} | 90 ++++---- .../base/IModuleManager.sol | 14 +- .../base/ModuleManager.sol | 18 +- tasks/deployBaseContracts.sh | 8 +- test/e2e/BountyManagerLifecycle.t.sol | 33 +-- ...osal.t.sol => CreateNewOrchestrator.t.sol} | 150 ++++++------- test/e2e/E2eTest.sol | 129 +++++------ test/e2e/FundManagement.t.sol | 30 +-- test/e2e/MilestoneLifecycle.t.sol | 38 ++-- test/e2e/ModuleUpdate.t.sol | 15 +- test/e2e/RecurringPayments.t.sol | 25 ++- test/factories/ModuleFactory.t.sol | 28 +-- test/factories/ProposalFactory.t.sol | 120 +++++----- test/factories/beacon/Beacon.t.sol | 2 +- test/modules/MetadataManager.t.sol | 89 ++++---- test/modules/ModuleTest.sol | 26 ++- test/modules/authorizer/RoleAuthorizer.t.sol | 156 +++++++------ .../authorizer/SingleVoteGovernor.t.sol | 89 ++++---- .../authorizer/TokenGatedRoleAuthorizer.t.sol | 44 ++-- test/modules/base/Module.t.sol | 34 +-- .../RebasingFundingManager.t.sol | 50 +++-- test/modules/logicModule/BountyManager.t.sol | 16 +- .../logicModule/MilestoneManager.t.sol | 38 ++-- .../logicModule/RecurringPaymentManager.t.sol | 38 ++-- .../SimplePaymentProcessor.t.sol | 18 +- .../StreamingPaymentProcessor.t.sol | 24 +- .../Orchestrator.t.sol} | 207 ++++++++++-------- .../base/ModuleManager.t.sol | 34 +-- .../helper/TypeSanityHelper.sol | 6 +- .../mocks/factories/ModuleFactoryMock.sol | 4 +- test/utils/mocks/modules/AuthorizerMock.sol | 6 +- .../mocks/modules/FundingManagerMock.sol | 16 +- test/utils/mocks/modules/base/ModuleMock.sol | 19 +- .../base/ModuleManagerMock.sol | 5 +- testnet.env | 8 +- 75 files changed, 1372 insertions(+), 1266 deletions(-) create mode 100644 script/factories/DeployOrchestratorFactory.s.sol delete mode 100644 script/factories/DeployProposalFactory.s.sol create mode 100644 script/orchestrator/DeployOrchestrator.s.sol delete mode 100644 script/proposal/DeployProposal.s.sol rename src/factories/{IProposalFactory.sol => IOrchestratorFactory.sol} (52%) rename src/factories/{ProposalFactory.sol => OrchestratorFactory.sol} (66%) rename src/{proposal/IProposal.sol => orchestrator/IOrchestrator.sol} (85%) rename src/{proposal/Proposal.sol => orchestrator/Orchestrator.sol} (80%) rename src/{proposal => orchestrator}/base/IModuleManager.sol (91%) rename src/{proposal => orchestrator}/base/ModuleManager.sol (92%) rename test/e2e/{CreateNewProposal.t.sol => CreateNewOrchestrator.t.sol} (71%) rename test/{proposal/Proposal.t.sol => orchestrator/Orchestrator.t.sol} (71%) rename test/{proposal => orchestrator}/base/ModuleManager.t.sol (91%) rename test/{proposal => orchestrator}/helper/TypeSanityHelper.sol (94%) rename test/utils/mocks/{proposal => orchestrator}/base/ModuleManagerMock.sol (91%) diff --git a/Makefile b/Makefile index ccafbf748..daad18a33 100644 --- a/Makefile +++ b/Makefile @@ -52,9 +52,9 @@ testFuzz: ## Run whole testsuite with a custom amount of fuzz runs # ----------------------------------------------------------------------------- # Individual Component Tests -.PHONY: testProposal -testProposal: ## Run proposal/ package tests - @forge test -vvv --match-path "*/proposal/*" +.PHONY: testOrchestrator +testOrchestrator: ## Run orchestrator/ package tests + @forge test -vvv --match-path "*/orchestrator/*" .PHONY: testModules testModules: ## Run modules/ package tests @@ -73,7 +73,7 @@ testScripts: ## Run e2e test suite @forge script script/deployment/DeploymentScript.s.sol @forge script script/factories/DeployModuleFactory.s.sol - @forge script script/factories/DeployProposalFactory.s.sol + @forge script script/factories/DeployOrchestratorFactory.s.sol @forge script script/modules/governance/DeployRoleAuthorizer.s.sol @forge script script/modules/governance/DeploySingleVoteGovernor.s.sol @@ -84,11 +84,11 @@ testScripts: ## Run e2e test suite @forge script script/modules/DeployMilestoneManager.s.sol @forge script script/modules/DeployRebasingFundingManager.s.sol - @forge script script/proposal/DeployProposal.s.sol + @forge script script/orchestrator/DeployOrchestrator.s.sol @forge script script/proxies/DeployBeacon.s.sol - @forge script script/setup/SetupToyProposalScript.s.sol + @forge script script/setup/SetupToyOrchestratorScript.s.sol # ----------------------------------------------------------------------------- # Static Analyzers @@ -101,7 +101,7 @@ analyze-slither: ## Run slither analyzer against project (requires solc-select) slither --ignore-compile src/factories || \ slither --ignore-compile src/generated || \ slither --ignore-compile src/modules || \ - slither --ignore-compile src/proposal + slither --ignore-compile src/orchestrator .PHONY: analyze-c4udit analyze-c4udit: ## Run c4udit analyzer against project @@ -148,17 +148,17 @@ pre-commit: ## Git pre-commit hook # Env variables required for the tests @export WALLET_DEPLOYER=0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 @export WALLET_DEPLOYER_PK=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 - @export DEPLOYMENT_PROPOSAL_FACTORY_TARGET=0x0000000000000000000000000000000000000001 - @export DEPLOYMENT_PROPOSAL_FACTORY_MODULE_FACTORY=0x0000000000000000000000000000000000000001 + @export DEPLOYMENT_ORCHESTRATOR_FACTORY_TARGET=0x0000000000000000000000000000000000000001 + @export DEPLOYMENT_ORCHESTRATOR_FACTORY_MODULE_FACTORY=0x0000000000000000000000000000000000000001 @export ANVIL_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 @export PPBO_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d @export MMBO_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a @export FMBO_PRIVATE_KEY=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 @export ABO_PRIVATE_KEY=0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a - @export PROPOSAL_OWNER_PRIVATE_KEY=0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba + @export ORCHESTRATOR_OWNER_PRIVATE_KEY=0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba @export FUNDER_1_PRIVATE_KEY=0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e - @export DEPLOYMENT_PROPOSAL_FACTORY_TARGET=0x0000000000000000000000000000000000000001 - @export DEPLOYMENT_PROPOSAL_FACTORY_MODULE_FACTORY=0x0000000000000000000000000000000000000002 + @export DEPLOYMENT_ORCHESTRATOR_FACTORY_TARGET=0x0000000000000000000000000000000000000001 + @export DEPLOYMENT_ORCHESTRATOR_FACTORY_MODULE_FACTORY=0x0000000000000000000000000000000000000002 @echo "### Running tests & generating the coverage report..." @forge coverage --report lcov diff --git a/dev.env b/dev.env index 4c7f2a615..3f2a7e5e9 100644 --- a/dev.env +++ b/dev.env @@ -28,9 +28,9 @@ export WALLET_DEPLOYER_PK=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae78 # ------------------------------------------------------------------------------ # Deployment Arguments -# ProposalFactory -export DEPLOYMENT_PROPOSAL_FACTORY_TARGET=0x0000000000000000000000000000000000000001 -export DEPLOYMENT_PROPOSAL_FACTORY_MODULE_FACTORY=0x0000000000000000000000000000000000000001 +# OrchestratorFactory +export DEPLOYMENT_ORCHESTRATOR_FACTORY_TARGET=0x0000000000000000000000000000000000000001 +export DEPLOYMENT_ORCHESTRATOR_FACTORY_MODULE_FACTORY=0x0000000000000000000000000000000000000001 # Keys used from anvil available accounts standard export ANVIL_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 @@ -38,9 +38,9 @@ export PPBO_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f460 export MMBO_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a export FMBO_PRIVATE_KEY=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 export ABO_PRIVATE_KEY=0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a -export PROPOSAL_OWNER_PRIVATE_KEY=0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba +export ORCHESTRATOR_OWNER_PRIVATE_KEY=0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba export FUNDER_1_PRIVATE_KEY=0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e # These are just basic Addresses fro testing -export DEPLOYMENT_PROPOSAL_FACTORY_TARGET=0x0000000000000000000000000000000000000001 -export DEPLOYMENT_PROPOSAL_FACTORY_MODULE_FACTORY=0x0000000000000000000000000000000000000002 \ No newline at end of file +export DEPLOYMENT_ORCHESTRATOR_FACTORY_TARGET=0x0000000000000000000000000000000000000001 +export DEPLOYMENT_ORCHESTRATOR_FACTORY_MODULE_FACTORY=0x0000000000000000000000000000000000000002 \ No newline at end of file diff --git a/script/deployment/DeploymentScript.s.sol b/script/deployment/DeploymentScript.s.sol index 0a0d1bfc1..f3c04f4de 100644 --- a/script/deployment/DeploymentScript.s.sol +++ b/script/deployment/DeploymentScript.s.sol @@ -13,10 +13,10 @@ import {IModuleFactory} from "src/factories/ModuleFactory.sol"; import {DeployAndSetUpBeacon} from "script/proxies/DeployAndSetUpBeacon.s.sol"; import {DeployModuleFactory} from "script/factories/DeployModuleFactory.s.sol"; -import {DeployProposalFactory} from - "script/factories/DeployProposalFactory.s.sol"; +import {DeployOrchestratorFactory} from + "script/factories/DeployOrchestratorFactory.s.sol"; -import {DeployProposal} from "script/proposal/DeployProposal.s.sol"; +import {DeployOrchestrator} from "script/orchestrator/DeployOrchestrator.s.sol"; import {DeployStreamingPaymentProcessor} from "script/modules/paymentProcessor/DeployStreamingPaymentProcessor.s.sol"; import {DeployMilestoneManager} from @@ -31,9 +31,10 @@ contract DeploymentScript is Script { // Instances of Deployer Contracts DeployModuleFactory deployModuleFactory = new DeployModuleFactory(); - DeployProposalFactory deployProposalFactory = new DeployProposalFactory(); + DeployOrchestratorFactory deployOrchestratorFactory = + new DeployOrchestratorFactory(); - DeployProposal deployProposal = new DeployProposal(); + DeployOrchestrator deployOrchestrator = new DeployOrchestrator(); DeployStreamingPaymentProcessor deployStreamingPaymentProcessor = new DeployStreamingPaymentProcessor(); DeployMilestoneManager deployMilestoneManager = new DeployMilestoneManager(); @@ -46,14 +47,14 @@ contract DeploymentScript is Script { // ------------------------------------------------------------------------ // Deployed Contracts - address proposal; + address orchestrator; address streamingPaymentProcessor; address milestoneManager; address fundingManager; address authorizer; address moduleFactory; - address proposalFactory; + address orchestratorFactory; address paymentProcessorBeacon; address milestoneManagerBeacon; @@ -85,17 +86,18 @@ contract DeploymentScript is Script { ); /// @notice Deploys all necessary factories, beacons and iplementations - /// @return factory The addresses of the fully deployed proposal factory. All other addresses should be accessible from this. + /// @return factory The addresses of the fully deployed orchestrator factory. All other addresses should be accessible from this. function run() public virtual returns (address factory) { // Deploy implementation contracts. - proposal = deployProposal.run(); + orchestrator = deployOrchestrator.run(); streamingPaymentProcessor = deployStreamingPaymentProcessor.run(); fundingManager = deployRebasingFundingManager.run(); authorizer = deployRoleAuthorizer.run(); milestoneManager = deployMilestoneManager.run(); moduleFactory = deployModuleFactory.run(); - proposalFactory = deployProposalFactory.run(proposal, moduleFactory); + orchestratorFactory = + deployOrchestratorFactory.run(orchestrator, moduleFactory); // Create beacons, set implementations and set metadata. paymentProcessorBeacon = deployAndSetUpBeacon.run( @@ -111,6 +113,6 @@ contract DeploymentScript is Script { milestoneManager, moduleFactory, milestoneManagerMetadata ); - return (proposalFactory); + return (orchestratorFactory); } } diff --git a/script/deployment/HowToSetup.md b/script/deployment/HowToSetup.md index 87caf335f..89014fa94 100644 --- a/script/deployment/HowToSetup.md +++ b/script/deployment/HowToSetup.md @@ -9,7 +9,7 @@ PPBO_PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b786 MMBO_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a ABO_PRIVATE_KEY=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 FMBO_PRIVATE_KEY=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 -PROPOSAL_OWNER_PRIVATE_KEY=0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a +ORCHESTRATOR_OWNER_PRIVATE_KEY=0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a ``` 2. Open a tab in your terminal diff --git a/script/factories/DeployModuleFactory.s.sol b/script/factories/DeployModuleFactory.s.sol index 8b2a6df5d..277b98b06 100644 --- a/script/factories/DeployModuleFactory.s.sol +++ b/script/factories/DeployModuleFactory.s.sol @@ -16,7 +16,7 @@ import {ModuleFactory} from "src/factories/ModuleFactory.sol"; contract DeployModuleFactory is Script { // ------------------------------------------------------------------------ // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); ModuleFactory moduleFactory; diff --git a/script/factories/DeployOrchestratorFactory.s.sol b/script/factories/DeployOrchestratorFactory.s.sol new file mode 100644 index 000000000..a6f7b944c --- /dev/null +++ b/script/factories/DeployOrchestratorFactory.s.sol @@ -0,0 +1,67 @@ +pragma solidity ^0.8.0; + +import "forge-std/Script.sol"; + +import {OrchestratorFactory} from "src/factories/OrchestratorFactory.sol"; + +/** + * @title OrchestratorFactory Deployment Script + * + * @dev Script to deploy a new OrchestratorFactory. + * + * The implementation and moduleFactory addresses can be supplied directly or read from the following environment variables: + * - DEPLOYMENT_ORCHESTRATOR_FACTORY_TARGET + * - DEPLOYMENT_ORCHESTRATOR_FACTORY_MODULE_FACTORY + * + * @author Inverter Network + */ + +contract DeployOrchestratorFactory is Script { + // ------------------------------------------------------------------------ + // Fetch Environment Variables + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); + address deployer = vm.addr(deployerPrivateKey); + + OrchestratorFactory orchestratorFactory; + + function run() external returns (address) { + // Read deployment settings from environment variables. + address target = vm.envAddress("DEPLOYMENT_ORCHESTRATOR_FACTORY_TARGET"); + address moduleFactory = + vm.envAddress("DEPLOYMENT_ORCHESTRATOR_FACTORY_MODULE_FACTORY"); + + // Check settings. + require( + target != address(0), + "DeployOrchestratorFactory: Missing env variable: target" + ); + require( + moduleFactory != address(0), + "DeployOrchestratorFactory: Missing env variable: moduleFactory" + ); + + // Deploy the orchestratorFactory. + return run(target, moduleFactory); + } + + function run(address target, address moduleFactory) + public + returns (address) + { + vm.startBroadcast(deployerPrivateKey); + { + // Deploy the orchestratorFactory. + orchestratorFactory = new OrchestratorFactory(target, moduleFactory); + } + + vm.stopBroadcast(); + + // Log the deployed OrchestratorFactory contract address. + console2.log( + "Deployment of OrchestratorFactory at address", + address(orchestratorFactory) + ); + + return address(orchestratorFactory); + } +} diff --git a/script/factories/DeployProposalFactory.s.sol b/script/factories/DeployProposalFactory.s.sol deleted file mode 100644 index f58ea2c37..000000000 --- a/script/factories/DeployProposalFactory.s.sol +++ /dev/null @@ -1,66 +0,0 @@ -pragma solidity ^0.8.0; - -import "forge-std/Script.sol"; - -import {ProposalFactory} from "src/factories/ProposalFactory.sol"; - -/** - * @title ProposalFactory Deployment Script - * - * @dev Script to deploy a new ProposalFactory. - * - * The implementation and moduleFactory addresses can be supplied directly or read from the following environment variables: - * - DEPLOYMENT_PROPOSAL_FACTORY_TARGET - * - DEPLOYMENT_PROPOSAL_FACTORY_MODULE_FACTORY - * - * @author Inverter Network - */ - -contract DeployProposalFactory is Script { - // ------------------------------------------------------------------------ - // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); - address deployer = vm.addr(deployerPrivateKey); - - ProposalFactory proposalFactory; - - function run() external returns (address) { - // Read deployment settings from environment variables. - address target = vm.envAddress("DEPLOYMENT_PROPOSAL_FACTORY_TARGET"); - address moduleFactory = - vm.envAddress("DEPLOYMENT_PROPOSAL_FACTORY_MODULE_FACTORY"); - - // Check settings. - require( - target != address(0), - "DeployProposalFactory: Missing env variable: target" - ); - require( - moduleFactory != address(0), - "DeployProposalFactory: Missing env variable: moduleFactory" - ); - - // Deploy the proposalFactory. - return run(target, moduleFactory); - } - - function run(address target, address moduleFactory) - public - returns (address) - { - vm.startBroadcast(deployerPrivateKey); - { - // Deploy the proposalFactory. - proposalFactory = new ProposalFactory(target, moduleFactory); - } - - vm.stopBroadcast(); - - // Log the deployed ProposalFactory contract address. - console2.log( - "Deployment of ProposalFactory at address", address(proposalFactory) - ); - - return address(proposalFactory); - } -} diff --git a/script/modules/DeployMilestoneManager.s.sol b/script/modules/DeployMilestoneManager.s.sol index eabdca26b..e25e1420f 100644 --- a/script/modules/DeployMilestoneManager.s.sol +++ b/script/modules/DeployMilestoneManager.s.sol @@ -16,7 +16,7 @@ import {MilestoneManager} from "src/modules/logicModule/MilestoneManager.sol"; contract DeployMilestoneManager is Script { // ------------------------------------------------------------------------ // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); MilestoneManager milestoneManager; diff --git a/script/modules/DeployRebasingFundingManager.s.sol b/script/modules/DeployRebasingFundingManager.s.sol index 98b443828..1e4283a0e 100644 --- a/script/modules/DeployRebasingFundingManager.s.sol +++ b/script/modules/DeployRebasingFundingManager.s.sol @@ -16,7 +16,7 @@ import {RebasingFundingManager} from contract DeployRebasingFundingManager is Script { // ------------------------------------------------------------------------ // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); RebasingFundingManager fundingManager; diff --git a/script/modules/governance/DeployRoleAuthorizer.s.sol b/script/modules/governance/DeployRoleAuthorizer.s.sol index 951267680..3d202d95b 100644 --- a/script/modules/governance/DeployRoleAuthorizer.s.sol +++ b/script/modules/governance/DeployRoleAuthorizer.s.sol @@ -16,7 +16,7 @@ import {RoleAuthorizer} from "src/modules/authorizer/RoleAuthorizer.sol"; contract DeployRoleAuthorizer is Script { // ------------------------------------------------------------------------ // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); RoleAuthorizer roleAuthorizer; diff --git a/script/modules/governance/DeploySingleVoteGovernor.s.sol b/script/modules/governance/DeploySingleVoteGovernor.s.sol index af0ee3045..1c0c70726 100644 --- a/script/modules/governance/DeploySingleVoteGovernor.s.sol +++ b/script/modules/governance/DeploySingleVoteGovernor.s.sol @@ -16,7 +16,7 @@ import {SingleVoteGovernor} from "src/modules/authorizer/SingleVoteGovernor.sol" contract DeploySingleVoteGovernor is Script { // ------------------------------------------------------------------------ // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); SingleVoteGovernor singleVoteGovernor; diff --git a/script/modules/paymentProcessor/DeploySimplePaymentProcessor.s.sol b/script/modules/paymentProcessor/DeploySimplePaymentProcessor.s.sol index 158d600d1..46738dae5 100644 --- a/script/modules/paymentProcessor/DeploySimplePaymentProcessor.s.sol +++ b/script/modules/paymentProcessor/DeploySimplePaymentProcessor.s.sol @@ -16,7 +16,7 @@ import {SimplePaymentProcessor} from contract DeployPaymentProcessor is Script { // ------------------------------------------------------------------------ // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); SimplePaymentProcessor paymentProcessor; diff --git a/script/modules/paymentProcessor/DeployStreamingPaymentProcessor.s.sol b/script/modules/paymentProcessor/DeployStreamingPaymentProcessor.s.sol index 137e8f6b1..23d0b42de 100644 --- a/script/modules/paymentProcessor/DeployStreamingPaymentProcessor.s.sol +++ b/script/modules/paymentProcessor/DeployStreamingPaymentProcessor.s.sol @@ -16,7 +16,7 @@ import {StreamingPaymentProcessor} from contract DeployStreamingPaymentProcessor is Script { // ------------------------------------------------------------------------ // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); StreamingPaymentProcessor paymentProcessor; diff --git a/script/orchestrator/DeployOrchestrator.s.sol b/script/orchestrator/DeployOrchestrator.s.sol new file mode 100644 index 000000000..6b233fc7f --- /dev/null +++ b/script/orchestrator/DeployOrchestrator.s.sol @@ -0,0 +1,42 @@ +pragma solidity ^0.8.0; + +import "forge-std/Script.sol"; + +import {Orchestrator} from "src/orchestrator/Orchestrator.sol"; + +/** + * @title Orchestrator Deployment Script + * + * @dev Script to deploy a new Orchestrator. + * + * + * @author Inverter Network + */ + +contract DeployOrchestrator is Script { + // ------------------------------------------------------------------------ + // Fetch Environment Variables + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); + address deployer = vm.addr(deployerPrivateKey); + + Orchestrator orchestrator; + + function run() external returns (address) { + vm.startBroadcast(deployerPrivateKey); + { + // Deploy the orchestrator. + + orchestrator = new Orchestrator(); + } + + vm.stopBroadcast(); + + // Log the deployed Orchestrator contract address. + console2.log( + "Deployment of Orchestrator Implementation at address", + address(orchestrator) + ); + + return address(orchestrator); + } +} diff --git a/script/proposal/DeployProposal.s.sol b/script/proposal/DeployProposal.s.sol deleted file mode 100644 index 5afac8cdd..000000000 --- a/script/proposal/DeployProposal.s.sol +++ /dev/null @@ -1,42 +0,0 @@ -pragma solidity ^0.8.0; - -import "forge-std/Script.sol"; - -import {Proposal} from "src/proposal/Proposal.sol"; - -/** - * @title Proposal Deployment Script - * - * @dev Script to deploy a new Proposal. - * - * - * @author Inverter Network - */ - -contract DeployProposal is Script { - // ------------------------------------------------------------------------ - // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); - address deployer = vm.addr(deployerPrivateKey); - - Proposal proposal; - - function run() external returns (address) { - vm.startBroadcast(deployerPrivateKey); - { - // Deploy the proposal. - - proposal = new Proposal(); - } - - vm.stopBroadcast(); - - // Log the deployed Proposal contract address. - console2.log( - "Deployment of Proposal Implementation at address", - address(proposal) - ); - - return address(proposal); - } -} diff --git a/script/proxies/DeployAndSetUpBeacon.s.sol b/script/proxies/DeployAndSetUpBeacon.s.sol index d4d8f2784..3eb9737e0 100644 --- a/script/proxies/DeployAndSetUpBeacon.s.sol +++ b/script/proxies/DeployAndSetUpBeacon.s.sol @@ -20,7 +20,7 @@ import {DeployBeacon} from "script/proxies/DeployBeacon.s.sol"; contract DeployAndSetUpBeacon is Script { // ------------------------------------------------------------------------ // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); Beacon beacon; diff --git a/script/proxies/DeployBeacon.s.sol b/script/proxies/DeployBeacon.s.sol index 004fb688f..602a8e529 100644 --- a/script/proxies/DeployBeacon.s.sol +++ b/script/proxies/DeployBeacon.s.sol @@ -16,7 +16,7 @@ import {Beacon} from "src/factories/beacon/Beacon.sol"; contract DeployBeacon is Script { // ------------------------------------------------------------------------ // Fetch Environment Variables - uint deployerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); + uint deployerPrivateKey = vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); address deployer = vm.addr(deployerPrivateKey); Beacon beacon; diff --git a/script/setup/SetupToyProposalScript.s.sol b/script/setup/SetupToyProposalScript.s.sol index ad721084a..15005819f 100644 --- a/script/setup/SetupToyProposalScript.s.sol +++ b/script/setup/SetupToyProposalScript.s.sol @@ -8,25 +8,26 @@ import "../deployment/DeploymentScript.s.sol"; import {IMilestoneManager} from "src/modules/logicModule/IMilestoneManager.sol"; import {IFundingManager} from "src/modules/fundingManager/IFundingManager.sol"; -import {IProposalFactory} from "src/factories/IProposalFactory.sol"; -import {IProposal} from "src/proposal/Proposal.sol"; +import {IOrchestratorFactory} from "src/factories/IOrchestratorFactory.sol"; +import {IOrchestrator} from "src/orchestrator/Orchestrator.sol"; import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; -contract SetupToyProposalScript is Test, DeploymentScript { +contract SetupToyOrchestratorScript is Test, DeploymentScript { bool hasDependency; string[] dependencies = new string[](0); // ------------------------------------------------------------------------ // Fetch Environment Variables - uint proposalOwnerPrivateKey = vm.envUint("PROPOSAL_OWNER_PRIVATE_KEY"); - address proposalOwner = vm.addr(proposalOwnerPrivateKey); + uint orchestratorOwnerPrivateKey = + vm.envUint("ORCHESTRATOR_OWNER_PRIVATE_KEY"); + address orchestratorOwner = vm.addr(orchestratorOwnerPrivateKey); //------------------------------------------------------------------------- // Mock Funder and Contributor information //Since this is a demo deployment, we will use the same address for the owner and the funder. - uint funder1PrivateKey = proposalOwnerPrivateKey; - address funder1 = proposalOwner; + uint funder1PrivateKey = orchestratorOwnerPrivateKey; + address funder1 = orchestratorOwner; // Every Milestone needs some contributors IMilestoneManager.Contributor alice = IMilestoneManager.Contributor( @@ -39,7 +40,7 @@ contract SetupToyProposalScript is Test, DeploymentScript { // Storage ERC20Mock token; - IProposal test_proposal; + IOrchestrator test_orchestrator; IMilestoneManager.Contributor[] contributors; address[] initialAuthorizedAddresses; @@ -47,72 +48,76 @@ contract SetupToyProposalScript is Test, DeploymentScript { //------------------------------------------------------------------------- // Script - function run() public override returns (address deployedProposal) { + function run() public override returns (address deployedOrchestrator) { // ------------------------------------------------------------------------ // Setup - // First we deploy a mock ERC20 to act as funding token for the proposal. It has a public mint function. - vm.startBroadcast(proposalOwnerPrivateKey); + // First we deploy a mock ERC20 to act as funding token for the orchestrator. It has a public mint function. + vm.startBroadcast(orchestratorOwnerPrivateKey); { token = new ERC20Mock("Mock", "MOCK"); } vm.stopBroadcast(); // Then, we run the deployment script to deploy the factories, implementations and Beacons. - address proposalFactory = DeploymentScript.run(); + address orchestratorFactory = DeploymentScript.run(); // ------------------------------------------------------------------------ // Define Initial Configuration Data - // Proposal: Owner, funding token - IProposalFactory.ProposalConfig memory proposalConfig = IProposalFactory - .ProposalConfig({owner: proposalOwner, token: token}); + // Orchestrator: Owner, funding token + IOrchestratorFactory.OrchestratorConfig memory orchestratorConfig = + IOrchestratorFactory.OrchestratorConfig({ + owner: orchestratorOwner, + token: token + }); // Funding Manager: Metadata, token address - IProposalFactory.ModuleConfig memory fundingManagerFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig memory fundingManagerFactoryConfig = + IOrchestratorFactory.ModuleConfig( fundingManagerMetadata, abi.encode(address(token)), abi.encode(hasDependency, dependencies) ); // Payment Processor: only Metadata - IProposalFactory.ModuleConfig memory paymentProcessorFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig memory paymentProcessorFactoryConfig = + IOrchestratorFactory.ModuleConfig( paymentProcessorMetadata, bytes(""), abi.encode(hasDependency, dependencies) ); // Authorizer: Metadata, initial authorized addresses - initialAuthorizedAddresses.push(proposalOwner); - IProposalFactory.ModuleConfig memory authorizerFactoryConfig = - IProposalFactory.ModuleConfig( + initialAuthorizedAddresses.push(orchestratorOwner); + IOrchestratorFactory.ModuleConfig memory authorizerFactoryConfig = + IOrchestratorFactory.ModuleConfig( authorizerMetadata, abi.encode(initialAuthorizedAddresses), abi.encode(hasDependency, dependencies) ); // MilestoneManager: Metadata, salary precision, fee percentage, fee treasury address - IProposalFactory.ModuleConfig memory milestoneManagerFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig memory milestoneManagerFactoryConfig = + IOrchestratorFactory.ModuleConfig( milestoneManagerMetadata, - abi.encode(100_000_000, 1_000_000, proposalOwner), + abi.encode(100_000_000, 1_000_000, orchestratorOwner), abi.encode(hasDependency, dependencies) ); // Add the configuration for all the non-mandatory modules. In this case only the Milestone Manager. - IProposalFactory.ModuleConfig[] memory additionalModuleConfig = - new IProposalFactory.ModuleConfig[](1); + IOrchestratorFactory.ModuleConfig[] memory additionalModuleConfig = + new IOrchestratorFactory.ModuleConfig[](1); additionalModuleConfig[0] = milestoneManagerFactoryConfig; // ------------------------------------------------------------------------ - // Proposal Creation + // Orchestrator Creation - vm.startBroadcast(proposalOwnerPrivateKey); + vm.startBroadcast(orchestratorOwnerPrivateKey); { - test_proposal = IProposalFactory(proposalFactory).createProposal( - proposalConfig, + test_orchestrator = IOrchestratorFactory(orchestratorFactory) + .createOrchestrator( + orchestratorConfig, fundingManagerFactoryConfig, authorizerFactoryConfig, paymentProcessorFactoryConfig, @@ -121,12 +126,13 @@ contract SetupToyProposalScript is Test, DeploymentScript { } vm.stopBroadcast(); - // Check if the proposal has been created correctly. + // Check if the orchestrator has been created correctly. - assert(address(test_proposal) != address(0)); + assert(address(test_orchestrator) != address(0)); - address proposalToken = address(IProposal(test_proposal).token()); - assertEq(proposalToken, address(token)); + address orchestratorToken = + address(IOrchestrator(test_orchestrator).token()); + assertEq(orchestratorToken, address(token)); // Now we need to find the MilestoneManager. ModuleManager has a function called `listModules` that returns a list of // active modules, let's use that to get the address of the MilestoneManager. @@ -134,35 +140,35 @@ contract SetupToyProposalScript is Test, DeploymentScript { // TODO: Ideally this would be substituted by a check that that all mandatory modules implement their corresponding interfaces + the same for MilestoneManager address[] memory moduleAddresses = - IProposal(test_proposal).listModules(); + IOrchestrator(test_orchestrator).listModules(); uint lenModules = moduleAddresses.length; - address proposalCreatedMilestoneManagerAddress; + address orchestratorCreatedMilestoneManagerAddress; for (uint i; i < lenModules;) { try IMilestoneManager(moduleAddresses[i]).hasActiveMilestone() returns (bool) { - proposalCreatedMilestoneManagerAddress = moduleAddresses[i]; + orchestratorCreatedMilestoneManagerAddress = moduleAddresses[i]; break; } catch { i++; } } - IMilestoneManager proposalCreatedMilestoneManager = - IMilestoneManager(proposalCreatedMilestoneManagerAddress); + IMilestoneManager orchestratorCreatedMilestoneManager = + IMilestoneManager(orchestratorCreatedMilestoneManagerAddress); assertFalse( - proposalCreatedMilestoneManager.hasActiveMilestone(), + orchestratorCreatedMilestoneManager.hasActiveMilestone(), "Error in the MilestoneManager" ); assertFalse( - proposalCreatedMilestoneManager.isExistingMilestoneId( + orchestratorCreatedMilestoneManager.isExistingMilestoneId( type(uint).max ), "Error in the MilestoneManager" ); assertEq( - proposalCreatedMilestoneManager.getMaximumContributors(), + orchestratorCreatedMilestoneManager.getMaximumContributors(), 50, "Error in the MilestoneManager" ); @@ -172,9 +178,9 @@ contract SetupToyProposalScript is Test, DeploymentScript { "==================================================================================" ); console2.log( - "Proposal with Id %s created at address: %s ", - test_proposal.proposalId(), - address(test_proposal) + "Orchestrator with Id %s created at address: %s ", + test_orchestrator.orchestratorId(), + address(test_orchestrator) ); // ------------------------------------------------------------------------ @@ -183,16 +189,16 @@ contract SetupToyProposalScript is Test, DeploymentScript { // IMPORTANT // ========= // Due to how the underlying rebase mechanism works, it is necessary - // to always have some amount of tokens in the proposal. + // to always have some amount of tokens in the orchestrator. // It's best, if the owner deposits them right after deployment. uint initialDeposit = 10e18; IFundingManager fundingManager = - IFundingManager(address(test_proposal.fundingManager())); + IFundingManager(address(test_orchestrator.fundingManager())); - vm.startBroadcast(proposalOwnerPrivateKey); + vm.startBroadcast(orchestratorOwnerPrivateKey); { - token.mint(address(proposalOwner), initialDeposit); + token.mint(address(orchestratorOwner), initialDeposit); token.approve(address(fundingManager), initialDeposit); @@ -217,16 +223,16 @@ contract SetupToyProposalScript is Test, DeploymentScript { contributors.push(alice); contributors.push(bob); - vm.startBroadcast(proposalOwnerPrivateKey); + vm.startBroadcast(orchestratorOwnerPrivateKey); { - proposalCreatedMilestoneManager.addMilestone( + orchestratorCreatedMilestoneManager.addMilestone( 1 weeks, 1000e18, contributors, bytes("Here could be a more detailed description") ); - proposalCreatedMilestoneManager.addMilestone( + orchestratorCreatedMilestoneManager.addMilestone( 2 weeks, 5000e18, contributors, @@ -239,17 +245,23 @@ contract SetupToyProposalScript is Test, DeploymentScript { // Check if the Milestones have has been added correctly // milestoneId 1 should exist and 0 shouldn't, since IDs start from 1. - assertTrue(!(proposalCreatedMilestoneManager.isExistingMilestoneId(0))); - assertTrue(proposalCreatedMilestoneManager.isExistingMilestoneId(1)); + assertTrue( + !(orchestratorCreatedMilestoneManager.isExistingMilestoneId(0)) + ); + assertTrue(orchestratorCreatedMilestoneManager.isExistingMilestoneId(1)); - assertTrue(proposalCreatedMilestoneManager.isContributor(1, alice.addr)); - assertTrue(proposalCreatedMilestoneManager.isContributor(2, alice.addr)); + assertTrue( + orchestratorCreatedMilestoneManager.isContributor(1, alice.addr) + ); + assertTrue( + orchestratorCreatedMilestoneManager.isContributor(2, alice.addr) + ); console2.log( "==================================================================================" ); console2.log("\n\n"); - return address(test_proposal); + return address(test_orchestrator); } } diff --git a/src/factories/IModuleFactory.sol b/src/factories/IModuleFactory.sol index 667a71430..559b0f3ee 100644 --- a/src/factories/IModuleFactory.sol +++ b/src/factories/IModuleFactory.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import {IBeacon} from "@oz/proxy/beacon/IBeacon.sol"; // Internal Interfaces -import {IModule, IProposal} from "src/modules/base/IModule.sol"; +import {IModule, IOrchestrator} from "src/modules/base/IModule.sol"; interface IModuleFactory { //-------------------------------------------------------------------------- @@ -31,9 +31,9 @@ interface IModuleFactory { IModule.Metadata indexed metadata, IBeacon indexed beacon ); - /// @notice Event emitted when new module created for a proposal. + /// @notice Event emitted when new module created for a orchestrator. event ModuleCreated( - address indexed proposal, address indexed module, string moduleTitle + address indexed orchestrator, address indexed module, string moduleTitle ); //-------------------------------------------------------------------------- @@ -41,11 +41,11 @@ interface IModuleFactory { /// @notice Creates a module instance identified by given metadata. /// @param metadata The module's metadata. - /// @param proposal The proposal's instance of the module. + /// @param orchestrator The orchestrator's instance of the module. /// @param configdata The configdata of the module function createModule( IModule.Metadata memory metadata, - IProposal proposal, + IOrchestrator orchestrator, bytes memory configdata ) external returns (address); diff --git a/src/factories/IProposalFactory.sol b/src/factories/IOrchestratorFactory.sol similarity index 52% rename from src/factories/IProposalFactory.sol rename to src/factories/IOrchestratorFactory.sol index 36247dcd4..9f66684f8 100644 --- a/src/factories/IProposalFactory.sol +++ b/src/factories/IOrchestratorFactory.sol @@ -5,25 +5,25 @@ pragma solidity ^0.8.0; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; // Internal Interfaces -import {IModule, IProposal} from "src/modules/base/IModule.sol"; +import {IModule, IOrchestrator} from "src/modules/base/IModule.sol"; -interface IProposalFactory { +interface IOrchestratorFactory { //-------------------------------------------------------------------------- // Errors /// @notice Given id is invalid. - error ProposalFactory__InvalidId(); + error OrchestratorFactory__InvalidId(); /// @notice The module's data arrays length mismatch. - error ProposalFactory__ModuleDataLengthMismatch(); + error OrchestratorFactory__ModuleDataLengthMismatch(); - /// @notice The proposal owner is address(0) - error ProposalFactory__ProposalOwnerIsInvalid(); + /// @notice The orchestrator owner is address(0) + error OrchestratorFactory__OrchestratorOwnerIsInvalid(); //-------------------------------------------------------------------------- // Structs - struct ProposalConfig { + struct OrchestratorConfig { address owner; IERC20 token; } @@ -37,32 +37,32 @@ interface IProposalFactory { //-------------------------------------------------------------------------- // Functions - /// @notice Creates a new proposal with caller being the proposal's owner. - /// @param proposalConfig The proposal's config data. - /// @param authorizerConfig The config data for the proposal's {IAuthorizer} + /// @notice Creates a new orchestrator with caller being the orchestrator's owner. + /// @param orchestratorConfig The orchestrator's config data. + /// @param authorizerConfig The config data for the orchestrator's {IAuthorizer} /// instance. - /// @param paymentProcessorConfig The config data for the proposal's + /// @param paymentProcessorConfig The config data for the orchestrator's /// {IPaymentProcessor} instance. /// @param moduleConfigs Variable length set of optional module's config /// data. - function createProposal( - ProposalConfig memory proposalConfig, + function createOrchestrator( + OrchestratorConfig memory orchestratorConfig, ModuleConfig memory fundingManagerConfig, ModuleConfig memory authorizerConfig, ModuleConfig memory paymentProcessorConfig, ModuleConfig[] memory moduleConfigs - ) external returns (IProposal); + ) external returns (IOrchestrator); - /// @notice Returns the {IProposal} target implementation address. + /// @notice Returns the {IOrchestrator} target implementation address. function target() external view returns (address); /// @notice Returns the {IModuleFactory} implementation address. function moduleFactory() external view returns (address); - /// @notice Returns the {IProposal} address that corresponds to the given id. - /// @param id The requested proposal's id. - function getProposalByID(uint id) external view returns (address); + /// @notice Returns the {IOrchestrator} address that corresponds to the given id. + /// @param id The requested orchestrator's id. + function getOrchestratorByID(uint id) external view returns (address); - /// @notice Returns the counter of the current proposal id - function getProposalIDCounter() external view returns (uint); + /// @notice Returns the counter of the current orchestrator id + function getOrchestratorIDCounter() external view returns (uint); } diff --git a/src/factories/ModuleFactory.sol b/src/factories/ModuleFactory.sol index c717cca6d..46147b400 100644 --- a/src/factories/ModuleFactory.sol +++ b/src/factories/ModuleFactory.sol @@ -17,7 +17,7 @@ import {LibMetadata} from "src/modules/lib/LibMetadata.sol"; // Internal Interfaces import { IModuleFactory, - IProposal, + IOrchestrator, IModule } from "src/factories/IModuleFactory.sol"; @@ -75,7 +75,7 @@ contract ModuleFactory is IModuleFactory, Ownable2Step { /// @inheritdoc IModuleFactory function createModule( IModule.Metadata memory metadata, - IProposal proposal, + IOrchestrator orchestrator, bytes memory configdata ) external returns (address) { // Note that the metadata's validity is not checked because the @@ -102,9 +102,11 @@ contract ModuleFactory is IModuleFactory, Ownable2Step { address implementation = address(new BeaconProxy(beacon)); - IModule(implementation).init(proposal, metadata, configdata); + IModule(implementation).init(orchestrator, metadata, configdata); - emit ModuleCreated(address(proposal), implementation, metadata.title); + emit ModuleCreated( + address(orchestrator), implementation, metadata.title + ); return implementation; } diff --git a/src/factories/ProposalFactory.sol b/src/factories/OrchestratorFactory.sol similarity index 66% rename from src/factories/ProposalFactory.sol rename to src/factories/OrchestratorFactory.sol index f6c6203fc..00339615f 100644 --- a/src/factories/ProposalFactory.sol +++ b/src/factories/OrchestratorFactory.sol @@ -9,51 +9,51 @@ import {IERC20} from "@oz/token/ERC20/IERC20.sol"; // Internal Interfaces import { - IProposalFactory, - IProposal, + IOrchestratorFactory, + IOrchestrator, IModule -} from "src/factories/IProposalFactory.sol"; +} from "src/factories/IOrchestratorFactory.sol"; import { IFundingManager, IAuthorizer, IPaymentProcessor -} from "src/proposal/IProposal.sol"; +} from "src/orchestrator/IOrchestrator.sol"; import {IModuleFactory} from "src/factories/IModuleFactory.sol"; /** - * @title Proposal Factory + * @title Orchestrator Factory * - * @dev An immutable factory for deploying proposals. + * @dev An immutable factory for deploying orchestrators. * * @author Inverter Network */ -contract ProposalFactory is IProposalFactory { +contract OrchestratorFactory is IOrchestratorFactory { //-------------------------------------------------------------------------- // Immutables - /// @inheritdoc IProposalFactory + /// @inheritdoc IOrchestratorFactory address public immutable override target; - /// @inheritdoc IProposalFactory + /// @inheritdoc IOrchestratorFactory address public immutable override moduleFactory; //-------------------------------------------------------------------------- // Storage - /// @dev Maps the id to the proposals - mapping(uint => address) private _proposals; + /// @dev Maps the id to the orchestrators + mapping(uint => address) private _orchestrators; - /// @dev The counter of the current proposal id. + /// @dev The counter of the current orchestrator id. /// @dev Starts counting from 1. - uint private _proposalIdCounter; + uint private _orchestratorIdCounter; //-------------------------------------------------------------------------------- // Modifier /// @notice Modifier to guarantee that the given id is valid - modifier validProposalId(uint id) { - if (id > _proposalIdCounter) { - revert ProposalFactory__InvalidId(); + modifier validOrchestratorId(uint id) { + if (id > _orchestratorIdCounter) { + revert OrchestratorFactory__InvalidId(); } _; } @@ -69,37 +69,37 @@ contract ProposalFactory is IProposalFactory { //-------------------------------------------------------------------------- // Public Mutating Functions - /// @inheritdoc IProposalFactory - function createProposal( - ProposalConfig memory proposalConfig, + /// @inheritdoc IOrchestratorFactory + function createOrchestrator( + OrchestratorConfig memory orchestratorConfig, ModuleConfig memory fundingManagerConfig, ModuleConfig memory authorizerConfig, ModuleConfig memory paymentProcessorConfig, ModuleConfig[] memory moduleConfigs - ) external returns (IProposal) { + ) external returns (IOrchestrator) { address clone = Clones.clone(target); - //Map proposal clone - _proposals[++_proposalIdCounter] = clone; + //Map orchestrator clone + _orchestrators[++_orchestratorIdCounter] = clone; // Deploy and cache {IFundingManager} module. address fundingManager = IModuleFactory(moduleFactory).createModule( fundingManagerConfig.metadata, - IProposal(clone), + IOrchestrator(clone), fundingManagerConfig.configdata ); // Deploy and cache {IAuthorizer} module. address authorizer = IModuleFactory(moduleFactory).createModule( authorizerConfig.metadata, - IProposal(clone), + IOrchestrator(clone), authorizerConfig.configdata ); // Deploy and cache {IPaymentProcessor} module. address paymentProcessor = IModuleFactory(moduleFactory).createModule( paymentProcessorConfig.metadata, - IProposal(clone), + IOrchestrator(clone), paymentProcessorConfig.configdata ); @@ -109,20 +109,20 @@ contract ProposalFactory is IProposalFactory { for (uint i; i < modulesLen; ++i) { modules[i] = IModuleFactory(moduleFactory).createModule( moduleConfigs[i].metadata, - IProposal(clone), + IOrchestrator(clone), moduleConfigs[i].configdata ); } - if (proposalConfig.owner == address(0)) { - revert ProposalFactory__ProposalOwnerIsInvalid(); + if (orchestratorConfig.owner == address(0)) { + revert OrchestratorFactory__OrchestratorOwnerIsInvalid(); } - // Initialize proposal. - IProposal(clone).init( - _proposalIdCounter, - proposalConfig.owner, - proposalConfig.token, + // Initialize orchestrator. + IOrchestrator(clone).init( + _orchestratorIdCounter, + orchestratorConfig.owner, + orchestratorConfig.token, modules, IFundingManager(fundingManager), IAuthorizer(authorizer), @@ -130,12 +130,12 @@ contract ProposalFactory is IProposalFactory { ); // Second round of module initializations to satisfy cross-referencing between modules - // This can be run post the proposal initialization. This ensures a few more variables are - // available that are set during the proposal init function. + // This can be run post the orchestrator initialization. This ensures a few more variables are + // available that are set during the orchestrator init function. for (uint i; i < modulesLen; ++i) { if (_dependencyInjectionRequired(moduleConfigs[i].dependencydata)) { IModule(modules[i]).init2( - IProposal(clone), moduleConfigs[i].dependencydata + IOrchestrator(clone), moduleConfigs[i].dependencydata ); } } @@ -143,36 +143,36 @@ contract ProposalFactory is IProposalFactory { // Also, running the init2 functionality on the compulsory modules excluded from the modules array if (_dependencyInjectionRequired(fundingManagerConfig.dependencydata)) { IModule(fundingManager).init2( - IProposal(clone), fundingManagerConfig.dependencydata + IOrchestrator(clone), fundingManagerConfig.dependencydata ); } if (_dependencyInjectionRequired(authorizerConfig.dependencydata)) { IModule(authorizer).init2( - IProposal(clone), authorizerConfig.dependencydata + IOrchestrator(clone), authorizerConfig.dependencydata ); } if (_dependencyInjectionRequired(paymentProcessorConfig.dependencydata)) { IModule(paymentProcessor).init2( - IProposal(clone), paymentProcessorConfig.dependencydata + IOrchestrator(clone), paymentProcessorConfig.dependencydata ); } - return IProposal(clone); + return IOrchestrator(clone); } - /// @inheritdoc IProposalFactory - function getProposalByID(uint id) + /// @inheritdoc IOrchestratorFactory + function getOrchestratorByID(uint id) external view - validProposalId(id) + validOrchestratorId(id) returns (address) { - return _proposals[id]; + return _orchestrators[id]; } - function getProposalIDCounter() external view returns (uint) { - return _proposalIdCounter; + function getOrchestratorIDCounter() external view returns (uint) { + return _orchestratorIdCounter; } function decoder(bytes memory data) diff --git a/src/modules/IMetadataManager.sol b/src/modules/IMetadataManager.sol index a495c38a5..26006928c 100644 --- a/src/modules/IMetadataManager.sol +++ b/src/modules/IMetadataManager.sol @@ -11,7 +11,7 @@ interface IMetadataManager { string twitterHandle; } - struct ProposalMetadata { + struct OrchestratorMetadata { string title; string descriptionShort; string descriptionLong; @@ -33,8 +33,8 @@ interface IMetadataManager { string name, address account, string twitterHandle ); - /// @notice Event emitted when the proposal metadata changed. - event ProposalMetadataUpdated( + /// @notice Event emitted when the orchestrator metadata changed. + event OrchestratorMetadataUpdated( string title, string descriptionShort, string descriptionLong, diff --git a/src/modules/MetadataManager.sol b/src/modules/MetadataManager.sol index 58479493d..82a7a1477 100644 --- a/src/modules/MetadataManager.sol +++ b/src/modules/MetadataManager.sol @@ -6,14 +6,14 @@ import {Module} from "src/modules/base/Module.sol"; // Internal Interfaces import {IMetadataManager} from "src/modules/IMetadataManager.sol"; -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; contract MetadataManager is IMetadataManager, Module { //-------------------------------------------------------------------------- // Storage ManagerMetadata private _managerMetadata; - ProposalMetadata private _proposalMetadata; + OrchestratorMetadata private _orchestratorMetadata; MemberMetadata[] private _teamMetadata; //-------------------------------------------------------------------------- @@ -21,23 +21,24 @@ contract MetadataManager is IMetadataManager, Module { /// @inheritdoc Module function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory configdata ) external override(Module) initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); ( ManagerMetadata memory managerMetadata_, - ProposalMetadata memory proposalMetadata_, + OrchestratorMetadata memory orchestratorMetadata_, MemberMetadata[] memory teamMetadata_ ) = abi.decode( - configdata, (ManagerMetadata, ProposalMetadata, MemberMetadata[]) + configdata, + (ManagerMetadata, OrchestratorMetadata, MemberMetadata[]) ); _setManagerMetadata(managerMetadata_); - _setProposalMetadata(proposalMetadata_); + _setOrchestratorMetadata(orchestratorMetadata_); _setTeamMetadata(teamMetadata_); } @@ -53,12 +54,12 @@ contract MetadataManager is IMetadataManager, Module { return _managerMetadata; } - function getProposalMetadata() + function getOrchestratorMetadata() external view - returns (ProposalMetadata memory) + returns (OrchestratorMetadata memory) { - return _proposalMetadata; + return _orchestratorMetadata; } function getTeamMetadata() @@ -90,23 +91,22 @@ contract MetadataManager is IMetadataManager, Module { ); } - function setProposalMetadata(ProposalMetadata calldata proposalMetadata_) - public - onlyAuthorizedOrManager - { - _setProposalMetadata(proposalMetadata_); + function setOrchestratorMetadata( + OrchestratorMetadata calldata orchestratorMetadata_ + ) public onlyAuthorizedOrManager { + _setOrchestratorMetadata(orchestratorMetadata_); } - function _setProposalMetadata(ProposalMetadata memory proposalMetadata_) - private - { - _proposalMetadata = proposalMetadata_; - emit ProposalMetadataUpdated( - proposalMetadata_.title, - proposalMetadata_.descriptionShort, - proposalMetadata_.descriptionLong, - proposalMetadata_.externalMedias, - proposalMetadata_.categories + function _setOrchestratorMetadata( + OrchestratorMetadata memory orchestratorMetadata_ + ) private { + _orchestratorMetadata = orchestratorMetadata_; + emit OrchestratorMetadataUpdated( + orchestratorMetadata_.title, + orchestratorMetadata_.descriptionShort, + orchestratorMetadata_.descriptionLong, + orchestratorMetadata_.externalMedias, + orchestratorMetadata_.categories ); } diff --git a/src/modules/authorizer/IRoleAuthorizer.sol b/src/modules/authorizer/IRoleAuthorizer.sol index 4f6229ad5..a2cb98289 100644 --- a/src/modules/authorizer/IRoleAuthorizer.sol +++ b/src/modules/authorizer/IRoleAuthorizer.sol @@ -36,7 +36,7 @@ interface IRoleAuthorizer is /// the current transaction. /// @param role The identifier of the role we want to check /// @param who The address on which to perform the check. - /// @dev If the role is not self-managed, it will default to the proposal roles + /// @dev If the role is not self-managed, it will default to the orchestrator roles /// @dev If not, it will use the calling address to generate the role ID. Therefore, for checking on anything other than itself, hasRole() should be used function isAuthorized(uint8 role, address who) external @@ -63,7 +63,7 @@ interface IRoleAuthorizer is /// @param target The address to revoke the role from. function revokeRoleFromModule(uint8 role, address target) external; - /// @notice Toggles if a Module self-manages its roles or defaults to the proposal's roles. + /// @notice Toggles if a Module self-manages its roles or defaults to the orchestrator's roles. function toggleModuleSelfManagement() external; /// @notice Transfer the admin rights to a given role. diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index 21ab77884..e87c2a59a 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -5,7 +5,7 @@ pragma solidity 0.8.19; import {AccessControlEnumerableUpgradeable} from "@oz-up/access/AccessControlEnumerableUpgradeable.sol"; import {Module, IModule} from "src/modules/base/Module.sol"; -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; import {IRoleAuthorizer, IAuthorizer} from "./IRoleAuthorizer.sol"; contract RoleAuthorizer is @@ -16,21 +16,21 @@ contract RoleAuthorizer is //-------------------------------------------------------------------------- // Storage - // Core roles for a proposal. They correspond to uint8(0) and uint(1) - // NOTE that proposal owner can register more global roles using numbers from 2 onward. They'l need to go through the DEFAULT_ADMIN_ROLE for this. - // TODO Maybe it would be worth it to create an extra function that bypasses DEFAULT_ADMIN_ROLE, but only for global roles and by the PROPOSAL_OWNER_ROLE? This would streamline the process of creating roles for all modules + // Core roles for a orchestrator. They correspond to uint8(0) and uint(1) + // NOTE that orchestrator owner can register more global roles using numbers from 2 onward. They'l need to go through the DEFAULT_ADMIN_ROLE for this. + // TODO Maybe it would be worth it to create an extra function that bypasses DEFAULT_ADMIN_ROLE, but only for global roles and by the ORCHESTRATOR_OWNER_ROLE? This would streamline the process of creating roles for all modules enum CoreRoles { OWNER, // Partial Access to Protected Functions MANAGER // Full Access to Protected Functions } // Stores the if a module wants to use it's own roles - // If false it uses the proposal's core roles. + // If false it uses the orchestrator's core roles. mapping(address => bool) public selfManagedModules; // Stored for easy public reference. Other Modules can assume the following roles to exist - bytes32 public PROPOSAL_OWNER_ROLE; - bytes32 public PROPOSAL_MANAGER_ROLE; + bytes32 public ORCHESTRATOR_OWNER_ROLE; + bytes32 public ORCHESTRATOR_MANAGER_ROLE; bytes32 public constant BURN_ADMIN_ROLE = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; @@ -40,7 +40,7 @@ contract RoleAuthorizer is /// @notice Verifies that the caller is an active module modifier onlyModule(address module) { - if (!proposal().isModule(module)) { + if (!orchestrator().isModule(module)) { revert Module__RoleAuthorizer__NotActiveModule(module); } _; @@ -57,8 +57,8 @@ contract RoleAuthorizer is /// @notice Verifies that the owner being removed is not the last one modifier notLastOwner(bytes32 role) { if ( - role == PROPOSAL_OWNER_ROLE - && getRoleMemberCount(PROPOSAL_OWNER_ROLE) <= 1 + role == ORCHESTRATOR_OWNER_ROLE + && getRoleMemberCount(ORCHESTRATOR_OWNER_ROLE) <= 1 ) { revert Module__RoleAuthorizer__OwnerRoleCannotBeEmpty(); } @@ -75,11 +75,11 @@ contract RoleAuthorizer is /// @inheritdoc Module function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory configdata ) external override initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); (address initialOwner, address initialManager) = abi.decode(configdata, (address, address)); @@ -91,36 +91,36 @@ contract RoleAuthorizer is internal onlyInitializing { - // Note about DEFAULT_ADMIN_ROLE: The DEFAULT_ADMIN_ROLE has admin privileges on all roles in the contract. It starts out empty, but we set the proposal owners as "admins of the admin role", + // Note about DEFAULT_ADMIN_ROLE: The DEFAULT_ADMIN_ROLE has admin privileges on all roles in the contract. It starts out empty, but we set the orchestrator owners as "admins of the admin role", // so they can whitelist an address which then will have full write access to the roles in the system. This is mainly intended for safety/recovery situations, // Modules can opt out of this on a per-role basis by setting the admin role to "BURN_ADMIN_ROLE". - // Store RoleIDs for the Proposal roles: - PROPOSAL_OWNER_ROLE = - generateRoleId(address(proposal()), uint8(CoreRoles.OWNER)); - PROPOSAL_MANAGER_ROLE = - generateRoleId(address(proposal()), uint8(CoreRoles.MANAGER)); + // Store RoleIDs for the Orchestrator roles: + ORCHESTRATOR_OWNER_ROLE = + generateRoleId(address(orchestrator()), uint8(CoreRoles.OWNER)); + ORCHESTRATOR_MANAGER_ROLE = + generateRoleId(address(orchestrator()), uint8(CoreRoles.MANAGER)); // Set up OWNER role structure: // -> set OWNER as admin of itself - _setRoleAdmin(PROPOSAL_OWNER_ROLE, PROPOSAL_OWNER_ROLE); + _setRoleAdmin(ORCHESTRATOR_OWNER_ROLE, ORCHESTRATOR_OWNER_ROLE); // -> set OWNER as admin of DEFAULT_ADMIN_ROLE - _setRoleAdmin(DEFAULT_ADMIN_ROLE, PROPOSAL_OWNER_ROLE); + _setRoleAdmin(DEFAULT_ADMIN_ROLE, ORCHESTRATOR_OWNER_ROLE); // grant OWNER role to user from configData. // Note: If the initial owner is 0x0, it defaults to msgSender() if (initialOwner == address(0)) { - _grantRole(PROPOSAL_OWNER_ROLE, _msgSender()); + _grantRole(ORCHESTRATOR_OWNER_ROLE, _msgSender()); } else { - _grantRole(PROPOSAL_OWNER_ROLE, initialOwner); + _grantRole(ORCHESTRATOR_OWNER_ROLE, initialOwner); } // Set up MANAGER role structure: // -> set OWNER as admin of DEFAULT_ADMIN_ROLE - _setRoleAdmin(PROPOSAL_MANAGER_ROLE, PROPOSAL_OWNER_ROLE); + _setRoleAdmin(ORCHESTRATOR_MANAGER_ROLE, ORCHESTRATOR_OWNER_ROLE); // grant MANAGER Role to specified address - _grantRole(PROPOSAL_MANAGER_ROLE, initialManager); + _grantRole(ORCHESTRATOR_MANAGER_ROLE, initialManager); } //-------------------------------------------------------------------------- @@ -147,7 +147,7 @@ contract RoleAuthorizer is /// @dev Implements the function of the IAuthorizer interface by defauling to check if the caller holds the OWNER role. function isAuthorized(address who) external view returns (bool) { // In case no role is specfied, we ask if the caller is an owner - return hasRole(PROPOSAL_OWNER_ROLE, who); + return hasRole(ORCHESTRATOR_OWNER_ROLE, who); } /// @inheritdoc IRoleAuthorizer @@ -160,11 +160,11 @@ contract RoleAuthorizer is //Note: since it uses msgSenderto generate ID, this should only be used by modules. Users should call hasRole() bytes32 roleId; // If the module uses its own roles, check if account has the role. - // else check if account has role in proposal + // else check if account has role in orchestrator if (selfManagedModules[_msgSender()]) { roleId = generateRoleId(_msgSender(), role); } else { - roleId = generateRoleId(address(proposal()), role); + roleId = generateRoleId(address(orchestrator()), role); } return hasRole(roleId, who); } diff --git a/src/modules/authorizer/SingleVoteGovernor.sol b/src/modules/authorizer/SingleVoteGovernor.sol index c7b038d4b..3329c9f16 100644 --- a/src/modules/authorizer/SingleVoteGovernor.sol +++ b/src/modules/authorizer/SingleVoteGovernor.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.19; import {Module, IModule} from "src/modules/base/Module.sol"; -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; import { ISingleVoteGovernor, @@ -31,7 +31,7 @@ contract SingleVoteGovernor is ISingleVoteGovernor, Module { modifier isValidVoterAddress(address voter) { if ( voter == address(0) || voter == address(this) - || voter == address(proposal()) + || voter == address(orchestrator()) ) { revert Module__SingleVoteGovernor__InvalidVoterAddress(); } @@ -73,11 +73,11 @@ contract SingleVoteGovernor is ISingleVoteGovernor, Module { /// @inheritdoc Module function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory configdata ) external override initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); // Decode configdata to list of voters, the required threshold, and the // voting duration. @@ -115,7 +115,7 @@ contract SingleVoteGovernor is ISingleVoteGovernor, Module { if ( voter == address(0) || voter == address(this) - || voter == address(proposal()) + || voter == address(orchestrator()) ) { revert Module__SingleVoteGovernor__InvalidVoterAddress(); } @@ -176,7 +176,7 @@ contract SingleVoteGovernor is ISingleVoteGovernor, Module { revert Module__SingleVoteGovernor__UnreachableThreshold(); } - // Note that a threshold of zero is valid because a proposal can only be + // Note that a threshold of zero is valid because a orchestrator can only be // created by a voter anyway. emit ThresholdUpdated(threshold, newThreshold); diff --git a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol index 80c2ef49a..d12dba196 100644 --- a/src/modules/authorizer/TokenGatedRoleAuthorizer.sol +++ b/src/modules/authorizer/TokenGatedRoleAuthorizer.sol @@ -76,9 +76,9 @@ contract TokenGatedRoleAuthorizer is } else { return hasRole(roleId, who); } - // If not, check the account against the proposal roles + // If not, check the account against the orchestrator roles } else { - roleId = generateRoleId(address(proposal()), role); + roleId = generateRoleId(address(orchestrator()), role); return hasRole(roleId, who); } } diff --git a/src/modules/base/IModule.sol b/src/modules/base/IModule.sol index 39b19b96c..1f465d3f0 100644 --- a/src/modules/base/IModule.sol +++ b/src/modules/base/IModule.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; // Internal Interfaces -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; interface IModule { struct Metadata { @@ -18,18 +18,18 @@ interface IModule { /// @notice Function is only callable by authorized caller. error Module__CallerNotAuthorized(); - /// @notice Function is only callable by the proposal. - error Module__OnlyCallableByProposal(); + /// @notice Function is only callable by the orchestrator. + error Module__OnlyCallableByOrchestrator(); - /// @notice Given proposal address invalid. - error Module__InvalidProposalAddress(); + /// @notice Given orchestrator address invalid. + error Module__InvalidOrchestratorAddress(); /// @notice Given metadata invalid. error Module__InvalidMetadata(); - /// @notice Proposal callback triggered failed. + /// @notice Orchestrator callback triggered failed. /// @param funcSig The signature of the function called. - error Module_ProposalCallbackFailed(string funcSig); + error Module_OrchestratorCallbackFailed(string funcSig); /// @notice init2 was called again for a module error Module__CannotCallInit2Again(); @@ -44,21 +44,22 @@ interface IModule { /// @notice The module's initializer function. /// @dev CAN be overriden by downstream contract. /// @dev MUST call `__Module_init()`. - /// @param proposal The module's proposal instance. + /// @param orchestrator The module's orchestrator instance. /// @param metadata The module's metadata. /// @param configdata Variable config data for specific module /// implementations. function init( - IProposal proposal, + IOrchestrator orchestrator, Metadata memory metadata, bytes memory configdata ) external; /// @notice Second initialization function of the module to take care of dependencies. - /// @param proposal The module's proposal instance. + /// @param orchestrator The module's orchestrator instance. /// @param configdata Variable config data for specific module /// implementations. - function init2(IProposal proposal, bytes memory configdata) external; + function init2(IOrchestrator orchestrator, bytes memory configdata) + external; /// @notice Returns the module's identifier. /// @dev The identifier is defined as the keccak256 hash of the module's @@ -79,7 +80,7 @@ interface IModule { /// @return The module's title. function title() external view returns (string memory); - /// @notice Returns the module's {IProposal} proposal instance. - /// @return The module's proposal. - function proposal() external view returns (IProposal); + /// @notice Returns the module's {IOrchestrator} orchestrator instance. + /// @return The module's orchestrator. + function orchestrator() external view returns (IOrchestrator); } diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index 7f2931154..e0b795bd5 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -9,7 +9,7 @@ import {ContextUpgradeable} from "@oz-up/utils/ContextUpgradeable.sol"; import {LibMetadata} from "src/modules/lib/LibMetadata.sol"; // Internal Interfaces -import {IModule, IProposal} from "src/modules/base/IModule.sol"; +import {IModule, IOrchestrator} from "src/modules/base/IModule.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; /** @@ -17,9 +17,9 @@ import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; * * @dev The base contract for modules. * - * This contract provides a framework for triggering and receiving proposal + * This contract provides a framework for triggering and receiving orchestrator * callbacks (via `call`) and a modifier to authenticate - * callers via the module's proposal. + * callers via the module's orchestrator. * * Each module is identified via a unique identifier based on its major * version, title, and url given in the metadata. @@ -41,10 +41,10 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @custom:invariant Not mutated after the init2 call bool private __Module_initialization; - /// @dev The module's proposal instance. + /// @dev The module's orchestrator instance. /// /// @custom:invariant Not mutated after initialization. - IProposal internal __Module_proposal; + IOrchestrator internal __Module_orchestrator; /// @dev The module's metadata. /// @@ -59,9 +59,9 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { // inlines argument validations not needed in downstream contracts. /// @notice Modifier to guarantee function is only callable by addresses - /// authorized via Proposal. + /// authorized via Orchestrator. modifier onlyAuthorized() { - IAuthorizer authorizer = __Module_proposal.authorizer(); + IAuthorizer authorizer = __Module_orchestrator.authorizer(); if (!authorizer.isAuthorized(_msgSender())) { revert Module__CallerNotAuthorized(); } @@ -69,25 +69,25 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { } /// @notice Modifier to guarantee function is only callable by either - /// addresses authorized via Proposal or the Proposal's manager. + /// addresses authorized via Orchestrator or the Orchestrator's manager. modifier onlyAuthorizedOrManager() { - IAuthorizer authorizer = __Module_proposal.authorizer(); + IAuthorizer authorizer = __Module_orchestrator.authorizer(); if ( !authorizer.isAuthorized(_msgSender()) - && __Module_proposal.manager() != _msgSender() + && __Module_orchestrator.manager() != _msgSender() ) { revert Module__CallerNotAuthorized(); } _; } - /// @notice Modifier to guarantee function is only callable by the proposal. - /// @dev onlyProposal functions MUST only access the module's storage, i.e. + /// @notice Modifier to guarantee function is only callable by the orchestrator. + /// @dev onlyOrchestrator functions MUST only access the module's storage, i.e. /// `__Module_` variables. /// @dev Note to use function prefix `__Module_`. - modifier onlyProposal() { - if (_msgSender() != address(__Module_proposal)) { - revert Module__OnlyCallableByProposal(); + modifier onlyOrchestrator() { + if (_msgSender() != address(__Module_orchestrator)) { + revert Module__OnlyCallableByOrchestrator(); } _; } @@ -117,25 +117,25 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { /// @inheritdoc IModule function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory /*configdata*/ ) external virtual initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); } /// @dev The initialization function MUST be called by the upstream /// contract in their overriden `init()` function. - /// @param proposal_ The module's proposal. - function __Module_init(IProposal proposal_, Metadata memory metadata) - internal - onlyInitializing - { - // Write proposal to storage. - if (address(proposal_) == address(0)) { - revert Module__InvalidProposalAddress(); + /// @param orchestrator_ The module's orchestrator. + function __Module_init( + IOrchestrator orchestrator_, + Metadata memory metadata + ) internal onlyInitializing { + // Write orchestrator to storage. + if (address(orchestrator_) == address(0)) { + revert Module__InvalidOrchestratorAddress(); } - __Module_proposal = proposal_; + __Module_orchestrator = orchestrator_; // Write metadata to storage. if (!LibMetadata.isValid(metadata)) { @@ -144,7 +144,7 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { __Module_metadata = metadata; } - function init2(IProposal proposal_, bytes memory dependencydata) + function init2(IOrchestrator orchestrator_, bytes memory dependencydata) external virtual initializer2 @@ -175,31 +175,31 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { } /// @inheritdoc IModule - function proposal() public view returns (IProposal) { - return __Module_proposal; + function orchestrator() public view returns (IOrchestrator) { + return __Module_orchestrator; } //-------------------------------------------------------------------------- // Internal Functions - /// @dev Internal function to trigger a callback from the proposal. - /// @param data The call data for the proposal to call. + /// @dev Internal function to trigger a callback from the orchestrator. + /// @param data The call data for the orchestrator to call. /// @return Whether the callback succeeded. /// @return The return data of the callback. - function _triggerProposalCallback(bytes memory data) + function _triggerOrchestratorCallback(bytes memory data) internal returns (bool, bytes memory) { bool ok; bytes memory returnData; (ok, returnData) = - __Module_proposal.executeTxFromModule(address(this), data); + __Module_orchestrator.executeTxFromModule(address(this), data); - // Note that there is no check whether the proposal callback succeeded. + // Note that there is no check whether the orchestrator callback succeeded. // This responsibility is delegated to the caller, i.e. downstream // module implementation. // However, the {IModule} interface defines a generic error type for - // failed proposal callbacks that can be used to prevent different + // failed orchestrator callbacks that can be used to prevent different // custom error types in each implementation. return (ok, returnData); } diff --git a/src/modules/base/mixins/ERC20PaymentClient.sol b/src/modules/base/mixins/ERC20PaymentClient.sol index 8bc3dfe03..3b384ce96 100644 --- a/src/modules/base/mixins/ERC20PaymentClient.sol +++ b/src/modules/base/mixins/ERC20PaymentClient.sol @@ -14,7 +14,7 @@ import { * @title ERC20PaymentClient * * @dev The ERC20PaymentClient mixin enables modules to create payment orders that - * are processable by a proposal's {IPaymentProcessor} module. + * are processable by a orchestrator's {IPaymentProcessor} module. * * @author Inverter Network */ diff --git a/src/modules/fundingManager/IFundingManager.sol b/src/modules/fundingManager/IFundingManager.sol index 284b00c94..68e589f67 100644 --- a/src/modules/fundingManager/IFundingManager.sol +++ b/src/modules/fundingManager/IFundingManager.sol @@ -36,10 +36,10 @@ interface IFundingManager { address indexed from, address indexed to, uint indexed amount ); - /// @notice Event emitted when a transferal of proposal tokens takes place. + /// @notice Event emitted when a transferal of orchestrator tokens takes place. /// @param to The address that will receive the underlying tokens. /// @param amount The amount of underlying tokens transfered. - event TransferProposalToken(address indexed to, uint indexed amount); + event TransferOrchestratorToken(address indexed to, uint indexed amount); //-------------------------------------------------------------------------- // Functions @@ -52,5 +52,5 @@ interface IFundingManager { function withdraw(uint amount) external; function withdrawTo(address to, uint amount) external; - function transferProposalToken(address to, uint amount) external; + function transferOrchestratorToken(address to, uint amount) external; } diff --git a/src/modules/fundingManager/RebasingFundingManager.sol b/src/modules/fundingManager/RebasingFundingManager.sol index 950ea31fd..2c10be35d 100644 --- a/src/modules/fundingManager/RebasingFundingManager.sol +++ b/src/modules/fundingManager/RebasingFundingManager.sol @@ -11,7 +11,7 @@ import {Initializable} from "@oz-up/proxy/utils/Initializable.sol"; import {ContextUpgradeable} from "@oz-up/utils/ContextUpgradeable.sol"; // Internal Interfaces -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; // External Interfaces import {IERC20} from "@oz/token/ERC20/IERC20.sol"; @@ -57,28 +57,29 @@ contract RebasingFundingManager is /// @inheritdoc Module function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory configdata ) external override(Module) initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); - address proposalTokenAddress = abi.decode(configdata, (address)); + address orchestratorTokenAddress = abi.decode(configdata, (address)); - string memory _id = proposal_.proposalId().toString(); - string memory _name = - string(abi.encodePacked("Inverter Funding Token - Proposal #", _id)); + string memory _id = orchestrator_.orchestratorId().toString(); + string memory _name = string( + abi.encodePacked("Inverter Funding Token - Orchestrator #", _id) + ); string memory _symbol = string(abi.encodePacked("IFT-", _id)); // Initial upstream contracts. __ElasticReceiptToken_init( _name, _symbol, - IERC20MetadataUpgradeable(proposalTokenAddress).decimals() + IERC20MetadataUpgradeable(orchestratorTokenAddress).decimals() ); } function token() public view returns (IERC20) { - return __Module_proposal.token(); + return __Module_orchestrator.token(); } /// @dev Returns the current token balance as supply target. @@ -111,14 +112,14 @@ contract RebasingFundingManager is } //-------------------------------------------------------------------------- - // OnlyProposal Mutating Functions + // OnlyOrchestrator Mutating Functions - function transferProposalToken(address to, uint amount) + function transferOrchestratorToken(address to, uint amount) external - onlyProposal + onlyOrchestrator validAddress(to) { - _transferProposalToken(to, amount); + _transferOrchestratorToken(to, amount); } //-------------------------------------------------------------------------- @@ -149,9 +150,9 @@ contract RebasingFundingManager is emit Withdrawal(from, to, amount); } - function _transferProposalToken(address to, uint amount) internal { - __Module_proposal.token().safeTransfer(to, amount); + function _transferOrchestratorToken(address to, uint amount) internal { + __Module_orchestrator.token().safeTransfer(to, amount); - emit TransferProposalToken(to, amount); + emit TransferOrchestratorToken(to, amount); } } diff --git a/src/modules/logicModule/BountyManager.sol b/src/modules/logicModule/BountyManager.sol index 4e096023d..76a042264 100644 --- a/src/modules/logicModule/BountyManager.sol +++ b/src/modules/logicModule/BountyManager.sol @@ -15,7 +15,7 @@ import {ERC20PaymentClient} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; import {IBountyManager} from "src/modules/logicModule/IBountyManager.sol"; @@ -31,7 +31,7 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; //At the current state of the project the IRoleAuthorizer isnt the standardized Interface to use, //That means there is a possibility function calls will fail if the roleAuthorizer isnt implemented as the Authorizer //This will be changed in the coming future, -//but till then the RoleAuthorizer has to be selected as the Authorizer Module of the proposal if the BountyManager is to be used +//but till then the RoleAuthorizer has to be selected as the Authorizer Module of the orchestrator if the BountyManager is to be used contract BountyManager is IBountyManager, Module, ERC20PaymentClient { using SafeERC20 for IERC20; @@ -44,7 +44,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { //@todo Reminder that this will be moved into the Module Contract at a later point of time modifier onlyRole(uint8 roleId) { if ( - !IRoleAuthorizer(address(__Module_proposal.authorizer())) + !IRoleAuthorizer(address(__Module_orchestrator.authorizer())) .isAuthorized(roleId, _msgSender()) ) { revert Module__BountyManager__OnlyRole(roleId, address(this)); @@ -115,7 +115,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { uint totalAmount; uint currentAmount; address contrib; - address proposalAddress = address(__Module_proposal); + address orchestratorAddress = address(__Module_orchestrator); for (uint i; i < length;) { currentAmount = contributors[i].claimAmount; @@ -127,7 +127,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { contrib = contributors[i].addr; if ( contrib == address(0) || contrib == address(this) - || contrib == proposalAddress + || contrib == orchestratorAddress ) { revert Module__BountyManager__InvalidContributorAddress(); } @@ -191,25 +191,25 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { // Initialization /// @inheritdoc Module - function init(IProposal proposal_, Metadata memory metadata, bytes memory) - external - override(Module) - initializer - { - __Module_init(proposal_, metadata); + function init( + IOrchestrator orchestrator_, + Metadata memory metadata, + bytes memory + ) external override(Module) initializer { + __Module_init(orchestrator_, metadata); //init empty list of bounties and claims _bountyList.init(); _claimList.init(); } - function init2(IProposal, bytes memory) + function init2(IOrchestrator, bytes memory) external override(Module) initializer2 { //Note: due to the authorizer still not being set during initialization, // this function has to be called after. - IRoleAuthorizer(address(proposal().authorizer())) + IRoleAuthorizer(address(orchestrator().authorizer())) .toggleModuleSelfManagement(); } @@ -453,7 +453,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { _ensureTokenBalance(totalAmount); //when done process the Payments correctly - __Module_proposal.paymentProcessor().processPayments( + __Module_orchestrator.paymentProcessor().processPayments( IERC20PaymentClient(address(this)) ); @@ -470,42 +470,42 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { function grantBountyAdminRole(address addr) external onlyAuthorized { //@todo Will be removed in the future and moved to the authorizer directly IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); //@todo Cast to IRoleAuthorizer wont be necessary as soon as the IAuthorizer Interface in Proposal is replaced by IRoleAuthorizer, this is the same for the other implementations + IRoleAuthorizer(address(__Module_orchestrator.authorizer())); //@todo Cast to IRoleAuthorizer wont be necessary as soon as the IAuthorizer Interface in Orchestrator is replaced by IRoleAuthorizer, this is the same for the other implementations roleAuthorizer.grantRoleFromModule(uint8(Roles.BountyAdmin), addr); } /// @inheritdoc IBountyManager function grantClaimAdminRole(address addr) external onlyAuthorized { IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); + IRoleAuthorizer(address(__Module_orchestrator.authorizer())); roleAuthorizer.grantRoleFromModule(uint8(Roles.ClaimAdmin), addr); } /// @inheritdoc IBountyManager function grantVerifyAdminRole(address addr) external onlyAuthorized { IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); + IRoleAuthorizer(address(__Module_orchestrator.authorizer())); roleAuthorizer.grantRoleFromModule(uint8(Roles.VerifyAdmin), addr); } /// @inheritdoc IBountyManager function revokeBountyAdminRole(address addr) external onlyAuthorized { IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); + IRoleAuthorizer(address(__Module_orchestrator.authorizer())); roleAuthorizer.revokeRoleFromModule(uint8(Roles.BountyAdmin), addr); } /// @inheritdoc IBountyManager function revokeClaimAdminRole(address addr) external onlyAuthorized { IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); + IRoleAuthorizer(address(__Module_orchestrator.authorizer())); roleAuthorizer.revokeRoleFromModule(uint8(Roles.ClaimAdmin), addr); } /// @inheritdoc IBountyManager function revokeVerifyAdminRole(address addr) external onlyAuthorized { IRoleAuthorizer roleAuthorizer = - IRoleAuthorizer(address(__Module_proposal.authorizer())); + IRoleAuthorizer(address(__Module_orchestrator.authorizer())); roleAuthorizer.revokeRoleFromModule(uint8(Roles.VerifyAdmin), addr); } @@ -516,16 +516,16 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { internal override(ERC20PaymentClient) { - uint balance = __Module_proposal.token().balanceOf(address(this)); + uint balance = __Module_orchestrator.token().balanceOf(address(this)); if (balance < amount) { - // Trigger callback from proposal to transfer tokens + // Trigger callback from orchestrator to transfer tokens // to address(this). bool ok; - (ok, /*returnData*/ ) = __Module_proposal.executeTxFromModule( - address(__Module_proposal.fundingManager()), + (ok, /*returnData*/ ) = __Module_orchestrator.executeTxFromModule( + address(__Module_orchestrator.fundingManager()), abi.encodeWithSignature( - "transferProposalToken(address,uint256)", + "transferOrchestratorToken(address,uint256)", address(this), amount - balance ) @@ -541,7 +541,7 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { internal override(ERC20PaymentClient) { - IERC20 token = __Module_proposal.token(); + IERC20 token = __Module_orchestrator.token(); uint allowance = token.allowance(address(this), address(spender)); if (allowance < amount) { @@ -555,6 +555,6 @@ contract BountyManager is IBountyManager, Module, ERC20PaymentClient { override(ERC20PaymentClient) returns (bool) { - return __Module_proposal.paymentProcessor() == who; + return __Module_orchestrator.paymentProcessor() == who; } } diff --git a/src/modules/logicModule/IMilestoneManager.sol b/src/modules/logicModule/IMilestoneManager.sol index bd7abfa0a..ba937e55d 100644 --- a/src/modules/logicModule/IMilestoneManager.sol +++ b/src/modules/logicModule/IMilestoneManager.sol @@ -274,7 +274,7 @@ interface IMilestoneManager is IERC20PaymentClient { /// @notice Starts the next milestones. /// @dev Creates the payment orders to pay contributors. - /// @dev Reverts if next milestone not activatable or proposal's contributor + /// @dev Reverts if next milestone not activatable or orchestrator's contributor /// list empty. /// @dev Only callable by authorized addresses. function startNextMilestone() external; @@ -311,7 +311,7 @@ interface IMilestoneManager is IERC20PaymentClient { /// @dev Only callable by addresses holding the contributor role. /// @dev Reverts if id invalid, milestone not yet started, or milestone /// already completed. - /// @dev Relay function that routes the function call via the proposal. + /// @dev Relay function that routes the function call via the orchestrator. /// @param id The milestone's id. function submitMilestone(uint id, bytes calldata submissionData) external; diff --git a/src/modules/logicModule/MilestoneManager.sol b/src/modules/logicModule/MilestoneManager.sol index fb2b3c2fc..8faa3a188 100644 --- a/src/modules/logicModule/MilestoneManager.sol +++ b/src/modules/logicModule/MilestoneManager.sol @@ -17,7 +17,7 @@ import { // Internal Interfaces import {IMilestoneManager} from "src/modules/logicModule/IMilestoneManager.sol"; -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; // Internal Libraries import {LinkedIdList} from "src/common/LinkedIdList.sol"; @@ -25,18 +25,18 @@ import {LinkedIdList} from "src/common/LinkedIdList.sol"; /** * @title MilestoneManager * - * @dev Module to manage milestones for a proposal. + * @dev Module to manage milestones for a orchestrator. * * A milestone can exists in 4 different states: * - added * The milestone got added to the contract. * - active * When a milestone is started, it initias payment orders to pay - * the proposal's contributors. + * the orchestrator's contributors. * A milestone is active, until either its duration is over or it's * marked as completed. * - submitted - * A proposal contributor marks a milestone as submitted by + * A orchestrator contributor marks a milestone as submitted by * submitting non-empty data that can be interpreted and evaluated * by off-chain systems. * - completed @@ -111,7 +111,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { if ( contributorAddr == address(0) || contributorAddr == address(this) - || contributorAddr == address(proposal()) + || contributorAddr == address(orchestrator()) ) { revert Module__MilestoneManager__InvalidContributorAddress(); } @@ -190,11 +190,11 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { /// @inheritdoc Module function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory configdata ) external override(Module) initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); // Set up empty list of milestones. _milestoneList.init(); @@ -375,7 +375,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { _milestoneList.removeId(prevId, id); // stop all currently running payments - __Module_proposal.paymentProcessor().cancelRunningPayments( + __Module_orchestrator.paymentProcessor().cancelRunningPayments( IERC20PaymentClient(address(this)) ); @@ -430,7 +430,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { m.budget -= feePayout; _ensureTokenBalance(feePayout); - proposal().token().safeTransfer(FEE_TREASURY, feePayout); + orchestrator().token().safeTransfer(FEE_TREASURY, feePayout); // Create payment order for each contributor of the new milestone. uint len = contribCache.length; @@ -467,7 +467,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { } } - __Module_proposal.paymentProcessor().processPayments( + __Module_orchestrator.paymentProcessor().processPayments( IERC20PaymentClient(address(this)) ); @@ -696,16 +696,16 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { internal override(ERC20PaymentClient) { - uint balance = __Module_proposal.token().balanceOf(address(this)); + uint balance = __Module_orchestrator.token().balanceOf(address(this)); if (balance < amount) { - // Trigger callback from proposal to transfer tokens + // Trigger callback from orchestrator to transfer tokens // to address(this). bool ok; - (ok, /*returnData*/ ) = __Module_proposal.executeTxFromModule( - address(__Module_proposal.fundingManager()), + (ok, /*returnData*/ ) = __Module_orchestrator.executeTxFromModule( + address(__Module_orchestrator.fundingManager()), abi.encodeWithSignature( - "transferProposalToken(address,uint256)", + "transferOrchestratorToken(address,uint256)", address(this), amount - balance ) @@ -721,7 +721,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { internal override(ERC20PaymentClient) { - IERC20 token = __Module_proposal.token(); + IERC20 token = __Module_orchestrator.token(); uint allowance = token.allowance(address(this), address(spender)); if (allowance < amount) { @@ -735,6 +735,6 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { override(ERC20PaymentClient) returns (bool) { - return __Module_proposal.paymentProcessor() == who; + return __Module_orchestrator.paymentProcessor() == who; } } diff --git a/src/modules/logicModule/RecurringPaymentManager.sol b/src/modules/logicModule/RecurringPaymentManager.sol index 1ca7d53ac..227bac962 100644 --- a/src/modules/logicModule/RecurringPaymentManager.sol +++ b/src/modules/logicModule/RecurringPaymentManager.sol @@ -14,7 +14,7 @@ import {ERC20PaymentClient} from "src/modules/base/mixins/ERC20PaymentClient.sol"; // Internal Interfaces -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; import {IRecurringPaymentManager} from "src/modules/logicModule/IRecurringPaymentManager.sol"; @@ -84,11 +84,11 @@ contract RecurringPaymentManager is /// @inheritdoc Module function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory configdata ) external override(Module) initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); //Set empty list of RecurringPayment _paymentList.init(); @@ -355,7 +355,7 @@ contract RecurringPaymentManager is _addPaymentOrders(orders); //when done process the Payments correctly - __Module_proposal.paymentProcessor().processPayments( + __Module_orchestrator.paymentProcessor().processPayments( IERC20PaymentClient(address(this)) ); @@ -368,16 +368,16 @@ contract RecurringPaymentManager is internal override(ERC20PaymentClient) { - uint balance = __Module_proposal.token().balanceOf(address(this)); + uint balance = __Module_orchestrator.token().balanceOf(address(this)); if (balance < amount) { - // Trigger callback from proposal to transfer tokens + // Trigger callback from orchestrator to transfer tokens // to address(this). bool ok; - (ok, /*returnData*/ ) = __Module_proposal.executeTxFromModule( - address(__Module_proposal.fundingManager()), + (ok, /*returnData*/ ) = __Module_orchestrator.executeTxFromModule( + address(__Module_orchestrator.fundingManager()), abi.encodeWithSignature( - "transferProposalToken(address,uint256)", + "transferOrchestratorToken(address,uint256)", address(this), amount - balance ) @@ -393,7 +393,7 @@ contract RecurringPaymentManager is internal override(ERC20PaymentClient) { - IERC20 token = __Module_proposal.token(); + IERC20 token = __Module_orchestrator.token(); uint allowance = token.allowance(address(this), address(spender)); if (allowance < amount) { @@ -407,6 +407,6 @@ contract RecurringPaymentManager is override(ERC20PaymentClient) returns (bool) { - return __Module_proposal.paymentProcessor() == who; + return __Module_orchestrator.paymentProcessor() == who; } } diff --git a/src/modules/paymentProcessor/SimplePaymentProcessor.sol b/src/modules/paymentProcessor/SimplePaymentProcessor.sol index 3bfebf9cb..ac157b3a2 100644 --- a/src/modules/paymentProcessor/SimplePaymentProcessor.sol +++ b/src/modules/paymentProcessor/SimplePaymentProcessor.sol @@ -15,7 +15,7 @@ import { import {Module} from "src/modules/base/Module.sol"; // Internal Interfaces -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; /** * @title SimplePaymentProcessor @@ -34,7 +34,7 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { /// @notice checks that the caller is an active module modifier onlyModule() { - if (!proposal().isModule(_msgSender())) { + if (!orchestrator().isModule(_msgSender())) { revert Module__PaymentManager__OnlyCallableByModule(); } _; @@ -50,11 +50,11 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { /// @inheritdoc Module function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory /*configdata*/ ) external override(Module) initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); } //-------------------------------------------------------------------------- @@ -62,7 +62,7 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { /// @inheritdoc IPaymentProcessor function token() public view returns (IERC20) { - return __Module_proposal.token(); + return __Module_orchestrator.token(); } /// @inheritdoc IPaymentProcessor diff --git a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol index 747e84dc1..af142a9cc 100644 --- a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol @@ -13,7 +13,7 @@ import {ERC20} from "@oz/token/ERC20/ERC20.sol"; // Interfaces import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; /** * @title Payment processor module implementation #2: Linear vesting curve. @@ -55,7 +55,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @notice checks that the caller is an active module modifier onlyModule() { - if (!proposal().isModule(_msgSender())) { + if (!orchestrator().isModule(_msgSender())) { revert Module__PaymentManager__OnlyCallableByModule(); } _; @@ -83,11 +83,11 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc Module function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory /*configdata*/ ) external override(Module) initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); } /// @inheritdoc IStreamingPaymentProcessor @@ -320,7 +320,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { /// @inheritdoc IPaymentProcessor function token() public view returns (IERC20) { - return this.proposal().token(); + return this.orchestrator().token(); } /// @inheritdoc IStreamingPaymentProcessor @@ -716,7 +716,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { function validAddress(address addr) internal view returns (bool) { return !( addr == address(0) || addr == _msgSender() || addr == address(this) - || addr == address(proposal()) + || addr == address(orchestrator()) ); } diff --git a/src/proposal/IProposal.sol b/src/orchestrator/IOrchestrator.sol similarity index 85% rename from src/proposal/IProposal.sol rename to src/orchestrator/IOrchestrator.sol index 1e49b777c..50337c852 100644 --- a/src/proposal/IProposal.sol +++ b/src/orchestrator/IOrchestrator.sol @@ -5,24 +5,24 @@ pragma solidity ^0.8.0; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; // Internal Interfaces -import {IModuleManager} from "src/proposal/base/IModuleManager.sol"; +import {IModuleManager} from "src/orchestrator/base/IModuleManager.sol"; import {IFundingManager} from "src/modules/fundingManager/IFundingManager.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; import {IPaymentProcessor} from "src/modules/paymentProcessor/IPaymentProcessor.sol"; -interface IProposal is IModuleManager { +interface IOrchestrator is IModuleManager { //-------------------------------------------------------------------------- // Errors /// @notice Function is only callable by authorized caller. - error Proposal__CallerNotAuthorized(); + error Orchestrator__CallerNotAuthorized(); /// @notice Execution of transaction failed. - error Proposal__ExecuteTxFailed(); + error Orchestrator__ExecuteTxFailed(); - /// @notice The given module is not used in the proposal - error DependencyInjection__ModuleNotUsedInProposal(); + /// @notice The given module is not used in the orchestrator + error DependencyInjection__ModuleNotUsedInOrchestrator(); //-------------------------------------------------------------------------- // Events @@ -41,7 +41,7 @@ interface IProposal is IModuleManager { /// @notice Initialization function. function init( - uint proposalId, + uint orchestratorId, address owner, IERC20 token, address[] calldata modules, @@ -75,9 +75,9 @@ interface IProposal is IModuleManager { external returns (bytes memory); - /// @notice Returns the proposal's id. - /// @dev Unique id set by the {ProposalFactory} during initialization. - function proposalId() external view returns (uint); + /// @notice Returns the orchestrator's id. + /// @dev Unique id set by the {OrchestratorFactory} during initialization. + function orchestratorId() external view returns (uint); /// @notice The {IFundingManager} implementation used to hold and distribute Funds. function fundingManager() external view returns (IFundingManager); @@ -89,19 +89,19 @@ interface IProposal is IModuleManager { /// payments. function paymentProcessor() external view returns (IPaymentProcessor); - /// @notice The proposal's {IERC20} token accepted for fundings and used + /// @notice The orchestrator's {IERC20} token accepted for fundings and used /// for payments. function token() external view returns (IERC20); - /// @notice The version of the proposal instance. + /// @notice The version of the orchestrator instance. function version() external pure returns (string memory); function owner() external view returns (address); function manager() external view returns (address); - /// @notice find the address of a given module using it's name in a proposal - function findModuleAddressInProposal(string calldata moduleName) + /// @notice find the address of a given module using it's name in a orchestrator + function findModuleAddressInOrchestrator(string calldata moduleName) external view returns (address); diff --git a/src/proposal/Proposal.sol b/src/orchestrator/Orchestrator.sol similarity index 80% rename from src/proposal/Proposal.sol rename to src/orchestrator/Orchestrator.sol index 8d178d393..b597d0e1b 100644 --- a/src/proposal/Proposal.sol +++ b/src/orchestrator/Orchestrator.sol @@ -11,36 +11,36 @@ import {IERC20} from "@oz/token/ERC20/IERC20.sol"; import {MilestoneManager} from "src/modules/logicModule/MilestoneManager.sol"; import {RecurringPaymentManager} from "src/modules/logicModule/RecurringPaymentManager.sol"; -import {ModuleManager} from "src/proposal/base/ModuleManager.sol"; +import {ModuleManager} from "src/orchestrator/base/ModuleManager.sol"; import {IMilestoneManager} from "src/modules/logicModule/IMilestoneManager.sol"; // Internal Interfaces import { - IProposal, + IOrchestrator, IFundingManager, IPaymentProcessor, IAuthorizer -} from "src/proposal/IProposal.sol"; +} from "src/orchestrator/IOrchestrator.sol"; import {IModule} from "src/modules/base/IModule.sol"; /** - * @title Proposal + * @title Orchestrator * * @dev A new funding primitive to enable multiple actors within a decentralized - * network to collaborate on proposals. + * network to collaborate on orchestrators. * - * A proposal is composed of a [funding mechanism](./base/FundingVault) * and a set of [modules](./base/ModuleManager). + * A orchestrator is composed of a [funding mechanism](./base/FundingVault) * and a set of [modules](./base/ModuleManager). * * The token being accepted for funding is non-changeable and set during * initialization. Authorization is performed via calling a non-changeable * {IAuthorizer} instance. Payments, initiated by modules, are processed * via a non-changeable {IPaymentProcessor} instance. * - * Each proposal has a unique id set during initialization. + * Each orchestrator has a unique id set during initialization. * * @author Inverter Network */ -contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { +contract Orchestrator is IOrchestrator, OwnableUpgradeable, ModuleManager { //-------------------------------------------------------------------------- // Modifiers @@ -48,7 +48,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { /// address. modifier onlyAuthorized() { if (!authorizer.isAuthorized(_msgSender())) { - revert Proposal__CallerNotAuthorized(); + revert Orchestrator__CallerNotAuthorized(); } _; } @@ -61,7 +61,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { modifier onlyAuthorizedOrManager() { if (!authorizer.isAuthorized(_msgSender()) && _msgSender() != manager()) { - revert Proposal__CallerNotAuthorized(); + revert Orchestrator__CallerNotAuthorized(); } _; } @@ -71,17 +71,17 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { IERC20 private _token; - /// @inheritdoc IProposal - uint public override(IProposal) proposalId; + /// @inheritdoc IOrchestrator + uint public override(IOrchestrator) orchestratorId; - /// @inheritdoc IProposal - IFundingManager public override(IProposal) fundingManager; + /// @inheritdoc IOrchestrator + IFundingManager public override(IOrchestrator) fundingManager; - /// @inheritdoc IProposal - IAuthorizer public override(IProposal) authorizer; + /// @inheritdoc IOrchestrator + IAuthorizer public override(IOrchestrator) authorizer; - /// @inheritdoc IProposal - IPaymentProcessor public override(IProposal) paymentProcessor; + /// @inheritdoc IOrchestrator + IPaymentProcessor public override(IOrchestrator) paymentProcessor; //-------------------------------------------------------------------------- // Initializer @@ -90,22 +90,22 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { _disableInitializers(); } - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function init( - uint proposalId_, + uint orchestratorId_, address owner_, IERC20 token_, address[] calldata modules, IFundingManager fundingManager_, IAuthorizer authorizer_, IPaymentProcessor paymentProcessor_ - ) external override(IProposal) initializer { + ) external override(IOrchestrator) initializer { // Initialize upstream contracts. __Ownable_init(); __ModuleManager_init(modules); // Set storage variables. - proposalId = proposalId_; + orchestratorId = orchestratorId_; _token = token_; @@ -113,7 +113,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { authorizer = authorizer_; paymentProcessor = paymentProcessor_; - // Transfer ownerhsip of proposal to owner argument. + // Transfer ownerhsip of orchestrator to owner argument. _transferOwnership(owner_); // Add necessary modules. @@ -127,12 +127,12 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { //-------------------------------------------------------------------------- // Module search functions - /// @notice verifies whether a proposal with the title `moduleName` has been used in this proposal + /// @notice verifies whether a orchestrator with the title `moduleName` has been used in this orchestrator /// @dev The query string and the module title should be **exactly** same, as in same whitespaces, same capitalizations, etc. - /// @param moduleName Query string which is the title of the module to be searched in the proposal - /// @return uint256 index of the module in the list of modules used in the proposal + /// @param moduleName Query string which is the title of the module to be searched in the orchestrator + /// @return uint256 index of the module in the list of modules used in the orchestrator /// @return address address of the module with title `moduleName` - function _isModuleUsedInProposal(string calldata moduleName) + function _isModuleUsedInOrchestrator(string calldata moduleName) private view returns (uint, address) @@ -162,16 +162,16 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { return (type(uint).max, address(0)); } - /// @inheritdoc IProposal - function findModuleAddressInProposal(string calldata moduleName) + /// @inheritdoc IOrchestrator + function findModuleAddressInOrchestrator(string calldata moduleName) external view returns (address) { (uint moduleIndex, address moduleAddress) = - _isModuleUsedInProposal(moduleName); + _isModuleUsedInOrchestrator(moduleName); if (moduleIndex == type(uint).max) { - revert DependencyInjection__ModuleNotUsedInProposal(); + revert DependencyInjection__ModuleNotUsedInOrchestrator(); } return moduleAddress; @@ -183,7 +183,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { // are provided for the convenience of the users since matching the names of the modules does not // fully guarantee that the returned address is the address of the exact module the user was looking for - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function verifyAddressIsAuthorizerModule(address authModule) external view @@ -199,7 +199,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { } } - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function verifyAddressIsFundingManager(address fundingManagerAddress) external view @@ -215,7 +215,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { } } - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function verifyAddressIsMilestoneManager(address milestoneManagerAddress) external view @@ -231,7 +231,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { } } - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function verifyAddressIsRecurringPaymentManager( address recurringPaymentManager ) external view returns (bool) { @@ -245,7 +245,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { } } - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function verifyAddressIsPaymentProcessor(address paymentProcessorAddress) external view @@ -278,7 +278,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { //-------------------------------------------------------------------------- // onlyAuthorized Functions - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function setAuthorizer(IAuthorizer authorizer_) external onlyAuthorized { addModule(address(authorizer_)); removeModule(address(authorizer)); @@ -286,7 +286,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { emit AuthorizerUpdated(address(authorizer_)); } - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function setFundingManager(IFundingManager fundingManager_) external onlyAuthorized @@ -297,7 +297,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { emit FundingManagerUpdated(address(fundingManager_)); } - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function setPaymentProcessor(IPaymentProcessor paymentProcessor_) external onlyAuthorized @@ -308,7 +308,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { emit PaymentProcessorUpdated(address(paymentProcessor_)); } - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function executeTx(address target, bytes memory data) external onlyAuthorized @@ -321,19 +321,19 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { if (ok) { return returnData; } else { - revert Proposal__ExecuteTxFailed(); + revert Orchestrator__ExecuteTxFailed(); } } //-------------------------------------------------------------------------- // View Functions - /// @inheritdoc IProposal - function token() public view override(IProposal) returns (IERC20) { + /// @inheritdoc IOrchestrator + function token() public view override(IOrchestrator) returns (IERC20) { return _token; } - /// @inheritdoc IProposal + /// @inheritdoc IOrchestrator function version() external pure returns (string memory) { return "1"; } @@ -341,7 +341,7 @@ contract Proposal is IProposal, OwnableUpgradeable, ModuleManager { function owner() public view - override(OwnableUpgradeable, IProposal) + override(OwnableUpgradeable, IOrchestrator) returns (address) { return super.owner(); diff --git a/src/proposal/base/IModuleManager.sol b/src/orchestrator/base/IModuleManager.sol similarity index 91% rename from src/proposal/base/IModuleManager.sol rename to src/orchestrator/base/IModuleManager.sol index 68c23c9d5..d7aa236e5 100644 --- a/src/proposal/base/IModuleManager.sol +++ b/src/orchestrator/base/IModuleManager.sol @@ -6,25 +6,25 @@ interface IModuleManager { // Errors /// @notice Function is only callable by authorized address. - error Proposal__ModuleManager__CallerNotAuthorized(); + error Orchestrator__ModuleManager__CallerNotAuthorized(); /// @notice Function is only callable by modules. - error Proposal__ModuleManager__OnlyCallableByModule(); + error Orchestrator__ModuleManager__OnlyCallableByModule(); /// @notice Given module address invalid. - error Proposal__ModuleManager__InvalidModuleAddress(); + error Orchestrator__ModuleManager__InvalidModuleAddress(); /// @notice Given address is a module. - error Proposal__ModuleManager__IsModule(); + error Orchestrator__ModuleManager__IsModule(); /// @notice Given address is not a module. - error Proposal__ModuleManager__IsNotModule(); + error Orchestrator__ModuleManager__IsNotModule(); /// @notice The supplied modules are not consecutive. - error Proposal__ModuleManager__ModulesNotConsecutive(); + error Orchestrator__ModuleManager__ModulesNotConsecutive(); /// @notice The Manager has reached the maximum amount of modules. - error Proposal__ModuleManager__ModuleAmountOverLimits(); + error Orchestrator__ModuleManager__ModuleAmountOverLimits(); //-------------------------------------------------------------------------- // Events diff --git a/src/proposal/base/ModuleManager.sol b/src/orchestrator/base/ModuleManager.sol similarity index 92% rename from src/proposal/base/ModuleManager.sol rename to src/orchestrator/base/ModuleManager.sol index 92db78dde..19d832616 100644 --- a/src/proposal/base/ModuleManager.sol +++ b/src/orchestrator/base/ModuleManager.sol @@ -6,7 +6,7 @@ import {ContextUpgradeable} from "@oz-up/utils/ContextUpgradeable.sol"; import {Initializable} from "@oz-up/proxy/utils/Initializable.sol"; // Interfaces -import {IModuleManager} from "src/proposal/base/IModuleManager.sol"; +import {IModuleManager} from "src/orchestrator/base/IModuleManager.sol"; /** * @title Module Manager @@ -34,14 +34,14 @@ abstract contract ModuleManager is modifier __ModuleManager_onlyAuthorized() { if (!__ModuleManager_isAuthorized(_msgSender())) { - revert Proposal__ModuleManager__CallerNotAuthorized(); + revert Orchestrator__ModuleManager__CallerNotAuthorized(); } _; } modifier onlyModule() { if (!isModule(_msgSender())) { - revert Proposal__ModuleManager__OnlyCallableByModule(); + revert Orchestrator__ModuleManager__OnlyCallableByModule(); } _; } @@ -53,7 +53,7 @@ abstract contract ModuleManager is modifier isModule_(address module) { if (!isModule(module)) { - revert Proposal__ModuleManager__IsNotModule(); + revert Orchestrator__ModuleManager__IsNotModule(); } _; } @@ -65,7 +65,7 @@ abstract contract ModuleManager is modifier moduleLimitNotExceeded() { if (_modules.length >= MAX_MODULE_AMOUNT) { - revert Proposal__ModuleManager__ModuleAmountOverLimits(); + revert Orchestrator__ModuleManager__ModuleAmountOverLimits(); } _; } @@ -73,7 +73,7 @@ abstract contract ModuleManager is //-------------------------------------------------------------------------- // Constants - /// @dev Marks the maximum amount of Modules a Proposal can have to avoid out-of-gas risk. + /// @dev Marks the maximum amount of Modules a Orchestrator can have to avoid out-of-gas risk. uint private constant MAX_MODULE_AMOUNT = 128; //-------------------------------------------------------------------------- @@ -110,7 +110,7 @@ abstract contract ModuleManager is // Check that the initial list of Modules doesn't exceed the max amount // The subtraction by 3 is to ensure enough space for the compulsory modules: fundingManager, authorizer and paymentProcessor if (len > (MAX_MODULE_AMOUNT - 3)) { - revert Proposal__ModuleManager__ModuleAmountOverLimits(); + revert Orchestrator__ModuleManager__ModuleAmountOverLimits(); } for (uint i; i < len; ++i) { @@ -285,13 +285,13 @@ abstract contract ModuleManager is function _ensureValidModule(address module) private view { if (module == address(0) || module == address(this)) { - revert Proposal__ModuleManager__InvalidModuleAddress(); + revert Orchestrator__ModuleManager__InvalidModuleAddress(); } } function _ensureNotModule(address module) private view { if (isModule(module)) { - revert Proposal__ModuleManager__IsModule(); + revert Orchestrator__ModuleManager__IsModule(); } } } diff --git a/tasks/deployBaseContracts.sh b/tasks/deployBaseContracts.sh index c7a74452d..f85a71acc 100644 --- a/tasks/deployBaseContracts.sh +++ b/tasks/deployBaseContracts.sh @@ -1,7 +1,7 @@ # Script to deploy Inverter Base Contracts -# - ProposalFactory -forge script script/factories/DeployProposalFactory.s.sol:DeployProposalFactory \ +# - OrchestratorFactory +forge script script/factories/DeployOrchestratorFactory.s.sol:DeployOrchestratorFactory \ --fork-url $RPC_URL \ --sender $WALLET_DEPLOYER \ --private-key $WALLET_DEPLOYER_PK \ @@ -14,8 +14,8 @@ forge script script/factories/DeployModuleFactory.s.sol:DeployModuleFactory \ --private-key $WALLET_DEPLOYER_PK \ --broadcast -# - Proposal -forge script script/proposal/DeployProposal.s.sol:DeployProposal \ +# - Orchestrator +forge script script/orchestrator/DeployOrchestrator.s.sol:DeployOrchestrator \ --fork-url $RPC_URL \ --sender $WALLET_DEPLOYER \ --private-key $WALLET_DEPLOYER_PK \ diff --git a/test/e2e/BountyManagerLifecycle.t.sol b/test/e2e/BountyManagerLifecycle.t.sol index 5622fe45a..764cb79ad 100644 --- a/test/e2e/BountyManagerLifecycle.t.sol +++ b/test/e2e/BountyManagerLifecycle.t.sol @@ -5,8 +5,8 @@ import {E2eTest} from "test/e2e/E2eTest.sol"; import "forge-std/console.sol"; //Internal Dependencies -import {ModuleTest, IModule, IProposal} from "test/modules/ModuleTest.sol"; -import {IProposalFactory} from "src/factories/ProposalFactory.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; +import {IOrchestratorFactory} from "src/factories/OrchestratorFactory.sol"; import {AuthorizerMock} from "test/utils/mocks/modules/AuthorizerMock.sol"; // External Libraries @@ -49,22 +49,25 @@ contract BountyManagerLifecycle is E2eTest { function test_e2e_BountyManagerLifecycle() public { // -----------INIT - // address(this) creates a new proposal. - IProposalFactory.ProposalConfig memory proposalConfig = IProposalFactory - .ProposalConfig({owner: address(this), token: token}); - - IProposal proposal = - _createNewProposalWithAllModules_withRoleBasedAuthorizerAndBountyManager( - proposalConfig + // address(this) creates a new orchestrator. + IOrchestratorFactory.OrchestratorConfig memory orchestratorConfig = + IOrchestratorFactory.OrchestratorConfig({ + owner: address(this), + token: token + }); + + IOrchestrator orchestrator = + _createNewOrchestratorWithAllModules_withRoleBasedAuthorizerAndBountyManager( + orchestratorConfig ); RebasingFundingManager fundingManager = - RebasingFundingManager(address(proposal.fundingManager())); + RebasingFundingManager(address(orchestrator.fundingManager())); BountyManager bountyManager; // Find BountyManager - address[] memory modulesList = proposal.listModules(); + address[] memory modulesList = orchestrator.listModules(); for (uint i; i < modulesList.length; ++i) { try IBountyManager(modulesList[i]).isExistingBountyId(0) returns ( bool @@ -76,22 +79,22 @@ contract BountyManagerLifecycle is E2eTest { } } - // we authorize the deployer of the proposal as the bounty admin + // we authorize the deployer of the orchestrator as the bounty admin bountyManager.grantBountyAdminRole(address(this)); // Funders deposit funds // IMPORTANT // ========= // Due to how the underlying rebase mechanism works, it is necessary - // to always have some amount of tokens in the proposal. + // to always have some amount of tokens in the orchestrator. // It's best, if the owner deposits them right after deployment. uint initialDeposit = 10e18; token.mint(address(this), initialDeposit); token.approve(address(fundingManager), initialDeposit); fundingManager.deposit(initialDeposit); - // Seeing this great working on the proposal, funder1 decides to fund - // the proposal with 1k of tokens. + // Seeing this great working on the orchestrator, funder1 decides to fund + // the orchestrator with 1k of tokens. address funder1 = makeAddr("funder1"); token.mint(funder1, 1000e18); diff --git a/test/e2e/CreateNewProposal.t.sol b/test/e2e/CreateNewOrchestrator.t.sol similarity index 71% rename from test/e2e/CreateNewProposal.t.sol rename to test/e2e/CreateNewOrchestrator.t.sol index 7f3427dd8..c0fd44d1d 100644 --- a/test/e2e/CreateNewProposal.t.sol +++ b/test/e2e/CreateNewOrchestrator.t.sol @@ -38,18 +38,18 @@ import {IModule} from "src/modules/base/IModule.sol"; //Module Factory import {IModuleFactory, ModuleFactory} from "src/factories/ModuleFactory.sol"; -//Proposal Factory +//Orchestrator Factory import { - IProposalFactory, - ProposalFactory -} from "src/factories/ProposalFactory.sol"; + IOrchestratorFactory, + OrchestratorFactory +} from "src/factories/OrchestratorFactory.sol"; //Token import import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; -//Proposal -import {IProposal, Proposal} from "src/proposal/Proposal.sol"; +//Orchestrator +import {IOrchestrator, Orchestrator} from "src/orchestrator/Orchestrator.sol"; //Base Modules import {IPaymentProcessor} from @@ -58,9 +58,9 @@ import {IFundingManager} from "src/modules/fundingManager/IFundingManager.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; /** - * e2e PoC test to show how to create a new proposal via the {ProposalFactory}. + * e2e PoC test to show how to create a new orchestrator via the {OrchestratorFactory}. */ -contract ProposalCreation is Test { +contract OrchestratorCreation is Test { //Module Templates IFundingManager fundingManagerTemplate; //This is just the template thats referenced in the Factory later IRoleAuthorizer authorizerTemplate; //Just a template @@ -82,29 +82,29 @@ contract ProposalCreation is Test { IModule.Metadata milestoneManagerMetadata; IModule.Metadata metadataManagerMetadata; - //Proposal Metadata + //Orchestrator Metadata IMetadataManager.ManagerMetadata ownerMetadata; - IMetadataManager.ProposalMetadata proposalMetadata; + IMetadataManager.OrchestratorMetadata orchestratorMetadata; IMetadataManager.MemberMetadata[] teamMetadata; //Module Factory IModuleFactory moduleFactory; - //Proposal Template - IProposal proposalTemplate; //Just a template + //Orchestrator Template + IOrchestrator orchestratorTemplate; //Just a template - //Proposal Factory - IProposalFactory proposalFactory; + //Orchestrator Factory + IOrchestratorFactory orchestratorFactory; - // This function sets up all necessary components needed for the creation of a proposal. + // This function sets up all necessary components needed for the creation of a orchestrator. // Components are: - // -Authorizer: A Module that declares who can access the main functionalities of the proposal + // -Authorizer: A Module that declares who can access the main functionalities of the orchestrator // -SimplePaymentProcessor: A Module that enables Token distribution // -MilestoneManager: A Module that enables Declaration of Milestones and upon fullfillment, uses the Payment Processor for salary distributions - // -MetadataManager: A Module contains metadata for the proposal + // -MetadataManager: A Module contains metadata for the orchestrator // -Beacons: A Proxy Contract structure that enables to update all proxy contracts at the same time (EIP-1967) // -ModuleFactory: A factory that creates Modules. Modules have to be registered with Metadata and the intended beacon, which contains the module template, for it to be used - // -ProposalFactory: A Factory that creates Proposals. Needs to have a Proposal Template and a module factory as a reference. + // -OrchestratorFactory: A Factory that creates Orchestrators. Needs to have a Orchestrator Template and a module factory as a reference. function setUp() public { //========================================== @@ -185,13 +185,13 @@ contract ProposalCreation is Test { ); //========================================== - //Set up Proposal Metadata + //Set up Orchestrator Metadata ownerMetadata = IMetadataManager.ManagerMetadata( "Name", address(0xBEEF), "TwitterHandle" ); - proposalMetadata = IMetadataManager.ProposalMetadata( + orchestratorMetadata = IMetadataManager.OrchestratorMetadata( "Title", "DescriptionShort", "DescriptionLong", @@ -199,13 +199,13 @@ contract ProposalCreation is Test { new string[](0) ); - proposalMetadata.externalMedias.push("externalMedia1"); - proposalMetadata.externalMedias.push("externalMedia2"); - proposalMetadata.externalMedias.push("externalMedia3"); + orchestratorMetadata.externalMedias.push("externalMedia1"); + orchestratorMetadata.externalMedias.push("externalMedia2"); + orchestratorMetadata.externalMedias.push("externalMedia3"); - proposalMetadata.categories.push("category1"); - proposalMetadata.categories.push("category2"); - proposalMetadata.categories.push("category3"); + orchestratorMetadata.categories.push("category1"); + orchestratorMetadata.categories.push("category2"); + orchestratorMetadata.categories.push("category3"); teamMetadata.push( IMetadataManager.MemberMetadata( @@ -214,35 +214,35 @@ contract ProposalCreation is Test { ); //========================================== - //Set up Proposal Factory + //Set up Orchestrator Factory - //Create proposal template - proposalTemplate = new Proposal(); + //Create orchestrator template + orchestratorTemplate = new Orchestrator(); - //Create ProposalFactory - proposalFactory = new ProposalFactory( - address(proposalTemplate), + //Create OrchestratorFactory + orchestratorFactory = new OrchestratorFactory( + address(orchestratorTemplate), address(moduleFactory) ); } - // This function creates a new Proposal - // For this we create a few config files, that we'll later use in the Proposalfactory: - // -proposalFactoryConfig: Contains the owner and paymentToken address - // -authorizerFactoryConfig: Contains initially Authorized Addresses, that can use onlyAuthorized functions in the proposal + // This function creates a new Orchestrator + // For this we create a few config files, that we'll later use in the Orchestratorfactory: + // -orchestratorFactoryConfig: Contains the owner and paymentToken address + // -authorizerFactoryConfig: Contains initially Authorized Addresses, that can use onlyAuthorized functions in the orchestrator // Notice that we have to decrypt the initialAuthorizedAddresses into a bytes format for correct // creation of the module in the ModuleFactory // -paymentProcessorFactoryConfig: Just signals the Factory, that we want to integrate the SimplePaymentProcessor here // -optionalModules: This array contains further moduleConfigs in the same styling like before to signal - // the proposalFactory that we want to integrate the defined modules. - function createNewProposal() public returns (IProposal) { - //The Token used for Payment processes in the proposal + // the orchestratorFactory that we want to integrate the defined modules. + function createNewOrchestrator() public returns (IOrchestrator) { + //The Token used for Payment processes in the orchestrator // Could be WEI or USDC or other ERC20. IERC20 paymentToken = new ERC20Mock("Mock Token", "MOCK"); - // Create ProposalConfig instance. - IProposalFactory.ProposalConfig memory proposalFactoryConfig = - IProposalFactory.ProposalConfig({ + // Create OrchestratorConfig instance. + IOrchestratorFactory.OrchestratorConfig memory orchestratorFactoryConfig = + IOrchestratorFactory.OrchestratorConfig({ owner: address(this), token: paymentToken }); @@ -250,23 +250,23 @@ contract ProposalCreation is Test { bool hasDependency; string[] memory dependencies = new string[](0); - IProposalFactory.ModuleConfig memory fundingManagerFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig memory fundingManagerFactoryConfig = + IOrchestratorFactory.ModuleConfig( fundingManagerMetadata, abi.encode(address(paymentToken)), abi.encode(hasDependency, dependencies) ); - IProposalFactory.ModuleConfig memory authorizerFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig memory authorizerFactoryConfig = + IOrchestratorFactory.ModuleConfig( authorizerMetadata, abi.encode(address(this), address(this)), abi.encode(hasDependency, dependencies) ); //Create ModuleConfig for SimplePaymentProcessor - IProposalFactory.ModuleConfig memory paymentProcessorFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig memory paymentProcessorFactoryConfig = + IOrchestratorFactory.ModuleConfig( paymentProcessorMetadata, bytes(""), abi.encode(hasDependency, dependencies) @@ -277,38 +277,38 @@ contract ProposalCreation is Test { //Technically Authorizer and SimplePaymentProcessor are the only necessary Modules, but we'll inlcude the metadata manager as an example //Note: Its possible to submit a zero size array too - IProposalFactory.ModuleConfig[] memory optionalModules = - new IProposalFactory.ModuleConfig[](1); + IOrchestratorFactory.ModuleConfig[] memory optionalModules = + new IOrchestratorFactory.ModuleConfig[](1); //Add MetadataManager as a optional Module - optionalModules[0] = IProposalFactory.ModuleConfig( + optionalModules[0] = IOrchestratorFactory.ModuleConfig( metadataManagerMetadata, - abi.encode(ownerMetadata, proposalMetadata, teamMetadata), + abi.encode(ownerMetadata, orchestratorMetadata, teamMetadata), abi.encode(hasDependency, dependencies) ); - //Create proposal using the different needed configs - IProposal proposal = proposalFactory.createProposal( - proposalFactoryConfig, + //Create orchestrator using the different needed configs + IOrchestrator orchestrator = orchestratorFactory.createOrchestrator( + orchestratorFactoryConfig, fundingManagerFactoryConfig, authorizerFactoryConfig, paymentProcessorFactoryConfig, optionalModules ); - return proposal; + return orchestrator; } - //Just a formal test to see the use case of creating a new Proposal - function testCreateNewProposal() public { - //See createNewProposal() - createNewProposal(); + //Just a formal test to see the use case of creating a new Orchestrator + function testCreateNewOrchestrator() public { + //See createNewOrchestrator() + createNewOrchestrator(); } - //We're adding and removing a Module during the lifetime of the proposal + //We're adding and removing a Module during the lifetime of the orchestrator function testManageModulesLiveOnPorposal() public { - //Create Proposal - IProposal proposal = createNewProposal(); + //Create Orchestrator + IOrchestrator orchestrator = createNewOrchestrator(); //-------------------------------------------------------------------------------- // Adding Module @@ -333,38 +333,40 @@ contract ProposalCreation is Test { //Create the module via the moduleFactory address milestoneManager = moduleFactory.createModule( - milestoneManagerMetadata, proposal, milestoneManagerConfigdata + milestoneManagerMetadata, orchestrator, milestoneManagerConfigdata ); - //Add Module to the proposal - proposal.addModule(milestoneManager); + //Add Module to the orchestrator + orchestrator.addModule(milestoneManager); //-------------------------------------------------------------------------------- // Removing Module - proposal.removeModule(milestoneManager); + orchestrator.removeModule(milestoneManager); //In case there is a need to replace the paymentProcessor / fundingManager / authorizer //Create the modules via the moduleFactory address newPaymentProcessor = moduleFactory.createModule( - paymentProcessorMetadata, proposal, bytes("") + paymentProcessorMetadata, orchestrator, bytes("") ); address newFundingManager = moduleFactory.createModule( fundingManagerMetadata, - proposal, - abi.encode(address(proposal.token())) + orchestrator, + abi.encode(address(orchestrator.token())) ); address[] memory initialAuthorizedAddresses = new address[](1); initialAuthorizedAddresses[0] = address(this); address newAuthorizer = moduleFactory.createModule( - authorizerMetadata, proposal, abi.encode(initialAuthorizedAddresses) + authorizerMetadata, + orchestrator, + abi.encode(initialAuthorizedAddresses) ); //Replace the old modules with the new ones - proposal.setPaymentProcessor(IPaymentProcessor(newPaymentProcessor)); - proposal.setFundingManager(IFundingManager(newFundingManager)); - proposal.setAuthorizer(IAuthorizer(newAuthorizer)); + orchestrator.setPaymentProcessor(IPaymentProcessor(newPaymentProcessor)); + orchestrator.setFundingManager(IFundingManager(newFundingManager)); + orchestrator.setAuthorizer(IAuthorizer(newAuthorizer)); } } diff --git a/test/e2e/E2eTest.sol b/test/e2e/E2eTest.sol index fb6f4ca6a..96bd34c54 100644 --- a/test/e2e/E2eTest.sol +++ b/test/e2e/E2eTest.sol @@ -7,12 +7,12 @@ import "forge-std/console.sol"; // Factories import {ModuleFactory, IModuleFactory} from "src/factories/ModuleFactory.sol"; import { - ProposalFactory, - IProposalFactory -} from "src/factories/ProposalFactory.sol"; + OrchestratorFactory, + IOrchestratorFactory +} from "src/factories/OrchestratorFactory.sol"; -// Proposal -import {Proposal, IProposal} from "src/proposal/Proposal.sol"; +// Orchestrator +import {Orchestrator, IOrchestrator} from "src/orchestrator/Orchestrator.sol"; // Modules import {IModule} from "src/modules/base/IModule.sol"; @@ -46,10 +46,10 @@ contract E2eTest is Test { // Factory instances. ModuleFactory moduleFactory; - ProposalFactory proposalFactory; + OrchestratorFactory orchestratorFactory; - // Proposal implementation. - Proposal proposalImpl; + // Orchestrator implementation. + Orchestrator orchestratorImpl; //-- Module implementations, beacons, config for factory, and metadata. @@ -62,7 +62,7 @@ contract E2eTest is Test { "https://github.com/inverter/funding-manager", "RebasingFundingManager" ); - //IProposalFactory.ModuleConfig has to be set with token address, so needs a later Injection -> see _createNewProposalWithAllModules() + //IOrchestratorFactory.ModuleConfig has to be set with token address, so needs a later Injection -> see _createNewOrchestratorWithAllModules() AuthorizerMock authorizerImpl; Beacon authorizerBeacon; @@ -71,8 +71,8 @@ contract E2eTest is Test { 1, 1, "https://github.com/inverter/authorizer", "Authorizer" ); // Note that the IAuthorizer's first authorized address is address(this). - IProposalFactory.ModuleConfig authorizerFactoryConfig = IProposalFactory - .ModuleConfig( + IOrchestratorFactory.ModuleConfig authorizerFactoryConfig = + IOrchestratorFactory.ModuleConfig( authorizerMetadata, abi.encode(address(this)), abi.encode(hasDependency, dependencies) @@ -85,8 +85,8 @@ contract E2eTest is Test { 1, 1, "https://github.com/inverter/roleAuthorizer", "RoleAuthorizer" ); // Note that RoleAuthorizer owner and manager are the same - IProposalFactory.ModuleConfig roleAuthorizerFactoryConfig = IProposalFactory - .ModuleConfig( + IOrchestratorFactory.ModuleConfig roleAuthorizerFactoryConfig = + IOrchestratorFactory.ModuleConfig( roleAuthorizerMetadata, abi.encode(address(this), address(this)), abi.encode(hasDependency, dependencies) @@ -103,8 +103,8 @@ contract E2eTest is Test { "https://github.com/inverter/payment-processor", "SimplePaymentProcessor" ); - IProposalFactory.ModuleConfig paymentProcessorFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig paymentProcessorFactoryConfig = + IOrchestratorFactory.ModuleConfig( paymentProcessorMetadata, bytes(""), abi.encode(hasDependency, dependencies) @@ -119,8 +119,8 @@ contract E2eTest is Test { "https://github.com/inverter/streaming-payment-processor", "StreamingPaymentProcessor" ); - IProposalFactory.ModuleConfig streamingPaymentProcessorFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig streamingPaymentProcessorFactoryConfig = + IOrchestratorFactory.ModuleConfig( streamingPaymentProcessorMetadata, bytes(""), abi.encode(hasDependency, dependencies) @@ -135,8 +135,8 @@ contract E2eTest is Test { "https://github.com/inverter/milestone-manager", "MilestoneManager" ); - IProposalFactory.ModuleConfig milestoneManagerFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig milestoneManagerFactoryConfig = + IOrchestratorFactory.ModuleConfig( milestoneManagerMetadata, abi.encode(100_000_000, 1_000_000, makeAddr("treasury")), abi.encode(hasDependency, dependencies) @@ -148,8 +148,8 @@ contract E2eTest is Test { IModule.Metadata bountyManagerMetadata = IModule.Metadata( 1, 1, "https://github.com/inverter/bounty-manager", "BountyManager" ); - IProposalFactory.ModuleConfig bountyManagerFactoryConfig = IProposalFactory - .ModuleConfig( + IOrchestratorFactory.ModuleConfig bountyManagerFactoryConfig = + IOrchestratorFactory.ModuleConfig( bountyManagerMetadata, bytes(""), abi.encode(true, dependencies) ); @@ -163,16 +163,16 @@ contract E2eTest is Test { "https://github.com/inverter/recurring-payment-manager", "RecurringPaymentManager" ); - IProposalFactory.ModuleConfig recurringPaymentManagerFactoryConfig = - IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig recurringPaymentManagerFactoryConfig = + IOrchestratorFactory.ModuleConfig( recurringPaymentManagerMetadata, abi.encode(1 weeks), abi.encode(hasDependency, dependencies) ); function setUp() public { - // Deploy Proposal implementation. - proposalImpl = new Proposal(); + // Deploy Orchestrator implementation. + orchestratorImpl = new Orchestrator(); // Deploy module implementations. rebasingFundingManagerImpl = new RebasingFundingManager(); @@ -228,8 +228,8 @@ contract E2eTest is Test { // Deploy Factories. moduleFactory = new ModuleFactory(); - proposalFactory = - new ProposalFactory(address(proposalImpl), address(moduleFactory)); + orchestratorFactory = + new OrchestratorFactory(address(orchestratorImpl), address(moduleFactory)); // Register modules at moduleFactory. moduleFactory.registerMetadata( @@ -261,22 +261,23 @@ contract E2eTest is Test { ); } - function _createNewProposalWithAllModules( - IProposalFactory.ProposalConfig memory config - ) internal returns (IProposal) { - IProposalFactory.ModuleConfig[] memory optionalModules = - new IProposalFactory.ModuleConfig[](2); + function _createNewOrchestratorWithAllModules( + IOrchestratorFactory.OrchestratorConfig memory config + ) internal returns (IOrchestrator) { + IOrchestratorFactory.ModuleConfig[] memory optionalModules = + new IOrchestratorFactory.ModuleConfig[](2); optionalModules[0] = milestoneManagerFactoryConfig; optionalModules[1] = bountyManagerFactoryConfig; - IProposalFactory.ModuleConfig memory rebasingFundingManagerFactoryConfig = - IProposalFactory.ModuleConfig( - rebasingFundingManagerMetadata, - abi.encode(address(config.token)), - abi.encode(hasDependency, dependencies) - ); + IOrchestratorFactory.ModuleConfig memory + rebasingFundingManagerFactoryConfig = IOrchestratorFactory + .ModuleConfig( + rebasingFundingManagerMetadata, + abi.encode(address(config.token)), + abi.encode(hasDependency, dependencies) + ); - return proposalFactory.createProposal( + return orchestratorFactory.createOrchestrator( config, rebasingFundingManagerFactoryConfig, authorizerFactoryConfig, @@ -285,21 +286,22 @@ contract E2eTest is Test { ); } - function _createNewProposalWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor( - IProposalFactory.ProposalConfig memory config - ) internal returns (IProposal) { - IProposalFactory.ModuleConfig[] memory optionalModules = - new IProposalFactory.ModuleConfig[](1); + function _createNewOrchestratorWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor( + IOrchestratorFactory.OrchestratorConfig memory config + ) internal returns (IOrchestrator) { + IOrchestratorFactory.ModuleConfig[] memory optionalModules = + new IOrchestratorFactory.ModuleConfig[](1); optionalModules[0] = recurringPaymentManagerFactoryConfig; - IProposalFactory.ModuleConfig memory rebasingFundingManagerFactoryConfig = - IProposalFactory.ModuleConfig( - rebasingFundingManagerMetadata, - abi.encode(address(config.token)), - abi.encode(hasDependency, dependencies) - ); + IOrchestratorFactory.ModuleConfig memory + rebasingFundingManagerFactoryConfig = IOrchestratorFactory + .ModuleConfig( + rebasingFundingManagerMetadata, + abi.encode(address(config.token)), + abi.encode(hasDependency, dependencies) + ); - return proposalFactory.createProposal( + return orchestratorFactory.createOrchestrator( config, rebasingFundingManagerFactoryConfig, authorizerFactoryConfig, @@ -308,21 +310,22 @@ contract E2eTest is Test { ); } - function _createNewProposalWithAllModules_withRoleBasedAuthorizerAndBountyManager( - IProposalFactory.ProposalConfig memory config - ) internal returns (IProposal) { - IProposalFactory.ModuleConfig[] memory optionalModules = - new IProposalFactory.ModuleConfig[](1); + function _createNewOrchestratorWithAllModules_withRoleBasedAuthorizerAndBountyManager( + IOrchestratorFactory.OrchestratorConfig memory config + ) internal returns (IOrchestrator) { + IOrchestratorFactory.ModuleConfig[] memory optionalModules = + new IOrchestratorFactory.ModuleConfig[](1); optionalModules[0] = bountyManagerFactoryConfig; - IProposalFactory.ModuleConfig memory rebasingFundingManagerFactoryConfig = - IProposalFactory.ModuleConfig( - rebasingFundingManagerMetadata, - abi.encode(address(config.token)), - abi.encode(hasDependency, dependencies) - ); + IOrchestratorFactory.ModuleConfig memory + rebasingFundingManagerFactoryConfig = IOrchestratorFactory + .ModuleConfig( + rebasingFundingManagerMetadata, + abi.encode(address(config.token)), + abi.encode(hasDependency, dependencies) + ); - return proposalFactory.createProposal( + return orchestratorFactory.createOrchestrator( config, rebasingFundingManagerFactoryConfig, roleAuthorizerFactoryConfig, diff --git a/test/e2e/FundManagement.t.sol b/test/e2e/FundManagement.t.sol index c92d083f6..ffb704976 100644 --- a/test/e2e/FundManagement.t.sol +++ b/test/e2e/FundManagement.t.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {E2eTest} from "test/e2e/E2eTest.sol"; -import {IProposalFactory} from "src/factories/ProposalFactory.sol"; -import {IProposal} from "src/proposal/Proposal.sol"; +import {IOrchestratorFactory} from "src/factories/OrchestratorFactory.sol"; +import {IOrchestrator} from "src/orchestrator/Orchestrator.sol"; import {RebasingFundingManager} from "src/modules/fundingManager/RebasingFundingManager.sol"; @@ -12,9 +12,9 @@ import {RebasingFundingManager} from // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; /** - * E2e test demonstrating a proposal's fund management. + * E2e test demonstrating a orchestrator's fund management. * - * Funding of a proposal is managed via a fundingmanager. + * Funding of a orchestrator is managed via a fundingmanager. * * Upon deposit of funds, users receive receipt token. * The withdrawal amount of funds is _always_ in relation of the amount of @@ -27,15 +27,19 @@ contract FundManagement is E2eTest { ERC20Mock token = new ERC20Mock("Mock", "MOCK"); - function test_e2e_ProposalFundManagement() public { - // address(this) creates a new proposal. - IProposalFactory.ProposalConfig memory proposalConfig = IProposalFactory - .ProposalConfig({owner: address(this), token: token}); + function test_e2e_OrchestratorFundManagement() public { + // address(this) creates a new orchestrator. + IOrchestratorFactory.OrchestratorConfig memory orchestratorConfig = + IOrchestratorFactory.OrchestratorConfig({ + owner: address(this), + token: token + }); - IProposal proposal = _createNewProposalWithAllModules(proposalConfig); + IOrchestrator orchestrator = + _createNewOrchestratorWithAllModules(orchestratorConfig); RebasingFundingManager fundingManager = - RebasingFundingManager(address(proposal.fundingManager())); + RebasingFundingManager(address(orchestrator.fundingManager())); // IMPORTANT // ========= @@ -54,7 +58,7 @@ contract FundManagement is E2eTest { // Alice funds the fundingmanager with 1k tokens. vm.startPrank(alice); { - // Approve tokens to proposal. + // Approve tokens to orchestrator. token.approve(address(fundingManager), 1000e18); // Deposit tokens, i.e. fund the fundingmanager. @@ -81,10 +85,10 @@ contract FundManagement is E2eTest { } vm.stopPrank(); - // If the proposal spends half of the deposited tokens in the fundingmanager, i.e. for a milestone, + // If the orchestrator spends half of the deposited tokens in the fundingmanager, i.e. for a milestone, // alice and bob are still able to withdraw their respective leftover // of the tokens. - // Note that we simulate proposal spending by just burning tokens. + // Note that we simulate orchestrator spending by just burning tokens. token.burn( address(fundingManager), token.balanceOf(address(fundingManager)) / 2 diff --git a/test/e2e/MilestoneLifecycle.t.sol b/test/e2e/MilestoneLifecycle.t.sol index 38472122a..febdf8a81 100644 --- a/test/e2e/MilestoneLifecycle.t.sol +++ b/test/e2e/MilestoneLifecycle.t.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import {E2eTest} from "test/e2e/E2eTest.sol"; -import {IProposalFactory} from "src/factories/ProposalFactory.sol"; -import {IProposal} from "src/proposal/Proposal.sol"; +import {IOrchestratorFactory} from "src/factories/OrchestratorFactory.sol"; +import {IOrchestrator} from "src/orchestrator/Orchestrator.sol"; import { MilestoneManager, @@ -30,7 +30,7 @@ contract MilestoneLifecycle is E2eTest { // 1. A non-empty list of contributors for it // 2. The percentage of milestone funding to pay the contributors for the milestone. - // So lets add Alice and Bob as contributors to the proposal. + // So lets add Alice and Bob as contributors to the orchestrator. // Note the salary is specified in relation to the SALARY_PRECISION variable in the MilestoneManager. IMilestoneManager.Contributor alice = IMilestoneManager.Contributor( address(0xA11CE), 50_000_000, "AliceIdHash" @@ -45,20 +45,24 @@ contract MilestoneLifecycle is E2eTest { ERC20Mock token = new ERC20Mock("Mock", "MOCK"); function test_e2e_MilestoneLifecycle() public { - // First, we create a new proposal. - IProposalFactory.ProposalConfig memory proposalConfig = IProposalFactory - .ProposalConfig({owner: address(this), token: token}); + // First, we create a new orchestrator. + IOrchestratorFactory.OrchestratorConfig memory orchestratorConfig = + IOrchestratorFactory.OrchestratorConfig({ + owner: address(this), + token: token + }); - IProposal proposal = _createNewProposalWithAllModules(proposalConfig); + IOrchestrator orchestrator = + _createNewOrchestratorWithAllModules(orchestratorConfig); RebasingFundingManager fundingManager = - RebasingFundingManager(address(proposal.fundingManager())); + RebasingFundingManager(address(orchestrator.fundingManager())); // Now we add a few milestones. - // For that, we need to access the proposal's milestone module. + // For that, we need to access the orchestrator's milestone module. MilestoneManager milestoneManager; - address[] memory modulesList = proposal.listModules(); + address[] memory modulesList = orchestrator.listModules(); for (uint i; i < modulesList.length; ++i) { try IMilestoneManager(modulesList[i]).hasActiveMilestone() returns ( bool @@ -92,7 +96,7 @@ contract MilestoneLifecycle is E2eTest { // IMPORTANT // ========= // Due to how the underlying rebase mechanism works, it is necessary - // to always have some amount of tokens in the proposal. + // to always have some amount of tokens in the orchestrator. // It's best, if the owner deposits them right after deployment. uint initialDeposit = 10e18; token.mint(address(this), initialDeposit); @@ -105,8 +109,8 @@ contract MilestoneLifecycle is E2eTest { assertTrue(milestoneManager.isContributor(1, alice.addr)); assertTrue(milestoneManager.isContributor(1, bob.addr)); - // Seeing this great working on the proposal, funder1 decides to fund - // the proposal with 1k of tokens. + // Seeing this great working on the orchestrator, funder1 decides to fund + // the orchestrator with 1k of tokens. token.mint(funder1, 1000e18); vm.startPrank(funder1); @@ -116,7 +120,7 @@ contract MilestoneLifecycle is E2eTest { } vm.stopPrank(); - // The proposal now has 1k tokens of funding. Exactly the amount needed + // The orchestrator now has 1k tokens of funding. Exactly the amount needed // for the first milestone. assertEq( token.balanceOf(address(fundingManager)), 1000e18 + initialDeposit @@ -133,7 +137,7 @@ contract MilestoneLifecycle is E2eTest { // creates set set of payment orders inside the module and calls // the SimplePaymentProcessor module to process them. Note however, that the // orders are guaranteed to be payable, i.e. the tokens are already - // fetched from the proposal on creation of the order. + // fetched from the orchestrator on creation of the order. // since we take 1% fee, the expected balance is 990e18/2 @@ -181,9 +185,9 @@ contract MilestoneLifecycle is E2eTest { // This is independent whether the milestone is completed or not. vm.warp(block.timestamp + 1 weeks); - // Now start the next proposal... + // Now start the next orchestrator... milestoneManager.startNextMilestone(); - // ...which leaves 5k of tokens left in the proposal. + // ...which leaves 5k of tokens left in the orchestrator. assertEq( token.balanceOf(address(fundingManager)), 5000e18 + initialDeposit ); diff --git a/test/e2e/ModuleUpdate.t.sol b/test/e2e/ModuleUpdate.t.sol index 8431f5050..ba9a78fd9 100644 --- a/test/e2e/ModuleUpdate.t.sol +++ b/test/e2e/ModuleUpdate.t.sol @@ -16,7 +16,7 @@ import {LibMetadata} from "src/modules/lib/LibMetadata.sol"; import { IModuleFactory, IModule, - IProposal + IOrchestrator } from "src/factories/IModuleFactory.sol"; // Mocks @@ -65,11 +65,11 @@ contract ModuleUpdateTest is Test { function testBeaconUpgrade( IModule.Metadata memory metadata, - address proposal, + address orchestrator, bytes memory configdata ) public { _assumeValidMetadata(metadata); - _assumeValidProposal(proposal); + _assumeValidOrchestrator(orchestrator); // Create implementation V1 and upgrade beacon to it. ModuleImplementationV1Mock implementationV1 = @@ -80,8 +80,9 @@ contract ModuleUpdateTest is Test { factory.registerMetadata(metadata, beacon); //Create Module Proxy in Factory - address proxyImplementationAddress1 = - factory.createModule(metadata, IProposal(proposal), configdata); + address proxyImplementationAddress1 = factory.createModule( + metadata, IOrchestrator(orchestrator), configdata + ); assertEq( ModuleImplementationV1Mock(proxyImplementationAddress1).getVersion(), @@ -109,7 +110,7 @@ contract ModuleUpdateTest is Test { vm.assume(LibMetadata.isValid(metadata)); } - function _assumeValidProposal(address proposal) internal pure { - vm.assume(proposal != address(0)); + function _assumeValidOrchestrator(address orchestrator) internal pure { + vm.assume(orchestrator != address(0)); } } diff --git a/test/e2e/RecurringPayments.t.sol b/test/e2e/RecurringPayments.t.sol index f64efcc32..684619eef 100644 --- a/test/e2e/RecurringPayments.t.sol +++ b/test/e2e/RecurringPayments.t.sol @@ -5,8 +5,8 @@ import {E2eTest} from "test/e2e/E2eTest.sol"; import "forge-std/console.sol"; //Internal Dependencies -import {ModuleTest, IModule, IProposal} from "test/modules/ModuleTest.sol"; -import {IProposalFactory} from "src/factories/ProposalFactory.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; +import {IOrchestratorFactory} from "src/factories/OrchestratorFactory.sol"; import {AuthorizerMock} from "test/utils/mocks/modules/AuthorizerMock.sol"; // External Libraries @@ -57,20 +57,23 @@ contract RecurringPayments is E2eTest { RecurringPaymentManager recurringPaymentManager; // -----------INIT - // address(this) creates a new proposal. - IProposalFactory.ProposalConfig memory proposalConfig = IProposalFactory - .ProposalConfig({owner: address(this), token: token}); - - IProposal proposal = - _createNewProposalWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor( - proposalConfig + // address(this) creates a new orchestrator. + IOrchestratorFactory.OrchestratorConfig memory orchestratorConfig = + IOrchestratorFactory.OrchestratorConfig({ + owner: address(this), + token: token + }); + + IOrchestrator orchestrator = + _createNewOrchestratorWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor( + orchestratorConfig ); RebasingFundingManager fundingManager = - RebasingFundingManager(address(proposal.fundingManager())); + RebasingFundingManager(address(orchestrator.fundingManager())); // ------------------ FROM ModuleTest.sol - address[] memory modulesList = proposal.listModules(); + address[] memory modulesList = orchestrator.listModules(); for (uint i; i < modulesList.length; ++i) { try IRecurringPaymentManager(modulesList[i]).getCurrentEpoch() returns (uint) { diff --git a/test/factories/ModuleFactory.t.sol b/test/factories/ModuleFactory.t.sol index f07beb0ff..8dcdbbe7a 100644 --- a/test/factories/ModuleFactory.t.sol +++ b/test/factories/ModuleFactory.t.sol @@ -16,7 +16,7 @@ import {LibMetadata} from "src/modules/lib/LibMetadata.sol"; import { IModuleFactory, IModule, - IProposal + IOrchestrator } from "src/factories/IModuleFactory.sol"; // Mocks @@ -120,11 +120,11 @@ contract ModuleFactoryTest is Test { function testCreateModule( IModule.Metadata memory metadata, - address proposal, + address orchestrator, bytes memory configdata ) public { _assumeValidMetadata(metadata); - _assumeValidProposal(proposal); + _assumeValidOrchestrator(orchestrator); beacon.overrideImplementation(address(module)); @@ -133,34 +133,36 @@ contract ModuleFactoryTest is Test { // Create new module instance. IModule newModule = IModule( - factory.createModule(metadata, IProposal(proposal), configdata) + factory.createModule( + metadata, IOrchestrator(orchestrator), configdata + ) ); - assertEq(address(newModule.proposal()), address(proposal)); + assertEq(address(newModule.orchestrator()), address(orchestrator)); assertEq(newModule.identifier(), LibMetadata.identifier(metadata)); } function testCreateModuleFailsIfMetadataUnregistered( IModule.Metadata memory metadata, - address proposal, + address orchestrator, bytes memory configdata ) public { _assumeValidMetadata(metadata); - _assumeValidProposal(proposal); + _assumeValidOrchestrator(orchestrator); vm.expectRevert( IModuleFactory.ModuleFactory__UnregisteredMetadata.selector ); - factory.createModule(metadata, IProposal(proposal), configdata); + factory.createModule(metadata, IOrchestrator(orchestrator), configdata); } function testCreateModuleFailsIfBeaconsImplementationIsZero( IModule.Metadata memory metadata, - address proposal, + address orchestrator, bytes memory configdata ) public { _assumeValidMetadata(metadata); - _assumeValidProposal(proposal); + _assumeValidOrchestrator(orchestrator); // Setup and register beacon. beacon.overrideImplementation(address(new ModuleMock())); @@ -171,7 +173,7 @@ contract ModuleFactoryTest is Test { // Note that an `assert()` statement fails. vm.expectRevert(); - factory.createModule(metadata, IProposal(proposal), configdata); + factory.createModule(metadata, IOrchestrator(orchestrator), configdata); } //-------------------------------------------------------------------------- @@ -184,7 +186,7 @@ contract ModuleFactoryTest is Test { vm.assume(LibMetadata.isValid(metadata)); } - function _assumeValidProposal(address proposal) internal pure { - vm.assume(proposal != address(0)); + function _assumeValidOrchestrator(address orchestrator) internal pure { + vm.assume(orchestrator != address(0)); } } diff --git a/test/factories/ProposalFactory.t.sol b/test/factories/ProposalFactory.t.sol index d4fdf8f00..2079c735e 100644 --- a/test/factories/ProposalFactory.t.sol +++ b/test/factories/ProposalFactory.t.sol @@ -4,19 +4,19 @@ pragma solidity ^0.8.0; import "forge-std/Test.sol"; // Internal Dependencies -import {ProposalFactory} from "src/factories/ProposalFactory.sol"; +import {OrchestratorFactory} from "src/factories/OrchestratorFactory.sol"; // External Interfaces import {IERC20} from "@oz/token/ERC20/IERC20.sol"; // Internal Interfaces import { - IProposalFactory, + IOrchestratorFactory, IModule, - IProposal -} from "src/factories/IProposalFactory.sol"; + IOrchestrator +} from "src/factories/IOrchestratorFactory.sol"; -import {Proposal} from "src/proposal/Proposal.sol"; +import {Orchestrator} from "src/orchestrator/Orchestrator.sol"; // Mocks import {ModuleFactoryMock} from @@ -26,41 +26,41 @@ import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; -contract ProposalFactoryTest is Test { +contract OrchestratorFactoryTest is Test { bool hasDependency; string[] dependencies = new string[](0); // SuT - ProposalFactory factory; + OrchestratorFactory factory; - Proposal target; + Orchestrator target; // Mocks ModuleFactoryMock moduleFactory; // Metadata - IProposalFactory.ProposalConfig proposalConfig = IProposalFactory - .ProposalConfig({ + IOrchestratorFactory.OrchestratorConfig orchestratorConfig = + IOrchestratorFactory.OrchestratorConfig({ owner: address(this), token: IERC20(new ERC20Mock("Mock Token", "MOCK")) }); - IProposalFactory.ModuleConfig fundingManagerConfig = IProposalFactory - .ModuleConfig( + IOrchestratorFactory.ModuleConfig fundingManagerConfig = + IOrchestratorFactory.ModuleConfig( IModule.Metadata(1, 1, "https://fundingmanager.com", "FundingManager"), bytes("data"), abi.encode(hasDependency, dependencies) ); - IProposalFactory.ModuleConfig authorizerConfig = IProposalFactory + IOrchestratorFactory.ModuleConfig authorizerConfig = IOrchestratorFactory .ModuleConfig( IModule.Metadata(1, 1, "https://authorizer.com", "Authorizer"), bytes("data"), abi.encode(hasDependency, dependencies) ); - IProposalFactory.ModuleConfig paymentProcessorConfig = IProposalFactory - .ModuleConfig( + IOrchestratorFactory.ModuleConfig paymentProcessorConfig = + IOrchestratorFactory.ModuleConfig( IModule.Metadata( 1, 1, "https://paymentprocessor.com", "SimplePaymentProcessor" ), @@ -68,7 +68,8 @@ contract ProposalFactoryTest is Test { abi.encode(hasDependency, dependencies) ); - IProposalFactory.ModuleConfig moduleConfig = IProposalFactory.ModuleConfig( + IOrchestratorFactory.ModuleConfig moduleConfig = IOrchestratorFactory + .ModuleConfig( IModule.Metadata(1, 1, "https://module.com", "Module"), bytes(""), abi.encode(hasDependency, dependencies) @@ -77,25 +78,28 @@ contract ProposalFactoryTest is Test { function setUp() public { moduleFactory = new ModuleFactoryMock(); - target = new Proposal(); + target = new Orchestrator(); - factory = new ProposalFactory(address(target), address(moduleFactory)); + factory = + new OrchestratorFactory(address(target), address(moduleFactory)); } - function testValidProposalId(uint getId, uint proposalsCreated) public { + function testValidOrchestratorId(uint getId, uint orchestratorsCreated) + public + { // Note to stay reasonable - proposalsCreated = bound(proposalsCreated, 0, 50); + orchestratorsCreated = bound(orchestratorsCreated, 0, 50); - for (uint i = 0; i < proposalsCreated; ++i) { - _deployProposal(); + for (uint i = 0; i < orchestratorsCreated; ++i) { + _deployOrchestrator(); } - if (getId > proposalsCreated) { + if (getId > orchestratorsCreated) { vm.expectRevert( - IProposalFactory.ProposalFactory__InvalidId.selector + IOrchestratorFactory.OrchestratorFactory__InvalidId.selector ); } - factory.getProposalByID(getId); + factory.getOrchestratorByID(getId); } function testDeploymentInvariants() public { @@ -103,77 +107,79 @@ contract ProposalFactoryTest is Test { assertEq(factory.moduleFactory(), address(moduleFactory)); } - function testCreateProposal(uint modulesLen) public { + function testCreateOrchestrator(uint modulesLen) public { // Note to stay reasonable modulesLen = bound(modulesLen, 0, 50); // Create optional ModuleConfig instances. - IProposalFactory.ModuleConfig[] memory moduleConfigs = - new IProposalFactory.ModuleConfig[]( + IOrchestratorFactory.ModuleConfig[] memory moduleConfigs = + new IOrchestratorFactory.ModuleConfig[]( modulesLen ); for (uint i; i < modulesLen; ++i) { moduleConfigs[i] = moduleConfig; } - // Deploy Proposal with id=1 - IProposal proposal = factory.createProposal( - proposalConfig, + // Deploy Orchestrator with id=1 + IOrchestrator orchestrator = factory.createOrchestrator( + orchestratorConfig, fundingManagerConfig, authorizerConfig, paymentProcessorConfig, moduleConfigs ); - // Check that proposal's strorage correctly initialized. - assertEq(proposal.proposalId(), 1); - assertEq(address(proposal.token()), address(proposalConfig.token)); - assertTrue(address(proposal.authorizer()) != address(0)); - assertTrue(address(proposal.paymentProcessor()) != address(0)); + // Check that orchestrator's strorage correctly initialized. + assertEq(orchestrator.orchestratorId(), 1); + assertEq( + address(orchestrator.token()), address(orchestratorConfig.token) + ); + assertTrue(address(orchestrator.authorizer()) != address(0)); + assertTrue(address(orchestrator.paymentProcessor()) != address(0)); - // Check that other proposal's dependencies correctly initialized. + // Check that other orchestrator's dependencies correctly initialized. // Ownable: - assertEq(proposal.manager(), address(proposalConfig.owner)); + assertEq(orchestrator.manager(), address(orchestratorConfig.owner)); - // Deploy Proposal with id=2 - proposal = factory.createProposal( - proposalConfig, + // Deploy Orchestrator with id=2 + orchestrator = factory.createOrchestrator( + orchestratorConfig, fundingManagerConfig, authorizerConfig, paymentProcessorConfig, moduleConfigs ); - // Only check that proposal's id is correct. - assertEq(proposal.proposalId(), 2); + // Only check that orchestrator's id is correct. + assertEq(orchestrator.orchestratorId(), 2); - //check that proposalFactory idCounter is correct. - assertEq(factory.getProposalIDCounter(), 2); + //check that orchestratorFactory idCounter is correct. + assertEq(factory.getOrchestratorIDCounter(), 2); } - function testProposalMapping(uint proposalAmount) public { + function testOrchestratorMapping(uint orchestratorAmount) public { // Note to stay reasonable - proposalAmount = bound(proposalAmount, 0, 50); + orchestratorAmount = bound(orchestratorAmount, 0, 50); - for (uint i = 1; i < proposalAmount; ++i) { - address proposal = _deployProposal(); - assertEq(proposal, factory.getProposalByID(i)); + for (uint i = 1; i < orchestratorAmount; ++i) { + address orchestrator = _deployOrchestrator(); + assertEq(orchestrator, factory.getOrchestratorByID(i)); } } - function _deployProposal() private returns (address) { + function _deployOrchestrator() private returns (address) { //Create Empty ModuleConfig - IProposalFactory.ModuleConfig[] memory moduleConfigs = - new IProposalFactory.ModuleConfig[](0); + IOrchestratorFactory.ModuleConfig[] memory moduleConfigs = + new IOrchestratorFactory.ModuleConfig[](0); - // Deploy Proposal - IProposal proposal = factory.createProposal( - proposalConfig, + // Deploy Orchestrator + IOrchestrator orchestrator = factory.createOrchestrator( + orchestratorConfig, fundingManagerConfig, authorizerConfig, paymentProcessorConfig, moduleConfigs ); - return address(proposal); + return address(orchestrator); } } diff --git a/test/factories/beacon/Beacon.t.sol b/test/factories/beacon/Beacon.t.sol index a8ad8e9e6..1d7a44b0d 100644 --- a/test/factories/beacon/Beacon.t.sol +++ b/test/factories/beacon/Beacon.t.sol @@ -32,7 +32,7 @@ contract BeaconTest is Test { function testDeploymentInvariants() public { assertEq(beacon.implementation(), address(0)); - // Check that proposal's dependencies correctly initialized. + // Check that orchestrator's dependencies correctly initialized. // Ownable2Step: assertEq(beacon.owner(), address(this)); assertEq(beacon.pendingOwner(), address(0)); diff --git a/test/modules/MetadataManager.t.sol b/test/modules/MetadataManager.t.sol index d5d57ac12..1b19a7fac 100644 --- a/test/modules/MetadataManager.t.sol +++ b/test/modules/MetadataManager.t.sol @@ -7,7 +7,7 @@ import "forge-std/console.sol"; import {Clones} from "@oz/proxy/Clones.sol"; //Internal Dependencies -import {ModuleTest, IModule, IProposal} from "test/modules/ModuleTest.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -26,7 +26,7 @@ contract MetadataManagerTest is ModuleTest { // Constants IMetadataManager.ManagerMetadata MANAGER_METADATA; - IMetadataManager.ProposalMetadata PROPOSAL_METADATA; + IMetadataManager.OrchestratorMetadata ORCHESTRATOR_METADATA; IMetadataManager.MemberMetadata[] TEAM_METADATA; function setUp() public { @@ -35,7 +35,7 @@ contract MetadataManagerTest is ModuleTest { "Name", address(0xBEEF), "TwitterHandle" ); - PROPOSAL_METADATA = IMetadataManager.ProposalMetadata( + ORCHESTRATOR_METADATA = IMetadataManager.OrchestratorMetadata( "Title", "DescriptionShort", "DescriptionLong", @@ -43,13 +43,13 @@ contract MetadataManagerTest is ModuleTest { new string[](0) ); - PROPOSAL_METADATA.externalMedias.push("externalMedia1"); - PROPOSAL_METADATA.externalMedias.push("externalMedia2"); - PROPOSAL_METADATA.externalMedias.push("externalMedia3"); + ORCHESTRATOR_METADATA.externalMedias.push("externalMedia1"); + ORCHESTRATOR_METADATA.externalMedias.push("externalMedia2"); + ORCHESTRATOR_METADATA.externalMedias.push("externalMedia3"); - PROPOSAL_METADATA.categories.push("category1"); - PROPOSAL_METADATA.categories.push("category2"); - PROPOSAL_METADATA.categories.push("category3"); + ORCHESTRATOR_METADATA.categories.push("category1"); + ORCHESTRATOR_METADATA.categories.push("category2"); + ORCHESTRATOR_METADATA.categories.push("category3"); TEAM_METADATA.push( IMetadataManager.MemberMetadata( @@ -57,18 +57,18 @@ contract MetadataManagerTest is ModuleTest { ) ); - //Add Module to Mock Proposal + //Add Module to Mock Orchestrator address impl = address(new MetadataManager()); metadataManager = MetadataManager(Clones.clone(impl)); - _setUpProposal(metadataManager); + _setUpOrchestrator(metadataManager); //Init Module metadataManager.init( - _proposal, + _orchestrator, _METADATA, - abi.encode(MANAGER_METADATA, PROPOSAL_METADATA, TEAM_METADATA) + abi.encode(MANAGER_METADATA, ORCHESTRATOR_METADATA, TEAM_METADATA) ); } @@ -81,7 +81,7 @@ contract MetadataManagerTest is ModuleTest { "newName", address(0x606), "newTwitterHandle" ); - PROPOSAL_METADATA = IMetadataManager.ProposalMetadata( + ORCHESTRATOR_METADATA = IMetadataManager.OrchestratorMetadata( "newTitle", "newDescriptionShort", "newDescriptionLong", @@ -89,9 +89,9 @@ contract MetadataManagerTest is ModuleTest { new string[](0) ); - PROPOSAL_METADATA.externalMedias.push("newExternalMedia"); + ORCHESTRATOR_METADATA.externalMedias.push("newExternalMedia"); - PROPOSAL_METADATA.categories.push("newCategory1"); + ORCHESTRATOR_METADATA.categories.push("newCategory1"); TEAM_METADATA.push( IMetadataManager.MemberMetadata( @@ -105,9 +105,9 @@ contract MetadataManagerTest is ModuleTest { assertMetadataManagerManagerMetadataEqualTo(MANAGER_METADATA); //----------------------- - // PROPOSAL_METADATA - metadataManager.setProposalMetadata(PROPOSAL_METADATA); - assertMetadataManagerProposalMetadataEqualTo(PROPOSAL_METADATA); + // ORCHESTRATOR_METADATA + metadataManager.setOrchestratorMetadata(ORCHESTRATOR_METADATA); + assertMetadataManagerOrchestratorMetadataEqualTo(ORCHESTRATOR_METADATA); //----------------------- // TEAM_METADATA @@ -117,7 +117,7 @@ contract MetadataManagerTest is ModuleTest { function testReinitFails() public override(ModuleTest) { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - metadataManager.init(_proposal, _METADATA, bytes("")); + metadataManager.init(_orchestrator, _METADATA, bytes("")); } function testInit2MetadataManager() public { @@ -126,7 +126,7 @@ contract MetadataManagerTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - metadataManager.init2(_proposal, abi.encode(123)); + metadataManager.init2(_orchestrator, abi.encode(123)); // Calling init2 for the first time with no dependency // SHOULD FAIL @@ -134,17 +134,17 @@ contract MetadataManagerTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - metadataManager.init2(_proposal, dependencydata); + metadataManager.init2(_orchestrator, dependencydata); // Calling init2 for the first time with dependency = true // SHOULD PASS dependencydata = abi.encode(true, dependencies); - metadataManager.init2(_proposal, dependencydata); + metadataManager.init2(_orchestrator, dependencydata); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - metadataManager.init2(_proposal, dependencydata); + metadataManager.init2(_orchestrator, dependencydata); } function testSetter() public { @@ -156,10 +156,10 @@ contract MetadataManagerTest is ModuleTest { ); //----------------------- - // PROPOSAL_METADATA + // ORCHESTRATOR_METADATA - assertMetadataManagerProposalMetadataEqualTo( - metadataManager.getProposalMetadata() + assertMetadataManagerOrchestratorMetadataEqualTo( + metadataManager.getOrchestratorMetadata() ); //----------------------- @@ -186,46 +186,47 @@ contract MetadataManagerTest is ModuleTest { ); } - function assertMetadataManagerProposalMetadataEqualTo( - IMetadataManager.ProposalMetadata memory proposalMetadata_ + function assertMetadataManagerOrchestratorMetadataEqualTo( + IMetadataManager.OrchestratorMetadata memory orchestratorMetadata_ ) private { assertEq( - metadataManager.getProposalMetadata().title, proposalMetadata_.title + metadataManager.getOrchestratorMetadata().title, + orchestratorMetadata_.title ); assertEq( - metadataManager.getProposalMetadata().descriptionShort, - proposalMetadata_.descriptionShort + metadataManager.getOrchestratorMetadata().descriptionShort, + orchestratorMetadata_.descriptionShort ); assertEq( - metadataManager.getProposalMetadata().descriptionLong, - proposalMetadata_.descriptionLong + metadataManager.getOrchestratorMetadata().descriptionLong, + orchestratorMetadata_.descriptionLong ); assertEq( - metadataManager.getProposalMetadata().externalMedias.length, - proposalMetadata_.externalMedias.length + metadataManager.getOrchestratorMetadata().externalMedias.length, + orchestratorMetadata_.externalMedias.length ); //asserted Length is equal - uint len = proposalMetadata_.externalMedias.length; + uint len = orchestratorMetadata_.externalMedias.length; for (uint i = 0; i < len; ++i) { assertEq( - proposalMetadata_.externalMedias[i], - metadataManager.getProposalMetadata().externalMedias[i] + orchestratorMetadata_.externalMedias[i], + metadataManager.getOrchestratorMetadata().externalMedias[i] ); } assertEq( - metadataManager.getProposalMetadata().categories.length, - proposalMetadata_.categories.length + metadataManager.getOrchestratorMetadata().categories.length, + orchestratorMetadata_.categories.length ); //asserted Length is equal - len = proposalMetadata_.categories.length; + len = orchestratorMetadata_.categories.length; for (uint i = 0; i < len; ++i) { assertEq( - proposalMetadata_.categories[i], - metadataManager.getProposalMetadata().categories[i] + orchestratorMetadata_.categories[i], + metadataManager.getOrchestratorMetadata().categories[i] ); } } diff --git a/test/modules/ModuleTest.sol b/test/modules/ModuleTest.sol index d1bca97fd..eb790573e 100644 --- a/test/modules/ModuleTest.sol +++ b/test/modules/ModuleTest.sol @@ -10,10 +10,10 @@ import {Clones} from "@oz/proxy/Clones.sol"; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; // Internal Dependencies -import {Proposal} from "src/proposal/Proposal.sol"; +import {Orchestrator} from "src/orchestrator/Orchestrator.sol"; // Internal Interfaces -import {IModule, IProposal} from "src/modules/base/IModule.sol"; +import {IModule, IOrchestrator} from "src/modules/base/IModule.sol"; // Mocks import {FundingManagerMock} from @@ -27,7 +27,7 @@ import {PaymentProcessorMock} from * @dev Base class for module implementation test contracts. */ abstract contract ModuleTest is Test { - Proposal _proposal; + Orchestrator _orchestrator; // Mocks FundingManagerMock _fundingManager = new FundingManagerMock(); @@ -35,8 +35,8 @@ abstract contract ModuleTest is Test { ERC20Mock _token = new ERC20Mock("Mock Token", "MOCK"); PaymentProcessorMock _paymentProcessor = new PaymentProcessorMock(); - // Proposal Constants - uint constant _PROPOSAL_ID = 1; + // Orchestrator Constants + uint constant _ORCHESTRATOR_ID = 1; // Module Constants uint constant _MAJOR_VERSION = 1; @@ -50,15 +50,15 @@ abstract contract ModuleTest is Test { //-------------------------------------------------------------------------------- // Setup - function _setUpProposal(IModule module) internal virtual { + function _setUpOrchestrator(IModule module) internal virtual { address[] memory modules = new address[](1); modules[0] = address(module); - address impl = address(new Proposal()); - _proposal = Proposal(Clones.clone(impl)); + address impl = address(new Orchestrator()); + _orchestrator = Orchestrator(Clones.clone(impl)); - _proposal.init( - _PROPOSAL_ID, + _orchestrator.init( + _ORCHESTRATOR_ID, address(this), _token, modules, @@ -83,10 +83,12 @@ abstract contract ModuleTest is Test { // // Prefixed with `_expect`. - function _expectProposalCallbackFailure(string memory funcSig) internal { + function _expectOrchestratorCallbackFailure(string memory funcSig) + internal + { vm.expectRevert( abi.encodeWithSignature( - "Module_ProposalCallbackFailed(string)", funcSig + "Module_OrchestratorCallbackFailed(string)", funcSig ) ); } diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index 1f65bd55f..039e2d4d8 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -11,9 +11,9 @@ import { // External Libraries import {Clones} from "@oz/proxy/Clones.sol"; // Internal Dependencies -import {Proposal} from "src/proposal/Proposal.sol"; +import {Orchestrator} from "src/orchestrator/Orchestrator.sol"; // Interfaces -import {IModule, IProposal} from "src/modules/base/IModule.sol"; +import {IModule, IOrchestrator} from "src/modules/base/IModule.sol"; // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; import {ModuleMock} from "test/utils/mocks/modules/base/ModuleMock.sol"; @@ -29,7 +29,7 @@ contract RoleAuthorizerTest is Test { // Mocks RoleAuthorizer _authorizer; - Proposal internal _proposal = new Proposal(); + Orchestrator internal _orchestrator = new Orchestrator(); ERC20Mock internal _token = new ERC20Mock("Mock Token", "MOCK"); FundingManagerMock _fundingManager = new FundingManagerMock(); PaymentProcessorMock _paymentProcessor = new PaymentProcessorMock(); @@ -41,8 +41,8 @@ contract RoleAuthorizerTest is Test { ROLE_1 } - // Proposal Constants - uint internal constant _PROPOSAL_ID = 1; + // Orchestrator Constants + uint internal constant _ORCHESTRATOR_ID = 1; // Module Constants uint constant MAJOR_VERSION = 1; uint constant MINOR_VERSION = 1; @@ -55,13 +55,13 @@ contract RoleAuthorizerTest is Test { function setUp() public virtual { address authImpl = address(new RoleAuthorizer()); _authorizer = RoleAuthorizer(Clones.clone(authImpl)); - address propImpl = address(new Proposal()); - _proposal = Proposal(Clones.clone(propImpl)); + address propImpl = address(new Orchestrator()); + _orchestrator = Orchestrator(Clones.clone(propImpl)); ModuleMock module = new ModuleMock(); address[] memory modules = new address[](1); modules[0] = address(module); - _proposal.init( - _PROPOSAL_ID, + _orchestrator.init( + _ORCHESTRATOR_ID, address(this), _token, modules, @@ -73,22 +73,23 @@ contract RoleAuthorizerTest is Test { address initialAuth = ALBA; _authorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(initialAuth, initialManager) ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_MANAGER_ROLE(), address(this) + _authorizer.ORCHESTRATOR_MANAGER_ROLE(), address(this) ), true ); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA), true + _authorizer.hasRole(_authorizer.ORCHESTRATOR_OWNER_ROLE(), ALBA), + true ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_OWNER_ROLE(), address(this) + _authorizer.ORCHESTRATOR_OWNER_ROLE(), address(this) ), false ); @@ -99,7 +100,7 @@ contract RoleAuthorizerTest is Test { function testInitWithInitialOwner(address initialAuth) public { //Checks that address list gets correctly stored on initialization - // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. + // We "reuse" the orchestrator created in the setup, but the orchestrator doesn't know about this new authorizer. address authImpl = address(new RoleAuthorizer()); RoleAuthorizer testAuthorizer = RoleAuthorizer(Clones.clone(authImpl)); @@ -107,19 +108,19 @@ contract RoleAuthorizerTest is Test { assumeValidAuth(initialAuth); testAuthorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(initialAuth, address(this)) ); - assertEq(address(testAuthorizer.proposal()), address(_proposal)); + assertEq(address(testAuthorizer.orchestrator()), address(_orchestrator)); assertEq(testAuthorizer.isAuthorized(0, initialAuth), true); assertEq(testAuthorizer.isAuthorized(0, address(this)), false); assertEq( testAuthorizer.getRoleMemberCount( - testAuthorizer.PROPOSAL_OWNER_ROLE() + testAuthorizer.ORCHESTRATOR_OWNER_ROLE() ), 1 ); @@ -127,7 +128,7 @@ contract RoleAuthorizerTest is Test { function testInitWithoutInitialOwners() public { //Checks that address list gets correctly stored on initialization if there are no owners given - // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. + // We "reuse" the orchestrator created in the setup, but the orchestrator doesn't know about this new authorizer. address authImpl = address(new RoleAuthorizer()); RoleAuthorizer testAuthorizer = RoleAuthorizer(Clones.clone(authImpl)); @@ -135,40 +136,44 @@ contract RoleAuthorizerTest is Test { address initialAuth = address(0); testAuthorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(initialAuth, address(this)) ); - assertEq(address(testAuthorizer.proposal()), address(_proposal)); + assertEq(address(testAuthorizer.orchestrator()), address(_orchestrator)); assertEq(testAuthorizer.isAuthorized(0, address(this)), true); assertEq( testAuthorizer.getRoleMemberCount( - testAuthorizer.PROPOSAL_OWNER_ROLE() + testAuthorizer.ORCHESTRATOR_OWNER_ROLE() ), 1 ); } function testReinitFails() public { - //Create a mock new proposal - Proposal newProposal = Proposal(Clones.clone(address(new Proposal()))); + //Create a mock new orchestrator + Orchestrator newOrchestrator = + Orchestrator(Clones.clone(address(new Orchestrator()))); address[] memory initialAuth = new address[](1); initialAuth[0] = address(this); vm.expectRevert(); _authorizer.init( - IProposal(newProposal), + IOrchestrator(newOrchestrator), _METADATA, abi.encode(initialAuth, initialManager) ); assertEq(_authorizer.isAuthorized(0, address(this)), false); - assertEq(address(_authorizer.proposal()), address(_proposal)); + assertEq(address(_authorizer.orchestrator()), address(_orchestrator)); assertEq(_authorizer.isAuthorized(0, ALBA), true); assertEq( - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()), 1 + _authorizer.getRoleMemberCount( + _authorizer.ORCHESTRATOR_OWNER_ROLE() + ), + 1 ); } @@ -178,7 +183,7 @@ contract RoleAuthorizerTest is Test { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - _authorizer.init2(_proposal, abi.encode(123)); + _authorizer.init2(_orchestrator, abi.encode(123)); // Calling init2 for the first time with no dependency // SHOULD FAIL @@ -186,34 +191,35 @@ contract RoleAuthorizerTest is Test { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - _authorizer.init2(_proposal, dependencydata); + _authorizer.init2(_orchestrator, dependencydata); // Calling init2 for the first time with dependency = true // SHOULD PASS dependencydata = abi.encode(true, dependencies); - _authorizer.init2(_proposal, dependencydata); + _authorizer.init2(_orchestrator, dependencydata); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - _authorizer.init2(_proposal, dependencydata); + _authorizer.init2(_orchestrator, dependencydata); } // Test Register Roles //-------------------------------------------------------------------------------------- - // Test manually granting and revoking roles as proposal-defined Owner + // Test manually granting and revoking roles as orchestrator-defined Owner function testGrantOwnerRole(address[] memory newAuthorized) public { - uint amountAuth = - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()); + uint amountAuth = _authorizer.getRoleMemberCount( + _authorizer.ORCHESTRATOR_OWNER_ROLE() + ); _validateAuthorizedList(newAuthorized); vm.startPrank(address(ALBA)); for (uint i; i < newAuthorized.length; ++i) { _authorizer.grantRole( - _authorizer.PROPOSAL_OWNER_ROLE(), newAuthorized[i] + _authorizer.ORCHESTRATOR_OWNER_ROLE(), newAuthorized[i] ); } vm.stopPrank(); @@ -221,13 +227,15 @@ contract RoleAuthorizerTest is Test { for (uint i; i < newAuthorized.length; ++i) { assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_OWNER_ROLE(), newAuthorized[i] + _authorizer.ORCHESTRATOR_OWNER_ROLE(), newAuthorized[i] ), true ); } assertEq( - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()), + _authorizer.getRoleMemberCount( + _authorizer.ORCHESTRATOR_OWNER_ROLE() + ), (amountAuth + newAuthorized.length) ); } @@ -235,32 +243,38 @@ contract RoleAuthorizerTest is Test { function testRevokeOwnerRole() public { //Add Bob as owner vm.startPrank(address(ALBA)); - _authorizer.grantRole(_authorizer.PROPOSAL_OWNER_ROLE(), BOB); //Meet your new Manager + _authorizer.grantRole(_authorizer.ORCHESTRATOR_OWNER_ROLE(), BOB); //Meet your new Manager vm.stopPrank(); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), BOB), true + _authorizer.hasRole(_authorizer.ORCHESTRATOR_OWNER_ROLE(), BOB), + true ); - uint amountAuth = - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()); + uint amountAuth = _authorizer.getRoleMemberCount( + _authorizer.ORCHESTRATOR_OWNER_ROLE() + ); vm.startPrank(address(ALBA)); - _authorizer.revokeRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA); + _authorizer.revokeRole(_authorizer.ORCHESTRATOR_OWNER_ROLE(), ALBA); vm.stopPrank(); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA), false + _authorizer.hasRole(_authorizer.ORCHESTRATOR_OWNER_ROLE(), ALBA), + false ); assertEq( - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()), + _authorizer.getRoleMemberCount( + _authorizer.ORCHESTRATOR_OWNER_ROLE() + ), amountAuth - 1 ); } function testRemoveLastOwnerFails() public { - uint amountAuth = - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()); - bytes32 ownerRole = _authorizer.PROPOSAL_OWNER_ROLE(); //To correctly time the vm.expectRevert + uint amountAuth = _authorizer.getRoleMemberCount( + _authorizer.ORCHESTRATOR_OWNER_ROLE() + ); + bytes32 ownerRole = _authorizer.ORCHESTRATOR_OWNER_ROLE(); //To correctly time the vm.expectRevert vm.expectRevert( abi.encodeWithSelector( @@ -274,7 +288,9 @@ contract RoleAuthorizerTest is Test { assertEq(_authorizer.isAuthorized(ALBA), true); assertEq( - _authorizer.getRoleMemberCount(_authorizer.PROPOSAL_OWNER_ROLE()), + _authorizer.getRoleMemberCount( + _authorizer.ORCHESTRATOR_OWNER_ROLE() + ), amountAuth ); } @@ -282,7 +298,8 @@ contract RoleAuthorizerTest is Test { function testGrantManagerRole(address[] memory newAuthorized) public { // Here we test adding to a role with OWNER as admin - bytes32 managerRole = _authorizer.generateRoleId(address(_proposal), 1); + bytes32 managerRole = + _authorizer.generateRoleId(address(_orchestrator), 1); uint amountManagers = _authorizer.getRoleMemberCount(managerRole); _validateAuthorizedList(newAuthorized); @@ -306,13 +323,14 @@ contract RoleAuthorizerTest is Test { public { // Here we test adding to a role that has OWNER as admin while not being OWNER - bytes32 managerRole = _authorizer.generateRoleId(address(_proposal), 1); + bytes32 managerRole = + _authorizer.generateRoleId(address(_orchestrator), 1); vm.startPrank(address(ALBA)); _authorizer.grantRole(managerRole, BOB); //Meet your new Manager vm.stopPrank(); - //assertEq(_authorizer.hasRole(address(_proposal), 1, BOB), true); + //assertEq(_authorizer.hasRole(address(_orchestrator), 1, BOB), true); assertEq(_authorizer.hasRole(managerRole, BOB), true); uint amountManagers = _authorizer.getRoleMemberCount(managerRole); @@ -335,7 +353,8 @@ contract RoleAuthorizerTest is Test { function testRevokeManagerRole(address[] memory newAuthorized) public { // Here we test adding to a role with OWNER as admin - bytes32 managerRole = _authorizer.generateRoleId(address(_proposal), 1); + bytes32 managerRole = + _authorizer.generateRoleId(address(_orchestrator), 1); uint amountManagers = _authorizer.getRoleMemberCount(managerRole); _validateAuthorizedList(newAuthorized); @@ -364,7 +383,7 @@ contract RoleAuthorizerTest is Test { for (uint i; i < newAuthorized.length; ++i) { /* assertEq( - _authorizer.hasRole(address(_proposal), 1, newAuthorized[i]), + _authorizer.hasRole(address(_orchestrator), 1, newAuthorized[i]), false );*/ assertEq(_authorizer.hasRole(managerRole, newAuthorized[i]), false); @@ -376,7 +395,8 @@ contract RoleAuthorizerTest is Test { address[] memory newAuthorized ) public { // Here we test adding to a role that has OWNER as admin while not being OWNER - bytes32 managerRole = _authorizer.generateRoleId(address(_proposal), 1); + bytes32 managerRole = + _authorizer.generateRoleId(address(_orchestrator), 1); vm.startPrank(address(ALBA)); _authorizer.grantRole(managerRole, BOB); //Meet your new Manager @@ -443,11 +463,11 @@ contract RoleAuthorizerTest is Test { ); } - function testGrantRoleFromModuleFailsIfModuleNotInProposal() public { + function testGrantRoleFromModuleFailsIfModuleNotInOrchestrator() public { address newModule = _setupMockSelfManagedModule(); vm.prank(ALBA); - _proposal.removeModule(newModule); + _orchestrator.removeModule(newModule); vm.prank(newModule); vm.expectRevert( @@ -569,11 +589,11 @@ contract RoleAuthorizerTest is Test { ); } - function testRevokeRoleFromModuleFailsIfModuleNotInProposal() public { + function testRevokeRoleFromModuleFailsIfModuleNotInOrchestrator() public { address newModule = _setupMockSelfManagedModule(); vm.prank(ALBA); - _proposal.removeModule(newModule); + _orchestrator.removeModule(newModule); vm.prank(newModule); vm.expectRevert( @@ -672,7 +692,9 @@ contract RoleAuthorizerTest is Test { // Now we set the OWNER as Role admin vm.startPrank(BOB); - _authorizer.transferAdminRole(roleId, _authorizer.PROPOSAL_OWNER_ROLE()); + _authorizer.transferAdminRole( + roleId, _authorizer.ORCHESTRATOR_OWNER_ROLE() + ); vm.stopPrank(); // ALBA can now freely grant and revoke roles @@ -690,7 +712,7 @@ contract RoleAuthorizerTest is Test { bytes32 roleId = _authorizer.generateRoleId(newModule, uint8(ModuleRoles.ROLE_0)); - bytes32 ownerRole = _authorizer.PROPOSAL_OWNER_ROLE(); //Buffer this to time revert + bytes32 ownerRole = _authorizer.ORCHESTRATOR_OWNER_ROLE(); //Buffer this to time revert // BOB is not allowed to do this vm.startPrank(BOB); @@ -792,7 +814,7 @@ contract RoleAuthorizerTest is Test { vm.stopPrank(); } - function testModuleOnlyUsesProposalRolesWhenNotSelfManaged() public { + function testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged() public { // First, we set up a module and authorize BOB address newModule = _setupMockSelfManagedModule(); @@ -816,7 +838,7 @@ contract RoleAuthorizerTest is Test { // Test module can correctly return to managed mode function testModuleReturnToManagedMode() public { - //testModuleOnlyUsesProposalRolesWhenNotSelfManaged implicitly tests this + //testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged implicitly tests this } // Test the burnAdminRole @@ -861,7 +883,7 @@ contract RoleAuthorizerTest is Test { // -> Modules with burnt admin CAN return to managed state function testBurnedModuleCorrectlyReturnToManagedState() public { - // Same as testModuleOnlyUsesProposalRolesWhenNotSelfManaged but with ROLE_1 + // Same as testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged but with ROLE_1 // First, we set up a module and authorize BOB address newModule = _setupMockSelfManagedModule(); @@ -878,7 +900,7 @@ contract RoleAuthorizerTest is Test { // BOB is not authorized anymore assertFalse(_authorizer.isAuthorized(uint8(1), BOB)); - // But ALBA, as owner, is (uint8(0) because we are querying her owner role, not the proposal manager role) + // But ALBA, as owner, is (uint8(0) because we are querying her owner role, not the orchestrator manager role) assertTrue(_authorizer.isAuthorized(uint8(0), ALBA)); vm.stopPrank(); @@ -888,7 +910,7 @@ contract RoleAuthorizerTest is Test { // Test Helper Functions // SetUp ModuleWith Roles. - // Creates a Mock module and adds it to the proposal with 2 roles: + // Creates a Mock module and adds it to the orchestrator with 2 roles: // - 1 with default Admin // - 1 with burnt admin // BOB is member of both roles. @@ -896,7 +918,7 @@ contract RoleAuthorizerTest is Test { ModuleMock mockModule = new ModuleMock(); vm.prank(ALBA); //We assume ALBA is owner - _proposal.addModule(address(mockModule)); + _orchestrator.addModule(address(mockModule)); vm.startPrank(address(mockModule)); _authorizer.toggleModuleSelfManagement(); @@ -925,7 +947,7 @@ contract RoleAuthorizerTest is Test { return auths; } - // Adapted from proposal/helper/TypeSanityHelper.sol + // Adapted from orchestrator/helper/TypeSanityHelper.sol mapping(address => bool) authorizedCache; @@ -953,7 +975,7 @@ contract RoleAuthorizerTest is Test { address[] memory invalids = new address[](8); invalids[0] = address(0); - invalids[1] = address(_proposal); + invalids[1] = address(_orchestrator); invalids[2] = address(_authorizer); invalids[3] = address(_paymentProcessor); invalids[4] = address(_token); diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index 17ad21ad3..409c9d7ab 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -13,10 +13,10 @@ import { import {Clones} from "@oz/proxy/Clones.sol"; // Internal Dependencies -import {Proposal} from "src/proposal/Proposal.sol"; +import {Orchestrator} from "src/orchestrator/Orchestrator.sol"; // Interfaces -import {IProposal} from "src/proposal/IProposal.sol"; +import {IOrchestrator} from "src/orchestrator/IOrchestrator.sol"; import {IModule} from "src/modules/base/IModule.sol"; // Mocks @@ -34,15 +34,15 @@ contract SingleVoteGovernorTest is Test { // SuT SingleVoteGovernor _authorizer; - Proposal _proposal; + Orchestrator _orchestrator; address[] initialVoters; address[] currentVoters; // Constants and other data structures uint internal constant DEFAULT_QUORUM = 2; uint internal constant DEFAULT_DURATION = 4 days; - // For the proposal - uint internal constant _PROPOSAL_ID = 1; + // For the orchestrator + uint internal constant _ORCHESTRATOR_ID = 1; // For the metadata uint constant MAJOR_VERSION = 1; uint constant MINOR_VERSION = 1; @@ -65,18 +65,18 @@ contract SingleVoteGovernorTest is Test { ISingleVoteGovernor.Motion _bufMotion; function setUp() public { - // Set up a proposal + // Set up a orchestrator address authImpl = address(new SingleVoteGovernor()); _authorizer = SingleVoteGovernor(Clones.clone(authImpl)); - address impl = address(new Proposal()); - _proposal = Proposal(Clones.clone(impl)); + address impl = address(new Orchestrator()); + _orchestrator = Orchestrator(Clones.clone(impl)); address[] memory modules = new address[](1); modules[0] = address(module); - _proposal.init( - _PROPOSAL_ID, + _orchestrator.init( + _ORCHESTRATOR_ID, address(this), _token, modules, @@ -96,13 +96,13 @@ contract SingleVoteGovernorTest is Test { uint _startingDuration = DEFAULT_DURATION; _authorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(initialVoters, _startingThreshold, _startingDuration) ); - assertEq(address(_authorizer.proposal()), address(_proposal)); - assertEq(_proposal.isModule(address(_authorizer)), true); + assertEq(address(_authorizer.orchestrator()), address(_orchestrator)); + assertEq(_orchestrator.isModule(address(_authorizer)), true); assertEq(_authorizer.isAuthorized(address(_authorizer)), true); assertEq(_authorizer.isVoter(ALBA), true); @@ -115,9 +115,9 @@ contract SingleVoteGovernorTest is Test { // The deployer may be owner, but not authorized by default assertEq(_authorizer.isAuthorized(address(this)), false); - assertEq(_authorizer.isAuthorized(address(_proposal)), false); + assertEq(_authorizer.isAuthorized(address(_orchestrator)), false); assertEq(_authorizer.isVoter(address(this)), false); - assertEq(_authorizer.isVoter(address(_proposal)), false); + assertEq(_authorizer.isVoter(address(_orchestrator)), false); assertEq(_authorizer.voterCount(), 3); } @@ -259,7 +259,7 @@ contract SingleVoteGovernorTest is Test { function testInitWithInitialVoters(address[] memory testVoters) public { //Checks that address list gets correctly stored on initialization - // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. + // We "reuse" the orchestrator created in the setup, but the orchestrator doesn't know about this new authorizer. vm.assume(testVoters.length >= 2); _validateUserList(testVoters); @@ -275,12 +275,12 @@ contract SingleVoteGovernorTest is Test { } testAuthorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) ); - assertEq(address(testAuthorizer.proposal()), address(_proposal)); + assertEq(address(testAuthorizer.orchestrator()), address(_orchestrator)); for (uint i; i < testVoters.length; ++i) { assertEq(testAuthorizer.isVoter(testVoters[i]), true); @@ -294,7 +294,7 @@ contract SingleVoteGovernorTest is Test { uint8 position ) public { //Checks that address list gets correctly stored on initialization - // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. + // We "reuse" the orchestrator created in the setup, but the orchestrator doesn't know about this new authorizer. vm.assume(testVoters.length >= 2); position = uint8(bound(position, 1, testVoters.length - 1)); @@ -321,22 +321,23 @@ contract SingleVoteGovernorTest is Test { ) ); testAuthorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) ); } function testReinitFails() public { - //Create a mock new proposal - Proposal newProposal = Proposal(Clones.clone(address(new Proposal()))); + //Create a mock new orchestrator + Orchestrator newOrchestrator = + Orchestrator(Clones.clone(address(new Orchestrator()))); address[] memory testVoters = new address[](1); testVoters[0] = address(this); vm.expectRevert(); _authorizer.init( - IProposal(newProposal), + IOrchestrator(newOrchestrator), _METADATA, abi.encode( testVoters, @@ -355,7 +356,7 @@ contract SingleVoteGovernorTest is Test { } function testInitWithInvalidInitialVotersFails() public { - // We "reuse" the proposal created in the setup, but the proposal doesn't know about this new authorizer. + // We "reuse" the orchestrator created in the setup, but the orchestrator doesn't know about this new authorizer. address authImpl = address(new SingleVoteGovernor()); SingleVoteGovernor testAuthorizer = @@ -370,7 +371,7 @@ contract SingleVoteGovernorTest is Test { ) ); testAuthorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) ); @@ -386,7 +387,7 @@ contract SingleVoteGovernorTest is Test { ) ); testAuthorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) ); @@ -400,12 +401,12 @@ contract SingleVoteGovernorTest is Test { ) ); testAuthorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) ); - testVoters[0] = address(_proposal); + testVoters[0] = address(_orchestrator); vm.expectRevert( abi.encodeWithSelector( ISingleVoteGovernor @@ -414,12 +415,12 @@ contract SingleVoteGovernorTest is Test { ) ); testAuthorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(testVoters, DEFAULT_QUORUM, DEFAULT_DURATION) ); - assertEq(address(testAuthorizer.proposal()), address(0)); + assertEq(address(testAuthorizer.orchestrator()), address(0)); assertEq(testAuthorizer.voterCount(), 0); } @@ -429,7 +430,7 @@ contract SingleVoteGovernorTest is Test { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - _authorizer.init2(_proposal, abi.encode(123)); + _authorizer.init2(_orchestrator, abi.encode(123)); // Calling init2 for the first time with no dependency // SHOULD FAIL @@ -437,17 +438,17 @@ contract SingleVoteGovernorTest is Test { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - _authorizer.init2(_proposal, dependencydata); + _authorizer.init2(_orchestrator, dependencydata); // Calling init2 for the first time with dependency = true // SHOULD PASS dependencydata = abi.encode(true, dependencies); - _authorizer.init2(_proposal, dependencydata); + _authorizer.init2(_orchestrator, dependencydata); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - _authorizer.init2(_proposal, dependencydata); + _authorizer.init2(_orchestrator, dependencydata); } //-------------------------------------------------------------------------- @@ -977,9 +978,11 @@ contract SingleVoteGovernorTest is Test { function testOnlyGovernanceIsAuthorized(address _other) public { vm.assume(_other != address(_authorizer)); - vm.expectRevert(IProposal.Proposal__CallerNotAuthorized.selector); + vm.expectRevert( + IOrchestrator.Orchestrator__CallerNotAuthorized.selector + ); vm.prank(_other); - _proposal.executeTx(address(0), ""); + _orchestrator.executeTx(address(0), ""); } //-------------------------------------------------------------------------- @@ -1033,7 +1036,7 @@ contract SingleVoteGovernorTest is Test { // Fail to remove Authorized addresses until threshold is unreachble function testRemoveTooManyVoters() public { - assertEq(address(_proposal), address(_authorizer.proposal())); + assertEq(address(_orchestrator), address(_authorizer.orchestrator())); vm.startPrank(address(_authorizer)); _authorizer.removeVoter(COBIE); @@ -1051,7 +1054,7 @@ contract SingleVoteGovernorTest is Test { // Fail to remove Authorized addresses until the voterlist is empty function testRemoveUntilVoterListEmpty() public { - assertEq(address(_proposal), address(_authorizer.proposal())); + assertEq(address(_orchestrator), address(_authorizer.orchestrator())); vm.startPrank(address(_authorizer)); _authorizer.setThreshold(0); @@ -1107,7 +1110,7 @@ contract SingleVoteGovernorTest is Test { uint _newQ = 1; for (uint i; i < users.length; ++i) { vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); - vm.prank(users[i]); //authorized, but not Proposal + vm.prank(users[i]); //authorized, but not Orchestrator _authorizer.setThreshold(_newQ); } } @@ -1126,7 +1129,7 @@ contract SingleVoteGovernorTest is Test { // 2) The vote gets executed by anybody _authorizer.executeMotion(_voteID); - // 3) The proposal state has changed + // 3) The orchestrator state has changed assertEq(_authorizer.threshold(), _newThreshold); } @@ -1194,7 +1197,7 @@ contract SingleVoteGovernorTest is Test { uint _newDuration = 5 days; for (uint i; i < users.length; ++i) { vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); - vm.prank(users[i]); //authorized, but not Proposal + vm.prank(users[i]); //authorized, but not Orchestrator _authorizer.setVotingDuration(_newDuration); } } @@ -1212,7 +1215,7 @@ contract SingleVoteGovernorTest is Test { return contribs; } - // Adapted from proposal/helper/TypeSanityHelper.sol + // Adapted from orchestrator/helper/TypeSanityHelper.sol mapping(address => bool) userCache; @@ -1240,7 +1243,7 @@ contract SingleVoteGovernorTest is Test { address[] memory invalids = new address[](10); invalids[0] = address(0); - invalids[1] = address(_proposal); + invalids[1] = address(_orchestrator); invalids[2] = address(_authorizer); invalids[3] = address(_paymentProcessor); invalids[4] = address(_token); diff --git a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol index 3698df0a3..d2bde46e7 100644 --- a/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol +++ b/test/modules/authorizer/TokenGatedRoleAuthorizer.t.sol @@ -20,9 +20,9 @@ import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; // External Libraries import {Clones} from "@oz/proxy/Clones.sol"; // Internal Dependencies -import {Proposal} from "src/proposal/Proposal.sol"; +import {Orchestrator} from "src/orchestrator/Orchestrator.sol"; // Interfaces -import {IModule, IProposal} from "src/modules/base/IModule.sol"; +import {IModule, IOrchestrator} from "src/modules/base/IModule.sol"; // Mocks import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; import {ERC721Mock} from "test/utils/mocks/ERC721Mock.sol"; @@ -40,13 +40,13 @@ contract TokenGatedRoleAuthorizerUpstreamTests is RoleAuthorizerTest { _authorizer = RoleAuthorizer(Clones.clone(authImpl)); //========================================================================== - address propImpl = address(new Proposal()); - _proposal = Proposal(Clones.clone(propImpl)); + address propImpl = address(new Orchestrator()); + _orchestrator = Orchestrator(Clones.clone(propImpl)); ModuleMock module = new ModuleMock(); address[] memory modules = new address[](1); modules[0] = address(module); - _proposal.init( - _PROPOSAL_ID, + _orchestrator.init( + _ORCHESTRATOR_ID, address(this), _token, modules, @@ -59,22 +59,23 @@ contract TokenGatedRoleAuthorizerUpstreamTests is RoleAuthorizerTest { address initialManager = address(this); _authorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(initialAuth, initialManager) ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_MANAGER_ROLE(), address(this) + _authorizer.ORCHESTRATOR_MANAGER_ROLE(), address(this) ), true ); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA), true + _authorizer.hasRole(_authorizer.ORCHESTRATOR_OWNER_ROLE(), ALBA), + true ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_OWNER_ROLE(), address(this) + _authorizer.ORCHESTRATOR_OWNER_ROLE(), address(this) ), false ); @@ -87,7 +88,7 @@ contract TokenGatedRoleAuthorizerTest is Test { // Mocks TokenGatedRoleAuthorizer _authorizer; - Proposal internal _proposal = new Proposal(); + Orchestrator internal _orchestrator = new Orchestrator(); ERC20Mock internal _token = new ERC20Mock("Mock Token", "MOCK"); FundingManagerMock _fundingManager = new FundingManagerMock(); PaymentProcessorMock _paymentProcessor = new PaymentProcessorMock(); @@ -108,8 +109,8 @@ contract TokenGatedRoleAuthorizerTest is Test { ROLE_NFT } - // Proposal Constants - uint internal constant _PROPOSAL_ID = 1; + // Orchestrator Constants + uint internal constant _ORCHESTRATOR_ID = 1; // Module Constants uint constant MAJOR_VERSION = 1; uint constant MINOR_VERSION = 1; @@ -122,12 +123,12 @@ contract TokenGatedRoleAuthorizerTest is Test { function setUp() public { address authImpl = address(new TokenGatedRoleAuthorizer()); _authorizer = TokenGatedRoleAuthorizer(Clones.clone(authImpl)); - address propImpl = address(new Proposal()); - _proposal = Proposal(Clones.clone(propImpl)); + address propImpl = address(new Orchestrator()); + _orchestrator = Orchestrator(Clones.clone(propImpl)); address[] memory modules = new address[](1); modules[0] = address(mockModule); - _proposal.init( - _PROPOSAL_ID, + _orchestrator.init( + _ORCHESTRATOR_ID, address(this), _token, modules, @@ -140,22 +141,23 @@ contract TokenGatedRoleAuthorizerTest is Test { address initialManager = address(this); _authorizer.init( - IProposal(_proposal), + IOrchestrator(_orchestrator), _METADATA, abi.encode(initialAuth, initialManager) ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_MANAGER_ROLE(), address(this) + _authorizer.ORCHESTRATOR_MANAGER_ROLE(), address(this) ), true ); assertEq( - _authorizer.hasRole(_authorizer.PROPOSAL_OWNER_ROLE(), ALBA), true + _authorizer.hasRole(_authorizer.ORCHESTRATOR_OWNER_ROLE(), ALBA), + true ); assertEq( _authorizer.hasRole( - _authorizer.PROPOSAL_OWNER_ROLE(), address(this) + _authorizer.ORCHESTRATOR_OWNER_ROLE(), address(this) ), false ); diff --git a/test/modules/base/Module.t.sol b/test/modules/base/Module.t.sol index be0f24133..d01ff4e13 100644 --- a/test/modules/base/Module.t.sol +++ b/test/modules/base/Module.t.sol @@ -12,9 +12,9 @@ import {IERC20} from "@oz/token/ERC20/IERC20.sol"; import {LibMetadata} from "src/modules/lib/LibMetadata.sol"; // Internal Interfaces -import {IModule, IProposal} from "src/modules/base/IModule.sol"; +import {IModule, IOrchestrator} from "src/modules/base/IModule.sol"; -import {Proposal} from "src/proposal/Proposal.sol"; +import {Orchestrator} from "src/orchestrator/Orchestrator.sol"; // Mocks import {ModuleMock} from "test/utils/mocks/modules/base/ModuleMock.sol"; @@ -32,7 +32,7 @@ contract ModuleTest is Test { // SuT ModuleMock module; - Proposal proposal; + Orchestrator orchestrator; // Mocks FundingManagerMock fundingManager; @@ -58,18 +58,18 @@ contract ModuleTest is Test { paymentProcessor = new PaymentProcessorMock(); - address proposalImpl = address(new Proposal()); - proposal = Proposal(Clones.clone(proposalImpl)); + address orchestratorImpl = address(new Orchestrator()); + orchestrator = Orchestrator(Clones.clone(orchestratorImpl)); address impl = address(new ModuleMock()); module = ModuleMock(Clones.clone(impl)); - module.init(proposal, METADATA, CONFIGDATA); + module.init(orchestrator, METADATA, CONFIGDATA); - // Initialize proposal to enable module. + // Initialize orchestrator to enable module. address[] memory modules = new address[](1); modules[0] = address(module); - proposal.init( + orchestrator.init( 1, address(this), IERC20(new ERC20Mock("Mock", "MOCK")), @@ -84,8 +84,8 @@ contract ModuleTest is Test { // Tests: Initialization function testInit() public { - // Proposal correctly written to storage. - assertEq(address(module.proposal()), address(proposal)); + // Orchestrator correctly written to storage. + assertEq(address(module.orchestrator()), address(orchestrator)); // Identifier correctly computed. assertEq(module.identifier(), LibMetadata.identifier(METADATA)); @@ -109,20 +109,20 @@ contract ModuleTest is Test { module = ModuleMock(Clones.clone(impl)); vm.expectRevert(OZErrors.Initializable__NotInitializing); - module.initNoInitializer(proposal, METADATA, CONFIGDATA); + module.initNoInitializer(orchestrator, METADATA, CONFIGDATA); } function testReinitFails() public { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - module.init(proposal, METADATA, CONFIGDATA); + module.init(orchestrator, METADATA, CONFIGDATA); } - function testInitFailsForInvalidProposal() public { + function testInitFailsForInvalidOrchestrator() public { address impl = address(new ModuleMock()); module = ModuleMock(Clones.clone(impl)); - vm.expectRevert(IModule.Module__InvalidProposalAddress.selector); - module.init(IProposal(address(0)), METADATA, CONFIGDATA); + vm.expectRevert(IModule.Module__InvalidOrchestratorAddress.selector); + module.init(IOrchestrator(address(0)), METADATA, CONFIGDATA); } function testInitFailsIfMetadataInvalid() public { @@ -132,7 +132,7 @@ contract ModuleTest is Test { // Invalid if url empty. vm.expectRevert(IModule.Module__InvalidMetadata.selector); module.init( - proposal, + orchestrator, IModule.Metadata(MAJOR_VERSION, MINOR_VERSION, "", TITLE), CONFIGDATA ); @@ -140,7 +140,7 @@ contract ModuleTest is Test { // Invalid if title empty. vm.expectRevert(IModule.Module__InvalidMetadata.selector); module.init( - proposal, + orchestrator, IModule.Metadata(MAJOR_VERSION, MINOR_VERSION, URL, ""), CONFIGDATA ); diff --git a/test/modules/fundingManager/RebasingFundingManager.t.sol b/test/modules/fundingManager/RebasingFundingManager.t.sol index bf6e43457..94dc37651 100644 --- a/test/modules/fundingManager/RebasingFundingManager.t.sol +++ b/test/modules/fundingManager/RebasingFundingManager.t.sol @@ -7,7 +7,7 @@ import "forge-std/console.sol"; import {Clones} from "@oz/proxy/Clones.sol"; //Internal Dependencies -import {ModuleTest, IModule, IProposal} from "test/modules/ModuleTest.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -43,21 +43,23 @@ contract RebasingFundingManagerTest is ModuleTest { // Other constants. uint8 private constant DECIMALS = 18; - uint private constant PROPOSAL_ID = 1; + uint private constant ORCHESTRATOR_ID = 1; function setUp() public { //because generateValidUserDeposits uses a mechanism to generate random numbers based on blocktimestamp we warp it vm.warp(1_680_220_800); // March 31, 2023 at 00:00 GMT - //Add Module to Mock Proposal + //Add Module to Mock Orchestrator address impl = address(new RebasingFundingManager()); fundingManager = RebasingFundingManager(Clones.clone(impl)); - _setUpProposal(fundingManager); + _setUpOrchestrator(fundingManager); //Init Module - fundingManager.init(_proposal, _METADATA, abi.encode(address(_token))); + fundingManager.init( + _orchestrator, _METADATA, abi.encode(address(_token)) + ); } //-------------------------------------------------------------------------- @@ -69,7 +71,9 @@ contract RebasingFundingManagerTest is ModuleTest { function testInit() public override(ModuleTest) { assertEq(fundingManager.decimals(), DECIMALS); - assertEq(fundingManager.name(), "Inverter Funding Token - Proposal #1"); + assertEq( + fundingManager.name(), "Inverter Funding Token - Orchestrator #1" + ); assertEq(fundingManager.symbol(), "IFT-1"); assertEq(fundingManager.totalSupply(), 0); @@ -78,7 +82,7 @@ contract RebasingFundingManagerTest is ModuleTest { function testReinitFails() public override(ModuleTest) { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - fundingManager.init(_proposal, _METADATA, abi.encode()); + fundingManager.init(_orchestrator, _METADATA, abi.encode()); } function testInit2RebasingFundingManager() public { @@ -87,7 +91,7 @@ contract RebasingFundingManagerTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - fundingManager.init2(_proposal, abi.encode(123)); + fundingManager.init2(_orchestrator, abi.encode(123)); // Calling init2 for the first time with no dependency // SHOULD FAIL @@ -95,17 +99,17 @@ contract RebasingFundingManagerTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - fundingManager.init2(_proposal, dependencydata); + fundingManager.init2(_orchestrator, dependencydata); // Calling init2 for the first time with dependency = true // SHOULD PASS dependencydata = abi.encode(true, dependencies); - fundingManager.init2(_proposal, dependencydata); + fundingManager.init2(_orchestrator, dependencydata); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - fundingManager.init2(_proposal, dependencydata); + fundingManager.init2(_orchestrator, dependencydata); } //-------------------------------------------------------------------------- @@ -261,7 +265,7 @@ contract RebasingFundingManagerTest is ModuleTest { //Buffer variable to track how much underlying balance each user has left uint[] memory remainingFunds = new uint[](input.users.length); - //the deployer deposits 1 token so the proposal is never empty + //the deployer deposits 1 token so the orchestrator is never empty _token.mint(address(this), 1); vm.startPrank(address(this)); _token.approve(address(fundingManager), type(uint).max); @@ -342,9 +346,9 @@ contract RebasingFundingManagerTest is ModuleTest { remainingFunds[i] = fundingManager.balanceOf(input.users[i]); } - // ---- STEP THREE: WIND DOWN PROPOSAL + // ---- STEP THREE: WIND DOWN ORCHESTRATOR - // The proposal is deemed completed, so everybody withdraws + // The orchestrator is deemed completed, so everybody withdraws for (uint i; i < input.users.length; ++i) { uint balance = fundingManager.balanceOf(input.users[i]); if (balance != 0) { @@ -361,7 +365,7 @@ contract RebasingFundingManagerTest is ModuleTest { //Once everybody has withdrawn, only the initial token + some possible balance rounding leftovers remain. assertTrue(fundingManager.totalSupply() <= (1 + input.users.length)); - // ---- STEP FOUR: RE-START PROPOSAL + // ---- STEP FOUR: RE-START ORCHESTRATOR // Some time passes, and now half the users deposit their underliers again to continue funding (if they had any funds left). for (uint i; i < input.users.length / 2; ++i) { @@ -377,20 +381,20 @@ contract RebasingFundingManagerTest is ModuleTest { } //-------------------------------------------------------------------------- - // Tests: OnlyProposal Mutating Functions + // Tests: OnlyOrchestrator Mutating Functions - function testTransferProposalToken(address to, uint amount) public {} + function testTransferOrchestratorToken(address to, uint amount) public {} - function testTransferProposalTokenFails(address caller, address to) + function testTransferOrchestratorTokenFails(address caller, address to) public { _token.mint(address(fundingManager), 2); - if (caller != address(_proposal)) { - vm.expectRevert(IModule.Module__OnlyCallableByProposal.selector); + if (caller != address(_orchestrator)) { + vm.expectRevert(IModule.Module__OnlyCallableByOrchestrator.selector); } vm.prank(caller); - fundingManager.transferProposalToken(address(0xBEEF), 1); + fundingManager.transferOrchestratorToken(address(0xBEEF), 1); if (to == address(0) || to == address(fundingManager)) { vm.expectRevert( @@ -398,8 +402,8 @@ contract RebasingFundingManagerTest is ModuleTest { ); } - vm.prank(address(_proposal)); - fundingManager.transferProposalToken(to, 1); + vm.prank(address(_orchestrator)); + fundingManager.transferOrchestratorToken(to, 1); } //-------------------------------------------------------------------------- diff --git a/test/modules/logicModule/BountyManager.t.sol b/test/modules/logicModule/BountyManager.t.sol index 495d45128..7460a3810 100644 --- a/test/modules/logicModule/BountyManager.t.sol +++ b/test/modules/logicModule/BountyManager.t.sol @@ -7,7 +7,7 @@ import "forge-std/console.sol"; import {Clones} from "@oz/proxy/Clones.sol"; //Internal Dependencies -import {ModuleTest, IModule, IProposal} from "test/modules/ModuleTest.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -61,11 +61,11 @@ contract BountyManagerTest is ModuleTest { event ClaimVerified(uint indexed BountyId, uint indexed ClaimId); function setUp() public { - //Add Module to Mock Proposal + //Add Module to Mock Orchestrator address impl = address(new BountyManager()); bountyManager = BountyManager(Clones.clone(impl)); - _setUpProposal(bountyManager); + _setUpOrchestrator(bountyManager); _authorizer.setIsAuthorized(address(this), true); @@ -74,7 +74,7 @@ contract BountyManagerTest is ModuleTest { INVALID_CONTRIBUTORS.push(BEEF); - bountyManager.init(_proposal, _METADATA, bytes("")); + bountyManager.init(_orchestrator, _METADATA, bytes("")); } //-------------------------------------------------------------------------- @@ -85,7 +85,7 @@ contract BountyManagerTest is ModuleTest { function testReinitFails() public override(ModuleTest) { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - bountyManager.init(_proposal, _METADATA, bytes("")); + bountyManager.init(_orchestrator, _METADATA, bytes("")); } //-------------------------------------------------------------------------- @@ -256,7 +256,7 @@ contract BountyManagerTest is ModuleTest { if ( currentContrib.addr == address(0) || currentContrib.addr == address(bountyManager) - || currentContrib.addr == address(_proposal) + || currentContrib.addr == address(_orchestrator) ) { vm.expectRevert( IBountyManager @@ -873,7 +873,7 @@ contract BountyManagerTest is ModuleTest { a = addrs[i]; if ( a == address(0) || a == address(bountyManager) - || a == address(_proposal) + || a == address(_orchestrator) ) addrs[i] = address(0x1); //Convert amount 0 to 1 @@ -910,7 +910,7 @@ contract BountyManagerTest is ModuleTest { a = addrs[i]; if ( a == address(0) || a == address(bountyManager) - || a == address(_proposal) + || a == address(_orchestrator) ) addrs[i] = address(0x1); //Convert amount 0 to 1 diff --git a/test/modules/logicModule/MilestoneManager.t.sol b/test/modules/logicModule/MilestoneManager.t.sol index d9ce57ed0..aa8881274 100644 --- a/test/modules/logicModule/MilestoneManager.t.sol +++ b/test/modules/logicModule/MilestoneManager.t.sol @@ -6,7 +6,7 @@ import {Clones} from "@oz/proxy/Clones.sol"; import "forge-std/console.sol"; -import {ModuleTest, IModule, IProposal} from "test/modules/ModuleTest.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; // SuT import { @@ -73,12 +73,12 @@ contract MilestoneManagerTest is ModuleTest { address impl = address(new MilestoneManager()); milestoneManager = MilestoneManager(Clones.clone(impl)); - _setUpProposal(milestoneManager); + _setUpOrchestrator(milestoneManager); bytes memory configdata = abi.encode(SALARY_PRECISION, FEE_PERCENTAGE, FEE_TREASURY); - milestoneManager.init(_proposal, _METADATA, configdata); + milestoneManager.init(_orchestrator, _METADATA, configdata); _authorizer.setIsAuthorized(address(this), true); @@ -106,7 +106,7 @@ contract MilestoneManagerTest is ModuleTest { function testReinitFails() public override(ModuleTest) { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - milestoneManager.init(_proposal, _METADATA, bytes("")); + milestoneManager.init(_orchestrator, _METADATA, bytes("")); } function testInit2MilestoneManager() public { @@ -115,7 +115,7 @@ contract MilestoneManagerTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - milestoneManager.init2(_proposal, abi.encode(123)); + milestoneManager.init2(_orchestrator, abi.encode(123)); // Calling init2 for the first time with no dependency // SHOULD FAIL @@ -123,17 +123,17 @@ contract MilestoneManagerTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - milestoneManager.init2(_proposal, dependencydata); + milestoneManager.init2(_orchestrator, dependencydata); // Calling init2 for the first time with dependency = true // SHOULD PASS dependencydata = abi.encode(true, dependencies); - milestoneManager.init2(_proposal, dependencydata); + milestoneManager.init2(_orchestrator, dependencydata); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - milestoneManager.init2(_proposal, dependencydata); + milestoneManager.init2(_orchestrator, dependencydata); } //-------------------------------------------------------------------------- @@ -475,7 +475,7 @@ contract MilestoneManagerTest is ModuleTest { public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + vm.assume(caller != _orchestrator.manager()); vm.prank(caller); vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -507,7 +507,7 @@ contract MilestoneManagerTest is ModuleTest { //function testAddMilesteonFailsForInvalidBudget() public { // uint[] memory invalids = _createInvalidBudgets(); // - // vm.startPrank(address(_proposal)); + // vm.startPrank(address(_orchestrator)); // // for (uint i; i < invalids.length; ++i) { // vm.expectRevert( @@ -591,7 +591,7 @@ contract MilestoneManagerTest is ModuleTest { contribs[0] = ALICE; contribs[1] = BOB; contribs[2] = ALICE; - contribs[2].addr = address(_proposal); + contribs[2].addr = address(_orchestrator); vm.expectRevert( IMilestoneManager @@ -655,7 +655,7 @@ contract MilestoneManagerTest is ModuleTest { uint id = 1; // Note that id's start at 1. _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + vm.assume(caller != _orchestrator.manager()); vm.prank(caller); vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -828,7 +828,7 @@ contract MilestoneManagerTest is ModuleTest { address caller ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + vm.assume(caller != _orchestrator.manager()); vm.prank(caller); vm.expectRevert(IModule.Module__CallerNotAuthorized.selector); @@ -947,7 +947,7 @@ contract MilestoneManagerTest is ModuleTest { address caller ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + vm.assume(caller != _orchestrator.manager()); milestoneManager.addMilestone( DURATION, BUDGET, DEFAULT_CONTRIBUTORS, DETAILS @@ -973,7 +973,7 @@ contract MilestoneManagerTest is ModuleTest { milestoneManager.startNextMilestone(); } - function testStartNextMilestoneFailsIfTransferOfTokensFromProposalFailed( + function testStartNextMilestoneFailsIfTransferOfTokensFromOrchestratorFailed( address[] memory contributors ) public { IMilestoneManager.Contributor[] memory contribs = @@ -1096,7 +1096,7 @@ contract MilestoneManagerTest is ModuleTest { address caller ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + vm.assume(caller != _orchestrator.manager()); uint id = milestoneManager.addMilestone( DURATION, BUDGET, DEFAULT_CONTRIBUTORS, DETAILS @@ -1569,7 +1569,7 @@ contract MilestoneManagerTest is ModuleTest { address[] memory contributors ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + vm.assume(caller != _orchestrator.manager()); IMilestoneManager.Contributor[] memory contribs = _generateEqualContributors(contributors); @@ -1692,7 +1692,7 @@ contract MilestoneManagerTest is ModuleTest { address[] memory contributors ) public { _authorizer.setIsAuthorized(caller, false); - vm.assume(caller != _proposal.manager()); + vm.assume(caller != _orchestrator.manager()); IMilestoneManager.Contributor[] memory contribs = _generateEqualContributors(contributors); @@ -2124,7 +2124,7 @@ contract MilestoneManagerTest is ModuleTest { invalids[0] = address(0); invalids[1] = _SENTINEL_CONTRIBUTOR; - invalids[2] = address(_proposal); + invalids[2] = address(_orchestrator); invalids[3] = address(milestoneManager); return invalids; diff --git a/test/modules/logicModule/RecurringPaymentManager.t.sol b/test/modules/logicModule/RecurringPaymentManager.t.sol index abd2cee21..8f0dbdcae 100644 --- a/test/modules/logicModule/RecurringPaymentManager.t.sol +++ b/test/modules/logicModule/RecurringPaymentManager.t.sol @@ -7,7 +7,7 @@ import "forge-std/console.sol"; import {Clones} from "@oz/proxy/Clones.sol"; //Internal Dependencies -import {ModuleTest, IModule, IProposal} from "test/modules/ModuleTest.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; // Errors import {OZErrors} from "test/utils/errors/OZErrors.sol"; @@ -39,11 +39,11 @@ contract RecurringPaymentManagerTest is ModuleTest { event RecurringPaymentsTriggered(uint indexed currentEpoch); function setUp() public { - //Add Module to Mock Proposal + //Add Module to Mock Orchestrator address impl = address(new RecurringPaymentManager()); recurringPaymentManager = RecurringPaymentManager(Clones.clone(impl)); - _setUpProposal(recurringPaymentManager); + _setUpOrchestrator(recurringPaymentManager); _authorizer.setIsAuthorized(address(this), true); } @@ -60,7 +60,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //Init Module wrongly recurringPaymentManager.init( - _proposal, _METADATA, abi.encode(1 weeks - 1) + _orchestrator, _METADATA, abi.encode(1 weeks - 1) ); vm.expectRevert( @@ -71,20 +71,24 @@ contract RecurringPaymentManagerTest is ModuleTest { //Init Module wrongly recurringPaymentManager.init( - _proposal, _METADATA, abi.encode(52 weeks + 1) + _orchestrator, _METADATA, abi.encode(52 weeks + 1) ); //Init Module correct - recurringPaymentManager.init(_proposal, _METADATA, abi.encode(1 weeks)); + recurringPaymentManager.init( + _orchestrator, _METADATA, abi.encode(1 weeks) + ); assertEq(recurringPaymentManager.getEpochLength(), 1 weeks); } function testReinitFails() public override(ModuleTest) { - recurringPaymentManager.init(_proposal, _METADATA, abi.encode(1 weeks)); + recurringPaymentManager.init( + _orchestrator, _METADATA, abi.encode(1 weeks) + ); vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - recurringPaymentManager.init(_proposal, _METADATA, bytes("")); + recurringPaymentManager.init(_orchestrator, _METADATA, bytes("")); } function testInit2RecurringPaymentManager() public { @@ -93,7 +97,7 @@ contract RecurringPaymentManagerTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - recurringPaymentManager.init2(_proposal, abi.encode(123)); + recurringPaymentManager.init2(_orchestrator, abi.encode(123)); // Calling init2 for the first time with no dependency // SHOULD FAIL @@ -101,17 +105,17 @@ contract RecurringPaymentManagerTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - recurringPaymentManager.init2(_proposal, dependencydata); + recurringPaymentManager.init2(_orchestrator, dependencydata); // Calling init2 for the first time with dependency = true // SHOULD PASS dependencydata = abi.encode(true, dependencies); - recurringPaymentManager.init2(_proposal, dependencydata); + recurringPaymentManager.init2(_orchestrator, dependencydata); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - recurringPaymentManager.init2(_proposal, dependencydata); + recurringPaymentManager.init2(_orchestrator, dependencydata); } //-------------------------------------------------------------------------- @@ -246,7 +250,9 @@ contract RecurringPaymentManagerTest is ModuleTest { function testAddRecurringPaymentModifierInPosition() public { //Init Module - recurringPaymentManager.init(_proposal, _METADATA, abi.encode(1 weeks)); + recurringPaymentManager.init( + _orchestrator, _METADATA, abi.encode(1 weeks) + ); //Warp to a reasonable time vm.warp(2 weeks); @@ -352,7 +358,9 @@ contract RecurringPaymentManagerTest is ModuleTest { function testRemoveRecurringPaymentModifierInPosition() public { //Init Module - recurringPaymentManager.init(_proposal, _METADATA, abi.encode(1 weeks)); + recurringPaymentManager.init( + _orchestrator, _METADATA, abi.encode(1 weeks) + ); //onlyAuthorizedOrManager vm.prank(address(0xBEEF)); //Not Authorized @@ -553,7 +561,7 @@ contract RecurringPaymentManagerTest is ModuleTest { //Init Module recurringPaymentManager.init( - _proposal, _METADATA, abi.encode(epochLength) + _orchestrator, _METADATA, abi.encode(epochLength) ); } diff --git a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol index 76976fd5b..879cafbe6 100644 --- a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; // External Libraries import {Clones} from "@oz/proxy/Clones.sol"; -import {ModuleTest, IModule, IProposal} from "test/modules/ModuleTest.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; // SuT import { @@ -35,13 +35,13 @@ contract SimplePaymentProcessorTest is ModuleTest { address impl = address(new SimplePaymentProcessor()); paymentProcessor = SimplePaymentProcessor(Clones.clone(impl)); - _setUpProposal(paymentProcessor); + _setUpOrchestrator(paymentProcessor); _authorizer.setIsAuthorized(address(this), true); - _proposal.addModule(address(paymentClient)); + _orchestrator.addModule(address(paymentClient)); - paymentProcessor.init(_proposal, _METADATA, bytes("")); + paymentProcessor.init(_orchestrator, _METADATA, bytes("")); paymentClient.setIsAuthorized(address(paymentProcessor), true); } @@ -55,7 +55,7 @@ contract SimplePaymentProcessorTest is ModuleTest { function testReinitFails() public override(ModuleTest) { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - paymentProcessor.init(_proposal, _METADATA, bytes("")); + paymentProcessor.init(_orchestrator, _METADATA, bytes("")); } function testInit2SimplePaymentProcessor() public { @@ -64,7 +64,7 @@ contract SimplePaymentProcessorTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - paymentProcessor.init2(_proposal, abi.encode(123)); + paymentProcessor.init2(_orchestrator, abi.encode(123)); // Calling init2 for the first time with no dependency // SHOULD FAIL @@ -72,17 +72,17 @@ contract SimplePaymentProcessorTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - paymentProcessor.init2(_proposal, dependencydata); + paymentProcessor.init2(_orchestrator, dependencydata); // Calling init2 for the first time with dependency = true // SHOULD PASS dependencydata = abi.encode(true, dependencies); - paymentProcessor.init2(_proposal, dependencydata); + paymentProcessor.init2(_orchestrator, dependencydata); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - paymentProcessor.init2(_proposal, dependencydata); + paymentProcessor.init2(_orchestrator, dependencydata); } //-------------------------------------------------------------------------- diff --git a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol index 2d2f9b3f5..66aa706b4 100644 --- a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.0; // External Libraries import {Clones} from "@oz/proxy/Clones.sol"; -import {ModuleTest, IModule, IProposal} from "test/modules/ModuleTest.sol"; +import {ModuleTest, IModule, IOrchestrator} from "test/modules/ModuleTest.sol"; // SuT import {IPaymentProcessor} from @@ -57,13 +57,13 @@ contract StreamingPaymentProcessorTest is ModuleTest { address impl = address(new StreamingPaymentProcessor()); paymentProcessor = StreamingPaymentProcessor(Clones.clone(impl)); - _setUpProposal(paymentProcessor); + _setUpOrchestrator(paymentProcessor); _authorizer.setIsAuthorized(address(this), true); - _proposal.addModule(address(paymentClient)); + _orchestrator.addModule(address(paymentClient)); - paymentProcessor.init(_proposal, _METADATA, bytes("")); + paymentProcessor.init(_orchestrator, _METADATA, bytes("")); paymentClient.setIsAuthorized(address(paymentProcessor), true); } @@ -77,7 +77,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { function testReinitFails() public override(ModuleTest) { vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - paymentProcessor.init(_proposal, _METADATA, bytes("")); + paymentProcessor.init(_orchestrator, _METADATA, bytes("")); } function testInit2StreamingPaymentProcessor() public { @@ -86,7 +86,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - paymentProcessor.init2(_proposal, abi.encode(123)); + paymentProcessor.init2(_orchestrator, abi.encode(123)); // Calling init2 for the first time with no dependency // SHOULD FAIL @@ -94,17 +94,17 @@ contract StreamingPaymentProcessorTest is ModuleTest { vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - paymentProcessor.init2(_proposal, dependencydata); + paymentProcessor.init2(_orchestrator, dependencydata); // Calling init2 for the first time with dependency = true // SHOULD PASS dependencydata = abi.encode(true, dependencies); - paymentProcessor.init2(_proposal, dependencydata); + paymentProcessor.init2(_orchestrator, dependencydata); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - paymentProcessor.init2(_proposal, dependencydata); + paymentProcessor.init2(_orchestrator, dependencydata); } //-------------------------------------------------------------------------- @@ -994,7 +994,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { } //This test creates a new set of payments in a client which finished all running payments. - //one possible case would be a proposal that finishes all milestones succesfully and then gets "restarted" some time later + //one possible case would be a orchestrator that finishes all milestones succesfully and then gets "restarted" some time later function testCancelRunningPayments( address[] memory recipients, uint128[] memory amounts, @@ -1131,7 +1131,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { } } - //This test creates a new set of payments in a client which finished all running payments. one possible case would be a proposal that finishes all milestones succesfully and then gets "restarted" some time later + //This test creates a new set of payments in a client which finished all running payments. one possible case would be a orchestrator that finishes all milestones succesfully and then gets "restarted" some time later function testUpdateFinishedPayments( address[] memory recipients, uint128[] memory amounts, @@ -1385,7 +1385,7 @@ contract StreamingPaymentProcessorTest is ModuleTest { address[] memory invalids = new address[](5); invalids[0] = address(0); - invalids[1] = address(_proposal); + invalids[1] = address(_orchestrator); invalids[2] = address(paymentProcessor); invalids[3] = address(paymentClient); invalids[4] = address(this); diff --git a/test/proposal/Proposal.t.sol b/test/orchestrator/Orchestrator.t.sol similarity index 71% rename from test/proposal/Proposal.t.sol rename to test/orchestrator/Orchestrator.t.sol index 4df40df33..10d9f5948 100644 --- a/test/proposal/Proposal.t.sol +++ b/test/orchestrator/Orchestrator.t.sol @@ -10,15 +10,15 @@ import {Clones} from "@oz/proxy/Clones.sol"; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; // Internal Dependencies -import {Proposal} from "src/proposal/Proposal.sol"; +import {Orchestrator} from "src/orchestrator/Orchestrator.sol"; import {IModule} from "src/modules/base/IModule.sol"; // Internal Interfaces import { - IProposal, + IOrchestrator, IAuthorizer, IPaymentProcessor -} from "src/proposal/IProposal.sol"; +} from "src/orchestrator/IOrchestrator.sol"; // Mocks import {FundingManagerMock} from @@ -32,11 +32,11 @@ import {ERC20Mock} from "test/utils/mocks/ERC20Mock.sol"; import {OZErrors} from "test/utils/errors/OZErrors.sol"; // Helper -import {TypeSanityHelper} from "test/proposal/helper/TypeSanityHelper.sol"; +import {TypeSanityHelper} from "test/orchestrator/helper/TypeSanityHelper.sol"; -contract ProposalTest is Test { +contract OrchestratorTest is Test { // SuT - Proposal proposal; + Orchestrator orchestrator; // Helper TypeSanityHelper types; @@ -57,17 +57,17 @@ contract ProposalTest is Test { paymentProcessor = new PaymentProcessorMock(); token = new ERC20Mock("TestToken", "TST"); - address impl = address(new Proposal()); - proposal = Proposal(Clones.clone(impl)); + address impl = address(new Orchestrator()); + orchestrator = Orchestrator(Clones.clone(impl)); - types = new TypeSanityHelper(address(proposal)); + types = new TypeSanityHelper(address(orchestrator)); } //-------------------------------------------------------------------------- // Tests: Initialization - function testInit(uint proposalId, address[] memory modules) public { - types.assumeValidProposalId(proposalId); + function testInit(uint orchestratorId, address[] memory modules) public { + types.assumeValidOrchestratorId(orchestratorId); types.assumeValidModules(modules); address[] memory truncatedModules = new address[](125); @@ -80,9 +80,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(truncatedModules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, truncatedModules, @@ -94,9 +94,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(modules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, modules, @@ -106,24 +106,24 @@ contract ProposalTest is Test { ); } - // Check that proposal's storage correctly initialized. - assertEq(proposal.proposalId(), proposalId); - assertEq(address(proposal.manager()), address(this)); - assertEq(address(proposal.token()), address(token)); - assertEq(address(proposal.authorizer()), address(authorizer)); + // Check that orchestrator's storage correctly initialized. + assertEq(orchestrator.orchestratorId(), orchestratorId); + assertEq(address(orchestrator.manager()), address(this)); + assertEq(address(orchestrator.token()), address(token)); + assertEq(address(orchestrator.authorizer()), address(authorizer)); assertEq( - address(proposal.paymentProcessor()), address(paymentProcessor) + address(orchestrator.paymentProcessor()), address(paymentProcessor) ); - // Check that proposal's dependencies correctly initialized. + // Check that orchestrator's dependencies correctly initialized. // Ownable: - assertEq(proposal.manager(), address(this)); + assertEq(orchestrator.manager(), address(this)); } - function testReinitFails(uint proposalId, address[] memory modules) + function testReinitFails(uint orchestratorId, address[] memory modules) public { - types.assumeValidProposalId(proposalId); + types.assumeValidOrchestratorId(orchestratorId); address[] memory truncatedModules = new address[](125); if (modules.length > 125) { @@ -135,9 +135,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(truncatedModules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, truncatedModules, @@ -147,8 +147,8 @@ contract ProposalTest is Test { ); vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - proposal.init( - proposalId, + orchestrator.init( + orchestratorId, address(this), token, truncatedModules, @@ -161,9 +161,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(modules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, modules, @@ -173,8 +173,8 @@ contract ProposalTest is Test { ); vm.expectRevert(OZErrors.Initializable__AlreadyInitialized); - proposal.init( - proposalId, + orchestrator.init( + orchestratorId, address(this), token, modules, @@ -189,21 +189,21 @@ contract ProposalTest is Test { // Tests: Replacing the three base modules: authorizer, funding manager, // payment processor - function testSetAuthorizer(uint proposalId, address[] memory modules) + function testSetAuthorizer(uint orchestratorId, address[] memory modules) public { // limit to 100, otherwise we could run into the max module limit modules = cutArray(100, modules); - types.assumeValidProposalId(proposalId); + types.assumeValidOrchestratorId(orchestratorId); types.assumeValidModules(modules); // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(modules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, modules, @@ -225,34 +225,37 @@ contract ProposalTest is Test { vm.expectEmit(true, true, true, true); emit AuthorizerUpdated(address(newAuthorizer)); - proposal.setAuthorizer(newAuthorizer); - assertTrue(proposal.authorizer() == newAuthorizer); + orchestrator.setAuthorizer(newAuthorizer); + assertTrue(orchestrator.authorizer() == newAuthorizer); // verify whether the init value is set and not the value from the old // authorizer, to check whether the replacement is successful assertFalse( - IAuthorizer(proposal.authorizer()).isAuthorized(address(this)) + IAuthorizer(orchestrator.authorizer()).isAuthorized(address(this)) ); assertTrue( - IAuthorizer(proposal.authorizer()).isAuthorized(address(0xA11CE)) + IAuthorizer(orchestrator.authorizer()).isAuthorized( + address(0xA11CE) + ) ); } - function testSetFundingManager(uint proposalId, address[] memory modules) - public - { + function testSetFundingManager( + uint orchestratorId, + address[] memory modules + ) public { // limit to 100, otherwise we could run into the max module limit modules = cutArray(100, modules); - types.assumeValidProposalId(proposalId); + types.assumeValidOrchestratorId(orchestratorId); types.assumeValidModules(modules); // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(modules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, modules, @@ -262,7 +265,7 @@ contract ProposalTest is Test { ); authorizer.setIsAuthorized(address(this), true); - FundingManagerMock(address(proposal.fundingManager())).setToken( + FundingManagerMock(address(orchestrator.fundingManager())).setToken( IERC20(address(0xA11CE)) ); @@ -275,26 +278,29 @@ contract ProposalTest is Test { vm.expectEmit(true, true, true, true); emit FundingManagerUpdated(address(newFundingManager)); - proposal.setFundingManager(newFundingManager); - assertTrue(proposal.fundingManager() == newFundingManager); - assertTrue(address((proposal.fundingManager()).token()) == address(0)); + orchestrator.setFundingManager(newFundingManager); + assertTrue(orchestrator.fundingManager() == newFundingManager); + assertTrue( + address((orchestrator.fundingManager()).token()) == address(0) + ); } - function testSetPaymentProcessor(uint proposalId, address[] memory modules) - public - { + function testSetPaymentProcessor( + uint orchestratorId, + address[] memory modules + ) public { // limit to 100, otherwise we could run into the max module limit modules = cutArray(100, modules); - types.assumeValidProposalId(proposalId); + types.assumeValidOrchestratorId(orchestratorId); types.assumeValidModules(modules); // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(modules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, modules, @@ -314,15 +320,17 @@ contract ProposalTest is Test { vm.expectEmit(true, true, true, true); emit PaymentProcessorUpdated(address(newPaymentProcessor)); - proposal.setPaymentProcessor(newPaymentProcessor); - assertTrue(proposal.paymentProcessor() == newPaymentProcessor); + orchestrator.setPaymentProcessor(newPaymentProcessor); + assertTrue(orchestrator.paymentProcessor() == newPaymentProcessor); } //-------------------------------------------------------------------------- // Tests: Transaction Execution - function testExecuteTx(uint proposalId, address[] memory modules) public { - types.assumeValidProposalId(proposalId); + function testExecuteTx(uint orchestratorId, address[] memory modules) + public + { + types.assumeValidOrchestratorId(orchestratorId); address[] memory truncatedModules = new address[](125); if (modules.length > 125) { @@ -335,9 +343,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of truncatedModules. assumeMockAreNotInSet(truncatedModules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, truncatedModules, @@ -351,9 +359,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(modules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, modules, @@ -364,16 +372,17 @@ contract ProposalTest is Test { } authorizer.setIsAuthorized(address(this), true); - bytes memory returnData = - proposal.executeTx(address(this), abi.encodeWithSignature("ok()")); + bytes memory returnData = orchestrator.executeTx( + address(this), abi.encodeWithSignature("ok()") + ); assertTrue(abi.decode(returnData, (bool))); } function testExecuteTxFailsIfCallFails( - uint proposalId, + uint orchestratorId, address[] memory modules ) public { - types.assumeValidProposalId(proposalId); + types.assumeValidOrchestratorId(orchestratorId); address[] memory truncatedModules = new address[](125); if (modules.length > 125) { for (uint i; i < 125; i++) { @@ -385,9 +394,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of truncatedModules. assumeMockAreNotInSet(truncatedModules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, truncatedModules, @@ -401,9 +410,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(modules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(this), token, modules, @@ -415,15 +424,17 @@ contract ProposalTest is Test { authorizer.setIsAuthorized(address(this), true); - vm.expectRevert(IProposal.Proposal__ExecuteTxFailed.selector); - proposal.executeTx(address(this), abi.encodeWithSignature("fails()")); + vm.expectRevert(IOrchestrator.Orchestrator__ExecuteTxFailed.selector); + orchestrator.executeTx( + address(this), abi.encodeWithSignature("fails()") + ); } function testExecuteTxFailsIfCallerNotAuthorized( - uint proposalId, + uint orchestratorId, address[] memory modules ) public { - types.assumeValidProposalId(proposalId); + types.assumeValidOrchestratorId(orchestratorId); address[] memory truncatedModules = new address[](125); if (modules.length > 125) { @@ -436,9 +447,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of truncatedModules. assumeMockAreNotInSet(truncatedModules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(0xCAFE), // Note to not be the owner token, truncatedModules, @@ -452,9 +463,9 @@ contract ProposalTest is Test { // Make sure mock addresses are not in set of modules. assumeMockAreNotInSet(modules); - // Initialize proposal. - proposal.init( - proposalId, + // Initialize orchestrator. + orchestrator.init( + orchestratorId, address(0xCAFE), // Note to not be the owner token, modules, @@ -466,8 +477,10 @@ contract ProposalTest is Test { authorizer.setIsAuthorized(address(this), false); - vm.expectRevert(IProposal.Proposal__CallerNotAuthorized.selector); - proposal.executeTx(address(this), abi.encodeWithSignature("ok()")); + vm.expectRevert( + IOrchestrator.Orchestrator__CallerNotAuthorized.selector + ); + orchestrator.executeTx(address(this), abi.encodeWithSignature("ok()")); } function ok() public pure returns (bool) { @@ -482,7 +495,7 @@ contract ProposalTest is Test { // Tests: Other function testVersion() public { - assertEq(proposal.version(), "1"); + assertEq(orchestrator.version(), "1"); } //-------------------------------------------------------------------------- diff --git a/test/proposal/base/ModuleManager.t.sol b/test/orchestrator/base/ModuleManager.t.sol similarity index 91% rename from test/proposal/base/ModuleManager.t.sol rename to test/orchestrator/base/ModuleManager.t.sol index 5788e9b7b..b9273bc65 100644 --- a/test/proposal/base/ModuleManager.t.sol +++ b/test/orchestrator/base/ModuleManager.t.sol @@ -7,7 +7,7 @@ import {Test} from "forge-std/Test.sol"; import { ModuleManagerMock, IModuleManager -} from "test/utils/mocks/proposal/base/ModuleManagerMock.sol"; +} from "test/utils/mocks/orchestrator/base/ModuleManagerMock.sol"; // Mocks import {AuthorizerMock} from "test/utils/mocks/modules/AuthorizerMock.sol"; @@ -16,7 +16,7 @@ import {AuthorizerMock} from "test/utils/mocks/modules/AuthorizerMock.sol"; import {OZErrors} from "test/utils/errors/OZErrors.sol"; // Helper -import {TypeSanityHelper} from "test/proposal/helper/TypeSanityHelper.sol"; +import {TypeSanityHelper} from "test/orchestrator/helper/TypeSanityHelper.sol"; contract ModuleManagerTest is Test { // SuT @@ -60,7 +60,7 @@ contract ModuleManagerTest is Test { if (modules.length > (MAX_MODULES - 3)) { vm.expectRevert( IModuleManager - .Proposal__ModuleManager__ModuleAmountOverLimits + .Orchestrator__ModuleManager__ModuleAmountOverLimits .selector ); @@ -102,7 +102,7 @@ contract ModuleManagerTest is Test { vm.expectRevert( IModuleManager - .Proposal__ModuleManager__InvalidModuleAddress + .Orchestrator__ModuleManager__InvalidModuleAddress .selector ); moduleManager.init(modules); @@ -118,7 +118,7 @@ contract ModuleManagerTest is Test { modules[1] = address(0xCAFE); vm.expectRevert( - IModuleManager.Proposal__ModuleManager__IsModule.selector + IModuleManager.Orchestrator__ModuleManager__IsModule.selector ); moduleManager.init(modules); } @@ -131,7 +131,7 @@ contract ModuleManagerTest is Test { moduleManager = new ModuleManagerMock(); vm.expectRevert( IModuleManager - .Proposal__ModuleManager__ModuleAmountOverLimits + .Orchestrator__ModuleManager__ModuleAmountOverLimits .selector ); moduleManager.init(modules); @@ -146,7 +146,7 @@ contract ModuleManagerTest is Test { function testExecuteTxFromModuleOnlyCallableByModule() public { vm.expectRevert( IModuleManager - .Proposal__ModuleManager__OnlyCallableByModule + .Orchestrator__ModuleManager__OnlyCallableByModule .selector ); moduleManager.executeTxFromModule(address(this), bytes("")); @@ -225,7 +225,9 @@ contract ModuleManagerTest is Test { moduleManager.__ModuleManager_setIsAuthorized(address(this), false); vm.expectRevert( - IModuleManager.Proposal__ModuleManager__CallerNotAuthorized.selector + IModuleManager + .Orchestrator__ModuleManager__CallerNotAuthorized + .selector ); moduleManager.addModule(who); } @@ -236,7 +238,7 @@ contract ModuleManagerTest is Test { moduleManager.addModule(who); vm.expectRevert( - IModuleManager.Proposal__ModuleManager__IsModule.selector + IModuleManager.Orchestrator__ModuleManager__IsModule.selector ); moduleManager.addModule(who); } @@ -247,7 +249,7 @@ contract ModuleManagerTest is Test { for (uint i; i < invalids.length; ++i) { vm.expectRevert( IModuleManager - .Proposal__ModuleManager__InvalidModuleAddress + .Orchestrator__ModuleManager__InvalidModuleAddress .selector ); moduleManager.addModule(invalids[i]); @@ -269,7 +271,7 @@ contract ModuleManagerTest is Test { vm.expectRevert( IModuleManager - .Proposal__ModuleManager__ModuleAmountOverLimits + .Orchestrator__ModuleManager__ModuleAmountOverLimits .selector ); moduleManager.addModule(whos[MAX_MODULES]); @@ -333,7 +335,9 @@ contract ModuleManagerTest is Test { moduleManager.__ModuleManager_setIsAuthorized(address(this), false); vm.expectRevert( - IModuleManager.Proposal__ModuleManager__CallerNotAuthorized.selector + IModuleManager + .Orchestrator__ModuleManager__CallerNotAuthorized + .selector ); moduleManager.removeModule(who); } @@ -342,7 +346,7 @@ contract ModuleManagerTest is Test { types.assumeValidModule(who); vm.expectRevert( - IModuleManager.Proposal__ModuleManager__IsNotModule.selector + IModuleManager.Orchestrator__ModuleManager__IsNotModule.selector ); moduleManager.removeModule(who); } @@ -389,7 +393,7 @@ contract ModuleManagerTest is Test { vm.prank(caller); vm.expectRevert( IModuleManager - .Proposal__ModuleManager__OnlyCallableByModule + .Orchestrator__ModuleManager__OnlyCallableByModule .selector ); moduleManager.grantRole(role, account); @@ -438,7 +442,7 @@ contract ModuleManagerTest is Test { vm.prank(caller); vm.expectRevert( IModuleManager - .Proposal__ModuleManager__OnlyCallableByModule + .Orchestrator__ModuleManager__OnlyCallableByModule .selector ); moduleManager.revokeRole(role, account); diff --git a/test/proposal/helper/TypeSanityHelper.sol b/test/orchestrator/helper/TypeSanityHelper.sol similarity index 94% rename from test/proposal/helper/TypeSanityHelper.sol rename to test/orchestrator/helper/TypeSanityHelper.sol index ce96d0614..e04713fa3 100644 --- a/test/proposal/helper/TypeSanityHelper.sol +++ b/test/orchestrator/helper/TypeSanityHelper.sol @@ -23,10 +23,10 @@ contract TypeSanityHelper is Test { } //-------------------------------------------------------------------------------- - // Types for Proposal - // Contract: Proposal.sol + // Types for Orchestrator + // Contract: Orchestrator.sol - function assumeValidProposalId(uint id) public pure { + function assumeValidOrchestratorId(uint id) public pure { vm.assume(id != 0); } diff --git a/test/utils/mocks/factories/ModuleFactoryMock.sol b/test/utils/mocks/factories/ModuleFactoryMock.sol index d1da221a0..c73146991 100644 --- a/test/utils/mocks/factories/ModuleFactoryMock.sol +++ b/test/utils/mocks/factories/ModuleFactoryMock.sol @@ -7,7 +7,7 @@ import { IModuleFactory, IBeacon, IModule, - IProposal + IOrchestrator } from "src/factories/IModuleFactory.sol"; contract ModuleFactoryMock is IModuleFactory { @@ -17,7 +17,7 @@ contract ModuleFactoryMock is IModuleFactory { // address(0x1). uint public addressCounter = 10; - function createModule(IModule.Metadata memory, IProposal, bytes memory) + function createModule(IModule.Metadata memory, IOrchestrator, bytes memory) external returns (address) { diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index a0342af9a..6de4c81ee 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -import {Module, IModule, IProposal} from "src/modules/base/Module.sol"; +import {Module, IModule, IOrchestrator} from "src/modules/base/Module.sol"; import {IAuthorizer} from "src/modules/authorizer/IAuthorizer.sol"; import {IRoleAuthorizer} from "src/modules/authorizer/IRoleAuthorizer.sol"; @@ -24,11 +24,11 @@ contract AuthorizerMock is IRoleAuthorizer, Module { // IModule Functions function init( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory configdata ) public override(Module) initializer { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); // Read first authorized address from configdata. address authorized = abi.decode(configdata, (address)); diff --git a/test/utils/mocks/modules/FundingManagerMock.sol b/test/utils/mocks/modules/FundingManagerMock.sol index 405c3266e..4fe519446 100644 --- a/test/utils/mocks/modules/FundingManagerMock.sol +++ b/test/utils/mocks/modules/FundingManagerMock.sol @@ -5,7 +5,7 @@ pragma solidity ^0.8.0; import {IERC20} from "@oz/token/ERC20/IERC20.sol"; // Internal Dependencies -import {Module, IModule, IProposal} from "src/modules/base/Module.sol"; +import {Module, IModule, IOrchestrator} from "src/modules/base/Module.sol"; import {IFundingManager} from "src/modules/fundingManager/IFundingManager.sol"; // External Libraries @@ -16,12 +16,12 @@ contract FundingManagerMock is IFundingManager, Module { IERC20 private _token; - function init(IProposal proposal_, Metadata memory metadata, bytes memory) - public - override(Module) - initializer - { - __Module_init(proposal_, metadata); + function init( + IOrchestrator orchestrator_, + Metadata memory metadata, + bytes memory + ) public override(Module) initializer { + __Module_init(orchestrator_, metadata); } function setToken(IERC20 newToken) public { @@ -48,7 +48,7 @@ contract FundingManagerMock is IFundingManager, Module { _token.safeTransfer(to, amount); } - function transferProposalToken(address to, uint amount) external { + function transferOrchestratorToken(address to, uint amount) external { _token.safeTransfer(to, amount); } } diff --git a/test/utils/mocks/modules/base/ModuleMock.sol b/test/utils/mocks/modules/base/ModuleMock.sol index 5f77d1b24..f3b6f2846 100644 --- a/test/utils/mocks/modules/base/ModuleMock.sol +++ b/test/utils/mocks/modules/base/ModuleMock.sol @@ -1,24 +1,23 @@ // SPDX-License-Identifier: LGPL-3.0-only pragma solidity ^0.8.0; -import {Module, IModule, IProposal} from "src/modules/base/Module.sol"; +import {Module, IModule, IOrchestrator} from "src/modules/base/Module.sol"; contract ModuleMock is Module { - function init(IProposal proposal_, Metadata memory metadata, bytes memory) - public - virtual - override(Module) - initializer - { - __Module_init(proposal_, metadata); + function init( + IOrchestrator orchestrator_, + Metadata memory metadata, + bytes memory + ) public virtual override(Module) initializer { + __Module_init(orchestrator_, metadata); } // Note that the `initializer` modifier is missing. function initNoInitializer( - IProposal proposal_, + IOrchestrator orchestrator_, Metadata memory metadata, bytes memory ) external { - __Module_init(proposal_, metadata); + __Module_init(orchestrator_, metadata); } } diff --git a/test/utils/mocks/proposal/base/ModuleManagerMock.sol b/test/utils/mocks/orchestrator/base/ModuleManagerMock.sol similarity index 91% rename from test/utils/mocks/proposal/base/ModuleManagerMock.sol rename to test/utils/mocks/orchestrator/base/ModuleManagerMock.sol index fbddbf9ff..3d0775e27 100644 --- a/test/utils/mocks/proposal/base/ModuleManagerMock.sol +++ b/test/utils/mocks/orchestrator/base/ModuleManagerMock.sol @@ -3,8 +3,9 @@ pragma solidity ^0.8.0; // Internal Dependencies import { - ModuleManager, IModuleManager -} from "src/proposal/base/ModuleManager.sol"; + ModuleManager, + IModuleManager +} from "src/orchestrator/base/ModuleManager.sol"; contract ModuleManagerMock is ModuleManager { mapping(address => bool) private _authorized; diff --git a/testnet.env b/testnet.env index aefc7d348..861baab17 100644 --- a/testnet.env +++ b/testnet.env @@ -28,8 +28,8 @@ export WALLET_DEPLOYER_PK=0xcc3bf7af19c3ddb251d19b3abe51a7757d7a578c8f3194e06aac # ------------------------------------------------------------------------------ # Deployment Arguments -# ProposalFactory -export DEPLOYMENT_PROPOSAL_FACTORY_TARGET=0x15d6b0b21Fd59dcEBdCd2a36779b06Cd66Adb522 -export DEPLOYMENT_PROPOSAL_FACTORY_MODULE_FACTORY=0x7902494DBC5BB00e09B91782e0731cF268eE10D6 +# OrchestratorFactory +export DEPLOYMENT_ORCHESTRATOR_FACTORY_TARGET=0x15d6b0b21Fd59dcEBdCd2a36779b06Cd66Adb522 +export DEPLOYMENT_ORCHESTRATOR_FACTORY_MODULE_FACTORY=0x7902494DBC5BB00e09B91782e0731cF268eE10D6 -# Proposal Factory 0xF35205EDCF1677a32dF799d81FB5539FBFB4f5a9 +# Orchestrator Factory 0xF35205EDCF1677a32dF799d81FB5539FBFB4f5a9 From 97134eeb01dcfb505846bc58d52eaaa3d93f3905 Mon Sep 17 00:00:00 2001 From: FHieser Date: Tue, 1 Aug 2023 12:39:34 +0200 Subject: [PATCH 5/7] rename configdata to configData --- src/factories/IModuleFactory.sol | 4 ++-- src/factories/IOrchestratorFactory.sol | 2 +- src/factories/ModuleFactory.sol | 4 ++-- src/factories/OrchestratorFactory.sol | 8 ++++---- src/modules/MetadataManager.sol | 4 ++-- src/modules/authorizer/RoleAuthorizer.sol | 4 ++-- src/modules/authorizer/SingleVoteGovernor.sol | 6 +++--- src/modules/base/IModule.sol | 8 ++++---- src/modules/base/Module.sol | 2 +- .../fundingManager/RebasingFundingManager.sol | 4 ++-- src/modules/logicModule/MilestoneManager.sol | 4 ++-- src/modules/logicModule/RecurringPaymentManager.sol | 4 ++-- .../paymentProcessor/SimplePaymentProcessor.sol | 2 +- .../paymentProcessor/StreamingPaymentProcessor.sol | 2 +- test/e2e/CreateNewOrchestrator.t.sol | 6 +++--- test/e2e/ModuleUpdate.t.sol | 4 ++-- test/factories/ModuleFactory.t.sol | 12 ++++++------ test/modules/logicModule/MilestoneManager.t.sol | 4 ++-- test/utils/mocks/modules/AuthorizerMock.sol | 12 ++++++------ 19 files changed, 48 insertions(+), 48 deletions(-) diff --git a/src/factories/IModuleFactory.sol b/src/factories/IModuleFactory.sol index 559b0f3ee..9bde35330 100644 --- a/src/factories/IModuleFactory.sol +++ b/src/factories/IModuleFactory.sol @@ -42,11 +42,11 @@ interface IModuleFactory { /// @notice Creates a module instance identified by given metadata. /// @param metadata The module's metadata. /// @param orchestrator The orchestrator's instance of the module. - /// @param configdata The configdata of the module + /// @param configData The configData of the module function createModule( IModule.Metadata memory metadata, IOrchestrator orchestrator, - bytes memory configdata + bytes memory configData ) external returns (address); /// @notice Returns the {IBeacon} instance registered and the id for given diff --git a/src/factories/IOrchestratorFactory.sol b/src/factories/IOrchestratorFactory.sol index 9f66684f8..6a8ca22d8 100644 --- a/src/factories/IOrchestratorFactory.sol +++ b/src/factories/IOrchestratorFactory.sol @@ -30,7 +30,7 @@ interface IOrchestratorFactory { struct ModuleConfig { IModule.Metadata metadata; - bytes configdata; + bytes configData; bytes dependencydata; } diff --git a/src/factories/ModuleFactory.sol b/src/factories/ModuleFactory.sol index 46147b400..db3b3b351 100644 --- a/src/factories/ModuleFactory.sol +++ b/src/factories/ModuleFactory.sol @@ -76,7 +76,7 @@ contract ModuleFactory is IModuleFactory, Ownable2Step { function createModule( IModule.Metadata memory metadata, IOrchestrator orchestrator, - bytes memory configdata + bytes memory configData ) external returns (address) { // Note that the metadata's validity is not checked because the // module's `init()` function does it anyway. @@ -102,7 +102,7 @@ contract ModuleFactory is IModuleFactory, Ownable2Step { address implementation = address(new BeaconProxy(beacon)); - IModule(implementation).init(orchestrator, metadata, configdata); + IModule(implementation).init(orchestrator, metadata, configData); emit ModuleCreated( address(orchestrator), implementation, metadata.title diff --git a/src/factories/OrchestratorFactory.sol b/src/factories/OrchestratorFactory.sol index 00339615f..ccec8aa40 100644 --- a/src/factories/OrchestratorFactory.sol +++ b/src/factories/OrchestratorFactory.sol @@ -86,21 +86,21 @@ contract OrchestratorFactory is IOrchestratorFactory { address fundingManager = IModuleFactory(moduleFactory).createModule( fundingManagerConfig.metadata, IOrchestrator(clone), - fundingManagerConfig.configdata + fundingManagerConfig.configData ); // Deploy and cache {IAuthorizer} module. address authorizer = IModuleFactory(moduleFactory).createModule( authorizerConfig.metadata, IOrchestrator(clone), - authorizerConfig.configdata + authorizerConfig.configData ); // Deploy and cache {IPaymentProcessor} module. address paymentProcessor = IModuleFactory(moduleFactory).createModule( paymentProcessorConfig.metadata, IOrchestrator(clone), - paymentProcessorConfig.configdata + paymentProcessorConfig.configData ); // Deploy and cache optional modules. @@ -110,7 +110,7 @@ contract OrchestratorFactory is IOrchestratorFactory { modules[i] = IModuleFactory(moduleFactory).createModule( moduleConfigs[i].metadata, IOrchestrator(clone), - moduleConfigs[i].configdata + moduleConfigs[i].configData ); } diff --git a/src/modules/MetadataManager.sol b/src/modules/MetadataManager.sol index 82a7a1477..4d6a859d0 100644 --- a/src/modules/MetadataManager.sol +++ b/src/modules/MetadataManager.sol @@ -23,7 +23,7 @@ contract MetadataManager is IMetadataManager, Module { function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory configdata + bytes memory configData ) external override(Module) initializer { __Module_init(orchestrator_, metadata); @@ -32,7 +32,7 @@ contract MetadataManager is IMetadataManager, Module { OrchestratorMetadata memory orchestratorMetadata_, MemberMetadata[] memory teamMetadata_ ) = abi.decode( - configdata, + configData, (ManagerMetadata, OrchestratorMetadata, MemberMetadata[]) ); diff --git a/src/modules/authorizer/RoleAuthorizer.sol b/src/modules/authorizer/RoleAuthorizer.sol index e87c2a59a..9ae56f106 100644 --- a/src/modules/authorizer/RoleAuthorizer.sol +++ b/src/modules/authorizer/RoleAuthorizer.sol @@ -77,12 +77,12 @@ contract RoleAuthorizer is function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory configdata + bytes memory configData ) external override initializer { __Module_init(orchestrator_, metadata); (address initialOwner, address initialManager) = - abi.decode(configdata, (address, address)); + abi.decode(configData, (address, address)); __RoleAuthorizer_init(initialOwner, initialManager); } diff --git a/src/modules/authorizer/SingleVoteGovernor.sol b/src/modules/authorizer/SingleVoteGovernor.sol index 3329c9f16..8bcb4b22a 100644 --- a/src/modules/authorizer/SingleVoteGovernor.sol +++ b/src/modules/authorizer/SingleVoteGovernor.sol @@ -75,17 +75,17 @@ contract SingleVoteGovernor is ISingleVoteGovernor, Module { function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory configdata + bytes memory configData ) external override initializer { __Module_init(orchestrator_, metadata); - // Decode configdata to list of voters, the required threshold, and the + // Decode configData to list of voters, the required threshold, and the // voting duration. address[] memory voters; uint threshold_; uint voteDuration_; (voters, threshold_, voteDuration_) = - abi.decode(configdata, (address[], uint, uint)); + abi.decode(configData, (address[], uint, uint)); uint votersLen = voters.length; diff --git a/src/modules/base/IModule.sol b/src/modules/base/IModule.sol index 1f465d3f0..4f105e3cd 100644 --- a/src/modules/base/IModule.sol +++ b/src/modules/base/IModule.sol @@ -46,19 +46,19 @@ interface IModule { /// @dev MUST call `__Module_init()`. /// @param orchestrator The module's orchestrator instance. /// @param metadata The module's metadata. - /// @param configdata Variable config data for specific module + /// @param configData Variable config data for specific module /// implementations. function init( IOrchestrator orchestrator, Metadata memory metadata, - bytes memory configdata + bytes memory configData ) external; /// @notice Second initialization function of the module to take care of dependencies. /// @param orchestrator The module's orchestrator instance. - /// @param configdata Variable config data for specific module + /// @param configData Variable config data for specific module /// implementations. - function init2(IOrchestrator orchestrator, bytes memory configdata) + function init2(IOrchestrator orchestrator, bytes memory configData) external; /// @notice Returns the module's identifier. diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index e0b795bd5..752cda109 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -119,7 +119,7 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory /*configdata*/ + bytes memory /*configData*/ ) external virtual initializer { __Module_init(orchestrator_, metadata); } diff --git a/src/modules/fundingManager/RebasingFundingManager.sol b/src/modules/fundingManager/RebasingFundingManager.sol index 2c10be35d..87491011b 100644 --- a/src/modules/fundingManager/RebasingFundingManager.sol +++ b/src/modules/fundingManager/RebasingFundingManager.sol @@ -59,11 +59,11 @@ contract RebasingFundingManager is function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory configdata + bytes memory configData ) external override(Module) initializer { __Module_init(orchestrator_, metadata); - address orchestratorTokenAddress = abi.decode(configdata, (address)); + address orchestratorTokenAddress = abi.decode(configData, (address)); string memory _id = orchestrator_.orchestratorId().toString(); string memory _name = string( diff --git a/src/modules/logicModule/MilestoneManager.sol b/src/modules/logicModule/MilestoneManager.sol index 8faa3a188..4dca2e07e 100644 --- a/src/modules/logicModule/MilestoneManager.sol +++ b/src/modules/logicModule/MilestoneManager.sol @@ -192,7 +192,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory configdata + bytes memory configData ) external override(Module) initializer { __Module_init(orchestrator_, metadata); @@ -205,7 +205,7 @@ contract MilestoneManager is IMilestoneManager, Module, ERC20PaymentClient { _milestoneUpdateTimelock = 3 days; (SALARY_PRECISION, FEE_PCT, FEE_TREASURY) = - abi.decode(configdata, (uint, uint, address)); + abi.decode(configData, (uint, uint, address)); if (FEE_PCT >= SALARY_PRECISION) { revert Module__MilestoneManager__FeeOverHundredPercent(); diff --git a/src/modules/logicModule/RecurringPaymentManager.sol b/src/modules/logicModule/RecurringPaymentManager.sol index 227bac962..db5f4adcf 100644 --- a/src/modules/logicModule/RecurringPaymentManager.sol +++ b/src/modules/logicModule/RecurringPaymentManager.sol @@ -86,13 +86,13 @@ contract RecurringPaymentManager is function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory configdata + bytes memory configData ) external override(Module) initializer { __Module_init(orchestrator_, metadata); //Set empty list of RecurringPayment _paymentList.init(); - epochLength = abi.decode(configdata, (uint)); + epochLength = abi.decode(configData, (uint)); //revert if not at least 1 week and at most a year if (epochLength < 1 weeks || epochLength > 52 weeks) { diff --git a/src/modules/paymentProcessor/SimplePaymentProcessor.sol b/src/modules/paymentProcessor/SimplePaymentProcessor.sol index ac157b3a2..41387b877 100644 --- a/src/modules/paymentProcessor/SimplePaymentProcessor.sol +++ b/src/modules/paymentProcessor/SimplePaymentProcessor.sol @@ -52,7 +52,7 @@ contract SimplePaymentProcessor is Module, IPaymentProcessor { function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory /*configdata*/ + bytes memory /*configData*/ ) external override(Module) initializer { __Module_init(orchestrator_, metadata); } diff --git a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol index af142a9cc..66f51a8ff 100644 --- a/src/modules/paymentProcessor/StreamingPaymentProcessor.sol +++ b/src/modules/paymentProcessor/StreamingPaymentProcessor.sol @@ -85,7 +85,7 @@ contract StreamingPaymentProcessor is Module, IStreamingPaymentProcessor { function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory /*configdata*/ + bytes memory /*configData*/ ) external override(Module) initializer { __Module_init(orchestrator_, metadata); } diff --git a/test/e2e/CreateNewOrchestrator.t.sol b/test/e2e/CreateNewOrchestrator.t.sol index c0fd44d1d..39d293020 100644 --- a/test/e2e/CreateNewOrchestrator.t.sol +++ b/test/e2e/CreateNewOrchestrator.t.sol @@ -313,7 +313,7 @@ contract OrchestratorCreation is Test { //-------------------------------------------------------------------------------- // Adding Module - //Create milestoneManagerConfigdata + //Create milestoneManagerConfigData //Note: This bytes array is used for transmitting data in a generalized way // to the modules during they initilization via the modulefactory // Some Modules might need additional Deployment/Configuration data @@ -323,7 +323,7 @@ contract OrchestratorCreation is Test { bool hasDependency; string[] memory dependencies = new string[](0); - bytes memory milestoneManagerConfigdata = abi.encode( + bytes memory milestoneManagerConfigData = abi.encode( SALARY_PRECISION, FEE_PERCENTAGE, FEE_TREASURY, @@ -333,7 +333,7 @@ contract OrchestratorCreation is Test { //Create the module via the moduleFactory address milestoneManager = moduleFactory.createModule( - milestoneManagerMetadata, orchestrator, milestoneManagerConfigdata + milestoneManagerMetadata, orchestrator, milestoneManagerConfigData ); //Add Module to the orchestrator diff --git a/test/e2e/ModuleUpdate.t.sol b/test/e2e/ModuleUpdate.t.sol index ba9a78fd9..523887aa7 100644 --- a/test/e2e/ModuleUpdate.t.sol +++ b/test/e2e/ModuleUpdate.t.sol @@ -66,7 +66,7 @@ contract ModuleUpdateTest is Test { function testBeaconUpgrade( IModule.Metadata memory metadata, address orchestrator, - bytes memory configdata + bytes memory configData ) public { _assumeValidMetadata(metadata); _assumeValidOrchestrator(orchestrator); @@ -81,7 +81,7 @@ contract ModuleUpdateTest is Test { //Create Module Proxy in Factory address proxyImplementationAddress1 = factory.createModule( - metadata, IOrchestrator(orchestrator), configdata + metadata, IOrchestrator(orchestrator), configData ); assertEq( diff --git a/test/factories/ModuleFactory.t.sol b/test/factories/ModuleFactory.t.sol index 8dcdbbe7a..d72b211eb 100644 --- a/test/factories/ModuleFactory.t.sol +++ b/test/factories/ModuleFactory.t.sol @@ -121,7 +121,7 @@ contract ModuleFactoryTest is Test { function testCreateModule( IModule.Metadata memory metadata, address orchestrator, - bytes memory configdata + bytes memory configData ) public { _assumeValidMetadata(metadata); _assumeValidOrchestrator(orchestrator); @@ -134,7 +134,7 @@ contract ModuleFactoryTest is Test { // Create new module instance. IModule newModule = IModule( factory.createModule( - metadata, IOrchestrator(orchestrator), configdata + metadata, IOrchestrator(orchestrator), configData ) ); @@ -145,7 +145,7 @@ contract ModuleFactoryTest is Test { function testCreateModuleFailsIfMetadataUnregistered( IModule.Metadata memory metadata, address orchestrator, - bytes memory configdata + bytes memory configData ) public { _assumeValidMetadata(metadata); _assumeValidOrchestrator(orchestrator); @@ -153,13 +153,13 @@ contract ModuleFactoryTest is Test { vm.expectRevert( IModuleFactory.ModuleFactory__UnregisteredMetadata.selector ); - factory.createModule(metadata, IOrchestrator(orchestrator), configdata); + factory.createModule(metadata, IOrchestrator(orchestrator), configData); } function testCreateModuleFailsIfBeaconsImplementationIsZero( IModule.Metadata memory metadata, address orchestrator, - bytes memory configdata + bytes memory configData ) public { _assumeValidMetadata(metadata); _assumeValidOrchestrator(orchestrator); @@ -173,7 +173,7 @@ contract ModuleFactoryTest is Test { // Note that an `assert()` statement fails. vm.expectRevert(); - factory.createModule(metadata, IOrchestrator(orchestrator), configdata); + factory.createModule(metadata, IOrchestrator(orchestrator), configData); } //-------------------------------------------------------------------------- diff --git a/test/modules/logicModule/MilestoneManager.t.sol b/test/modules/logicModule/MilestoneManager.t.sol index aa8881274..a83be389b 100644 --- a/test/modules/logicModule/MilestoneManager.t.sol +++ b/test/modules/logicModule/MilestoneManager.t.sol @@ -75,10 +75,10 @@ contract MilestoneManagerTest is ModuleTest { _setUpOrchestrator(milestoneManager); - bytes memory configdata = + bytes memory configData = abi.encode(SALARY_PRECISION, FEE_PERCENTAGE, FEE_TREASURY); - milestoneManager.init(_orchestrator, _METADATA, configdata); + milestoneManager.init(_orchestrator, _METADATA, configData); _authorizer.setIsAuthorized(address(this), true); diff --git a/test/utils/mocks/modules/AuthorizerMock.sol b/test/utils/mocks/modules/AuthorizerMock.sol index 6de4c81ee..842d8e952 100644 --- a/test/utils/mocks/modules/AuthorizerMock.sol +++ b/test/utils/mocks/modules/AuthorizerMock.sol @@ -26,20 +26,20 @@ contract AuthorizerMock is IRoleAuthorizer, Module { function init( IOrchestrator orchestrator_, Metadata memory metadata, - bytes memory configdata + bytes memory configData ) public override(Module) initializer { __Module_init(orchestrator_, metadata); - // Read first authorized address from configdata. - address authorized = abi.decode(configdata, (address)); + // Read first authorized address from configData. + address authorized = abi.decode(configData, (address)); require(authorized != address(0), "Zero address can not be authorized"); _authorized[authorized] = true; } - function mockInit(bytes memory configdata) public { - // Read first authorized address from configdata. - address authorized = abi.decode(configdata, (address)); + function mockInit(bytes memory configData) public { + // Read first authorized address from configData. + address authorized = abi.decode(configData, (address)); require(authorized != address(0), "Zero address can not be authorized"); _authorized[authorized] = true; From 6354afd446611a41ef987174297fe5139a796683 Mon Sep 17 00:00:00 2001 From: FHieser Date: Tue, 1 Aug 2023 12:42:06 +0200 Subject: [PATCH 6/7] rename dependencydata to dependencyData --- src/factories/IOrchestratorFactory.sol | 2 +- src/factories/OrchestratorFactory.sol | 22 +++++++++---------- src/modules/base/Module.sol | 14 ++++++------ test/modules/MetadataManager.t.sol | 10 ++++----- test/modules/authorizer/RoleAuthorizer.t.sol | 10 ++++----- .../authorizer/SingleVoteGovernor.t.sol | 10 ++++----- .../RebasingFundingManager.t.sol | 10 ++++----- .../logicModule/MilestoneManager.t.sol | 10 ++++----- .../logicModule/RecurringPaymentManager.t.sol | 10 ++++----- .../SimplePaymentProcessor.t.sol | 10 ++++----- .../StreamingPaymentProcessor.t.sol | 10 ++++----- 11 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/factories/IOrchestratorFactory.sol b/src/factories/IOrchestratorFactory.sol index 6a8ca22d8..8b7508b61 100644 --- a/src/factories/IOrchestratorFactory.sol +++ b/src/factories/IOrchestratorFactory.sol @@ -31,7 +31,7 @@ interface IOrchestratorFactory { struct ModuleConfig { IModule.Metadata metadata; bytes configData; - bytes dependencydata; + bytes dependencyData; } //-------------------------------------------------------------------------- diff --git a/src/factories/OrchestratorFactory.sol b/src/factories/OrchestratorFactory.sol index ccec8aa40..12449879d 100644 --- a/src/factories/OrchestratorFactory.sol +++ b/src/factories/OrchestratorFactory.sol @@ -133,28 +133,28 @@ contract OrchestratorFactory is IOrchestratorFactory { // This can be run post the orchestrator initialization. This ensures a few more variables are // available that are set during the orchestrator init function. for (uint i; i < modulesLen; ++i) { - if (_dependencyInjectionRequired(moduleConfigs[i].dependencydata)) { + if (_dependencyInjectionRequired(moduleConfigs[i].dependencyData)) { IModule(modules[i]).init2( - IOrchestrator(clone), moduleConfigs[i].dependencydata + IOrchestrator(clone), moduleConfigs[i].dependencyData ); } } // Also, running the init2 functionality on the compulsory modules excluded from the modules array - if (_dependencyInjectionRequired(fundingManagerConfig.dependencydata)) { + if (_dependencyInjectionRequired(fundingManagerConfig.dependencyData)) { IModule(fundingManager).init2( - IOrchestrator(clone), fundingManagerConfig.dependencydata + IOrchestrator(clone), fundingManagerConfig.dependencyData ); } - if (_dependencyInjectionRequired(authorizerConfig.dependencydata)) { + if (_dependencyInjectionRequired(authorizerConfig.dependencyData)) { IModule(authorizer).init2( - IOrchestrator(clone), authorizerConfig.dependencydata + IOrchestrator(clone), authorizerConfig.dependencyData ); } - if (_dependencyInjectionRequired(paymentProcessorConfig.dependencydata)) + if (_dependencyInjectionRequired(paymentProcessorConfig.dependencyData)) { IModule(paymentProcessor).init2( - IOrchestrator(clone), paymentProcessorConfig.dependencydata + IOrchestrator(clone), paymentProcessorConfig.dependencyData ); } @@ -183,13 +183,13 @@ contract OrchestratorFactory is IOrchestratorFactory { (requirement,) = abi.decode(data, (bool, string[])); } - function _dependencyInjectionRequired(bytes memory dependencydata) + function _dependencyInjectionRequired(bytes memory dependencyData) internal view returns (bool) { - try this.decoder(dependencydata) returns (bool) { - return this.decoder(dependencydata); + try this.decoder(dependencyData) returns (bool) { + return this.decoder(dependencyData); } catch { return false; } diff --git a/src/modules/base/Module.sol b/src/modules/base/Module.sol index 752cda109..5cff550cc 100644 --- a/src/modules/base/Module.sol +++ b/src/modules/base/Module.sol @@ -101,8 +101,8 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { _; } - modifier validDependencyData(bytes memory dependencydata) { - if (!_dependencyInjectionRequired(dependencydata)) { + modifier validDependencyData(bytes memory dependencyData) { + if (!_dependencyInjectionRequired(dependencyData)) { revert Module__NoDependencyOrMalformedDependencyData(); } _; @@ -144,11 +144,11 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { __Module_metadata = metadata; } - function init2(IOrchestrator orchestrator_, bytes memory dependencydata) + function init2(IOrchestrator orchestrator_, bytes memory dependencyData) external virtual initializer2 - validDependencyData(dependencydata) + validDependencyData(dependencyData) {} //-------------------------------------------------------------------------- @@ -212,13 +212,13 @@ abstract contract Module is IModule, Initializable, ContextUpgradeable { (requirement,) = abi.decode(data, (bool, string[])); } - function _dependencyInjectionRequired(bytes memory dependencydata) + function _dependencyInjectionRequired(bytes memory dependencyData) internal view returns (bool) { - try this.decoder(dependencydata) returns (bool) { - return this.decoder(dependencydata); + try this.decoder(dependencyData) returns (bool) { + return this.decoder(dependencyData); } catch { return false; } diff --git a/test/modules/MetadataManager.t.sol b/test/modules/MetadataManager.t.sol index 1b19a7fac..642b66e7a 100644 --- a/test/modules/MetadataManager.t.sol +++ b/test/modules/MetadataManager.t.sol @@ -130,21 +130,21 @@ contract MetadataManagerTest is ModuleTest { // Calling init2 for the first time with no dependency // SHOULD FAIL - bytes memory dependencydata = abi.encode(hasDependency, dependencies); + bytes memory dependencyData = abi.encode(hasDependency, dependencies); vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - metadataManager.init2(_orchestrator, dependencydata); + metadataManager.init2(_orchestrator, dependencyData); // Calling init2 for the first time with dependency = true // SHOULD PASS - dependencydata = abi.encode(true, dependencies); - metadataManager.init2(_orchestrator, dependencydata); + dependencyData = abi.encode(true, dependencies); + metadataManager.init2(_orchestrator, dependencyData); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - metadataManager.init2(_orchestrator, dependencydata); + metadataManager.init2(_orchestrator, dependencyData); } function testSetter() public { diff --git a/test/modules/authorizer/RoleAuthorizer.t.sol b/test/modules/authorizer/RoleAuthorizer.t.sol index 039e2d4d8..15bd49bdb 100644 --- a/test/modules/authorizer/RoleAuthorizer.t.sol +++ b/test/modules/authorizer/RoleAuthorizer.t.sol @@ -187,21 +187,21 @@ contract RoleAuthorizerTest is Test { // Calling init2 for the first time with no dependency // SHOULD FAIL - bytes memory dependencydata = abi.encode(hasDependency, dependencies); + bytes memory dependencyData = abi.encode(hasDependency, dependencies); vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - _authorizer.init2(_orchestrator, dependencydata); + _authorizer.init2(_orchestrator, dependencyData); // Calling init2 for the first time with dependency = true // SHOULD PASS - dependencydata = abi.encode(true, dependencies); - _authorizer.init2(_orchestrator, dependencydata); + dependencyData = abi.encode(true, dependencies); + _authorizer.init2(_orchestrator, dependencyData); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - _authorizer.init2(_orchestrator, dependencydata); + _authorizer.init2(_orchestrator, dependencyData); } // Test Register Roles diff --git a/test/modules/authorizer/SingleVoteGovernor.t.sol b/test/modules/authorizer/SingleVoteGovernor.t.sol index 409c9d7ab..8763a82f9 100644 --- a/test/modules/authorizer/SingleVoteGovernor.t.sol +++ b/test/modules/authorizer/SingleVoteGovernor.t.sol @@ -434,21 +434,21 @@ contract SingleVoteGovernorTest is Test { // Calling init2 for the first time with no dependency // SHOULD FAIL - bytes memory dependencydata = abi.encode(hasDependency, dependencies); + bytes memory dependencyData = abi.encode(hasDependency, dependencies); vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - _authorizer.init2(_orchestrator, dependencydata); + _authorizer.init2(_orchestrator, dependencyData); // Calling init2 for the first time with dependency = true // SHOULD PASS - dependencydata = abi.encode(true, dependencies); - _authorizer.init2(_orchestrator, dependencydata); + dependencyData = abi.encode(true, dependencies); + _authorizer.init2(_orchestrator, dependencyData); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - _authorizer.init2(_orchestrator, dependencydata); + _authorizer.init2(_orchestrator, dependencyData); } //-------------------------------------------------------------------------- diff --git a/test/modules/fundingManager/RebasingFundingManager.t.sol b/test/modules/fundingManager/RebasingFundingManager.t.sol index 94dc37651..931b8528b 100644 --- a/test/modules/fundingManager/RebasingFundingManager.t.sol +++ b/test/modules/fundingManager/RebasingFundingManager.t.sol @@ -95,21 +95,21 @@ contract RebasingFundingManagerTest is ModuleTest { // Calling init2 for the first time with no dependency // SHOULD FAIL - bytes memory dependencydata = abi.encode(hasDependency, dependencies); + bytes memory dependencyData = abi.encode(hasDependency, dependencies); vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - fundingManager.init2(_orchestrator, dependencydata); + fundingManager.init2(_orchestrator, dependencyData); // Calling init2 for the first time with dependency = true // SHOULD PASS - dependencydata = abi.encode(true, dependencies); - fundingManager.init2(_orchestrator, dependencydata); + dependencyData = abi.encode(true, dependencies); + fundingManager.init2(_orchestrator, dependencyData); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - fundingManager.init2(_orchestrator, dependencydata); + fundingManager.init2(_orchestrator, dependencyData); } //-------------------------------------------------------------------------- diff --git a/test/modules/logicModule/MilestoneManager.t.sol b/test/modules/logicModule/MilestoneManager.t.sol index a83be389b..13323b384 100644 --- a/test/modules/logicModule/MilestoneManager.t.sol +++ b/test/modules/logicModule/MilestoneManager.t.sol @@ -119,21 +119,21 @@ contract MilestoneManagerTest is ModuleTest { // Calling init2 for the first time with no dependency // SHOULD FAIL - bytes memory dependencydata = abi.encode(hasDependency, dependencies); + bytes memory dependencyData = abi.encode(hasDependency, dependencies); vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - milestoneManager.init2(_orchestrator, dependencydata); + milestoneManager.init2(_orchestrator, dependencyData); // Calling init2 for the first time with dependency = true // SHOULD PASS - dependencydata = abi.encode(true, dependencies); - milestoneManager.init2(_orchestrator, dependencydata); + dependencyData = abi.encode(true, dependencies); + milestoneManager.init2(_orchestrator, dependencyData); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - milestoneManager.init2(_orchestrator, dependencydata); + milestoneManager.init2(_orchestrator, dependencyData); } //-------------------------------------------------------------------------- diff --git a/test/modules/logicModule/RecurringPaymentManager.t.sol b/test/modules/logicModule/RecurringPaymentManager.t.sol index 8f0dbdcae..ad027fb1f 100644 --- a/test/modules/logicModule/RecurringPaymentManager.t.sol +++ b/test/modules/logicModule/RecurringPaymentManager.t.sol @@ -101,21 +101,21 @@ contract RecurringPaymentManagerTest is ModuleTest { // Calling init2 for the first time with no dependency // SHOULD FAIL - bytes memory dependencydata = abi.encode(hasDependency, dependencies); + bytes memory dependencyData = abi.encode(hasDependency, dependencies); vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - recurringPaymentManager.init2(_orchestrator, dependencydata); + recurringPaymentManager.init2(_orchestrator, dependencyData); // Calling init2 for the first time with dependency = true // SHOULD PASS - dependencydata = abi.encode(true, dependencies); - recurringPaymentManager.init2(_orchestrator, dependencydata); + dependencyData = abi.encode(true, dependencies); + recurringPaymentManager.init2(_orchestrator, dependencyData); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - recurringPaymentManager.init2(_orchestrator, dependencydata); + recurringPaymentManager.init2(_orchestrator, dependencyData); } //-------------------------------------------------------------------------- diff --git a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol index 879cafbe6..80a634bba 100644 --- a/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/SimplePaymentProcessor.t.sol @@ -68,21 +68,21 @@ contract SimplePaymentProcessorTest is ModuleTest { // Calling init2 for the first time with no dependency // SHOULD FAIL - bytes memory dependencydata = abi.encode(hasDependency, dependencies); + bytes memory dependencyData = abi.encode(hasDependency, dependencies); vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - paymentProcessor.init2(_orchestrator, dependencydata); + paymentProcessor.init2(_orchestrator, dependencyData); // Calling init2 for the first time with dependency = true // SHOULD PASS - dependencydata = abi.encode(true, dependencies); - paymentProcessor.init2(_orchestrator, dependencydata); + dependencyData = abi.encode(true, dependencies); + paymentProcessor.init2(_orchestrator, dependencyData); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - paymentProcessor.init2(_orchestrator, dependencydata); + paymentProcessor.init2(_orchestrator, dependencyData); } //-------------------------------------------------------------------------- diff --git a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol index 66aa706b4..582c3bcea 100644 --- a/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol +++ b/test/modules/paymentProcessor/StreamingPaymentProcessor.t.sol @@ -90,21 +90,21 @@ contract StreamingPaymentProcessorTest is ModuleTest { // Calling init2 for the first time with no dependency // SHOULD FAIL - bytes memory dependencydata = abi.encode(hasDependency, dependencies); + bytes memory dependencyData = abi.encode(hasDependency, dependencies); vm.expectRevert( IModule.Module__NoDependencyOrMalformedDependencyData.selector ); - paymentProcessor.init2(_orchestrator, dependencydata); + paymentProcessor.init2(_orchestrator, dependencyData); // Calling init2 for the first time with dependency = true // SHOULD PASS - dependencydata = abi.encode(true, dependencies); - paymentProcessor.init2(_orchestrator, dependencydata); + dependencyData = abi.encode(true, dependencies); + paymentProcessor.init2(_orchestrator, dependencyData); // Attempting to call the init2 function again. // SHOULD FAIL vm.expectRevert(IModule.Module__CannotCallInit2Again.selector); - paymentProcessor.init2(_orchestrator, dependencydata); + paymentProcessor.init2(_orchestrator, dependencyData); } //-------------------------------------------------------------------------- From 97d582d332f5aec63b1f34a781ccf948a470749d Mon Sep 17 00:00:00 2001 From: FHieser Date: Tue, 1 Aug 2023 14:13:53 +0200 Subject: [PATCH 7/7] Fix / Pre-commit --- .gas-snapshot | 584 ++-- lcov.info | 2520 +++++++++-------- ...s.sol => SetupToyOrchestratorScript.s.sol} | 0 3 files changed, 1561 insertions(+), 1543 deletions(-) rename script/setup/{SetupToyProposalScript.s.sol => SetupToyOrchestratorScript.s.sol} (100%) diff --git a/.gas-snapshot b/.gas-snapshot index df168434f..e81f79a0a 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -5,390 +5,390 @@ BeaconTest:testSupportsInterface() (gas: 5585) BeaconTest:testUpgradeTo() (gas: 1865395) BeaconTest:testUpgradeToFailsIfImplementationNotContract() (gas: 13099) BeaconTest:testUpgradeToOnlyCallableByOwner(address) (runs: 256, μ: 11768, ~: 11768) -BountyManagerLifecycle:test_e2e_BountyManagerLifecycle() (gas: 3612843) -BountyManagerTest:testAccordingClaimToBounty(uint256,uint256) (runs: 256, μ: 27809044, ~: 27781805) -BountyManagerTest:testAddBounty(uint256,uint256,uint256,bytes) (runs: 256, μ: 2533163, ~: 2542511) +BountyManagerLifecycle:test_e2e_BountyManagerLifecycle() (gas: 3613329) +BountyManagerTest:testAccordingClaimToBounty(uint256,uint256) (runs: 256, μ: 28465732, ~: 30401812) +BountyManagerTest:testAddBounty(uint256,uint256,uint256,bytes) (runs: 256, μ: 2544665, ~: 2430756) BountyManagerTest:testAddBountyModifierInPosition() (gas: 54710) -BountyManagerTest:testAddClaim(uint256,address[],uint256[],bytes) (runs: 256, μ: 121223234, ~: 84449645) +BountyManagerTest:testAddClaim(uint256,address[],uint256[],bytes) (runs: 256, μ: 139203008, ~: 123467192) BountyManagerTest:testAddClaimModifierInPosition() (gas: 232567) BountyManagerTest:testGetBountyInformationModifierInPosition() (gas: 14198) BountyManagerTest:testGetClaimInformationModifierInPosition() (gas: 14566) -BountyManagerTest:testGrantBountyAdminRole(address) (runs: 256, μ: 57632, ~: 57632) +BountyManagerTest:testGrantBountyAdminRole(address) (runs: 256, μ: 57675, ~: 57675) BountyManagerTest:testInit() (gas: 210) BountyManagerTest:testLockBounty() (gas: 186497) BountyManagerTest:testLockBountyModifierInPosition() (gas: 201731) -BountyManagerTest:testNotClaimed(bool) (runs: 256, μ: 859811, ~: 857780) -BountyManagerTest:testOnlyClaimContributor(address[],uint256[],address) (runs: 256, μ: 5342040, ~: 6080176) -BountyManagerTest:testOnlyRole(bool) (runs: 256, μ: 66383, ~: 34404) +BountyManagerTest:testNotClaimed(bool) (runs: 256, μ: 859810, ~: 857756) +BountyManagerTest:testOnlyClaimContributor(address[],uint256[],address) (runs: 256, μ: 5349099, ~: 6086305) +BountyManagerTest:testOnlyRole(bool) (runs: 256, μ: 66839, ~: 34404) BountyManagerTest:testReinitFails() (gas: 31593) -BountyManagerTest:testRevokeBountyAdminRole(address) (runs: 256, μ: 48379, ~: 48364) +BountyManagerTest:testRevokeBountyAdminRole(address) (runs: 256, μ: 48415, ~: 48399) BountyManagerTest:testUpdateBounty(bytes) (runs: 256, μ: 232659, ~: 219235) BountyManagerTest:testUpdateBountyModifierInPosition() (gas: 171198) -BountyManagerTest:testUpdateClaimContributors(address[],uint256[]) (runs: 256, μ: 5695584, ~: 6342905) -BountyManagerTest:testUpdateClaimContributorsModifierInPosition() (gas: 532234) +BountyManagerTest:testUpdateClaimContributors(address[],uint256[]) (runs: 256, μ: 5695487, ~: 6343048) +BountyManagerTest:testUpdateClaimContributorsModifierInPosition() (gas: 532146) BountyManagerTest:testUpdateClaimDetails(bytes) (runs: 256, μ: 585106, ~: 571346) BountyManagerTest:testUpdateClaimDetailsModifierInPosition() (gas: 512182) -BountyManagerTest:testValidBountyId(uint256,uint256) (runs: 256, μ: 40761896, ~: 42483621) -BountyManagerTest:testValidClaimId(uint256,uint256) (runs: 256, μ: 137322449, ~: 140847347) -BountyManagerTest:testValidContributorsForBounty(uint256,uint256,address[],uint256[]) (runs: 256, μ: 553489, ~: 264446) -BountyManagerTest:testValidPayoutAmounts(uint256,uint256) (runs: 256, μ: 83389, ~: 27904) -BountyManagerTest:testVerifyClaim(address[],uint256[],bytes) (runs: 256, μ: 10555745, ~: 11610428) -BountyManagerTest:testVerifyClaimModifierInPosition() (gas: 1233472) +BountyManagerTest:testValidBountyId(uint256,uint256) (runs: 256, μ: 40601526, ~: 42135979) +BountyManagerTest:testValidClaimId(uint256,uint256) (runs: 256, μ: 134830747, ~: 135999117) +BountyManagerTest:testValidContributorsForBounty(uint256,uint256,address[],uint256[]) (runs: 256, μ: 758448, ~: 268960) +BountyManagerTest:testValidPayoutAmounts(uint256,uint256) (runs: 256, μ: 87249, ~: 27904) +BountyManagerTest:testVerifyClaim(address[],uint256[],bytes) (runs: 256, μ: 10559602, ~: 11613872) +BountyManagerTest:testVerifyClaimModifierInPosition() (gas: 1233338) Deployment:testContructor() (gas: 22575) Deployment:testInitialization() (gas: 22554) -Deployment:testInitilizationFailsIfMintAlreadyExecuted(address,uint256) (runs: 256, μ: 183776, ~: 184130) +Deployment:testInitilizationFailsIfMintAlreadyExecuted(address,uint256) (runs: 256, μ: 183728, ~: 183558) Deployment:testInvariants() (gas: 11970) ERC20:testApprove(address,address,uint256) (runs: 256, μ: 35509, ~: 36131) ERC20:testApproveInf(address,address) (runs: 256, μ: 234273, ~: 234273) -ERC20:testDecreaseAllowance(address,address,uint256) (runs: 256, μ: 28366, ~: 28594) +ERC20:testDecreaseAllowance(address,address,uint256) (runs: 256, μ: 28373, ~: 28596) ERC20:testFailPermitBadDeadline() (gas: 40235) ERC20:testFailPermitBadNonce() (gas: 40191) ERC20:testFailPermitPastDeadline() (gas: 13524) ERC20:testFailPermitReplay() (gas: 70396) -ERC20:testFailTransferAllFromInsufficientAllowance(address,address,uint256) (runs: 256, μ: 246460, ~: 247860) -ERC20:testFailTransferFromInsufficientAllowance(address,address,uint256) (runs: 256, μ: 246483, ~: 247883) -ERC20:testFailTransferFromInsufficientBalance(address,address,uint256) (runs: 256, μ: 233426, ~: 248292) +ERC20:testFailTransferAllFromInsufficientAllowance(address,address,uint256) (runs: 256, μ: 246538, ~: 247860) +ERC20:testFailTransferFromInsufficientAllowance(address,address,uint256) (runs: 256, μ: 246561, ~: 247883) +ERC20:testFailTransferFromInsufficientBalance(address,address,uint256) (runs: 256, μ: 234991, ~: 248292) ERC20:testFailTransferInsufficientBalance(address,address,uint256) (runs: 256, μ: 210180, ~: 221718) ERC20:testIncreaseAllowance(address,address,uint256) (runs: 256, μ: 35819, ~: 36441) ERC20:testPermit() (gas: 66746) ERC20:testTransfer(address,address,uint256) (runs: 256, μ: 209534, ~: 209534) ERC20:testTransferAll(address,address,uint256) (runs: 256, μ: 209763, ~: 209763) -ERC20:testTransferAllFrom(address,address,uint256) (runs: 256, μ: 216642, ~: 216620) -ERC20:testTransferAllFromWithZeroToken(address,address) (runs: 256, μ: 282648, ~: 282629) -ERC20:testTransferFrom(address,address,uint256) (runs: 256, μ: 216593, ~: 216571) -FundManagement:test_e2e_ProposalFundManagement() (gas: 2977093) -LibMetadataTest:testIdentifier((uint256,uint256,string,string)) (runs: 256, μ: 2760, ~: 2787) +ERC20:testTransferAllFrom(address,address,uint256) (runs: 256, μ: 216650, ~: 216622) +ERC20:testTransferAllFromWithZeroToken(address,address) (runs: 256, μ: 282655, ~: 282630) +ERC20:testTransferFrom(address,address,uint256) (runs: 256, μ: 216601, ~: 216573) +ERC20PaymentClientTest:testAddPaymentOrder(uint256,address,uint256,uint256) (runs: 256, μ: 20823, ~: 21117) +ERC20PaymentClientTest:testAddPaymentOrderFailsForInvalidAmount() (gas: 9357) +ERC20PaymentClientTest:testAddPaymentOrderFailsForInvalidRecipient() (gas: 11676) +ERC20PaymentClientTest:testAddPaymentOrders() (gas: 386924) +ERC20PaymentClientTest:testCollectPaymentOrders(uint256,address,uint256,uint256) (runs: 256, μ: 41790, ~: 42084) +ERC20PaymentClientTest:testCollectPaymentOrdersFailsCallerNotAuthorized() (gas: 10233) +FundManagement:test_e2e_OrchestratorFundManagement() (gas: 2977563) +LibMetadataTest:testIdentifier((uint256,uint256,string,string)) (runs: 256, μ: 2765, ~: 2787) LibMetadataTest:testMetadataInvalidIfTitleEmpty(uint256,uint256) (runs: 256, μ: 3552, ~: 3552) LibMetadataTest:testMetadataInvalidIfURLEmpty(uint256,uint256) (runs: 256, μ: 3494, ~: 3494) LibMetadataTest:testMetadataInvalidIfVersionOnlyZero(uint256,uint256) (runs: 256, μ: 725, ~: 725) LibMetadataTest:testMetadataIsValid(uint256,uint256,string,string) (runs: 256, μ: 4960, ~: 4960) -LinkedIdListTest:testAddId(uint256[]) (runs: 256, μ: 3314848, ~: 3370202) +LinkedIdListTest:testAddId(uint256[]) (runs: 256, μ: 3315595, ~: 3370202) LinkedIdListTest:testAddIdModifier() (gas: 58108) LinkedIdListTest:testDeploymentInvariants() (gas: 7072) LinkedIdListTest:testGetNextIdModifier() (gas: 5390) -LinkedIdListTest:testGetPreviousId(uint256[]) (runs: 256, μ: 14141935, ~: 11439963) +LinkedIdListTest:testGetPreviousId(uint256[]) (runs: 256, μ: 14141974, ~: 11439963) LinkedIdListTest:testGetPreviousIdModifier() (gas: 5325) -LinkedIdListTest:testIsExistingId(uint256[],uint256) (runs: 256, μ: 3460431, ~: 3633859) -LinkedIdListTest:testListIds(uint256[]) (runs: 256, μ: 3289090, ~: 3342422) -LinkedIdListTest:testMoveId(uint256[],uint256) (runs: 256, μ: 340873, ~: 357753) +LinkedIdListTest:testIsExistingId(uint256[],uint256) (runs: 256, μ: 3460595, ~: 3633438) +LinkedIdListTest:testListIds(uint256[]) (runs: 256, μ: 3289129, ~: 3342422) +LinkedIdListTest:testMoveId(uint256[],uint256) (runs: 256, μ: 339306, ~: 357895) LinkedIdListTest:testMoveIdInListModifier() (gas: 5407) -LinkedIdListTest:testOnlyConsecutiveIds(uint256[],uint256) (runs: 256, μ: 3449900, ~: 3626626) +LinkedIdListTest:testOnlyConsecutiveIds(uint256[],uint256) (runs: 256, μ: 3451285, ~: 3626626) LinkedIdListTest:testRemoveId(uint256[]) (runs: 256, μ: 6414, ~: 6414) LinkedIdListTest:testRemoveIdModifier() (gas: 60064) -LinkedIdListTest:testValidId(uint256[],uint256) (runs: 256, μ: 3409651, ~: 3580588) -LinkedIdListTest:testValidMoveParameter(uint256[],uint256,uint256,uint256) (runs: 256, μ: 3327318, ~: 3176051) -LinkedIdListTest:testValidNewId(uint256[],uint256) (runs: 256, μ: 3428911, ~: 3602211) -LinkedIdListTest:testValidPosition(uint256[],uint256) (runs: 256, μ: 3410565, ~: 3581700) -MetadataManagerTest:testInit() (gas: 488261) -MetadataManagerTest:testInit2MetadataManager() (gas: 58024) +LinkedIdListTest:testValidId(uint256[],uint256) (runs: 256, μ: 3410871, ~: 3581127) +LinkedIdListTest:testValidMoveParameter(uint256[],uint256,uint256,uint256) (runs: 256, μ: 3327895, ~: 3175285) +LinkedIdListTest:testValidNewId(uint256[],uint256) (runs: 256, μ: 3428955, ~: 3601866) +LinkedIdListTest:testValidPosition(uint256[],uint256) (runs: 256, μ: 3410873, ~: 3580480) +MetadataManagerTest:testInit() (gas: 488242) +MetadataManagerTest:testInit2MetadataManager() (gas: 57826) MetadataManagerTest:testReinitFails() (gas: 31524) -MetadataManagerTest:testSetter() (gas: 317234) -MilestoneLifecycle:test_e2e_MilestoneLifecycle() (gas: 4370773) -MilestoneManagerTest:testAddMilestone(uint256) (runs: 256, μ: 2987727, ~: 2876188) -MilestoneManagerTest:testAddMilestoneFailsForDuplicateContributors() (gas: 44061) +MetadataManagerTest:testSetter() (gas: 317194) +MilestoneLifecycle:test_e2e_MilestoneLifecycle() (gas: 4371235) +MilestoneManagerTest:testAddMilestone(uint256) (runs: 256, μ: 3060988, ~: 3184757) +MilestoneManagerTest:testAddMilestoneFailsForDuplicateContributors() (gas: 44038) MilestoneManagerTest:testAddMilestoneFailsForInvalidContributorAddresses() (gas: 105374) -MilestoneManagerTest:testAddMilestoneFailsForInvalidDuration() (gas: 43724) +MilestoneManagerTest:testAddMilestoneFailsForInvalidDuration() (gas: 43683) MilestoneManagerTest:testAddMilestoneFailsForInvalidSalarySum() (gas: 46543) -MilestoneManagerTest:testAddMilestoneFailsIfCallerNotAuthorizedOrOwner(address) (runs: 256, μ: 55834, ~: 55834) -MilestoneManagerTest:testAddMilestoneFailsIfContributorsListEmpty() (gas: 28255) +MilestoneManagerTest:testAddMilestoneFailsIfCallerNotAuthorizedOrOwner(address) (runs: 256, μ: 55856, ~: 55856) +MilestoneManagerTest:testAddMilestoneFailsIfContributorsListEmpty() (gas: 28277) MilestoneManagerTest:testAddMilestoneFailsIfContributorsListTooBig() (gas: 80429) -MilestoneManagerTest:testCompleteMilestone(address[]) (runs: 256, μ: 5061194, ~: 4882570) -MilestoneManagerTest:testCompleteMilestoneFailsForInvalidId(address[]) (runs: 256, μ: 5009368, ~: 4831602) -MilestoneManagerTest:testCompleteMilestoneFailsIfCallerNotAuthorizedOrOwner(address,address[]) (runs: 256, μ: 4946728, ~: 4545880) -MilestoneManagerTest:testCompleteMilestoneFailsIfMilestoneNotYetSubmitted(address[]) (runs: 256, μ: 4936823, ~: 4688046) -MilestoneManagerTest:testDeclineMilestone(address[]) (runs: 256, μ: 5054264, ~: 4942132) -MilestoneManagerTest:testDeclineMilestoneFailsForInvalidId(address[]) (runs: 256, μ: 5009410, ~: 4831644) -MilestoneManagerTest:testDeclineMilestoneFailsIfCallerNotAuthorized(address,address[]) (runs: 256, μ: 4946716, ~: 4545868) -MilestoneManagerTest:testDeclineMilestoneFailsIfMilestoneAlreadyCompleted(address[]) (runs: 256, μ: 5033211, ~: 4855445) -MilestoneManagerTest:testDeclineMilestoneFailsIfMilestoneNotYetSubmitted(address[]) (runs: 256, μ: 4936842, ~: 4688065) -MilestoneManagerTest:testGetActiveMilestoneId() (gas: 788446) +MilestoneManagerTest:testCompleteMilestone(address[]) (runs: 256, μ: 5099970, ~: 4882503) +MilestoneManagerTest:testCompleteMilestoneFailsForInvalidId(address[]) (runs: 256, μ: 5048000, ~: 4831600) +MilestoneManagerTest:testCompleteMilestoneFailsIfCallerNotAuthorizedOrOwner(address,address[]) (runs: 256, μ: 5061941, ~: 4742982) +MilestoneManagerTest:testCompleteMilestoneFailsIfMilestoneNotYetSubmitted(address[]) (runs: 256, μ: 4993950, ~: 4885035) +MilestoneManagerTest:testDeclineMilestone(address[]) (runs: 256, μ: 5076984, ~: 4743478) +MilestoneManagerTest:testDeclineMilestoneFailsForInvalidId(address[]) (runs: 256, μ: 5048042, ~: 4831642) +MilestoneManagerTest:testDeclineMilestoneFailsIfCallerNotAuthorized(address,address[]) (runs: 256, μ: 5062017, ~: 4743058) +MilestoneManagerTest:testDeclineMilestoneFailsIfMilestoneAlreadyCompleted(address[]) (runs: 256, μ: 5071776, ~: 4855376) +MilestoneManagerTest:testDeclineMilestoneFailsIfMilestoneNotYetSubmitted(address[]) (runs: 256, μ: 4993946, ~: 4885031) +MilestoneManagerTest:testGetActiveMilestoneId() (gas: 788466) MilestoneManagerTest:testGetActiveMilestoneIdFailsIfNoActiveMilestone() (gas: 378674) -MilestoneManagerTest:testGetMaximumContributors() (gas: 8195) -MilestoneManagerTest:testGetMilesoneInformation() (gas: 391098) -MilestoneManagerTest:testGetMilesoneInformationFailsIfNoMilestoneExists() (gas: 15449) -MilestoneManagerTest:testGetPreviousMilestone(uint256,uint256) (runs: 256, μ: 3093265, ~: 2926708) +MilestoneManagerTest:testGetMaximumContributors() (gas: 8173) +MilestoneManagerTest:testGetMilesoneInformation() (gas: 391055) +MilestoneManagerTest:testGetMilesoneInformationFailsIfNoMilestoneExists() (gas: 15426) +MilestoneManagerTest:testGetPreviousMilestone(uint256,uint256) (runs: 256, μ: 3099901, ~: 3208665) MilestoneManagerTest:testGetSalaryPrecision() (gas: 10286) -MilestoneManagerTest:testHasActiveMilestone() (gas: 788407) -MilestoneManagerTest:testHasActiveMilestoneFalseIfMilestoneAlreadyCompleted(address[]) (runs: 256, μ: 5045907, ~: 4867734) -MilestoneManagerTest:testHasActiveMilestoneFalseIfMilestonesDurationOver(address[]) (runs: 256, μ: 5011848, ~: 4900203) +MilestoneManagerTest:testHasActiveMilestone() (gas: 788405) +MilestoneManagerTest:testHasActiveMilestoneFalseIfMilestoneAlreadyCompleted(address[]) (runs: 256, μ: 5084578, ~: 4867666) +MilestoneManagerTest:testHasActiveMilestoneFalseIfMilestonesDurationOver(address[]) (runs: 256, μ: 5034399, ~: 4702603) MilestoneManagerTest:testHasActiveMilestoneFalseIfNoActiveMilestoneYet() (gas: 375950) MilestoneManagerTest:testInit() (gas: 20071) -MilestoneManagerTest:testInit2MilestoneManager() (gas: 57799) -MilestoneManagerTest:testListMilestoneIds(uint256) (runs: 256, μ: 2975931, ~: 3211303) -MilestoneManagerTest:testMoveMilestoneForInvalidIntermediatePosition(address[]) (runs: 256, μ: 6815931, ~: 6449127) -MilestoneManagerTest:testMoveMilestoneInList(uint256,uint256,uint256) (runs: 256, μ: 5822699, ~: 6382913) -MilestoneManagerTest:testNextMilestoneActivatableIfCurrentMilestoneStartedAndDurationExceeded(address[]) (runs: 256, μ: 6796369, ~: 6459667) -MilestoneManagerTest:testNextMilestoneActivatableIfFirstMilestone() (gas: 384367) -MilestoneManagerTest:testNextMilestoneNotActivatableIfCurrentMilestoneStartedAndDurationNotExceeded(address[]) (runs: 256, μ: 6804417, ~: 6437613) -MilestoneManagerTest:testNextMilestoneNotActivatableIfNoNextMilestone() (gas: 13181) -MilestoneManagerTest:testNextMilestoneNotActivatableIfUnderTimelock(address[]) (runs: 256, μ: 7135530, ~: 6646554) -MilestoneManagerTest:testPctMathWithDissimilarSalaries(address[]) (runs: 256, μ: 1712635, ~: 1711599) -MilestoneManagerTest:testPctMathWithEqualSalary(address[]) (runs: 256, μ: 4988908, ~: 4737357) +MilestoneManagerTest:testInit2MilestoneManager() (gas: 57979) +MilestoneManagerTest:testListMilestoneIds(uint256) (runs: 256, μ: 3064736, ~: 3211325) +MilestoneManagerTest:testMoveMilestoneForInvalidIntermediatePosition(address[]) (runs: 256, μ: 7001774, ~: 6723730) +MilestoneManagerTest:testMoveMilestoneInList(uint256,uint256,uint256) (runs: 256, μ: 5645935, ~: 6095845) +MilestoneManagerTest:testNextMilestoneActivatableIfCurrentMilestoneStartedAndDurationExceeded(address[]) (runs: 256, μ: 6958508, ~: 6597249) +MilestoneManagerTest:testNextMilestoneActivatableIfFirstMilestone() (gas: 384344) +MilestoneManagerTest:testNextMilestoneNotActivatableIfCurrentMilestoneStartedAndDurationNotExceeded(address[]) (runs: 256, μ: 6990260, ~: 6712216) +MilestoneManagerTest:testNextMilestoneNotActivatableIfNoNextMilestone() (gas: 13138) +MilestoneManagerTest:testNextMilestoneNotActivatableIfUnderTimelock(address[]) (runs: 256, μ: 7203451, ~: 6934390) +MilestoneManagerTest:testPctMathWithDissimilarSalaries(address[]) (runs: 256, μ: 1719995, ~: 1724975) +MilestoneManagerTest:testPctMathWithEqualSalary(address[]) (runs: 256, μ: 5046833, ~: 4936890) MilestoneManagerTest:testReinitFails() (gas: 31560) -MilestoneManagerTest:testRemoveMilestone(uint256) (runs: 256, μ: 5406699, ~: 5701313) +MilestoneManagerTest:testRemoveMilestone(uint256) (runs: 256, μ: 5158908, ~: 4962914) MilestoneManagerTest:testRemoveMilestoneFailsForInvalidId() (gas: 29326) -MilestoneManagerTest:testRemoveMilestoneFailsIfCallerNotAuthorizedOrOwner(address) (runs: 256, μ: 39693, ~: 39693) -MilestoneManagerTest:testRemoveMilestoneFailsIfMilestoneActive(address[]) (runs: 256, μ: 4934697, ~: 4685920) -MilestoneManagerTest:testStartAndStopRandomMilestone(uint256,uint256) (runs: 256, μ: 6406148, ~: 6629591) -MilestoneManagerTest:testStartNextMilestone(address[]) (runs: 256, μ: 6973281, ~: 6676100) -MilestoneManagerTest:testStartNextMilestoneAfterCurrentMilestoneIsStopped(address[]) (runs: 256, μ: 9074002, ~: 8533091) -MilestoneManagerTest:testStartNextMilestoneFailsIfCallerNotAuthorizedOrOwner(address) (runs: 256, μ: 393730, ~: 393730) -MilestoneManagerTest:testStartNextMilestoneFailsIfNextMilestoneNotActivatable() (gas: 31803) -MilestoneManagerTest:testStartNextMilestoneFailsIfTransferOfTokensFromProposalFailed(address[]) (runs: 256, μ: 2706669, ~: 2566179) -MilestoneManagerTest:testStopMilestone(address[]) (runs: 256, μ: 6959339, ~: 6662158) -MilestoneManagerTest:testStopMilestoneFailsIfCallerNotAuthorizedOrOwner(address[],address) (runs: 256, μ: 7758149, ~: 7671705) -MilestoneManagerTest:testStopMilestoneFailsIfMilestoneNotActive() (gas: 381254) -MilestoneManagerTest:testSubmitMilestone(address[],bytes) (runs: 256, μ: 5284565, ~: 5390406) -MilestoneManagerTest:testSubmitMilestoneFailsForInvalidId(address[]) (runs: 256, μ: 4935075, ~: 4686298) -MilestoneManagerTest:testSubmitMilestoneFailsForInvalidSubmissionData(address[]) (runs: 256, μ: 4952921, ~: 4703535) -MilestoneManagerTest:testSubmitMilestoneFailsIfCallerNotContributor(address[]) (runs: 256, μ: 4971010, ~: 4720744) -MilestoneManagerTest:testSubmitMilestoneFailsIfMilestoneAlreadyCompleted(address[]) (runs: 256, μ: 5048033, ~: 4869861) -MilestoneManagerTest:testSubmitMilestoneFailsIfMilestoneNotYetStarted(address[]) (runs: 256, μ: 2667764, ~: 2509066) -MilestoneManagerTest:testSubmitMilestoneSubmissionDataNotChangeable(address[],bytes,bytes) (runs: 256, μ: 4815660, ~: 4479178) -MilestoneManagerTest:testUpdateMilestone(uint256,uint256,bytes,address[]) (runs: 256, μ: 2781145, ~: 2677795) -MilestoneManagerTest:testUpdateMilestoneFailsForInvalidDuration() (gas: 381697) -MilestoneManagerTest:testUpdateMilestoneFailsForInvalidId() (gas: 383256) +MilestoneManagerTest:testRemoveMilestoneFailsIfCallerNotAuthorizedOrOwner(address) (runs: 256, μ: 39671, ~: 39671) +MilestoneManagerTest:testRemoveMilestoneFailsIfMilestoneActive(address[]) (runs: 256, μ: 4991824, ~: 4882909) +MilestoneManagerTest:testStartAndStopRandomMilestone(uint256,uint256) (runs: 256, μ: 6447449, ~: 6629595) +MilestoneManagerTest:testStartNextMilestone(address[]) (runs: 256, μ: 6970020, ~: 6676163) +MilestoneManagerTest:testStartNextMilestoneAfterCurrentMilestoneIsStopped(address[]) (runs: 256, μ: 9220133, ~: 8900610) +MilestoneManagerTest:testStartNextMilestoneFailsIfCallerNotAuthorizedOrOwner(address) (runs: 256, μ: 393752, ~: 393752) +MilestoneManagerTest:testStartNextMilestoneFailsIfNextMilestoneNotActivatable() (gas: 31780) +MilestoneManagerTest:testStartNextMilestoneFailsIfTransferOfTokensFromOrchestratorFailed(address[]) (runs: 256, μ: 2704324, ~: 2513592) +MilestoneManagerTest:testStopMilestone(address[]) (runs: 256, μ: 6956078, ~: 6662221) +MilestoneManagerTest:testStopMilestoneFailsIfCallerNotAuthorizedOrOwner(address[],address) (runs: 256, μ: 7725163, ~: 7671768) +MilestoneManagerTest:testStopMilestoneFailsIfMilestoneNotActive() (gas: 381231) +MilestoneManagerTest:testSubmitMilestone(address[],bytes) (runs: 256, μ: 5390380, ~: 5648309) +MilestoneManagerTest:testSubmitMilestoneFailsForInvalidId(address[]) (runs: 256, μ: 4992224, ~: 4883309) +MilestoneManagerTest:testSubmitMilestoneFailsForInvalidSubmissionData(address[]) (runs: 256, μ: 5010233, ~: 4901109) +MilestoneManagerTest:testSubmitMilestoneFailsIfCallerNotContributor(address[]) (runs: 256, μ: 5028537, ~: 4919118) +MilestoneManagerTest:testSubmitMilestoneFailsIfMilestoneAlreadyCompleted(address[]) (runs: 256, μ: 5086749, ~: 4869837) +MilestoneManagerTest:testSubmitMilestoneFailsIfMilestoneNotYetStarted(address[]) (runs: 256, μ: 2713475, ~: 2614264) +MilestoneManagerTest:testSubmitMilestoneSubmissionDataNotChangeable(address[],bytes,bytes) (runs: 256, μ: 4848708, ~: 4467492) +MilestoneManagerTest:testUpdateMilestone(uint256,uint256,bytes,address[]) (runs: 256, μ: 2854942, ~: 2786554) +MilestoneManagerTest:testUpdateMilestoneFailsForInvalidDuration() (gas: 381719) +MilestoneManagerTest:testUpdateMilestoneFailsForInvalidId() (gas: 383278) MilestoneManagerTest:testUpdateMilestoneFailsIfCallerNotAuthorizedOrOwner(address) (runs: 256, μ: 395516, ~: 395516) -MilestoneManagerTest:testUpdateMilestoneFailsIfMilestoneAlreadyStarted(address[]) (runs: 256, μ: 5098478, ~: 4801657) -MilestoneManagerTest:testUpdateMilestoneOneByOne(uint256,uint256,bytes,address[]) (runs: 256, μ: 3199731, ~: 3062968) -MintBurn:testFailBurnAll(address,uint256) (runs: 256, μ: 163735, ~: 223832) +MilestoneManagerTest:testUpdateMilestoneFailsIfMilestoneAlreadyStarted(address[]) (runs: 256, μ: 5158560, ~: 5008225) +MilestoneManagerTest:testUpdateMilestoneOneByOne(uint256,uint256,bytes,address[]) (runs: 256, μ: 3202482, ~: 3090079) +MintBurn:testFailBurnAll(address,uint256) (runs: 256, μ: 167810, ~: 223832) MintBurn:testFailMintMoreThanMaxSupply(address) (runs: 256, μ: 93127, ~: 93127) -ModuleFactoryTest:testCreateModule((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 405027, ~: 398048) -ModuleFactoryTest:testCreateModuleFailsIfBeaconsImplementationIsZero((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 908683, ~: 908694) -ModuleFactoryTest:testCreateModuleFailsIfMetadataUnregistered((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 16753, ~: 16750) +ModuleFactoryTest:testCreateModule((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 405499, ~: 398073) +ModuleFactoryTest:testCreateModuleFailsIfBeaconsImplementationIsZero((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 908667, ~: 908691) +ModuleFactoryTest:testCreateModuleFailsIfMetadataUnregistered((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 16762, ~: 16750) ModuleFactoryTest:testDeploymentInvariants() (gas: 10709) -ModuleFactoryTest:testRegisterMetadata((uint256,uint256,string,string)) (runs: 256, μ: 73933, ~: 73961) +ModuleFactoryTest:testRegisterMetadata((uint256,uint256,string,string)) (runs: 256, μ: 73923, ~: 73961) ModuleFactoryTest:testRegisterMetadataFailsIfAlreadyRegistered() (gas: 208365) ModuleFactoryTest:testRegisterMetadataFailsIfBeaconsImplementationIsZero() (gas: 33633) ModuleFactoryTest:testRegisterMetadataFailsIfMetadataInvalid() (gas: 20331) ModuleFactoryTest:testRegisterMetadataOnlyCallableByOwner(address) (runs: 256, μ: 28529, ~: 28529) -ModuleManagerTest:testAddModule(address[]) (runs: 256, μ: 4372916, ~: 4112024) -ModuleManagerTest:testAddModuleFailsForInvalidAddress() (gas: 40475) -ModuleManagerTest:testAddModuleFailsIfAlreadyAdded(address) (runs: 256, μ: 89868, ~: 89868) -ModuleManagerTest:testAddModuleFailsIfCallerNotAuthorized(address) (runs: 256, μ: 21654, ~: 21654) +ModuleManagerTest:testAddModule(address[]) (runs: 256, μ: 4514436, ~: 4419064) +ModuleManagerTest:testAddModuleFailsForInvalidAddress() (gas: 40453) +ModuleManagerTest:testAddModuleFailsIfAlreadyAdded(address) (runs: 256, μ: 89846, ~: 89846) +ModuleManagerTest:testAddModuleFailsIfCallerNotAuthorized(address) (runs: 256, μ: 21632, ~: 21632) ModuleManagerTest:testAddModuleFailsIfLimitReached(address[]) (runs: 256, μ: 9832681, ~: 9832681) ModuleManagerTest:testExecuteTxFromModuleOnlyCallableByModule() (gas: 11829) ModuleManagerTest:testExecuteTxFromModuleViaCall() (gas: 82581) ModuleManagerTest:testExecuteTxFromModuleViaCallFails() (gas: 82856) -ModuleManagerTest:testGrantRole(address,bytes32,address) (runs: 256, μ: 2192231, ~: 2192231) -ModuleManagerTest:testGrantRoleFailsIfCallerNotModule(address,address,bytes32,address) (runs: 256, μ: 2168536, ~: 2168536) -ModuleManagerTest:testInit(address[]) (runs: 256, μ: 5117456, ~: 4877661) -ModuleManagerTest:testInitFailsForInvalidModules() (gas: 2151688) +ModuleManagerTest:testGrantRole(address,bytes32,address) (runs: 256, μ: 2192209, ~: 2192209) +ModuleManagerTest:testGrantRoleFailsIfCallerNotModule(address,address,bytes32,address) (runs: 256, μ: 2168514, ~: 2168514) +ModuleManagerTest:testInit(address[]) (runs: 256, μ: 6324468, ~: 6116165) +ModuleManagerTest:testInitFailsForInvalidModules() (gas: 2151666) ModuleManagerTest:testInitFailsForNonInitializerFunction() (gas: 13514) ModuleManagerTest:testInitFailsForTooManyModules(address[]) (runs: 256, μ: 1043653, ~: 1043008) -ModuleManagerTest:testInitFailsIfModuleAddedTwice() (gas: 1063640) +ModuleManagerTest:testInitFailsIfModuleAddedTwice() (gas: 2160813) ModuleManagerTest:testReinitFails() (gas: 13692) -ModuleManagerTest:testRemoveModuleFailsIfCallerNotAuthorized(address) (runs: 256, μ: 90922, ~: 90922) -ModuleManagerTest:testRemoveModuleFailsIfNotModule(address) (runs: 256, μ: 22623, ~: 22623) -ModuleManagerTest:testRemoveModules(address[]) (runs: 256, μ: 7298009, ~: 6413359) -ModuleManagerTest:testRenounceRole(address,bytes32,address) (runs: 256, μ: 2176593, ~: 2176593) -ModuleManagerTest:testRevokeRole(address,bytes32,address) (runs: 256, μ: 2176785, ~: 2176785) -ModuleManagerTest:testRevokeRoleFailsIfCallerNotModule(address,address,bytes32,address) (runs: 256, μ: 2168569, ~: 2168569) -ModuleManagerTest:testRolesDisabledIfModuleDisabled(address,bytes32,address) (runs: 256, μ: 2160342, ~: 2160342) -ModuleTest:testInit() (gas: 50728) -ModuleTest:testInitFailsForInvalidProposal() (gas: 943833) -ModuleTest:testInitFailsForNonInitializerFunction() (gas: 925784) +ModuleManagerTest:testRemoveModuleFailsIfCallerNotAuthorized(address) (runs: 256, μ: 90900, ~: 90900) +ModuleManagerTest:testRemoveModuleFailsIfNotModule(address) (runs: 256, μ: 22601, ~: 22601) +ModuleManagerTest:testRemoveModules(address[]) (runs: 256, μ: 7489779, ~: 6819974) +ModuleManagerTest:testRenounceRole(address,bytes32,address) (runs: 256, μ: 2176571, ~: 2176571) +ModuleManagerTest:testRevokeRole(address,bytes32,address) (runs: 256, μ: 2176763, ~: 2176763) +ModuleManagerTest:testRevokeRoleFailsIfCallerNotModule(address,address,bytes32,address) (runs: 256, μ: 2168547, ~: 2168547) +ModuleManagerTest:testRolesDisabledIfModuleDisabled(address,bytes32,address) (runs: 256, μ: 2160320, ~: 2160320) +ModuleTest:testInit() (gas: 50749) +ModuleTest:testInitFailsForInvalidOrchestrator() (gas: 943833) +ModuleTest:testInitFailsForNonInitializerFunction() (gas: 925807) ModuleTest:testInitFailsIfMetadataInvalid() (gas: 1004812) ModuleTest:testReinitFails() (gas: 33612) -ModuleUpdateTest:testBeaconUpgrade((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 2223129, ~: 2216517) +ModuleUpdateTest:testBeaconUpgrade((uint256,uint256,string,string),address,bytes) (runs: 256, μ: 2221861, ~: 2214718) ModuleUpdateTest:testDeploymentInvariants() (gas: 10686) -PaymentClientTest:testAddPaymentOrder(uint256,address,uint256,uint256) (runs: 256, μ: 20793, ~: 21117) -PaymentClientTest:testAddPaymentOrderFailsForInvalidAmount() (gas: 9357) -PaymentClientTest:testAddPaymentOrderFailsForInvalidRecipient() (gas: 11676) -PaymentClientTest:testAddPaymentOrders() (gas: 386924) -PaymentClientTest:testCollectPaymentOrders(uint256,address,uint256,uint256) (runs: 256, μ: 41768, ~: 42084) -PaymentClientTest:testCollectPaymentOrdersFailsCallerNotAuthorized() (gas: 10233) -ProposalCreation:testCreateNewProposal() (gas: 3561654) -ProposalCreation:testManageModulesLiveOnPorposal() (gas: 5443614) -ProposalFactoryTest:testCreateProposal(uint256) (runs: 256, μ: 4114167, ~: 4068716) -ProposalFactoryTest:testDeploymentInvariants() (gas: 10647) -ProposalFactoryTest:testProposalMapping(uint256) (runs: 256, μ: 10975506, ~: 11238894) -ProposalFactoryTest:testValidProposalId(uint256,uint256) (runs: 256, μ: 10776153, ~: 10783359) -ProposalTest:testExecuteTx(uint256,address[]) (runs: 256, μ: 7246336, ~: 8946601) -ProposalTest:testExecuteTxFailsIfCallFails(uint256,address[]) (runs: 256, μ: 7246087, ~: 8946351) -ProposalTest:testExecuteTxFailsIfCallerNotAuthorized(uint256,address[]) (runs: 256, μ: 7227446, ~: 8927710) -ProposalTest:testInit(uint256,address[]) (runs: 256, μ: 4885866, ~: 4814236) -ProposalTest:testReinitFails(uint256,address[]) (runs: 256, μ: 7228977, ~: 8931602) -ProposalTest:testSetAuthorizer(uint256,address[]) (runs: 256, μ: 5375882, ~: 5257067) -ProposalTest:testSetFundingManager(uint256,address[]) (runs: 256, μ: 5197804, ~: 5016769) -ProposalTest:testSetPaymentProcessor(uint256,address[]) (runs: 256, μ: 4259741, ~: 4087064) -ProposalTest:testVersion() (gas: 9727) +OrchestratorCreation:testCreateNewOrchestrator() (gas: 3562081) +OrchestratorCreation:testManageModulesLiveOnPorposal() (gas: 5444039) +OrchestratorFactoryTest:testCreateOrchestrator(uint256) (runs: 256, μ: 4165871, ~: 4195261) +OrchestratorFactoryTest:testDeploymentInvariants() (gas: 10647) +OrchestratorFactoryTest:testOrchestratorMapping(uint256) (runs: 256, μ: 10595294, ~: 10817130) +OrchestratorFactoryTest:testValidOrchestratorId(uint256,uint256) (runs: 256, μ: 10781629, ~: 11217606) +OrchestratorTest:testExecuteTx(uint256,address[]) (runs: 256, μ: 7228590, ~: 8908922) +OrchestratorTest:testExecuteTxFailsIfCallFails(uint256,address[]) (runs: 256, μ: 7228341, ~: 8908672) +OrchestratorTest:testExecuteTxFailsIfCallerNotAuthorized(uint256,address[]) (runs: 256, μ: 7152232, ~: 8890031) +OrchestratorTest:testInit(uint256,address[]) (runs: 256, μ: 4961257, ~: 4965032) +OrchestratorTest:testReinitFails(uint256,address[]) (runs: 256, μ: 7166430, ~: 8893872) +OrchestratorTest:testSetAuthorizer(uint256,address[]) (runs: 256, μ: 5510132, ~: 5449355) +OrchestratorTest:testSetFundingManager(uint256,address[]) (runs: 256, μ: 5392572, ~: 5361411) +OrchestratorTest:testSetPaymentProcessor(uint256,address[]) (runs: 256, μ: 4370151, ~: 4316841) +OrchestratorTest:testVersion() (gas: 9727) Rebase:testNoRebaseIfMaxSupplyTarget() (gas: 118025) Rebase:testNoRebaseIfZeroSupplyTarget() (gas: 90080) Rebase:testRebaseTables() (gas: 26401914) -RebasingFundingManagerTest:testDeposit(address,uint256) (runs: 256, μ: 234079, ~: 234301) -RebasingFundingManagerTest:testDepositAndSpendFunds(uint256,uint256[]) (runs: 256, μ: 5331288, ~: 657334) -RebasingFundingManagerTest:testDepositSpendUntilEmptyRedepositAndWindDown(uint256,uint256[]) (runs: 256, μ: 7006307, ~: 856102) -RebasingFundingManagerTest:testInit() (gas: 31536) -RebasingFundingManagerTest:testInit2RebasingFundingManager() (gas: 57952) -RebasingFundingManagerTest:testReinitFails() (gas: 31521) -RebasingFundingManagerTest:testSelfDepositFails(address,uint256) (runs: 256, μ: 248825, ~: 248761) -RebasingFundingManagerTest:testTransferProposalToken(address,uint256) (runs: 256, μ: 383, ~: 383) -RebasingFundingManagerTest:testTransferProposalTokenFails(address,address) (runs: 256, μ: 111982, ~: 112426) -RecurringPaymentManagerTest:testAddRecurringPayment(uint256,uint256,uint256,address) (runs: 256, μ: 2321500, ~: 2333444) -RecurringPaymentManagerTest:testAddRecurringPaymentModifierInPosition() (gas: 343355) -RecurringPaymentManagerTest:testGetFutureEpoch(uint256) (runs: 256, μ: 286229, ~: 286429) +RebasingFundingManagerTest:testDeposit(address,uint256) (runs: 256, μ: 233973, ~: 233944) +RebasingFundingManagerTest:testDepositAndSpendFunds(uint256,uint256[]) (runs: 256, μ: 5155385, ~: 657160) +RebasingFundingManagerTest:testDepositSpendUntilEmptyRedepositAndWindDown(uint256,uint256[]) (runs: 256, μ: 6669712, ~: 850944) +RebasingFundingManagerTest:testInit() (gas: 31470) +RebasingFundingManagerTest:testInit2RebasingFundingManager() (gas: 57956) +RebasingFundingManagerTest:testReinitFails() (gas: 31565) +RebasingFundingManagerTest:testSelfDepositFails(address,uint256) (runs: 256, μ: 248960, ~: 248915) +RebasingFundingManagerTest:testTransferOrchestratorToken(address,uint256) (runs: 256, μ: 382, ~: 382) +RebasingFundingManagerTest:testTransferOrchestratorTokenFails(address,address) (runs: 256, μ: 112277, ~: 112425) +RecurringPaymentManagerTest:testAddRecurringPayment(uint256,uint256,uint256,address) (runs: 256, μ: 2259944, ~: 2084433) +RecurringPaymentManagerTest:testAddRecurringPaymentModifierInPosition() (gas: 343267) +RecurringPaymentManagerTest:testGetFutureEpoch(uint256) (runs: 256, μ: 286188, ~: 286093) RecurringPaymentManagerTest:testGetRecurringPaymentInformationModifierInPosition() (gas: 13735) RecurringPaymentManagerTest:testInit() (gas: 781690) -RecurringPaymentManagerTest:testInit2RecurringPaymentManager() (gas: 109091) +RecurringPaymentManagerTest:testInit2RecurringPaymentManager() (gas: 109161) RecurringPaymentManagerTest:testReinitFails() (gas: 280761) -RecurringPaymentManagerTest:testRemoveRecurringPayment(uint256,uint256) (runs: 256, μ: 3839441, ~: 3898412) +RecurringPaymentManagerTest:testRemoveRecurringPayment(uint256,uint256) (runs: 256, μ: 3940008, ~: 4130544) RecurringPaymentManagerTest:testRemoveRecurringPaymentModifierInPosition() (gas: 295902) -RecurringPaymentManagerTest:testTrigger(uint256,address[]) (runs: 256, μ: 21633798, ~: 17842719) -RecurringPaymentManagerTest:testTriggerFor(uint256,address[],uint256,uint256) (runs: 256, μ: 7098305, ~: 6997326) -RecurringPaymentManagerTest:testTriggerForModifierInPosition(uint256) (runs: 256, μ: 585600, ~: 585806) -RecurringPaymentManagerTest:testValidId(uint256,uint256,uint256) (runs: 256, μ: 59799900, ~: 62188724) -RecurringPaymentManagerTest:testValidStartEpoch(uint256,uint256) (runs: 256, μ: 434052, ~: 457060) -RecurringPayments:test_e2e_RecurringPayments(uint256) (runs: 256, μ: 3704861, ~: 3704865) +RecurringPaymentManagerTest:testTrigger(uint256,address[]) (runs: 256, μ: 21928215, ~: 18701967) +RecurringPaymentManagerTest:testTriggerFor(uint256,address[],uint256,uint256) (runs: 256, μ: 7097128, ~: 7001279) +RecurringPaymentManagerTest:testTriggerForModifierInPosition(uint256) (runs: 256, μ: 585553, ~: 585762) +RecurringPaymentManagerTest:testValidId(uint256,uint256,uint256) (runs: 256, μ: 57171841, ~: 56263290) +RecurringPaymentManagerTest:testValidStartEpoch(uint256,uint256) (runs: 256, μ: 434027, ~: 457038) +RecurringPayments:test_e2e_RecurringPayments(uint256) (runs: 256, μ: 3705136, ~: 3705133) RegisterModuleAtFactory:test_e2e_RegisterModuleAtModuleFactory() (gas: 1749190) -RoleAuthorizerTest:testAdminCannotModifyRoleIfAdminBurned() (gas: 1163709) -RoleAuthorizerTest:testAdminIgnoresIfRoleIsSelfManaged() (gas: 1136923) -RoleAuthorizerTest:testBurnAdminChangesRoleState() (gas: 209) -RoleAuthorizerTest:testBurnedModuleCorrectlyReturnToManagedState() (gas: 1081280) -RoleAuthorizerTest:testChangeRoleAdminOnModuleRole() (gas: 1144708) -RoleAuthorizerTest:testChangeRoleAdminOnModuleRoleFailsIfNotAdmin() (gas: 1029934) -RoleAuthorizerTest:testGrantAdminRole() (gas: 113843) -RoleAuthorizerTest:testGrantAdminRoleFailsIfNotOwner() (gas: 52380) -RoleAuthorizerTest:testGrantManagerRole(address[]) (runs: 256, μ: 1058033, ~: 1062443) -RoleAuthorizerTest:testGrantManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 769346, ~: 760425) -RoleAuthorizerTest:testGrantOwnerRole(address[]) (runs: 256, μ: 1088798, ~: 1187221) -RoleAuthorizerTest:testGrantRoleFromModule() (gas: 1091811) -RoleAuthorizerTest:testGrantRoleFromModuleFailsIfCalledByNonModule() (gas: 1003617) -RoleAuthorizerTest:testGrantRoleFromModuleFailsIfModuleNotInProposal() (gas: 973911) -RoleAuthorizerTest:testGrantRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 984620) -RoleAuthorizerTest:testGrantRoleFromModuleIdempotence() (gas: 1093076) -RoleAuthorizerTest:testInit2RoleAuthorizer() (gas: 57959) -RoleAuthorizerTest:testInitWithInitialOwner(address) (runs: 256, μ: 2573503, ~: 2573503) -RoleAuthorizerTest:testInitWithoutInitialOwners() (gas: 2550421) -RoleAuthorizerTest:testModifyRoleByAdminFailsIfAdminBurned() (gas: 1189438) -RoleAuthorizerTest:testModuleOnlyUsesOwnRolesWhenSelfManaged() (gas: 1094679) -RoleAuthorizerTest:testModuleOnlyUsesProposalRolesWhenNotSelfManaged() (gas: 1081258) -RoleAuthorizerTest:testModuleReturnToManagedMode() (gas: 187) -RoleAuthorizerTest:testReinitFails() (gas: 1858682) -RoleAuthorizerTest:testRemoveLastOwnerFails() (gas: 32359) -RoleAuthorizerTest:testRevokeManagerRole(address[]) (runs: 256, μ: 911987, ~: 912176) -RoleAuthorizerTest:testRevokeManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 769305, ~: 760384) -RoleAuthorizerTest:testRevokeOwnerRole() (gas: 98445) -RoleAuthorizerTest:testRevokeRoleFromModule() (gas: 1024691) -RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfCalledByNonModule() (gas: 1003714) -RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfModuleNotInProposal() (gas: 975957) -RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 986657) -RoleAuthorizerTest:testRevokeRoleFromModuleIdempotence() (gas: 1008878) -RoleAuthorizerTest:testtoggleModuleSelfManagement() (gas: 978570) +RoleAuthorizerTest:testAdminCannotModifyRoleIfAdminBurned() (gas: 1163664) +RoleAuthorizerTest:testAdminIgnoresIfRoleIsSelfManaged() (gas: 1136813) +RoleAuthorizerTest:testBurnAdminChangesRoleState() (gas: 189) +RoleAuthorizerTest:testBurnedModuleCorrectlyReturnToManagedState() (gas: 1081182) +RoleAuthorizerTest:testChangeRoleAdminOnModuleRole() (gas: 1144651) +RoleAuthorizerTest:testChangeRoleAdminOnModuleRoleFailsIfNotAdmin() (gas: 1029932) +RoleAuthorizerTest:testGrantAdminRole() (gas: 113821) +RoleAuthorizerTest:testGrantAdminRoleFailsIfNotOwner() (gas: 52359) +RoleAuthorizerTest:testGrantManagerRole(address[]) (runs: 256, μ: 1072019, ~: 1164709) +RoleAuthorizerTest:testGrantManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 767051, ~: 825083) +RoleAuthorizerTest:testGrantOwnerRole(address[]) (runs: 256, μ: 1085884, ~: 1186713) +RoleAuthorizerTest:testGrantRoleFromModule() (gas: 1091875) +RoleAuthorizerTest:testGrantRoleFromModuleFailsIfCalledByNonModule() (gas: 1003704) +RoleAuthorizerTest:testGrantRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 973932) +RoleAuthorizerTest:testGrantRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 984641) +RoleAuthorizerTest:testGrantRoleFromModuleIdempotence() (gas: 1093140) +RoleAuthorizerTest:testInit2RoleAuthorizer() (gas: 57786) +RoleAuthorizerTest:testInitWithInitialOwner(address) (runs: 256, μ: 2574248, ~: 2574248) +RoleAuthorizerTest:testInitWithoutInitialOwners() (gas: 2551187) +RoleAuthorizerTest:testModifyRoleByAdminFailsIfAdminBurned() (gas: 1189415) +RoleAuthorizerTest:testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged() (gas: 1081162) +RoleAuthorizerTest:testModuleOnlyUsesOwnRolesWhenSelfManaged() (gas: 1094656) +RoleAuthorizerTest:testModuleReturnToManagedMode() (gas: 231) +RoleAuthorizerTest:testReinitFails() (gas: 1858692) +RoleAuthorizerTest:testRemoveLastOwnerFails() (gas: 32357) +RoleAuthorizerTest:testRevokeManagerRole(address[]) (runs: 256, μ: 916376, ~: 956185) +RoleAuthorizerTest:testRevokeManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 767754, ~: 825843) +RoleAuthorizerTest:testRevokeOwnerRole() (gas: 98406) +RoleAuthorizerTest:testRevokeRoleFromModule() (gas: 1024776) +RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfCalledByNonModule() (gas: 1003690) +RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 976002) +RoleAuthorizerTest:testRevokeRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 986700) +RoleAuthorizerTest:testRevokeRoleFromModuleIdempotence() (gas: 1008832) +RoleAuthorizerTest:testtoggleModuleSelfManagement() (gas: 978427) SimplePaymentProcessorTest:testCancelPaymentsFailsWhenCalledByNonModule(address) (runs: 256, μ: 32905, ~: 32905) SimplePaymentProcessorTest:testCancelPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 918492, ~: 918492) SimplePaymentProcessorTest:testInit() (gas: 20668) -SimplePaymentProcessorTest:testInit2SimplePaymentProcessor() (gas: 57757) -SimplePaymentProcessorTest:testProcessPayments(address,uint256) (runs: 256, μ: 235042, ~: 235102) +SimplePaymentProcessorTest:testInit2SimplePaymentProcessor() (gas: 57894) +SimplePaymentProcessorTest:testProcessPayments(address,uint256) (runs: 256, μ: 235045, ~: 235102) SimplePaymentProcessorTest:testProcessPaymentsFailsWhenCalledByNonModule(address) (runs: 256, μ: 32905, ~: 32905) SimplePaymentProcessorTest:testProcessPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 918457, ~: 918457) SimplePaymentProcessorTest:testReinitFails() (gas: 31449) SimulateTransferPrecision:testSimulation() (gas: 3718) -SingleVoteGovernorTest:testAbstain(address[]) (runs: 256, μ: 9222398, ~: 9290048) -SingleVoteGovernorTest:testAbstainUnauthorized(address[]) (runs: 256, μ: 859339, ~: 840731) -SingleVoteGovernorTest:testAddVoters(address[]) (runs: 256, μ: 1186598, ~: 1190618) +SingleVoteGovernorTest:testAbstain(address[]) (runs: 256, μ: 8870059, ~: 8174775) +SingleVoteGovernorTest:testAbstainUnauthorized(address[]) (runs: 256, μ: 881080, ~: 875954) +SingleVoteGovernorTest:testAddVoters(address[]) (runs: 256, μ: 1209199, ~: 1189782) SingleVoteGovernorTest:testCastInvalidVote(uint8) (runs: 256, μ: 199978, ~: 199978) -SingleVoteGovernorTest:testCreateVote() (gas: 850107) -SingleVoteGovernorTest:testCreateVoteWithRecentlyAuthorizedAddress(address[]) (runs: 256, μ: 11641897, ~: 11463648) +SingleVoteGovernorTest:testCreateVote() (gas: 850041) +SingleVoteGovernorTest:testCreateVoteWithRecentlyAuthorizedAddress(address[]) (runs: 256, μ: 11456010, ~: 11462812) SingleVoteGovernorTest:testDoubleExecution() (gas: 367598) -SingleVoteGovernorTest:testDoubleVoting(address[]) (runs: 256, μ: 8504119, ~: 8487504) +SingleVoteGovernorTest:testDoubleVoting(address[]) (runs: 256, μ: 8224740, ~: 8054816) SingleVoteGovernorTest:testExecuteFailedVote() (gas: 258979) SingleVoteGovernorTest:testExecuteInexistentVote(uint256) (runs: 256, μ: 13331, ~: 13331) SingleVoteGovernorTest:testExecuteWhileVotingOpen() (gas: 276377) SingleVoteGovernorTest:testGetThreshold() (gas: 10278) SingleVoteGovernorTest:testGetVoteDuration() (gas: 10254) -SingleVoteGovernorTest:testGovernanceThresholdChange() (gas: 367379) +SingleVoteGovernorTest:testGovernanceThresholdChange() (gas: 367357) SingleVoteGovernorTest:testGovernanceVoteDurationChange() (gas: 365218) -SingleVoteGovernorTest:testInit2SingleVoteGovernor() (gas: 58114) -SingleVoteGovernorTest:testInitWithDuplicateInitialVotersFails(address[],uint8) (runs: 256, μ: 2867614, ~: 2876373) -SingleVoteGovernorTest:testInitWithInitialVoters(address[]) (runs: 256, μ: 3245770, ~: 3223072) -SingleVoteGovernorTest:testInitWithInvalidInitialVotersFails() (gas: 2611837) +SingleVoteGovernorTest:testInit2SingleVoteGovernor() (gas: 58251) +SingleVoteGovernorTest:testInitWithDuplicateInitialVotersFails(address[],uint8) (runs: 256, μ: 2897441, ~: 2896846) +SingleVoteGovernorTest:testInitWithInitialVoters(address[]) (runs: 256, μ: 3262614, ~: 3280076) +SingleVoteGovernorTest:testInitWithInvalidInitialVotersFails() (gas: 2611859) SingleVoteGovernorTest:testMotionSetInvalidVoteDuration() (gas: 18203) -SingleVoteGovernorTest:testMotionSetThreshold() (gas: 20733) +SingleVoteGovernorTest:testMotionSetThreshold() (gas: 20711) SingleVoteGovernorTest:testMotionSetVoteDuration() (gas: 18595) SingleVoteGovernorTest:testOnlyGovernanceIsAuthorized(address) (runs: 256, μ: 23372, ~: 23372) -SingleVoteGovernorTest:testReinitFails() (gas: 1851924) -SingleVoteGovernorTest:testRemoveTooManyVoters() (gas: 27596) -SingleVoteGovernorTest:testRemoveUntilVoterListEmpty() (gas: 32289) -SingleVoteGovernorTest:testRemoveVoter(address[]) (runs: 256, μ: 7467297, ~: 7628256) -SingleVoteGovernorTest:testSetUnreachableThreshold(uint256) (runs: 256, μ: 15070, ~: 15070) -SingleVoteGovernorTest:testUnauthorizedGovernanceVoteDurationChange(address[]) (runs: 256, μ: 7656017, ~: 7506234) -SingleVoteGovernorTest:testUnauthorizedThresholdChange(address[]) (runs: 256, μ: 7656485, ~: 7506694) -SingleVoteGovernorTest:testUnauthorizedVoteCreation(address[]) (runs: 256, μ: 723124, ~: 691946) -SingleVoteGovernorTest:testUnauthorizedVoterAddition(address[]) (runs: 256, μ: 7660535, ~: 7510664) -SingleVoteGovernorTest:testUnauthorizedVoterRemoval(address[]) (runs: 256, μ: 7659700, ~: 7509845) -SingleVoteGovernorTest:testVoteAgainst(address[]) (runs: 256, μ: 9078780, ~: 9021361) -SingleVoteGovernorTest:testVoteAgainstUnauthorized(address[]) (runs: 256, μ: 859090, ~: 840488) +SingleVoteGovernorTest:testReinitFails() (gas: 1851858) +SingleVoteGovernorTest:testRemoveTooManyVoters() (gas: 27704) +SingleVoteGovernorTest:testRemoveUntilVoterListEmpty() (gas: 32392) +SingleVoteGovernorTest:testRemoveVoter(address[]) (runs: 256, μ: 7098610, ~: 6494620) +SingleVoteGovernorTest:testSetUnreachableThreshold(uint256) (runs: 256, μ: 15048, ~: 15048) +SingleVoteGovernorTest:testUnauthorizedGovernanceVoteDurationChange(address[]) (runs: 256, μ: 7348399, ~: 6723137) +SingleVoteGovernorTest:testUnauthorizedThresholdChange(address[]) (runs: 256, μ: 7348441, ~: 6723177) +SingleVoteGovernorTest:testUnauthorizedVoteCreation(address[]) (runs: 256, μ: 727523, ~: 691550) +SingleVoteGovernorTest:testUnauthorizedVoterAddition(address[]) (runs: 256, μ: 7352737, ~: 6727107) +SingleVoteGovernorTest:testUnauthorizedVoterRemoval(address[]) (runs: 256, μ: 7352734, ~: 6727103) +SingleVoteGovernorTest:testVoteAgainst(address[]) (runs: 256, μ: 8866857, ~: 8355329) +SingleVoteGovernorTest:testVoteAgainstUnauthorized(address[]) (runs: 256, μ: 880824, ~: 875700) SingleVoteGovernorTest:testVoteExecution() (gas: 365240) -SingleVoteGovernorTest:testVoteInFavor(address[]) (runs: 256, μ: 9187701, ~: 9021083) -SingleVoteGovernorTest:testVoteInFavorUnauthorized(address[]) (runs: 256, μ: 859339, ~: 840731) -SingleVoteGovernorTest:testVoteOnExpired(uint256[]) (runs: 256, μ: 1439968, ~: 1457372) -SingleVoteGovernorTest:testVoteOnUnexistingID(uint160[]) (runs: 256, μ: 357512, ~: 315249) -StreamingPaymentProcessorTest:testBlockedAddressCanClaimLater() (gas: 477090) -StreamingPaymentProcessorTest:testCancelPaymentsFailsWhenCalledByNonModule(address) (runs: 256, μ: 32971, ~: 32971) -StreamingPaymentProcessorTest:testCancelPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 918492, ~: 918492) -StreamingPaymentProcessorTest:testCancelRunningPayments(address[],uint128[],uint64[]) (runs: 256, μ: 8417137, ~: 6420548) -StreamingPaymentProcessorTest:testFalseReturningTokenTransfers() (gas: 473237) -StreamingPaymentProcessorTest:testInit() (gas: 21431) -StreamingPaymentProcessorTest:testInit2StreamingPaymentProcessor() (gas: 58042) +SingleVoteGovernorTest:testVoteInFavor(address[]) (runs: 256, μ: 8824984, ~: 8133220) +SingleVoteGovernorTest:testVoteInFavorUnauthorized(address[]) (runs: 256, μ: 881080, ~: 875954) +SingleVoteGovernorTest:testVoteOnExpired(uint256[]) (runs: 256, μ: 1434351, ~: 1457372) +SingleVoteGovernorTest:testVoteOnUnexistingID(uint160[]) (runs: 256, μ: 575849, ~: 403211) +StreamingPaymentProcessorTest:testBlockedAddressCanClaimLater() (gas: 477071) +StreamingPaymentProcessorTest:testCancelPaymentsFailsWhenCalledByNonModule(address) (runs: 256, μ: 32949, ~: 32949) +StreamingPaymentProcessorTest:testCancelPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 918470, ~: 918470) +StreamingPaymentProcessorTest:testCancelRunningPayments(address[],uint128[],uint64[]) (runs: 256, μ: 10934119, ~: 8213025) +StreamingPaymentProcessorTest:testFalseReturningTokenTransfers() (gas: 473218) +StreamingPaymentProcessorTest:testInit() (gas: 21409) +StreamingPaymentProcessorTest:testInit2StreamingPaymentProcessor() (gas: 57914) StreamingPaymentProcessorTest:testProcessPaymentsFailsWhenCalledOnOtherClient(address) (runs: 256, μ: 918509, ~: 918509) -StreamingPaymentProcessorTest:testProcessPaymentsWorksForDueTimeThatIsPlacedBeforeStartTime(address[],uint256[]) (runs: 256, μ: 6136285, ~: 5565210) +StreamingPaymentProcessorTest:testProcessPaymentsWorksForDueTimeThatIsPlacedBeforeStartTime(address[],uint256[]) (runs: 256, μ: 6312345, ~: 5955557) StreamingPaymentProcessorTest:testReinitFails() (gas: 31487) -StreamingPaymentProcessorTest:testStreamingCalculation(address[],uint128[]) (runs: 256, μ: 15233044, ~: 14764368) -StreamingPaymentProcessorTest:testUpdateFinishedPayments(address[],uint128[],uint64[]) (runs: 256, μ: 14758979, ~: 11743472) -StreamingPaymentProcessorTest:test_cancelRunningPayments_allCreatedOrdersGetCancelled(address[],uint128[]) (runs: 256, μ: 9230708, ~: 7331778) -StreamingPaymentProcessorTest:test_claimVestedAmounts_fullVesting(address[],uint128[],uint64[]) (runs: 256, μ: 8052486, ~: 6270059) -StreamingPaymentProcessorTest:test_processPayments(address[],uint128[],uint64[]) (runs: 256, μ: 6752938, ~: 5102664) -StreamingPaymentProcessorTest:test_processPayments_discardsInvalidPaymentOrders() (gas: 553838) +StreamingPaymentProcessorTest:testStreamingCalculation(address[],uint128[]) (runs: 256, μ: 16475872, ~: 16390380) +StreamingPaymentProcessorTest:testUpdateFinishedPayments(address[],uint128[],uint64[]) (runs: 256, μ: 20394560, ~: 14892649) +StreamingPaymentProcessorTest:test_cancelRunningPayments_allCreatedOrdersGetCancelled(address[],uint128[]) (runs: 256, μ: 12585287, ~: 8999292) +StreamingPaymentProcessorTest:test_claimVestedAmounts_fullVesting(address[],uint128[],uint64[]) (runs: 256, μ: 10564627, ~: 7090946) +StreamingPaymentProcessorTest:test_processPayments(address[],uint128[],uint64[]) (runs: 256, μ: 9187151, ~: 6545371) +StreamingPaymentProcessorTest:test_processPayments_discardsInvalidPaymentOrders() (gas: 553803) StreamingPaymentProcessorTest:test_processPayments_failsWhenCalledByNonModule(address) (runs: 256, μ: 32913, ~: 32913) -StreamingPaymentProcessorTest:test_processPayments_paymentOrdersAreNotOverwritten(uint256,uint256,uint256,uint256) (runs: 256, μ: 1474040, ~: 1471104) -StreamingPaymentProcessorTest:test_processPayments_vestingInfoGetsDeletedPostFullPayment(address[],uint128[],uint64[]) (runs: 256, μ: 7921904, ~: 6167649) -StreamingPaymentProcessorTest:test_removePaymentAndClaimForSpecificWalletId(uint256,uint256,uint256,uint256) (runs: 256, μ: 1687247, ~: 1687395) -StreamingPaymentProcessorTest:test_removePaymentForSpecificWalletId_halfVestingDoneMultipleOrdersForSingleBeneficiary(uint256,uint256,uint256,uint256) (runs: 256, μ: 1587829, ~: 1587961) -TokenGatedRoleAuthorizerTest:testAdminCannotAddNonTokenWhenTokenGated() (gas: 289753) -TokenGatedRoleAuthorizerTest:testCanAddTokenWhenTokenGated() (gas: 336605) -TokenGatedRoleAuthorizerTest:testCannotAddNonTokenWhenTokenGated() (gas: 183394) -TokenGatedRoleAuthorizerTest:testFuzzNFTAuthorization(address[],bool[]) (runs: 256, μ: 736689, ~: 617325) -TokenGatedRoleAuthorizerTest:testFuzzTokenAuthorization(uint256,address[],uint256[]) (runs: 256, μ: 2566412, ~: 2244266) -TokenGatedRoleAuthorizerTest:testMakeRoleTokenGated() (gas: 339142) -TokenGatedRoleAuthorizerTest:testMakingFunctionTokenGatedFailsIfAlreadyInUse() (gas: 126804) -TokenGatedRoleAuthorizerTest:testSetThreshold() (gas: 181323) +StreamingPaymentProcessorTest:test_processPayments_paymentOrdersAreNotOverwritten(uint256,uint256,uint256,uint256) (runs: 256, μ: 1474245, ~: 1472961) +StreamingPaymentProcessorTest:test_processPayments_vestingInfoGetsDeletedPostFullPayment(address[],uint128[],uint64[]) (runs: 256, μ: 10393189, ~: 6974091) +StreamingPaymentProcessorTest:test_removePaymentAndClaimForSpecificWalletId(uint256,uint256,uint256,uint256) (runs: 256, μ: 1687219, ~: 1687396) +StreamingPaymentProcessorTest:test_removePaymentForSpecificWalletId_halfVestingDoneMultipleOrdersForSingleBeneficiary(uint256,uint256,uint256,uint256) (runs: 256, μ: 1587797, ~: 1587960) +TokenGatedRoleAuthorizerTest:testAdminCannotAddNonTokenWhenTokenGated() (gas: 289709) +TokenGatedRoleAuthorizerTest:testCanAddTokenWhenTokenGated() (gas: 336693) +TokenGatedRoleAuthorizerTest:testCannotAddNonTokenWhenTokenGated() (gas: 183438) +TokenGatedRoleAuthorizerTest:testFuzzNFTAuthorization(address[],bool[]) (runs: 256, μ: 739120, ~: 615045) +TokenGatedRoleAuthorizerTest:testFuzzTokenAuthorization(uint256,address[],uint256[]) (runs: 256, μ: 2568879, ~: 2222492) +TokenGatedRoleAuthorizerTest:testMakeRoleTokenGated() (gas: 339230) +TokenGatedRoleAuthorizerTest:testMakingFunctionTokenGatedFailsIfAlreadyInUse() (gas: 126856) +TokenGatedRoleAuthorizerTest:testSetThreshold() (gas: 181345) TokenGatedRoleAuthorizerTest:testSetThresholdFailsIfInvalid() (gas: 153654) -TokenGatedRoleAuthorizerTest:testSetThresholdFailsIfNotTokenGated() (gas: 237868) -TokenGatedRoleAuthorizerTest:testSetThresholdFromAdminFailsIfInvalid() (gas: 291365) -TokenGatedRoleAuthorizerTest:testSetTokenGatedFailsIfRoleAlreadyInUse() (gas: 218711) -TokenGatedRoleAuthorizerTest:testSetTokenGatingByAdmin() (gas: 149646) -TokenGatedRoleAuthorizerUpstreamTests:testAdminCannotModifyRoleIfAdminBurned() (gas: 1166124) -TokenGatedRoleAuthorizerUpstreamTests:testAdminIgnoresIfRoleIsSelfManaged() (gas: 1141901) -TokenGatedRoleAuthorizerUpstreamTests:testBurnAdminChangesRoleState() (gas: 209) -TokenGatedRoleAuthorizerUpstreamTests:testBurnedModuleCorrectlyReturnToManagedState() (gas: 1083710) -TokenGatedRoleAuthorizerUpstreamTests:testChangeRoleAdminOnModuleRole() (gas: 1149349) -TokenGatedRoleAuthorizerUpstreamTests:testChangeRoleAdminOnModuleRoleFailsIfNotAdmin() (gas: 1029902) -TokenGatedRoleAuthorizerUpstreamTests:testGrantAdminRole() (gas: 116179) -TokenGatedRoleAuthorizerUpstreamTests:testGrantAdminRoleFailsIfNotOwner() (gas: 52490) -TokenGatedRoleAuthorizerUpstreamTests:testGrantManagerRole(address[]) (runs: 256, μ: 1072404, ~: 1118686) -TokenGatedRoleAuthorizerUpstreamTests:testGrantManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 764692, ~: 763157) -TokenGatedRoleAuthorizerUpstreamTests:testGrantOwnerRole(address[]) (runs: 256, μ: 1087037, ~: 1087847) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModule() (gas: 1094066) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfCalledByNonModule() (gas: 1003602) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfModuleNotInProposal() (gas: 973896) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 984534) -TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleIdempotence() (gas: 1095508) -TokenGatedRoleAuthorizerUpstreamTests:testInit2RoleAuthorizer() (gas: 57913) -TokenGatedRoleAuthorizerUpstreamTests:testInitWithInitialOwner(address) (runs: 256, μ: 2573503, ~: 2573503) -TokenGatedRoleAuthorizerUpstreamTests:testInitWithoutInitialOwners() (gas: 2550421) -TokenGatedRoleAuthorizerUpstreamTests:testModifyRoleByAdminFailsIfAdminBurned() (gas: 1194190) -TokenGatedRoleAuthorizerUpstreamTests:testModuleOnlyUsesOwnRolesWhenSelfManaged() (gas: 1097310) -TokenGatedRoleAuthorizerUpstreamTests:testModuleOnlyUsesProposalRolesWhenNotSelfManaged() (gas: 1083688) -TokenGatedRoleAuthorizerUpstreamTests:testModuleReturnToManagedMode() (gas: 187) -TokenGatedRoleAuthorizerUpstreamTests:testReinitFails() (gas: 1858850) -TokenGatedRoleAuthorizerUpstreamTests:testRemoveLastOwnerFails() (gas: 32448) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeManagerRole(address[]) (runs: 256, μ: 922029, ~: 916319) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 764661, ~: 763126) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeOwnerRole() (gas: 100403) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModule() (gas: 1027006) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfCalledByNonModule() (gas: 1003731) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfModuleNotInProposal() (gas: 975942) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 986571) -TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleIdempotence() (gas: 1008900) -TokenGatedRoleAuthorizerUpstreamTests:testtoggleModuleSelfManagement() (gas: 978401) \ No newline at end of file +TokenGatedRoleAuthorizerTest:testSetThresholdFailsIfNotTokenGated() (gas: 237823) +TokenGatedRoleAuthorizerTest:testSetThresholdFromAdminFailsIfInvalid() (gas: 291321) +TokenGatedRoleAuthorizerTest:testSetTokenGatedFailsIfRoleAlreadyInUse() (gas: 218656) +TokenGatedRoleAuthorizerTest:testSetTokenGatingByAdmin() (gas: 149600) +TokenGatedRoleAuthorizerUpstreamTests:testAdminCannotModifyRoleIfAdminBurned() (gas: 1166099) +TokenGatedRoleAuthorizerUpstreamTests:testAdminIgnoresIfRoleIsSelfManaged() (gas: 1141788) +TokenGatedRoleAuthorizerUpstreamTests:testBurnAdminChangesRoleState() (gas: 189) +TokenGatedRoleAuthorizerUpstreamTests:testBurnedModuleCorrectlyReturnToManagedState() (gas: 1083807) +TokenGatedRoleAuthorizerUpstreamTests:testChangeRoleAdminOnModuleRole() (gas: 1149335) +TokenGatedRoleAuthorizerUpstreamTests:testChangeRoleAdminOnModuleRoleFailsIfNotAdmin() (gas: 1030054) +TokenGatedRoleAuthorizerUpstreamTests:testGrantAdminRole() (gas: 116069) +TokenGatedRoleAuthorizerUpstreamTests:testGrantAdminRoleFailsIfNotOwner() (gas: 52381) +TokenGatedRoleAuthorizerUpstreamTests:testGrantManagerRole(address[]) (runs: 256, μ: 1077572, ~: 1169701) +TokenGatedRoleAuthorizerUpstreamTests:testGrantManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 771571, ~: 827859) +TokenGatedRoleAuthorizerUpstreamTests:testGrantOwnerRole(address[]) (runs: 256, μ: 1089366, ~: 1139292) +TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModule() (gas: 1094238) +TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfCalledByNonModule() (gas: 1003797) +TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 974025) +TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 984750) +TokenGatedRoleAuthorizerUpstreamTests:testGrantRoleFromModuleIdempotence() (gas: 1095657) +TokenGatedRoleAuthorizerUpstreamTests:testInit2RoleAuthorizer() (gas: 57961) +TokenGatedRoleAuthorizerUpstreamTests:testInitWithInitialOwner(address) (runs: 256, μ: 2574248, ~: 2574248) +TokenGatedRoleAuthorizerUpstreamTests:testInitWithoutInitialOwners() (gas: 2551187) +TokenGatedRoleAuthorizerUpstreamTests:testModifyRoleByAdminFailsIfAdminBurned() (gas: 1194164) +TokenGatedRoleAuthorizerUpstreamTests:testModuleOnlyUsesOrchestratorRolesWhenNotSelfManaged() (gas: 1083787) +TokenGatedRoleAuthorizerUpstreamTests:testModuleOnlyUsesOwnRolesWhenSelfManaged() (gas: 1097395) +TokenGatedRoleAuthorizerUpstreamTests:testModuleReturnToManagedMode() (gas: 231) +TokenGatedRoleAuthorizerUpstreamTests:testReinitFails() (gas: 1858839) +TokenGatedRoleAuthorizerUpstreamTests:testRemoveLastOwnerFails() (gas: 32357) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeManagerRole(address[]) (runs: 256, μ: 926926, ~: 1004313) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeManagerRoleFailsIfNotOwner(address[]) (runs: 256, μ: 772052, ~: 828377) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeOwnerRole() (gas: 100240) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModule() (gas: 1027199) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfCalledByNonModule() (gas: 1003838) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfModuleNotInOrchestrator() (gas: 976095) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleFailsIfModuleNotSelfManaged() (gas: 986809) +TokenGatedRoleAuthorizerUpstreamTests:testRevokeRoleFromModuleIdempotence() (gas: 1008985) +TokenGatedRoleAuthorizerUpstreamTests:testtoggleModuleSelfManagement() (gas: 978566) \ No newline at end of file diff --git a/lcov.info b/lcov.info index 7d3b4e105..85608bd60 100644 --- a/lcov.info +++ b/lcov.info @@ -1,19 +1,19 @@ TN: SF:script/deployment/DeploymentScript.s.sol -FN:89,DeploymentScript.run +FN:90,DeploymentScript.run FNDA:0,DeploymentScript.run -DA:91,0 DA:92,0 DA:93,0 DA:94,0 DA:95,0 -DA:97,0 +DA:96,0 DA:98,0 -DA:101,0 -DA:104,0 -DA:107,0 -DA:110,0 -DA:114,0 +DA:99,0 +DA:103,0 +DA:106,0 +DA:109,0 +DA:112,0 +DA:116,0 FNF:1 FNH:0 LF:12 @@ -38,9 +38,9 @@ BRF:0 BRH:0 end_of_record TN: -SF:script/factories/DeployProposalFactory.s.sol -FN:27,DeployProposalFactory.run -FNDA:0,DeployProposalFactory.run +SF:script/factories/DeployOrchestratorFactory.s.sol +FN:27,DeployOrchestratorFactory.run +FNDA:0,DeployOrchestratorFactory.run DA:29,0 DA:30,0 DA:31,0 @@ -51,13 +51,13 @@ DA:38,0 BRDA:38,1,0,- BRDA:38,1,1,- DA:44,0 -FN:47,DeployProposalFactory.run -FNDA:0,DeployProposalFactory.run +FN:47,DeployOrchestratorFactory.run +FNDA:0,DeployOrchestratorFactory.run DA:51,0 DA:54,0 DA:57,0 DA:60,0 -DA:64,0 +DA:65,0 FNF:2 FNH:0 LF:11 @@ -162,9 +162,9 @@ BRF:0 BRH:0 end_of_record TN: -SF:script/proposal/DeployProposal.s.sol -FN:24,DeployProposal.run -FNDA:0,DeployProposal.run +SF:script/orchestrator/DeployOrchestrator.s.sol +FN:24,DeployOrchestrator.run +FNDA:0,DeployOrchestrator.run DA:25,0 DA:29,0 DA:32,0 @@ -213,80 +213,82 @@ BRF:0 BRH:0 end_of_record TN: -SF:script/setup/SetupToyProposalScript.s.sol -FN:50,SetupToyProposalScript.run -FNDA:0,SetupToyProposalScript.run -DA:55,0 -DA:57,0 -DA:59,0 -DA:62,0 -DA:68,0 -DA:72,0 -DA:73,0 -DA:80,0 -DA:81,0 -DA:88,0 -DA:89,0 -DA:90,0 -DA:97,0 -DA:98,0 -DA:105,0 -DA:106,0 -DA:107,0 -DA:112,0 -DA:114,0 -DA:122,0 -DA:126,0 -BRDA:126,0,0,- -BRDA:126,0,1,- -DA:128,0 -DA:129,0 -DA:136,0 -DA:137,0 -DA:138,0 -DA:139,0 -DA:141,0 +SF:script/setup/SetupToyOrchestratorScript.s.sol +FN:51,SetupToyOrchestratorScript.run +FNDA:0,SetupToyOrchestratorScript.run +DA:56,0 +DA:58,0 +DA:60,0 +DA:63,0 +DA:69,0 +DA:70,0 +DA:76,0 +DA:77,0 +DA:84,0 +DA:85,0 +DA:92,0 +DA:93,0 +DA:94,0 +DA:101,0 +DA:102,0 +DA:109,0 +DA:110,0 +DA:111,0 +DA:116,0 +DA:118,0 +DA:127,0 +DA:131,0 +BRDA:131,0,0,- +BRDA:131,0,1,- +DA:133,0 +DA:134,0 +DA:135,0 DA:142,0 -DA:151,0 -DA:152,0 -DA:154,0 +DA:143,0 +DA:144,0 +DA:145,0 +DA:147,0 +DA:148,0 +DA:157,0 DA:158,0 +DA:160,0 DA:164,0 DA:170,0 -DA:171,0 -DA:174,0 -DA:189,0 -DA:190,0 -DA:191,0 -DA:193,0 +DA:176,0 +DA:177,0 +DA:180,0 DA:195,0 +DA:196,0 DA:197,0 DA:199,0 DA:201,0 -DA:202,0 +DA:203,0 DA:205,0 DA:207,0 DA:208,0 -DA:209,0 DA:211,0 -DA:212,0 +DA:213,0 +DA:214,0 +DA:215,0 DA:217,0 DA:218,0 -DA:220,0 -DA:222,0 -DA:229,0 -DA:236,0 -DA:237,0 +DA:223,0 +DA:224,0 +DA:226,0 +DA:228,0 +DA:235,0 DA:242,0 DA:243,0 -DA:245,0 -DA:246,0 DA:248,0 DA:251,0 DA:253,0 +DA:256,0 +DA:260,0 +DA:263,0 +DA:265,0 FNF:1 FNH:0 -LF:66 +LF:68 LH:0 BRF:2 BRH:0 @@ -385,22 +387,22 @@ BRDA:101,1,1,1562 DA:103,1562 DA:105,1562 DA:107,1562 -DA:109,1562 -FN:116,ModuleFactory.getBeaconAndId +DA:111,1562 +FN:118,ModuleFactory.getBeaconAndId FNDA:256,ModuleFactory.getBeaconAndId -DA:121,3357 DA:123,3357 -FN:130,ModuleFactory.registerMetadata +DA:125,3357 +FN:132,ModuleFactory.registerMetadata FNDA:1286,ModuleFactory.registerMetadata -DA:136,1027 -DA:137,1027 DA:138,1027 -DA:141,1027 -BRDA:141,2,0,1 -BRDA:141,2,1,1026 -DA:142,1 -DA:146,1026 -DA:147,1026 +DA:139,1027 +DA:140,1027 +DA:143,1027 +BRDA:143,2,0,1 +BRDA:143,2,1,1026 +DA:144,1 +DA:148,1026 +DA:149,1026 FNF:3 FNH:3 LF:18 @@ -409,53 +411,53 @@ BRF:6 BRH:6 end_of_record TN: -SF:src/factories/ProposalFactory.sol -FN:73,ProposalFactory.createProposal -FNDA:13238,ProposalFactory.createProposal -DA:80,13238 -DA:83,13238 -DA:86,13238 -DA:93,13238 -DA:100,13238 -DA:107,13238 -DA:108,13238 -DA:109,13238 -DA:110,12797 -DA:117,13238 +SF:src/factories/OrchestratorFactory.sol +FN:73,OrchestratorFactory.createOrchestrator +FNDA:13139,OrchestratorFactory.createOrchestrator +DA:80,13139 +DA:83,13139 +DA:86,13139 +DA:93,13139 +DA:100,13139 +DA:107,13139 +DA:108,13139 +DA:109,13139 +DA:110,12183 +DA:117,13139 BRDA:117,0,0,- -BRDA:117,0,1,13238 +BRDA:117,0,1,13139 DA:118,0 -DA:122,13238 -DA:135,13238 -DA:136,12797 +DA:122,13139 +DA:135,13139 +DA:136,12183 BRDA:136,1,0,- BRDA:136,1,1,3 DA:137,3 -DA:144,13238 +DA:144,13139 BRDA:144,2,0,- BRDA:144,2,1,- DA:145,0 -DA:149,13238 +DA:149,13139 BRDA:149,3,0,- BRDA:149,3,1,- DA:150,0 -DA:154,13238 +DA:154,13139 BRDA:154,4,0,- BRDA:154,4,1,- DA:156,0 -DA:161,13238 -FN:165,ProposalFactory.getProposalByID -FNDA:6302,ProposalFactory.getProposalByID -DA:171,6089 -FN:174,ProposalFactory.getProposalIDCounter -FNDA:256,ProposalFactory.getProposalIDCounter +DA:161,13139 +FN:165,OrchestratorFactory.getOrchestratorByID +FNDA:6660,OrchestratorFactory.getOrchestratorByID +DA:171,6440 +FN:174,OrchestratorFactory.getOrchestratorIDCounter +FNDA:256,OrchestratorFactory.getOrchestratorIDCounter DA:175,256 -FN:178,ProposalFactory.decoder -FNDA:105022,ProposalFactory.decoder -DA:183,105022 -FN:186,ProposalFactory._dependencyInjectionRequired -FNDA:52511,ProposalFactory._dependencyInjectionRequired -DA:191,52511 +FN:178,OrchestratorFactory.decoder +FNDA:103200,OrchestratorFactory.decoder +DA:183,103200 +FN:186,OrchestratorFactory._dependencyInjectionRequired +FNDA:51600,OrchestratorFactory._dependencyInjectionRequired +DA:191,51600 FNF:5 FNH:5 LF:26 @@ -482,9 +484,10 @@ DA:64,3 FN:71,Beacon.supportsInterface FNDA:1,Beacon.supportsInterface DA:78,1 +DA:79,0 FNF:4 FNH:4 -LF:7 +LF:8 LH:7 BRF:2 BRH:2 @@ -508,30 +511,30 @@ FNDA:3,MetadataManager.init DA:28,2 DA:30,2 DA:34,2 -DA:38,2 -DA:40,2 -DA:42,2 -FN:48,MetadataManager.getManagerMetadata +DA:39,2 +DA:41,2 +DA:43,2 +FN:49,MetadataManager.getManagerMetadata FNDA:7,MetadataManager.getManagerMetadata -DA:53,7 -FN:56,MetadataManager.getProposalMetadata -FNDA:19,MetadataManager.getProposalMetadata -DA:61,19 -FN:64,MetadataManager.getTeamMetadata +DA:54,7 +FN:57,MetadataManager.getOrchestratorMetadata +FNDA:19,MetadataManager.getOrchestratorMetadata +DA:62,19 +FN:65,MetadataManager.getTeamMetadata FNDA:6,MetadataManager.getTeamMetadata -DA:69,6 -FN:75,MetadataManager.setManagerMetadata +DA:70,6 +FN:76,MetadataManager.setManagerMetadata FNDA:1,MetadataManager.setManagerMetadata -DA:79,1 -FN:82,MetadataManager._setManagerMetadata +DA:80,1 +FN:83,MetadataManager._setManagerMetadata FNDA:3,MetadataManager._setManagerMetadata -DA:85,3 DA:86,3 -FN:93,MetadataManager.setProposalMetadata -FNDA:1,MetadataManager.setProposalMetadata +DA:87,3 +FN:94,MetadataManager.setOrchestratorMetadata +FNDA:1,MetadataManager.setOrchestratorMetadata DA:97,1 -FN:100,MetadataManager._setProposalMetadata -FNDA:3,MetadataManager._setProposalMetadata +FN:100,MetadataManager._setOrchestratorMetadata +FNDA:3,MetadataManager._setOrchestratorMetadata DA:103,3 DA:104,3 FN:113,MetadataManager.setTeamMetadata @@ -573,8 +576,8 @@ DA:116,516 DA:121,518 DA:123,518 FN:132,RoleAuthorizer._revokeRole -FNDA:5008,RoleAuthorizer._revokeRole -DA:138,5006 +FNDA:5244,RoleAuthorizer._revokeRole +DA:138,5242 FN:148,RoleAuthorizer.isAuthorized FNDA:58,RoleAuthorizer.isAuthorized DA:150,58 @@ -589,7 +592,7 @@ DA:167,1032 DA:169,1039 FN:173,RoleAuthorizer.generateRoleId FNDA:2648,RoleAuthorizer.generateRoleId -DA:179,33400 +DA:179,35929 FN:185,RoleAuthorizer.toggleModuleSelfManagement FNDA:50,RoleAuthorizer.toggleModuleSelfManagement DA:186,50 @@ -640,22 +643,24 @@ BRDA:99,1,0,- BRDA:99,1,1,515 DA:100,0 DA:105,515 +DA:106,515 BRDA:104,2,0,- BRDA:104,2,1,515 DA:108,0 DA:112,515 DA:113,515 -DA:114,6913 -DA:117,6913 +DA:114,6996 +DA:117,6996 +DA:118,6994 BRDA:116,3,0,3 -BRDA:116,3,1,6910 +BRDA:116,3,1,6993 DA:120,3 -DA:123,6910 +DA:123,6993 BRDA:123,4,0,256 -BRDA:123,4,1,6654 +BRDA:123,4,1,6737 DA:124,256 -DA:127,6654 -DA:128,6654 +DA:127,6737 +DA:128,6737 DA:132,256 DA:135,256 DA:136,256 @@ -665,11 +670,11 @@ FN:147,SingleVoteGovernor.isAuthorized FNDA:257,SingleVoteGovernor.isAuthorized DA:154,257 FN:160,SingleVoteGovernor.getReceipt -FNDA:41807,SingleVoteGovernor.getReceipt -DA:165,41807 -DA:167,41807 +FNDA:42071,SingleVoteGovernor.getReceipt +DA:165,42071 +DA:167,42071 FN:173,SingleVoteGovernor.setThreshold -FNDA:4980,SingleVoteGovernor.setThreshold +FNDA:4916,SingleVoteGovernor.setThreshold DA:175,259 BRDA:175,5,0,256 BRDA:175,5,1,3 @@ -677,146 +682,147 @@ DA:176,256 DA:182,3 DA:183,3 FN:186,SingleVoteGovernor.setVotingDuration -FNDA:4687,SingleVoteGovernor.setVotingDuration +FNDA:4625,SingleVoteGovernor.setVotingDuration DA:189,6 +DA:190,5 BRDA:188,6,0,2 BRDA:188,6,1,4 DA:192,2 DA:195,4 DA:196,4 FN:202,SingleVoteGovernor.addVoter -FNDA:60809,SingleVoteGovernor.addVoter -DA:203,56042 -BRDA:203,7,0,51355 -BRDA:203,7,1,56042 -DA:204,51355 -DA:206,51355 -DA:208,51355 +FNDA:61428,SingleVoteGovernor.addVoter +DA:203,56763 +BRDA:203,7,0,51788 +BRDA:203,7,1,56763 +DA:204,51788 +DA:206,51788 +DA:208,51788 FN:212,SingleVoteGovernor.removeVoter -FNDA:13983,SingleVoteGovernor.removeVoter -DA:214,9017 +FNDA:14413,SingleVoteGovernor.removeVoter +DA:214,9617 BRDA:214,8,0,1 -BRDA:214,8,1,9016 +BRDA:214,8,1,9616 DA:215,1 -DA:219,9016 +DA:219,9616 BRDA:219,9,0,1 -BRDA:219,9,1,9015 +BRDA:219,9,1,9615 DA:220,1 -DA:223,9015 -BRDA:223,10,0,4509 -BRDA:223,10,1,9015 -DA:224,4509 -DA:226,4509 -DA:228,4509 +DA:223,9615 +BRDA:223,10,0,4809 +BRDA:223,10,1,9615 +DA:224,4809 +DA:226,4809 +DA:228,4809 FN:235,SingleVoteGovernor.createMotion -FNDA:58608,SingleVoteGovernor.createMotion -DA:241,53837 -DA:245,53837 -DA:248,53837 -DA:249,53837 -DA:251,53837 -DA:252,53837 -DA:253,53837 -DA:255,53837 -DA:259,53837 -DA:262,53837 +FNDA:59286,SingleVoteGovernor.createMotion +DA:241,54150 +DA:245,54150 +DA:248,54150 +DA:249,54150 +DA:251,54150 +DA:252,54150 +DA:253,54150 +DA:255,54150 +DA:259,54150 +DA:262,54150 FN:265,SingleVoteGovernor.castVote -FNDA:323761,SingleVoteGovernor.castVote -DA:270,309078 +FNDA:361617,SingleVoteGovernor.castVote +DA:270,346182 BRDA:270,11,0,256 -BRDA:270,11,1,308822 +BRDA:270,11,1,345926 DA:271,256 -DA:275,308822 -BRDA:275,12,0,38256 -BRDA:275,12,1,270566 -DA:276,38256 -DA:280,270566 -DA:283,270566 -BRDA:283,13,0,92217 -BRDA:283,13,1,178349 -DA:284,92217 -DA:288,178349 -BRDA:288,14,0,13767 -BRDA:288,14,1,164582 -DA:289,13767 -DA:292,164582 -BRDA:292,15,0,149927 -BRDA:292,15,1,14655 -DA:294,149927 -DA:296,14655 -BRDA:296,16,0,9741 -BRDA:296,16,1,4914 -DA:298,9741 -DA:300,4914 -BRDA:300,17,0,4914 -BRDA:300,17,1,4914 -DA:302,4914 -DA:306,164582 +DA:275,345926 +BRDA:275,12,0,68526 +BRDA:275,12,1,277400 +DA:276,68526 +DA:280,277400 +DA:283,277400 +BRDA:283,13,0,98304 +BRDA:283,13,1,179096 +DA:284,98304 +DA:288,179096 +BRDA:288,14,0,13836 +BRDA:288,14,1,165260 +DA:289,13836 +DA:292,165260 +BRDA:292,15,0,150553 +BRDA:292,15,1,14707 +DA:294,150553 +DA:296,14707 +BRDA:296,16,0,9801 +BRDA:296,16,1,4906 +DA:298,9801 +DA:300,4906 +BRDA:300,17,0,4906 +BRDA:300,17,1,4906 +DA:302,4906 +DA:306,165260 FN:309,SingleVoteGovernor.executeMotion -FNDA:46932,SingleVoteGovernor.executeMotion -DA:311,46932 -DA:314,46932 +FNDA:47077,SingleVoteGovernor.executeMotion +DA:311,47077 +DA:314,47077 BRDA:314,18,0,256 -BRDA:314,18,1,46676 +BRDA:314,18,1,46821 DA:315,256 -DA:319,46676 +DA:319,46821 BRDA:319,19,0,2 -BRDA:319,19,1,46674 +BRDA:319,19,1,46819 DA:320,2 -DA:324,46674 +DA:324,46819 BRDA:324,20,0,1 -BRDA:324,20,1,46673 +BRDA:324,20,1,46818 DA:325,1 -DA:329,46673 +DA:329,46818 BRDA:329,21,0,1 -BRDA:329,21,1,46672 +BRDA:329,21,1,46817 DA:330,1 -DA:334,46672 -DA:337,46672 -DA:338,46672 -DA:339,46672 -DA:342,46672 -DA:343,46672 -DA:345,46672 +DA:334,46817 +DA:337,46817 +DA:338,46817 +DA:339,46817 +DA:342,46817 +DA:343,46817 +DA:345,46817 FNF:10 FNH:10 -LF:91 -LH:89 +LF:94 +LH:92 BRF:44 BRH:42 end_of_record TN: SF:src/modules/authorizer/TokenGatedRoleAuthorizer.sol FN:62,TokenGatedRoleAuthorizer.isAuthorized -FNDA:27046,TokenGatedRoleAuthorizer.isAuthorized -DA:69,27046 -DA:71,27046 -BRDA:71,0,0,27036 +FNDA:29575,TokenGatedRoleAuthorizer.isAuthorized +DA:69,29575 +DA:71,29575 +BRDA:71,0,0,29565 BRDA:71,0,1,4 -DA:72,27040 -DA:74,27040 -BRDA:74,1,0,27036 +DA:72,29569 +DA:74,29569 +BRDA:74,1,0,29565 BRDA:74,1,1,4 -DA:75,27036 +DA:75,29565 DA:77,4 DA:81,6 DA:82,6 FN:90,TokenGatedRoleAuthorizer._grantRole -FNDA:8586,TokenGatedRoleAuthorizer._grantRole -DA:95,8586 +FNDA:8585,TokenGatedRoleAuthorizer._grantRole +DA:95,8585 BRDA:95,2,0,- BRDA:95,2,1,521 DA:96,521 -DA:102,8586 +DA:102,8585 FN:109,TokenGatedRoleAuthorizer.hasTokenRole -FNDA:27036,TokenGatedRoleAuthorizer.hasTokenRole -DA:114,54072 -DA:116,54072 -DA:117,54072 -DA:118,54072 -DA:119,54072 -DA:122,54072 -DA:135,30836 +FNDA:29565,TokenGatedRoleAuthorizer.hasTokenRole +DA:114,59130 +DA:116,59130 +DA:117,59130 +DA:118,59130 +DA:119,59130 +DA:122,59130 +DA:135,32324 FN:139,TokenGatedRoleAuthorizer.getThresholdValue FNDA:1,TokenGatedRoleAuthorizer.getThresholdValue DA:144,1 @@ -881,11 +887,11 @@ DA:169,1 FN:173,Module.title FNDA:1,Module.title DA:174,1 -FN:178,Module.proposal -FNDA:59672,Module.proposal -DA:179,531111 -FN:189,Module._triggerProposalCallback -FNDA:0,Module._triggerProposalCallback +FN:178,Module.orchestrator +FNDA:74559,Module.orchestrator +DA:179,570230 +FN:189,Module._triggerOrchestratorCallback +FNDA:0,Module._triggerOrchestratorCallback DA:193,0 DA:194,0 DA:195,0 @@ -904,69 +910,69 @@ BRF:4 BRH:4 end_of_record TN: -SF:src/modules/base/mixins/PaymentClient.sol -FN:76,PaymentClient._addPaymentOrder -FNDA:86251,PaymentClient._addPaymentOrder -DA:82,86248 -DA:85,86248 -DA:89,86248 -DA:91,86248 -FN:97,PaymentClient._addPaymentOrders -FNDA:22219,PaymentClient._addPaymentOrders -DA:98,22219 -DA:100,22219 -DA:102,22219 -DA:103,22219 -DA:104,221965 -DA:105,221965 -DA:108,221965 -DA:111,221965 -DA:113,221965 -DA:117,22219 -DA:121,22219 -FN:128,PaymentClient.collectPaymentOrders -FNDA:7034,PaymentClient.collectPaymentOrders -DA:135,7034 -BRDA:135,0,0,1 -BRDA:135,0,1,7033 -DA:136,1 -DA:142,7033 -DA:147,7033 -DA:148,7033 -DA:149,7033 -DA:150,109323 -DA:154,7033 -DA:157,7033 -DA:160,7033 -DA:165,7033 -DA:169,7033 -FN:173,PaymentClient.paymentOrders -FNDA:9335,PaymentClient.paymentOrders -DA:179,9335 -FN:183,PaymentClient.outstandingTokenAmount -FNDA:513,PaymentClient.outstandingTokenAmount -DA:184,513 -FN:190,PaymentClient._ensureValidRecipient -FNDA:166309,PaymentClient._ensureValidRecipient -DA:191,166309 -BRDA:191,1,0,1 -BRDA:191,1,1,166308 -DA:192,1 -FN:196,PaymentClient._ensureValidAmount -FNDA:166359,PaymentClient._ensureValidAmount -DA:197,166359 -BRDA:197,2,0,1 -BRDA:197,2,1,166358 -FN:200,PaymentClient._ensureValidPaymentOrder -FNDA:308216,PaymentClient._ensureValidPaymentOrder -DA:201,308216 -BRDA:201,3,0,1 -BRDA:201,3,1,308215 -DA:202,1 -DA:204,308215 -BRDA:204,4,0,2 -BRDA:204,4,1,308213 -DA:205,2 +SF:src/modules/base/mixins/ERC20PaymentClient.sol +FN:79,ERC20PaymentClient._addPaymentOrder +FNDA:103475,ERC20PaymentClient._addPaymentOrder +DA:85,103472 +DA:88,103472 +DA:92,103472 +DA:94,103472 +FN:100,ERC20PaymentClient._addPaymentOrders +FNDA:21536,ERC20PaymentClient._addPaymentOrders +DA:101,21536 +DA:103,21536 +DA:105,21536 +DA:106,21536 +DA:107,229792 +DA:108,229792 +DA:111,229792 +DA:114,229792 +DA:116,229792 +DA:120,21536 +DA:124,21536 +FN:131,ERC20PaymentClient.collectPaymentOrders +FNDA:7109,ERC20PaymentClient.collectPaymentOrders +DA:138,7109 +BRDA:138,0,0,1 +BRDA:138,0,1,7108 +DA:139,1 +DA:145,7108 +DA:150,7108 +DA:151,7108 +DA:152,7108 +DA:153,129020 +DA:157,7108 +DA:160,7108 +DA:163,7108 +DA:168,7108 +DA:172,7108 +FN:176,ERC20PaymentClient.paymentOrders +FNDA:9410,ERC20PaymentClient.paymentOrders +DA:182,9410 +FN:186,ERC20PaymentClient.outstandingTokenAmount +FNDA:513,ERC20PaymentClient.outstandingTokenAmount +DA:187,513 +FN:193,ERC20PaymentClient._ensureValidRecipient +FNDA:177582,ERC20PaymentClient._ensureValidRecipient +DA:194,177582 +BRDA:194,1,0,1 +BRDA:194,1,1,177581 +DA:195,1 +FN:199,ERC20PaymentClient._ensureValidAmount +FNDA:177615,ERC20PaymentClient._ensureValidAmount +DA:200,177615 +BRDA:200,2,0,1 +BRDA:200,2,1,177614 +FN:203,ERC20PaymentClient._ensureValidPaymentOrder +FNDA:333267,ERC20PaymentClient._ensureValidPaymentOrder +DA:204,333267 +BRDA:204,3,0,1 +BRDA:204,3,1,333266 +DA:205,1 +DA:207,333266 +BRDA:207,4,0,2 +BRDA:207,4,1,333264 +DA:208,2 FNF:8 FNH:8 LF:36 @@ -982,71 +988,70 @@ DA:64,262 DA:66,262 DA:68,262 DA:69,262 -DA:70,262 -DA:71,262 -DA:73,262 -FN:80,RebasingFundingManager.token +DA:72,262 +DA:74,262 +FN:81,RebasingFundingManager.token FNDA:0,RebasingFundingManager.token -DA:81,84015 -FN:85,RebasingFundingManager._supplyTarget -FNDA:31481,RebasingFundingManager._supplyTarget -DA:91,31481 -FN:97,RebasingFundingManager.deposit -FNDA:13759,RebasingFundingManager.deposit -DA:98,13759 -FN:101,RebasingFundingManager.depositFor -FNDA:8574,RebasingFundingManager.depositFor -DA:102,8574 -FN:105,RebasingFundingManager.withdraw -FNDA:4279,RebasingFundingManager.withdraw -DA:106,4279 -FN:109,RebasingFundingManager.withdrawTo -FNDA:4101,RebasingFundingManager.withdrawTo -DA:110,4101 -FN:116,RebasingFundingManager.transferProposalToken -FNDA:774,RebasingFundingManager.transferProposalToken -DA:121,517 -FN:127,RebasingFundingManager._deposit -FNDA:22333,RebasingFundingManager._deposit -DA:129,22333 -BRDA:129,0,0,256 -BRDA:129,0,1,22077 -DA:130,256 -DA:133,22077 -BRDA:133,1,0,- -BRDA:133,1,1,22077 -DA:134,0 -DA:137,22077 -DA:139,22077 -DA:141,22077 -FN:144,RebasingFundingManager._withdraw -FNDA:8380,RebasingFundingManager._withdraw -DA:145,8380 -DA:147,8380 -DA:149,8380 -FN:152,RebasingFundingManager._transferProposalToken -FNDA:517,RebasingFundingManager._transferProposalToken -DA:153,517 -DA:155,517 +DA:82,75372 +FN:86,RebasingFundingManager._supplyTarget +FNDA:28169,RebasingFundingManager._supplyTarget +DA:92,28169 +FN:98,RebasingFundingManager.deposit +FNDA:12460,RebasingFundingManager.deposit +DA:99,12460 +FN:102,RebasingFundingManager.depositFor +FNDA:7854,RebasingFundingManager.depositFor +DA:103,7854 +FN:106,RebasingFundingManager.withdraw +FNDA:3610,RebasingFundingManager.withdraw +DA:107,3610 +FN:110,RebasingFundingManager.withdrawTo +FNDA:3477,RebasingFundingManager.withdrawTo +DA:111,3477 +FN:117,RebasingFundingManager.transferOrchestratorToken +FNDA:774,RebasingFundingManager.transferOrchestratorToken +DA:122,517 +FN:128,RebasingFundingManager._deposit +FNDA:20314,RebasingFundingManager._deposit +DA:130,20314 +BRDA:130,0,0,256 +BRDA:130,0,1,20058 +DA:131,256 +DA:134,20058 +BRDA:134,1,0,- +BRDA:134,1,1,20058 +DA:135,0 +DA:138,20058 +DA:140,20058 +DA:142,20058 +FN:145,RebasingFundingManager._withdraw +FNDA:7087,RebasingFundingManager._withdraw +DA:146,7087 +DA:148,7087 +DA:150,7087 +FN:153,RebasingFundingManager._transferOrchestratorToken +FNDA:517,RebasingFundingManager._transferOrchestratorToken +DA:154,517 +DA:156,517 FNF:11 FNH:10 -LF:26 -LH:25 +LF:25 +LH:24 BRF:4 BRH:3 end_of_record TN: SF:src/modules/fundingManager/token/ElasticReceiptTokenBase.sol FN:201,ElasticReceiptTokenBase.transfer -FNDA:489,ElasticReceiptTokenBase.transfer -DA:209,489 -DA:211,489 +FNDA:488,ElasticReceiptTokenBase.transfer +DA:209,488 +DA:211,488 DA:213,256 FN:217,ElasticReceiptTokenBase.transferFrom -FNDA:1259,ElasticReceiptTokenBase.transferFrom -DA:226,1259 -DA:228,1259 -DA:229,747 +FNDA:1261,ElasticReceiptTokenBase.transferFrom +DA:226,1261 +DA:228,1261 +DA:229,749 DA:231,512 FN:235,ElasticReceiptTokenBase.transferAll FNDA:256,ElasticReceiptTokenBase.transferAll @@ -1066,10 +1071,10 @@ DA:269,256 DA:272,512 DA:274,512 FN:278,ElasticReceiptTokenBase.approve -FNDA:2027,ElasticReceiptTokenBase.approve -DA:284,2027 -DA:286,2027 -DA:287,2027 +FNDA:2029,ElasticReceiptTokenBase.approve +DA:284,2029 +DA:286,2029 +DA:287,2029 FN:295,ElasticReceiptTokenBase.increaseAllowance FNDA:512,ElasticReceiptTokenBase.increaseAllowance DA:299,512 @@ -1105,8 +1110,8 @@ FN:398,ElasticReceiptTokenBase.totalSupply FNDA:780,ElasticReceiptTokenBase.totalSupply DA:399,780 FN:403,ElasticReceiptTokenBase.balanceOf -FNDA:64877,ElasticReceiptTokenBase.balanceOf -DA:404,64877 +FNDA:56451,ElasticReceiptTokenBase.balanceOf +DA:404,56451 FN:408,ElasticReceiptTokenBase.scaledTotalSupply FNDA:2,ElasticReceiptTokenBase.scaledTotalSupply DA:409,2 @@ -1120,67 +1125,67 @@ FN:426,ElasticReceiptTokenBase.DOMAIN_SEPARATOR FNDA:1,ElasticReceiptTokenBase.DOMAIN_SEPARATOR DA:427,2 FN:442,ElasticReceiptTokenBase._tokensToBits -FNDA:35543,ElasticReceiptTokenBase._tokensToBits -DA:443,35543 +FNDA:32081,ElasticReceiptTokenBase._tokensToBits +DA:443,32081 FN:449,ElasticReceiptTokenBase._bitsToTokens -FNDA:9554,ElasticReceiptTokenBase._bitsToTokens -DA:450,9554 +FNDA:8274,ElasticReceiptTokenBase._bitsToTokens +DA:450,8274 FN:459,ElasticReceiptTokenBase._mint -FNDA:25671,ElasticReceiptTokenBase._mint -DA:466,25627 -BRDA:466,4,0,362 -BRDA:466,4,1,25265 -DA:467,362 -DA:471,25265 -DA:472,25265 -DA:478,25265 -DA:479,25265 -BRDA:479,5,0,4210 -BRDA:479,5,1,25265 -DA:480,4210 -DA:484,25265 -DA:485,25265 -DA:488,25265 +FNDA:23474,ElasticReceiptTokenBase._mint +DA:466,23431 +BRDA:466,4,0,349 +BRDA:466,4,1,23082 +DA:467,349 +DA:471,23082 +DA:472,23082 +DA:478,23082 +DA:479,23082 +BRDA:479,5,0,4046 +BRDA:479,5,1,23082 +DA:480,4046 +DA:484,23082 +DA:485,23082 +DA:488,23082 FN:498,ElasticReceiptTokenBase._burn -FNDA:8530,ElasticReceiptTokenBase._burn -DA:506,8530 -DA:507,8530 -DA:510,8530 -DA:511,8530 -DA:516,8530 -DA:517,8530 -DA:520,8380 -DA:521,8380 -DA:524,8380 +FNDA:7250,ElasticReceiptTokenBase._burn +DA:506,7250 +DA:507,7250 +DA:510,7250 +DA:511,7250 +DA:516,7250 +DA:517,7250 +DA:520,7087 +DA:521,7087 +DA:524,7087 FN:533,ElasticReceiptTokenBase._rebase -FNDA:38233,ElasticReceiptTokenBase._rebase -DA:534,38233 -DA:538,38233 -BRDA:538,6,0,4574 -BRDA:538,6,1,33659 -DA:539,4574 -DA:543,33659 -DA:544,33659 -DA:547,33659 -DA:548,33659 +FNDA:34758,ElasticReceiptTokenBase._rebase +DA:534,34758 +DA:538,34758 +BRDA:538,6,0,4397 +BRDA:538,6,1,30361 +DA:539,4397 +DA:543,30361 +DA:544,30361 +DA:547,30361 +DA:548,30361 FN:553,ElasticReceiptTokenBase._activeBits -FNDA:67456,ElasticReceiptTokenBase._activeBits -DA:554,67456 +FNDA:60695,ElasticReceiptTokenBase._activeBits +DA:554,60695 FN:559,ElasticReceiptTokenBase._transfer -FNDA:35799,ElasticReceiptTokenBase._transfer -DA:562,35799 -DA:563,35331 -DA:565,35331 -BRDA:565,7,0,2572 -BRDA:565,7,1,35331 -DA:566,2572 -DA:569,35331 +FNDA:32337,ElasticReceiptTokenBase._transfer +DA:562,32337 +DA:563,31868 +DA:565,31868 +BRDA:565,7,0,2561 +BRDA:565,7,1,31868 +DA:566,2561 +DA:569,31868 FN:574,ElasticReceiptTokenBase._useAllowance -FNDA:2027,ElasticReceiptTokenBase._useAllowance -DA:578,2027 -BRDA:578,8,0,1771 -BRDA:578,8,1,1259 -DA:579,1771 +FNDA:2029,ElasticReceiptTokenBase._useAllowance +DA:578,2029 +BRDA:578,8,0,1773 +BRDA:578,8,1,1261 +DA:579,1773 FNF:24 FNH:24 LF:78 @@ -1191,9 +1196,9 @@ end_of_record TN: SF:src/modules/fundingManager/token/ElasticReceiptTokenUpgradeable.sol FN:13,ElasticReceiptTokenUpgradeable.__ElasticReceiptToken_init -FNDA:523,ElasticReceiptTokenUpgradeable.__ElasticReceiptToken_init -DA:18,523 -BRDA:18,0,0,256 +FNDA:345,ElasticReceiptTokenUpgradeable.__ElasticReceiptToken_init +DA:18,345 +BRDA:18,0,0,78 BRDA:18,0,1,267 DA:21,267 DA:22,267 @@ -1209,23 +1214,23 @@ end_of_record TN: SF:src/modules/lib/LibMetadata.sol FN:17,LibMetadata.identifier -FNDA:3357,LibMetadata.identifier -DA:22,3357 +FNDA:3614,LibMetadata.identifier +DA:22,3614 FN:32,LibMetadata.isValid -FNDA:1030,LibMetadata.isValid -DA:38,1030 -BRDA:38,0,0,1 -BRDA:38,0,1,1029 -DA:39,1 -DA:43,1029 -BRDA:43,1,0,1 -BRDA:43,1,1,1028 -DA:44,1 -DA:48,1028 +FNDA:5678,LibMetadata.isValid +DA:38,5678 +BRDA:38,0,0,2 +BRDA:38,0,1,5676 +DA:39,2 +DA:43,5676 +BRDA:43,1,0,2 +BRDA:43,1,1,5674 +DA:44,2 +DA:48,5674 BRDA:48,2,0,- -BRDA:48,2,1,1028 +BRDA:48,2,1,5674 DA:49,0 -DA:52,1028 +DA:52,5674 FNF:2 FNH:2 LF:8 @@ -1235,187 +1240,189 @@ BRH:5 end_of_record TN: SF:src/modules/logicModule/BountyManager.sol -FN:104,BountyManager.validContributorsForBounty -FNDA:159256,BountyManager.validContributorsForBounty -DA:109,159256 -DA:111,159256 -BRDA:111,0,0,4 -BRDA:111,0,1,159252 -DA:112,4 -DA:114,159252 -DA:115,159252 -DA:116,159252 -DA:117,159252 -DA:118,159252 -DA:119,624925 -DA:122,624925 -BRDA:122,1,0,117 -BRDA:122,1,1,624808 -DA:123,117 -DA:126,624808 -DA:128,624808 -BRDA:127,2,0,31 -BRDA:127,2,1,624777 -DA:131,31 -DA:134,624777 -DA:136,624777 -DA:141,159104 -BRDA:140,3,0,71 -BRDA:140,3,1,159033 -DA:144,71 -FN:193,BountyManager.init +FN:105,BountyManager.validContributorsForBounty +FNDA:157107,BountyManager.validContributorsForBounty +DA:110,157107 +DA:112,157107 +BRDA:112,0,0,2 +BRDA:112,0,1,157105 +DA:113,2 +DA:115,157105 +DA:116,157105 +DA:117,157105 +DA:118,157105 +DA:119,157105 +DA:120,623464 +DA:123,623464 +BRDA:123,1,0,111 +BRDA:123,1,1,623353 +DA:124,111 +DA:127,623353 +DA:129,623353 +DA:130,623333 +BRDA:128,2,0,20 +BRDA:128,2,1,623333 +DA:132,20 +DA:135,623333 +DA:137,623333 +DA:142,156974 +DA:143,156912 +BRDA:141,3,0,83 +BRDA:141,3,1,156891 +DA:145,83 +FN:194,BountyManager.init FNDA:4,BountyManager.init -DA:198,3 -DA:200,3 +DA:199,3 DA:201,3 -FN:204,BountyManager.init2 +DA:202,3 +FN:205,BountyManager.init2 FNDA:3,BountyManager.init2 -DA:211,3 -FN:219,BountyManager.getBountyInformation -FNDA:4600,BountyManager.getBountyInformation -DA:225,4373 -FN:229,BountyManager.listBountyIds +DA:212,3 +FN:220,BountyManager.getBountyInformation +FNDA:4861,BountyManager.getBountyInformation +DA:226,4632 +FN:230,BountyManager.listBountyIds FNDA:0,BountyManager.listBountyIds -DA:230,0 -FN:234,BountyManager.isExistingBountyId +DA:231,0 +FN:235,BountyManager.isExistingBountyId FNDA:1,BountyManager.isExistingBountyId -DA:235,164967 -FN:239,BountyManager.getClaimInformation -FNDA:7000,BountyManager.getClaimInformation -DA:245,6769 -FN:249,BountyManager.listClaimIds +DA:236,163081 +FN:240,BountyManager.getClaimInformation +FNDA:7203,BountyManager.getClaimInformation +DA:246,6977 +FN:250,BountyManager.listClaimIds FNDA:0,BountyManager.listClaimIds -DA:250,0 -FN:254,BountyManager.isExistingClaimId +DA:251,0 +FN:255,BountyManager.isExistingClaimId FNDA:0,BountyManager.isExistingClaimId -DA:255,8620 -FN:259,BountyManager.listClaimIdsForContributorAddress -FNDA:294934,BountyManager.listClaimIdsForContributorAddress -DA:264,294934 -FN:271,BountyManager.addBounty -FNDA:127857,BountyManager.addBounty -DA:282,127564 -DA:285,127564 -DA:287,127564 -DA:289,127564 -DA:290,127564 -DA:291,127564 -DA:293,127564 -DA:297,127564 -FN:301,BountyManager.updateBounty +DA:256,8825 +FN:260,BountyManager.listClaimIdsForContributorAddress +FNDA:297804,BountyManager.listClaimIdsForContributorAddress +DA:265,297804 +FN:272,BountyManager.addBounty +FNDA:135969,BountyManager.addBounty +DA:283,135631 +DA:286,135631 +DA:288,135631 +DA:290,135631 +DA:291,135631 +DA:292,135631 +DA:294,135631 +DA:298,135631 +FN:302,BountyManager.updateBounty FNDA:258,BountyManager.updateBounty -DA:306,256 -DA:308,256 -FN:312,BountyManager.lockBounty +DA:307,256 +DA:309,256 +FN:313,BountyManager.lockBounty FNDA:6,BountyManager.lockBounty -DA:318,3 -DA:320,3 -FN:324,BountyManager.addClaim -FNDA:159002,BountyManager.addClaim -DA:335,158999 -DA:337,158777 -DA:340,158777 -DA:342,158777 -DA:345,158777 -DA:347,158777 -DA:348,158777 -DA:349,610332 -DA:351,610332 -DA:353,610332 -DA:357,158777 -DA:359,158777 -DA:361,158777 -FN:365,BountyManager.updateClaimContributors +DA:319,3 +DA:321,3 +FN:325,BountyManager.addClaim +FNDA:156853,BountyManager.addClaim +DA:336,156850 +DA:338,156635 +DA:341,156635 +DA:343,156635 +DA:346,156635 +DA:348,156635 +DA:349,156635 +DA:350,608618 +DA:352,608618 +DA:354,608618 +DA:358,156635 +DA:360,156635 +DA:362,156635 +FN:366,BountyManager.updateClaimContributors FNDA:260,BountyManager.updateClaimContributors -DA:375,257 -DA:376,256 -DA:378,256 +DA:376,257 +DA:377,256 DA:379,256 -DA:381,512 -DA:383,512 -DA:387,256 -DA:389,256 -DA:391,256 -DA:392,11548 -DA:394,11548 -DA:396,11548 -DA:400,256 -FN:404,BountyManager.updateClaimDetails +DA:380,256 +DA:382,512 +DA:384,512 +DA:388,256 +DA:390,256 +DA:392,256 +DA:393,11594 +DA:395,11594 +DA:397,11594 +DA:401,256 +FN:405,BountyManager.updateClaimDetails FNDA:514,BountyManager.updateClaimDetails -DA:409,256 -DA:411,256 -FN:415,BountyManager.verifyClaim -FNDA:847,BountyManager.verifyClaim -DA:423,656 -DA:425,656 -DA:428,656 -DA:431,656 -DA:434,656 -DA:435,12273 -DA:436,12273 -DA:438,12273 -DA:447,12273 -DA:452,656 -DA:455,656 -DA:460,656 -DA:462,656 -FN:469,BountyManager.grantBountyAdminRole +DA:410,256 +DA:412,256 +FN:416,BountyManager.verifyClaim +FNDA:849,BountyManager.verifyClaim +DA:424,661 +DA:426,661 +DA:429,661 +DA:432,661 +DA:435,661 +DA:436,12208 +DA:437,12208 +DA:439,12208 +DA:448,12208 +DA:453,661 +DA:456,661 +DA:461,661 +DA:463,661 +FN:470,BountyManager.grantBountyAdminRole FNDA:513,BountyManager.grantBountyAdminRole -DA:471,513 DA:472,513 DA:473,513 -FN:477,BountyManager.grantClaimAdminRole +DA:474,513 +FN:478,BountyManager.grantClaimAdminRole FNDA:1,BountyManager.grantClaimAdminRole -DA:478,1 DA:479,1 DA:480,1 -FN:484,BountyManager.grantVerifyAdminRole +DA:481,1 +FN:485,BountyManager.grantVerifyAdminRole FNDA:1,BountyManager.grantVerifyAdminRole -DA:485,1 DA:486,1 DA:487,1 -FN:491,BountyManager.revokeBountyAdminRole +DA:488,1 +FN:492,BountyManager.revokeBountyAdminRole FNDA:256,BountyManager.revokeBountyAdminRole -DA:492,256 DA:493,256 DA:494,256 -FN:498,BountyManager.revokeClaimAdminRole +DA:495,256 +FN:499,BountyManager.revokeClaimAdminRole FNDA:0,BountyManager.revokeClaimAdminRole -DA:499,0 DA:500,0 DA:501,0 -FN:505,BountyManager.revokeVerifyAdminRole +DA:502,0 +FN:506,BountyManager.revokeVerifyAdminRole FNDA:0,BountyManager.revokeVerifyAdminRole -DA:506,0 DA:507,0 DA:508,0 -FN:514,BountyManager._ensureTokenBalance -FNDA:12930,BountyManager._ensureTokenBalance -DA:518,12930 -DA:520,12930 -BRDA:520,4,0,- -BRDA:520,4,1,12273 -DA:523,12273 -DA:524,12273 -DA:533,12273 -BRDA:533,5,0,- -BRDA:533,5,1,12273 -DA:534,0 -FN:539,BountyManager._ensureTokenAllowance +DA:509,0 +FN:515,BountyManager._ensureTokenBalance +FNDA:12870,BountyManager._ensureTokenBalance +DA:519,12870 +DA:521,12870 +BRDA:521,4,0,- +BRDA:521,4,1,12208 +DA:524,12208 +DA:525,12208 +DA:534,12208 +BRDA:534,5,0,- +BRDA:534,5,1,12208 +DA:535,0 +FN:540,BountyManager._ensureTokenAllowance FNDA:1,BountyManager._ensureTokenAllowance -DA:543,1 DA:544,1 -DA:546,1 -BRDA:546,6,0,1 -BRDA:546,6,1,1 +DA:545,1 DA:547,1 -FN:551,BountyManager._isAuthorizedPaymentProcessor +BRDA:547,6,0,1 +BRDA:547,6,1,1 +DA:548,1 +FN:552,BountyManager._isAuthorizedPaymentProcessor FNDA:1,BountyManager._isAuthorizedPaymentProcessor -DA:557,1 +DA:558,1 FNF:26 FNH:21 -LF:111 -LH:102 +LF:113 +LH:104 BRF:14 BRH:12 end_of_record @@ -1433,11 +1440,11 @@ BRDA:210,0,0,- BRDA:210,0,1,3 DA:211,0 FN:219,MilestoneManager.getMilestoneInformation -FNDA:5093,MilestoneManager.getMilestoneInformation -DA:225,9191 +FNDA:5194,MilestoneManager.getMilestoneInformation +DA:225,9292 FN:229,MilestoneManager.listMilestoneIds -FNDA:7551,MilestoneManager.listMilestoneIds -DA:230,7551 +FNDA:6855,MilestoneManager.listMilestoneIds +DA:230,6855 FN:234,MilestoneManager.getActiveMilestoneId FNDA:514,MilestoneManager.getActiveMilestoneId DA:235,514 @@ -1454,30 +1461,31 @@ DA:245,5 DA:248,1026 DA:252,1026 DA:253,1026 +DA:254,770 FN:258,MilestoneManager.isNextMilestoneActivatable FNDA:771,MilestoneManager.isNextMilestoneActivatable -DA:260,11757 -DA:261,11757 +DA:260,11806 +DA:261,11806 BRDA:261,3,0,259 -BRDA:261,3,1,11498 +BRDA:261,3,1,11547 DA:262,259 -DA:266,11498 +DA:266,11547 BRDA:265,4,0,512 -BRDA:265,4,1,10986 +BRDA:265,4,1,11035 DA:269,512 -DA:273,10986 +DA:273,11035 BRDA:273,5,0,- -BRDA:273,5,1,10986 +BRDA:273,5,1,11035 DA:274,0 -DA:278,10986 +DA:278,11035 BRDA:278,6,0,8196 -BRDA:278,6,1,2790 +BRDA:278,6,1,2839 DA:279,8196 -DA:282,2790 -DA:286,2790 +DA:282,2839 +DA:286,2839 FN:290,MilestoneManager.isExistingMilestoneId FNDA:1,MilestoneManager.isExistingMilestoneId -DA:291,48203 +DA:291,47706 FN:295,MilestoneManager.getPreviousMilestoneId FNDA:768,MilestoneManager.getPreviousMilestoneId DA:300,768 @@ -1486,9 +1494,9 @@ FNDA:2,MilestoneManager.isContributor DA:309,4355 DA:312,4099 DA:313,4099 -DA:314,9976 +DA:314,10114 BRDA:314,7,0,3843 -BRDA:314,7,1,6133 +BRDA:314,7,1,6271 DA:315,3843 DA:318,256 FN:322,MilestoneManager.getSalaryPrecision @@ -1504,13 +1512,14 @@ FN:335,MilestoneManager.getMilestoneUpdateTimelock FNDA:1,MilestoneManager.getMilestoneUpdateTimelock DA:336,1 FN:343,MilestoneManager.addMilestone -FNDA:32389,MilestoneManager.addMilestone -DA:349,32133 -DA:351,32125 +FNDA:31931,MilestoneManager.addMilestone +DA:349,31675 +DA:351,31667 FN:355,MilestoneManager.stopMilestone FNDA:1025,MilestoneManager.stopMilestone DA:360,769 DA:365,769 +DA:366,768 BRDA:364,8,0,1 BRDA:364,8,1,768 DA:368,1 @@ -1519,49 +1528,49 @@ DA:375,768 DA:378,768 DA:382,768 FN:386,MilestoneManager.removeMilestone -FNDA:6271,MilestoneManager.removeMilestone -DA:391,6014 -DA:395,6014 +FNDA:5575,MilestoneManager.removeMilestone +DA:391,5318 +DA:395,5318 BRDA:395,9,0,256 -BRDA:395,9,1,5758 +BRDA:395,9,1,5062 DA:396,256 -DA:400,5758 -DA:403,5758 -DA:405,5758 +DA:400,5062 +DA:403,5062 +DA:405,5062 FN:409,MilestoneManager.startNextMilestone -FNDA:11242,MilestoneManager.startNextMilestone -DA:410,10986 +FNDA:11291,MilestoneManager.startNextMilestone +DA:410,11035 BRDA:410,10,0,257 -BRDA:410,10,1,10729 +BRDA:410,10,1,10778 DA:411,257 -DA:415,10729 -DA:416,10729 -DA:419,10729 -DA:422,10729 -DA:424,10729 -DA:426,10729 +DA:415,10778 +DA:416,10778 +DA:419,10778 +DA:422,10778 +DA:424,10778 +DA:426,10778 BRDA:426,11,0,- -BRDA:426,11,1,186229 -DA:428,10729 -DA:430,10729 -DA:432,10729 -DA:433,10473 -DA:436,10473 -DA:437,10473 +BRDA:426,11,1,191620 +DA:428,10778 +DA:430,10778 +DA:432,10778 +DA:433,10522 +DA:436,10522 +DA:437,10522 BRDA:437,12,0,- -BRDA:437,12,1,169 -DA:439,169 -DA:440,169 -DA:443,169 -DA:452,10473 +BRDA:437,12,1,170 +DA:439,170 +DA:440,170 +DA:443,170 +DA:452,10522 BRDA:452,13,0,- -BRDA:452,13,1,186229 -DA:454,10304 -DA:455,10304 -DA:456,186229 -DA:466,10304 -DA:470,10473 -DA:474,10473 +BRDA:452,13,1,191620 +DA:454,10352 +DA:455,10352 +DA:456,191620 +DA:466,10352 +DA:470,10522 +DA:474,10522 FN:478,MilestoneManager.updateMilestone FNDA:2050,MilestoneManager.updateMilestone DA:485,1793 @@ -1582,17 +1591,18 @@ BRDA:501,16,1,1536 DA:502,512 DA:503,512 DA:507,1536 +DA:508,1536 BRDA:506,17,0,256 BRDA:506,17,1,1536 DA:510,256 DA:511,256 DA:514,1536 BRDA:514,18,0,- -BRDA:514,18,1,12214 +BRDA:514,18,1,12399 DA:516,512 DA:517,512 DA:518,512 -DA:519,12214 +DA:519,12399 DA:521,512 DA:524,1536 BRDA:524,19,0,1536 @@ -1643,20 +1653,20 @@ BRDA:597,25,1,- DA:598,0 DA:600,0 FN:613,MilestoneManager._addMilestone -FNDA:32125,MilestoneManager._addMilestone -DA:620,32125 -DA:623,32125 -DA:626,32125 -DA:627,32125 -DA:629,32125 -DA:630,32125 -DA:631,280913 -DA:634,32125 -DA:635,32125 -DA:637,32125 -DA:641,32125 +FNDA:31667,MilestoneManager._addMilestone +DA:620,31667 +DA:623,31667 +DA:626,31667 +DA:627,31667 +DA:629,31667 +DA:630,31667 +DA:631,286912 +DA:634,31667 +DA:635,31667 +DA:637,31667 +DA:641,31667 FN:654,MilestoneManager._validateMilestoneDetails -FNDA:33926,MilestoneManager._validateMilestoneDetails +FNDA:33468,MilestoneManager._validateMilestoneDetails FN:664,MilestoneManager.hashContributors FNDA:3072,MilestoneManager.hashContributors DA:669,3072 @@ -1664,25 +1674,25 @@ DA:671,3072 DA:672,3072 DA:673,3072 DA:675,3072 -DA:676,39546 -DA:677,39546 -DA:678,39546 +DA:676,40545 +DA:677,40545 +DA:678,40545 DA:681,3072 FN:684,MilestoneManager.updateMilestoneUpdateTimelock FNDA:0,MilestoneManager.updateMilestoneUpdateTimelock DA:688,0 DA:689,0 FN:695,MilestoneManager._ensureTokenBalance -FNDA:21204,MilestoneManager._ensureTokenBalance -DA:699,21204 -DA:701,21204 +FNDA:21302,MilestoneManager._ensureTokenBalance +DA:699,21302 +DA:701,21302 BRDA:701,26,0,256 -BRDA:701,26,1,18157 -DA:704,18413 -DA:705,18413 -DA:714,18413 +BRDA:701,26,1,18206 +DA:704,18462 +DA:705,18462 +DA:714,18462 BRDA:714,27,0,256 -BRDA:714,27,1,18157 +BRDA:714,27,1,18206 DA:715,256 FN:720,MilestoneManager._ensureTokenAllowance FNDA:2,MilestoneManager._ensureTokenAllowance @@ -1697,152 +1707,152 @@ FNDA:2,MilestoneManager._isAuthorizedPaymentProcessor DA:738,2 FNF:30 FNH:27 -LF:156 -LH:148 +LF:159 +LH:151 BRF:58 BRH:50 end_of_record TN: SF:src/modules/logicModule/RecurringPaymentManager.sol -FN:85,RecurringPaymentManager.init +FN:86,RecurringPaymentManager.init FNDA:2311,RecurringPaymentManager.init -DA:90,2310 -DA:92,2310 -DA:94,2310 -DA:97,2310 -BRDA:97,0,0,2 -BRDA:97,0,1,2308 -DA:98,2 -FN:106,RecurringPaymentManager.getEpochLength -FNDA:40058,RecurringPaymentManager.getEpochLength -DA:107,40058 -FN:111,RecurringPaymentManager.getRecurringPaymentInformation -FNDA:320769,RecurringPaymentManager.getRecurringPaymentInformation -DA:117,320536 -FN:121,RecurringPaymentManager.listRecurringPaymentIds -FNDA:14844,RecurringPaymentManager.listRecurringPaymentIds -DA:122,14844 -FN:126,RecurringPaymentManager.getPreviousPaymentId +DA:91,2310 +DA:93,2310 +DA:95,2310 +DA:98,2310 +BRDA:98,0,0,2 +BRDA:98,0,1,2308 +DA:99,2 +FN:107,RecurringPaymentManager.getEpochLength +FNDA:42644,RecurringPaymentManager.getEpochLength +DA:108,42644 +FN:112,RecurringPaymentManager.getRecurringPaymentInformation +FNDA:341893,RecurringPaymentManager.getRecurringPaymentInformation +DA:118,341659 +FN:122,RecurringPaymentManager.listRecurringPaymentIds +FNDA:14188,RecurringPaymentManager.listRecurringPaymentIds +DA:123,14188 +FN:127,RecurringPaymentManager.getPreviousPaymentId FNDA:0,RecurringPaymentManager.getPreviousPaymentId -DA:127,0 -FN:131,RecurringPaymentManager.isExistingRecurringPaymentId +DA:128,0 +FN:132,RecurringPaymentManager.isExistingRecurringPaymentId FNDA:0,RecurringPaymentManager.isExistingRecurringPaymentId -DA:132,322561 -FN:139,RecurringPaymentManager.getEpochFromTimestamp +DA:133,343685 +FN:140,RecurringPaymentManager.getEpochFromTimestamp FNDA:0,RecurringPaymentManager.getEpochFromTimestamp -DA:144,0 -FN:148,RecurringPaymentManager.getCurrentEpoch -FNDA:131877,RecurringPaymentManager.getCurrentEpoch -DA:149,310917 -FN:153,RecurringPaymentManager.getFutureEpoch +DA:145,0 +FN:149,RecurringPaymentManager.getCurrentEpoch +FNDA:144634,RecurringPaymentManager.getCurrentEpoch +DA:150,334199 +FN:154,RecurringPaymentManager.getFutureEpoch FNDA:768,RecurringPaymentManager.getFutureEpoch -DA:158,768 -FN:165,RecurringPaymentManager.addRecurringPayment -FNDA:166360,RecurringPaymentManager.addRecurringPayment -DA:178,166308 -DA:181,166308 -DA:184,166308 -DA:185,166308 -DA:187,166308 -DA:189,166308 -DA:191,166308 -DA:199,166308 -FN:203,RecurringPaymentManager.removeRecurringPayment -FNDA:8473,RecurringPaymentManager.removeRecurringPayment -DA:208,8472 -DA:211,8472 -DA:214,8472 -DA:216,8472 -FN:223,RecurringPaymentManager.trigger -FNDA:3186,RecurringPaymentManager.trigger -DA:224,3186 -FN:228,RecurringPaymentManager.triggerFor +DA:159,768 +FN:166,RecurringPaymentManager.addRecurringPayment +FNDA:177616,RecurringPaymentManager.addRecurringPayment +DA:179,177581 +DA:182,177581 +DA:185,177581 +DA:186,177581 +DA:188,177581 +DA:190,177581 +DA:192,177581 +DA:200,177581 +FN:204,RecurringPaymentManager.removeRecurringPayment +FNDA:7667,RecurringPaymentManager.removeRecurringPayment +DA:209,7666 +DA:212,7666 +DA:215,7666 +DA:217,7666 +FN:224,RecurringPaymentManager.trigger +FNDA:3261,RecurringPaymentManager.trigger +DA:225,3261 +FN:229,RecurringPaymentManager.triggerFor FNDA:1024,RecurringPaymentManager.triggerFor -DA:235,256 -FN:238,RecurringPaymentManager._triggerFor -FNDA:11914,RecurringPaymentManager._triggerFor -DA:240,11914 -DA:242,11914 -DA:245,11914 -DA:248,161113 -DA:249,149199 -DA:250,149199 -DA:258,11914 -DA:259,11914 -DA:262,11914 -DA:265,11914 -DA:268,11914 -DA:271,11914 -DA:274,161113 -DA:275,149199 -DA:278,149199 -BRDA:278,1,0,- -BRDA:278,1,1,16798 -DA:279,18935 -DA:282,18935 -BRDA:282,2,0,- -BRDA:282,2,1,16798 -DA:283,18935 -DA:284,18935 -BRDA:284,3,0,- -BRDA:284,3,1,16798 -DA:285,16798 -DA:290,149199 -DA:292,149199 -DA:295,11914 -DA:298,11914 -DA:299,149199 -BRDA:299,4,0,18935 -BRDA:299,4,1,149199 -DA:300,149199 -BRDA:300,5,0,16798 -BRDA:300,5,1,149199 -DA:302,11914 -DA:304,11914 -DA:306,11914 -DA:309,11914 -DA:312,161113 -DA:314,149199 -BRDA:314,6,0,- -BRDA:314,6,1,16798 -DA:316,18935 -DA:319,18935 -DA:326,18935 -DA:329,18935 -BRDA:329,7,0,- -BRDA:329,7,1,16798 -DA:331,16798 -DA:334,16798 -DA:343,16798 -DA:346,18935 -DA:350,149199 -DA:351,149199 -DA:354,11914 -DA:357,11914 -DA:361,11914 -FN:366,RecurringPaymentManager._ensureTokenBalance -FNDA:15100,RecurringPaymentManager._ensureTokenBalance -DA:370,15100 -DA:372,15100 -BRDA:372,8,0,- -BRDA:372,8,1,3267 -DA:375,3267 -DA:376,3267 -DA:385,3267 -BRDA:385,9,0,- -BRDA:385,9,1,3267 -DA:386,0 -FN:391,RecurringPaymentManager._ensureTokenAllowance -FNDA:3186,RecurringPaymentManager._ensureTokenAllowance -DA:395,3186 -DA:396,3186 -DA:398,3186 -BRDA:398,10,0,2146 -BRDA:398,10,1,3186 -DA:399,2146 -FN:403,RecurringPaymentManager._isAuthorizedPaymentProcessor -FNDA:3186,RecurringPaymentManager._isAuthorizedPaymentProcessor -DA:409,3186 +DA:236,256 +FN:239,RecurringPaymentManager._triggerFor +FNDA:11183,RecurringPaymentManager._triggerFor +DA:241,11183 +DA:243,11183 +DA:246,11183 +DA:249,171457 +DA:250,160274 +DA:251,160274 +DA:259,11183 +DA:260,11183 +DA:263,11183 +DA:266,11183 +DA:269,11183 +DA:272,11183 +DA:275,171457 +DA:276,160274 +DA:279,160274 +BRDA:279,1,0,- +BRDA:279,1,1,17959 +DA:280,20210 +DA:283,20210 +BRDA:283,2,0,- +BRDA:283,2,1,17959 +DA:284,20210 +DA:285,20210 +BRDA:285,3,0,- +BRDA:285,3,1,17959 +DA:286,17959 +DA:291,160274 +DA:293,160274 +DA:296,11183 +DA:299,11183 +DA:300,160274 +BRDA:300,4,0,20210 +BRDA:300,4,1,160274 +DA:301,160274 +BRDA:301,5,0,17959 +BRDA:301,5,1,160274 +DA:303,11183 +DA:305,11183 +DA:307,11183 +DA:310,11183 +DA:313,171457 +DA:315,160274 +BRDA:315,6,0,- +BRDA:315,6,1,17959 +DA:317,20210 +DA:320,20210 +DA:327,20210 +DA:330,20210 +BRDA:330,7,0,- +BRDA:330,7,1,17959 +DA:332,17959 +DA:335,17959 +DA:344,17959 +DA:347,20210 +DA:351,160274 +DA:352,160274 +DA:355,11183 +DA:358,11183 +DA:362,11183 +FN:367,RecurringPaymentManager._ensureTokenBalance +FNDA:14444,RecurringPaymentManager._ensureTokenBalance +DA:371,14444 +DA:373,14444 +BRDA:373,8,0,- +BRDA:373,8,1,3356 +DA:376,3356 +DA:377,3356 +DA:386,3356 +BRDA:386,9,0,- +BRDA:386,9,1,3356 +DA:387,0 +FN:392,RecurringPaymentManager._ensureTokenAllowance +FNDA:3261,RecurringPaymentManager._ensureTokenAllowance +DA:396,3261 +DA:397,3261 +DA:399,3261 +BRDA:399,10,0,2244 +BRDA:399,10,1,3261 +DA:400,2244 +FN:404,RecurringPaymentManager._isAuthorizedPaymentProcessor +FNDA:3261,RecurringPaymentManager._isAuthorizedPaymentProcessor +DA:410,3261 FNF:17 FNH:14 LF:83 @@ -1889,15 +1899,16 @@ FN:85,StreamingPaymentProcessor.init FNDA:257,StreamingPaymentProcessor.init DA:90,256 FN:94,StreamingPaymentProcessor.claimAll -FNDA:44427,StreamingPaymentProcessor.claimAll -DA:96,44427 -BRDA:95,0,0,8174 -BRDA:95,0,1,36253 -DA:102,8174 -DA:107,36253 +FNDA:56002,StreamingPaymentProcessor.claimAll +DA:96,56002 +BRDA:95,0,0,10806 +BRDA:95,0,1,45196 +DA:102,10806 +DA:107,45196 FN:111,StreamingPaymentProcessor.claimForSpecificWalletId FNDA:512,StreamingPaymentProcessor.claimForSpecificWalletId DA:117,512 +DA:118,512 BRDA:116,1,0,- BRDA:116,1,1,512 DA:120,0 @@ -1910,7 +1921,7 @@ FN:140,StreamingPaymentProcessor.processPayments FNDA:4356,StreamingPaymentProcessor.processPayments DA:146,3844 BRDA:146,3,0,- -BRDA:146,3,1,75091 +BRDA:146,3,1,92379 DA:148,3588 DA:149,3588 DA:150,3588 @@ -1925,19 +1936,19 @@ DA:161,3588 DA:162,3588 DA:164,3588 DA:166,3588 -DA:167,75091 -DA:168,75091 -DA:169,75091 -DA:170,75091 -DA:171,75091 -DA:173,75091 -DA:182,75091 -DA:192,75091 +DA:167,92379 +DA:168,92379 +DA:169,92379 +DA:170,92379 +DA:171,92379 +DA:173,92379 +DA:182,92379 +DA:192,92379 FN:199,StreamingPaymentProcessor.cancelRunningPayments FNDA:1024,StreamingPaymentProcessor.cancelRunningPayments DA:204,512 -FN:208,StreamingPaymentProcessor.removeAllContributorPayments -FNDA:0,StreamingPaymentProcessor.removeAllContributorPayments +FN:208,StreamingPaymentProcessor.removeAllPaymentReceiverPayments +FNDA:0,StreamingPaymentProcessor.removeAllPaymentReceiverPayments DA:213,0 BRDA:212,5,0,- BRDA:212,5,1,- @@ -1946,216 +1957,222 @@ DA:220,0 FN:224,StreamingPaymentProcessor.removePaymentForSpecificWalletId FNDA:512,StreamingPaymentProcessor.removePaymentForSpecificWalletId DA:231,512 -DA:238,512 -BRDA:237,6,0,512 -BRDA:237,6,1,512 DA:241,512 -FN:249,StreamingPaymentProcessor.isActiveContributor -FNDA:16573,StreamingPaymentProcessor.isActiveContributor -DA:254,16573 -FN:258,StreamingPaymentProcessor.startForSpecificWalletId -FNDA:8576,StreamingPaymentProcessor.startForSpecificWalletId -DA:263,933388 -FN:267,StreamingPaymentProcessor.dueToForSpecificWalletId -FNDA:8576,StreamingPaymentProcessor.dueToForSpecificWalletId -DA:272,1005701 -FN:276,StreamingPaymentProcessor.releasedForSpecificWalletId -FNDA:8576,StreamingPaymentProcessor.releasedForSpecificWalletId -DA:281,915871 -FN:285,StreamingPaymentProcessor.vestedAmountForSpecificWalletId -FNDA:17517,StreamingPaymentProcessor.vestedAmountForSpecificWalletId -DA:291,924812 -FN:297,StreamingPaymentProcessor.releasableForSpecificWalletId -FNDA:852244,StreamingPaymentProcessor.releasableForSpecificWalletId -DA:302,907295 -FN:308,StreamingPaymentProcessor.unclaimable +DA:242,512 +BRDA:240,6,0,512 +BRDA:240,6,1,512 +DA:246,512 +FN:254,StreamingPaymentProcessor.isActivePaymentReceiver +FNDA:20988,StreamingPaymentProcessor.isActivePaymentReceiver +DA:259,20988 +FN:263,StreamingPaymentProcessor.startForSpecificWalletId +FNDA:11888,StreamingPaymentProcessor.startForSpecificWalletId +DA:268,983564 +FN:272,StreamingPaymentProcessor.dueToForSpecificWalletId +FNDA:11888,StreamingPaymentProcessor.dueToForSpecificWalletId +DA:277,1076708 +FN:281,StreamingPaymentProcessor.releasedForSpecificWalletId +FNDA:11888,StreamingPaymentProcessor.releasedForSpecificWalletId +DA:286,961792 +FN:290,StreamingPaymentProcessor.vestedAmountForSpecificWalletId +FNDA:21772,StreamingPaymentProcessor.vestedAmountForSpecificWalletId +DA:296,971676 +FN:302,StreamingPaymentProcessor.releasableForSpecificWalletId +FNDA:879966,StreamingPaymentProcessor.releasableForSpecificWalletId +DA:307,949904 +DA:309,949904 +FN:313,StreamingPaymentProcessor.unclaimable FNDA:260,StreamingPaymentProcessor.unclaimable -DA:313,44689 -FN:317,StreamingPaymentProcessor.token +DA:318,56264 +FN:322,StreamingPaymentProcessor.token FNDA:1,StreamingPaymentProcessor.token -DA:318,58640 -FN:322,StreamingPaymentProcessor.viewAllPaymentOrders +DA:323,73527 +FN:327,StreamingPaymentProcessor.viewAllPaymentOrders FNDA:2560,StreamingPaymentProcessor.viewAllPaymentOrders -DA:328,2560 -DA:330,2560 -DA:332,2560 DA:333,2560 -DA:334,2560 -DA:336,7936 -DA:337,5376 -DA:341,5376 -DA:345,2560 -FN:355,StreamingPaymentProcessor._afterClaimCleanup -FNDA:54791,StreamingPaymentProcessor._afterClaimCleanup -DA:361,54791 -DA:364,54791 -DA:370,54791 -BRDA:370,7,0,52999 -BRDA:370,7,1,54791 -DA:371,52999 -DA:378,54791 -FN:387,StreamingPaymentProcessor._findAddressInActiveVestings -FNDA:128085,StreamingPaymentProcessor._findAddressInActiveVestings -DA:392,128085 -DA:394,128085 -DA:395,128085 -DA:396,2601606 -BRDA:396,8,0,55559 -BRDA:396,8,1,2546047 -DA:397,55559 -DA:400,2546047 -DA:403,72526 -FN:413,StreamingPaymentProcessor._findActiveWalletId -FNDA:55303,StreamingPaymentProcessor._findActiveWalletId -DA:418,55303 -DA:420,55303 -DA:422,55303 -DA:423,56327 -DA:424,56327 -BRDA:424,9,0,55303 -BRDA:424,9,1,1024 -DA:425,55303 -DA:428,1024 -DA:432,0 -FN:439,StreamingPaymentProcessor._cancelRunningOrders +DA:335,2560 +DA:337,2560 +DA:338,2560 +DA:339,2560 +DA:341,7936 +DA:342,5376 +DA:346,5376 +DA:350,2560 +FN:360,StreamingPaymentProcessor._afterClaimCleanup +FNDA:69678,StreamingPaymentProcessor._afterClaimCleanup +DA:366,69678 +DA:369,69678 +DA:375,69678 +BRDA:375,7,0,67886 +BRDA:375,7,1,69678 +DA:376,67886 +DA:383,69678 +FN:392,StreamingPaymentProcessor._findAddressInActiveVestings +FNDA:160260,StreamingPaymentProcessor._findAddressInActiveVestings +DA:396,160260 +DA:398,160260 +DA:399,160260 +DA:400,4261898 +BRDA:400,8,0,70446 +BRDA:400,8,1,4191452 +DA:401,70446 +DA:404,4191452 +DA:407,89814 +FN:417,StreamingPaymentProcessor._findActiveWalletId +FNDA:70190,StreamingPaymentProcessor._findActiveWalletId +DA:422,70190 +DA:424,70190 +DA:426,70190 +DA:427,71214 +DA:428,71214 +BRDA:428,9,0,70190 +BRDA:428,9,1,1024 +DA:429,70190 +DA:432,1024 +DA:436,0 +FN:443,StreamingPaymentProcessor._cancelRunningOrders FNDA:512,StreamingPaymentProcessor._cancelRunningOrders -DA:440,512 -DA:441,512 -DA:443,512 -DA:444,17262 -DA:445,16750 -DA:448,16750 -FN:459,StreamingPaymentProcessor._removePayment -FNDA:16750,StreamingPaymentProcessor._removePayment -DA:460,16750 -DA:462,16750 -DA:464,16750 -DA:465,16750 -DA:466,33500 -DA:467,16750 -DA:468,16750 -DA:473,16750 -BRDA:472,10,0,12105 -BRDA:472,10,1,16750 -DA:476,12105 -DA:480,16750 -FN:491,StreamingPaymentProcessor._removePaymentForSpecificWalletId -FNDA:54791,StreamingPaymentProcessor._removePaymentForSpecificWalletId -DA:496,54791 -DA:498,54791 -BRDA:498,11,0,- -BRDA:498,11,1,54791 -DA:499,0 -DA:507,54791 -DA:511,54791 -FN:520,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId -FNDA:54791,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId -DA:525,54791 -FN:533,StreamingPaymentProcessor._removeContributorFromActiveVestings -FNDA:52999,StreamingPaymentProcessor._removeContributorFromActiveVestings -DA:538,52999 -DA:539,52999 -DA:541,52999 -BRDA:541,12,0,- -BRDA:541,12,1,52999 -DA:542,0 -DA:548,52999 -DA:549,52999 -DA:553,52999 -FN:565,StreamingPaymentProcessor._addPayment -FNDA:75091,StreamingPaymentProcessor._addPayment -DA:574,75091 -BRDA:573,13,0,5 -BRDA:573,13,1,75086 -DA:577,5 -DA:581,75086 -DA:583,75086 -DA:589,75086 -BRDA:588,14,0,72526 -BRDA:588,14,1,75086 -DA:592,72526 -DA:595,75086 -DA:597,75086 -FN:610,StreamingPaymentProcessor._claimAll -FNDA:36253,StreamingPaymentProcessor._claimAll -DA:611,36253 -DA:613,36253 -DA:615,36253 -DA:616,73530 -DA:617,37277 -DA:622,37277 -FN:635,StreamingPaymentProcessor._claimForSpecificWalletId -FNDA:55051,StreamingPaymentProcessor._claimForSpecificWalletId -DA:641,55051 -DA:642,55051 -DA:643,55051 -DA:646,55051 -BRDA:645,15,0,2 -BRDA:645,15,1,55051 -DA:649,2 -DA:650,2 -DA:653,55051 -DA:655,55051 -DA:664,55051 -BRDA:664,16,0,55049 -BRDA:664,16,1,2 -DA:665,55049 -DA:667,2 -DA:670,55051 -DA:671,55051 -DA:674,55051 -BRDA:674,17,0,42174 -BRDA:674,17,1,55051 -DA:675,42174 -FN:685,StreamingPaymentProcessor._vestingAmountForSpecificWalletId -FNDA:924812,StreamingPaymentProcessor._vestingAmountForSpecificWalletId -DA:691,924812 -DA:692,924812 -DA:693,924812 -DA:694,924812 -DA:695,924812 -DA:697,924812 -BRDA:697,18,0,- -BRDA:697,18,1,924812 -DA:698,0 -DA:699,924812 -BRDA:699,19,0,101230 -BRDA:699,19,1,823582 -DA:700,101230 -DA:702,823582 -FN:710,StreamingPaymentProcessor.validAddress -FNDA:75091,StreamingPaymentProcessor.validAddress -DA:711,75091 -FN:720,StreamingPaymentProcessor.validSalary -FNDA:75087,StreamingPaymentProcessor.validSalary -DA:721,75087 -FN:727,StreamingPaymentProcessor.validStart -FNDA:75086,StreamingPaymentProcessor.validStart -DA:728,75086 +DA:444,512 +DA:445,512 +DA:447,512 +DA:448,23206 +DA:449,22694 +DA:452,22694 +FN:463,StreamingPaymentProcessor._removePayment +FNDA:22694,StreamingPaymentProcessor._removePayment +DA:464,22694 +DA:466,22694 +DA:468,22694 +DA:469,22694 +DA:470,45388 +DA:471,22694 +DA:472,22694 +DA:477,22694 +DA:478,22694 +BRDA:476,10,0,16289 +BRDA:476,10,1,22694 +DA:480,16289 +DA:484,22694 +FN:495,StreamingPaymentProcessor._removePaymentForSpecificWalletId +FNDA:69678,StreamingPaymentProcessor._removePaymentForSpecificWalletId +DA:500,69678 +DA:501,69678 +DA:503,69678 +BRDA:503,11,0,- +BRDA:503,11,1,69678 +DA:504,0 +DA:512,69678 +DA:516,69678 +FN:525,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId +FNDA:69678,StreamingPaymentProcessor._removeVestingInformationForSpecificWalletId +DA:530,69678 +FN:538,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings +FNDA:67886,StreamingPaymentProcessor._removePaymentReceiverFromActiveVestings +DA:543,67886 +DA:544,67886 +DA:546,67886 +BRDA:546,12,0,- +BRDA:546,12,1,67886 +DA:547,0 +DA:553,67886 +DA:554,67886 +DA:558,67886 +FN:570,StreamingPaymentProcessor._addPayment +FNDA:92379,StreamingPaymentProcessor._addPayment +DA:579,92379 +DA:580,92374 +BRDA:578,13,0,5 +BRDA:578,13,1,92374 +DA:582,5 +DA:586,92374 +DA:588,92374 +DA:594,92374 +BRDA:593,14,0,89814 +BRDA:593,14,1,92374 +DA:597,89814 +DA:600,92374 +DA:602,92374 +FN:615,StreamingPaymentProcessor._claimAll +FNDA:45196,StreamingPaymentProcessor._claimAll +DA:616,45196 +DA:618,45196 +DA:620,45196 +DA:621,91416 +DA:622,46220 +DA:627,46220 +FN:640,StreamingPaymentProcessor._claimForSpecificWalletId +FNDA:69938,StreamingPaymentProcessor._claimForSpecificWalletId +DA:646,69938 +DA:647,69938 +DA:648,69938 +DA:651,69938 +DA:652,68914 +BRDA:650,15,0,2 +BRDA:650,15,1,69938 +DA:654,2 +DA:655,2 +DA:658,69938 +DA:660,69938 +DA:669,69938 +BRDA:669,16,0,69936 +BRDA:669,16,1,2 +DA:670,69936 +DA:672,2 +DA:675,69938 +DA:676,69938 +DA:679,69938 +BRDA:679,17,0,52877 +BRDA:679,17,1,69938 +DA:680,52877 +FN:690,StreamingPaymentProcessor._vestingAmountForSpecificWalletId +FNDA:971676,StreamingPaymentProcessor._vestingAmountForSpecificWalletId +DA:696,971676 +DA:698,971676 +DA:699,971676 +DA:700,971676 +DA:701,971676 +DA:703,971676 +BRDA:703,18,0,- +BRDA:703,18,1,971676 +DA:704,0 +DA:705,971676 +BRDA:705,19,0,127735 +BRDA:705,19,1,843941 +DA:706,127735 +DA:708,843941 +FN:716,StreamingPaymentProcessor.validAddress +FNDA:92379,StreamingPaymentProcessor.validAddress +DA:717,92379 +FN:726,StreamingPaymentProcessor.validSalary +FNDA:92375,StreamingPaymentProcessor.validSalary +DA:727,92375 +FN:733,StreamingPaymentProcessor.validStart +FNDA:92374,StreamingPaymentProcessor.validStart +DA:734,92374 FNF:31 FNH:30 -LF:145 -LH:135 +LF:152 +LH:142 BRF:40 BRH:31 end_of_record TN: -SF:src/proposal/Proposal.sol -FN:94,Proposal.init -FNDA:15542,Proposal.init -DA:104,15286 -DA:105,15286 -DA:108,15286 -DA:110,15286 -DA:112,15286 -DA:113,15286 -DA:114,15286 -DA:117,15286 -DA:122,15286 -DA:123,15286 -DA:124,15286 -FN:135,Proposal._isModuleUsedInProposal -FNDA:0,Proposal._isModuleUsedInProposal +SF:src/orchestrator/Orchestrator.sol +FN:94,Orchestrator.init +FNDA:15443,Orchestrator.init +DA:104,15187 +DA:105,15187 +DA:108,15187 +DA:110,15187 +DA:112,15187 +DA:113,15187 +DA:114,15187 +DA:117,15187 +DA:122,15187 +DA:123,15187 +DA:124,15187 +FN:135,Orchestrator._isModuleUsedInOrchestrator +FNDA:0,Orchestrator._isModuleUsedInOrchestrator DA:140,0 DA:141,0 DA:142,0 @@ -2166,13 +2183,14 @@ DA:148,0 BRDA:148,0,0,- BRDA:148,0,1,- DA:150,0 +DA:151,0 BRDA:149,1,0,- BRDA:149,1,1,- DA:153,0 DA:158,0 DA:162,0 -FN:166,Proposal.findModuleAddressInProposal -FNDA:0,Proposal.findModuleAddressInProposal +FN:166,Orchestrator.findModuleAddressInOrchestrator +FNDA:0,Orchestrator.findModuleAddressInOrchestrator DA:171,0 DA:172,0 DA:173,0 @@ -2180,53 +2198,53 @@ BRDA:173,2,0,- BRDA:173,2,1,- DA:174,0 DA:177,0 -FN:187,Proposal.verifyAddressIsAuthorizerModule -FNDA:0,Proposal.verifyAddressIsAuthorizerModule +FN:187,Orchestrator.verifyAddressIsAuthorizerModule +FNDA:0,Orchestrator.verifyAddressIsAuthorizerModule DA:192,0 DA:194,0 -FN:203,Proposal.verifyAddressIsFundingManager -FNDA:0,Proposal.verifyAddressIsFundingManager +FN:203,Orchestrator.verifyAddressIsFundingManager +FNDA:0,Orchestrator.verifyAddressIsFundingManager DA:208,0 DA:209,0 DA:211,0 -FN:219,Proposal.verifyAddressIsMilestoneManager -FNDA:0,Proposal.verifyAddressIsMilestoneManager +FN:219,Orchestrator.verifyAddressIsMilestoneManager +FNDA:0,Orchestrator.verifyAddressIsMilestoneManager DA:224,0 DA:225,0 DA:227,0 -FN:235,Proposal.verifyAddressIsRecurringPaymentManager -FNDA:0,Proposal.verifyAddressIsRecurringPaymentManager +FN:235,Orchestrator.verifyAddressIsRecurringPaymentManager +FNDA:0,Orchestrator.verifyAddressIsRecurringPaymentManager DA:238,0 DA:239,0 DA:241,0 -FN:249,Proposal.verifyAddressIsPaymentProcessor -FNDA:0,Proposal.verifyAddressIsPaymentProcessor +FN:249,Orchestrator.verifyAddressIsPaymentProcessor +FNDA:0,Orchestrator.verifyAddressIsPaymentProcessor DA:254,0 DA:255,0 DA:257,0 -FN:269,Proposal.__ModuleManager_isAuthorized -FNDA:1586,Proposal.__ModuleManager_isAuthorized +FN:269,Orchestrator.__ModuleManager_isAuthorized +FNDA:1586,Orchestrator.__ModuleManager_isAuthorized DA:275,1586 -FN:282,Proposal.setAuthorizer -FNDA:257,Proposal.setAuthorizer +FN:282,Orchestrator.setAuthorizer +FNDA:257,Orchestrator.setAuthorizer DA:283,257 DA:284,257 DA:285,257 DA:286,257 -FN:290,Proposal.setFundingManager -FNDA:257,Proposal.setFundingManager +FN:290,Orchestrator.setFundingManager +FNDA:257,Orchestrator.setFundingManager DA:294,257 DA:295,257 DA:296,257 DA:297,257 -FN:301,Proposal.setPaymentProcessor -FNDA:257,Proposal.setPaymentProcessor +FN:301,Orchestrator.setPaymentProcessor +FNDA:257,Orchestrator.setPaymentProcessor DA:305,257 DA:306,257 DA:307,257 DA:308,257 -FN:312,Proposal.executeTx -FNDA:1024,Proposal.executeTx +FN:312,Orchestrator.executeTx +FNDA:1024,Orchestrator.executeTx DA:317,512 DA:318,512 DA:319,512 @@ -2235,66 +2253,66 @@ BRDA:321,3,0,256 BRDA:321,3,1,256 DA:322,256 DA:324,256 -FN:332,Proposal.token -FNDA:206841,Proposal.token -DA:333,206841 -FN:337,Proposal.version -FNDA:1,Proposal.version +FN:332,Orchestrator.token +FNDA:212591,Orchestrator.token +DA:333,212591 +FN:337,Orchestrator.version +FNDA:1,Orchestrator.version DA:338,1 -FN:341,Proposal.owner -FNDA:0,Proposal.owner +FN:341,Orchestrator.owner +FNDA:0,Orchestrator.owner DA:347,4357 -FN:350,Proposal.manager -FNDA:4357,Proposal.manager +FN:350,Orchestrator.manager +FNDA:4357,Orchestrator.manager DA:351,4357 FNF:17 FNH:9 -LF:64 +LF:65 LH:34 BRF:8 BRH:2 end_of_record TN: -SF:src/proposal/base/ModuleManager.sol +SF:src/orchestrator/base/ModuleManager.sol FN:101,ModuleManager.__ModuleManager_init -FNDA:17339,ModuleManager.__ModuleManager_init -DA:105,17338 -DA:107,17338 -DA:108,17338 -DA:112,17338 -BRDA:112,0,0,260 -BRDA:112,0,1,17078 -DA:113,260 -DA:116,17078 -DA:117,168131 -DA:119,168131 +FNDA:17240,ModuleManager.__ModuleManager_init +DA:105,17239 +DA:107,17239 +DA:108,17239 +DA:112,17239 +BRDA:112,0,0,261 +BRDA:112,0,1,16978 +DA:113,261 +DA:116,16978 +DA:117,174932 +DA:119,174932 FN:123,ModuleManager.__ModuleManager_addModule -FNDA:213989,ModuleManager.__ModuleManager_addModule -DA:128,213985 +FNDA:220493,ModuleManager.__ModuleManager_addModule +DA:128,220489 FN:147,ModuleManager.hasRole FNDA:1024,ModuleManager.hasRole DA:152,2560 FN:156,ModuleManager.isModule -FNDA:99768,ModuleManager.isModule -DA:162,464880 +FNDA:103479,ModuleManager.isModule +DA:162,479366 FN:166,ModuleManager.listModules -FNDA:1278,ModuleManager.listModules -DA:167,1278 +FNDA:1277,ModuleManager.listModules +DA:167,1277 FN:171,ModuleManager.modulesSize FNDA:0,ModuleManager.modulesSize DA:172,0 FN:179,ModuleManager.addModule -FNDA:79454,ModuleManager.addModule -DA:186,79454 +FNDA:82396,ModuleManager.addModule +DA:186,82396 FN:190,ModuleManager.removeModule -FNDA:32587,ModuleManager.removeModule -DA:195,32846 +FNDA:33843,ModuleManager.removeModule +DA:195,34102 FN:202,ModuleManager.executeTxFromModule -FNDA:33956,ModuleManager.executeTxFromModule -DA:208,33955 -DA:209,33955 -DA:211,33955 -DA:213,33955 +FNDA:34029,ModuleManager.executeTxFromModule +DA:208,34028 +DA:209,34028 +DA:211,34028 +DA:213,34028 FN:217,ModuleManager.grantRole FNDA:1280,ModuleManager.grantRole DA:218,1024 @@ -2317,36 +2335,36 @@ BRDA:237,3,1,256 DA:238,256 DA:239,256 FN:248,ModuleManager._commitAddModule -FNDA:293439,ModuleManager._commitAddModule -DA:250,293439 -DA:251,293439 -DA:252,293439 +FNDA:302885,ModuleManager._commitAddModule +DA:250,302885 +DA:251,302885 +DA:252,302885 FN:257,ModuleManager._commitRemoveModule -FNDA:32846,ModuleManager._commitRemoveModule -DA:264,32846 -DA:266,32846 -DA:268,32846 -DA:269,32846 -DA:270,1091495 -BRDA:270,4,0,32846 -BRDA:270,4,1,1058649 -DA:271,32846 -DA:272,32846 -DA:277,32846 -DA:279,32846 -DA:281,32846 -DA:283,32846 +FNDA:34102,ModuleManager._commitRemoveModule +DA:264,34102 +DA:266,34102 +DA:268,34102 +DA:269,34102 +DA:270,1115544 +BRDA:270,4,0,34102 +BRDA:270,4,1,1081442 +DA:271,34102 +DA:272,34102 +DA:277,34102 +DA:279,34102 +DA:281,34102 +DA:283,34102 FN:286,ModuleManager._ensureValidModule -FNDA:293445,ModuleManager._ensureValidModule -DA:287,293445 +FNDA:302891,ModuleManager._ensureValidModule +DA:287,302891 BRDA:287,5,0,6 -BRDA:287,5,1,293439 +BRDA:287,5,1,302885 DA:288,6 FN:292,ModuleManager._ensureNotModule -FNDA:293702,ModuleManager._ensureNotModule -DA:293,293702 +FNDA:303148,ModuleManager._ensureNotModule +DA:293,303148 BRDA:293,6,0,257 -BRDA:293,6,1,293445 +BRDA:293,6,1,302891 DA:294,257 FNF:16 FNH:15 @@ -2410,31 +2428,31 @@ DA:249,0 DA:252,0 DA:256,0 DA:259,0 -FN:264,E2eTest._createNewProposalWithAllModules -FNDA:0,E2eTest._createNewProposalWithAllModules +FN:264,E2eTest._createNewOrchestratorWithAllModules +FNDA:0,E2eTest._createNewOrchestratorWithAllModules DA:267,0 DA:268,0 DA:269,0 DA:270,0 DA:272,0 DA:273,0 -DA:279,0 -FN:288,E2eTest._createNewProposalWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor -FNDA:0,E2eTest._createNewProposalWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor -DA:291,0 +DA:280,0 +FN:289,E2eTest._createNewOrchestratorWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor +FNDA:0,E2eTest._createNewOrchestratorWithAllModules_withRecurringPaymentManagerAndStreamingPaymentProcessor DA:292,0 DA:293,0 -DA:295,0 +DA:294,0 DA:296,0 -DA:302,0 -FN:311,E2eTest._createNewProposalWithAllModules_withRoleBasedAuthorizerAndBountyManager -FNDA:0,E2eTest._createNewProposalWithAllModules_withRoleBasedAuthorizerAndBountyManager -DA:314,0 -DA:315,0 +DA:297,0 +DA:304,0 +FN:313,E2eTest._createNewOrchestratorWithAllModules_withRoleBasedAuthorizerAndBountyManager +FNDA:0,E2eTest._createNewOrchestratorWithAllModules_withRoleBasedAuthorizerAndBountyManager DA:316,0 +DA:317,0 DA:318,0 -DA:319,0 -DA:325,0 +DA:320,0 +DA:321,0 +DA:328,0 FNF:4 FNH:0 LF:70 @@ -2444,39 +2462,39 @@ BRH:0 end_of_record TN: SF:test/modules/ModuleTest.sol -FN:53,ModuleTest._setUpProposal -FNDA:0,ModuleTest._setUpProposal +FN:53,ModuleTest._setUpOrchestrator +FNDA:0,ModuleTest._setUpOrchestrator DA:54,0 DA:55,0 DA:57,0 DA:58,0 DA:60,0 DA:69,0 -FN:86,ModuleTest._expectProposalCallbackFailure -FNDA:0,ModuleTest._expectProposalCallbackFailure -DA:87,0 -FN:107,ModuleTest._assumeNonEmptyString +FN:86,ModuleTest._expectOrchestratorCallbackFailure +FNDA:0,ModuleTest._expectOrchestratorCallbackFailure +DA:89,0 +FN:109,ModuleTest._assumeNonEmptyString FNDA:0,ModuleTest._assumeNonEmptyString -DA:108,0 -FN:111,ModuleTest._assumeTimestampNotInPast +DA:110,0 +FN:113,ModuleTest._assumeTimestampNotInPast FNDA:0,ModuleTest._assumeTimestampNotInPast -DA:112,0 -FN:117,ModuleTest._assumeElemNotInSet +DA:114,0 +FN:119,ModuleTest._assumeElemNotInSet FNDA:0,ModuleTest._assumeElemNotInSet -DA:121,0 -DA:122,0 -FN:126,ModuleTest._assumeElemNotInSet +DA:123,0 +DA:124,0 +FN:128,ModuleTest._assumeElemNotInSet FNDA:0,ModuleTest._assumeElemNotInSet -DA:127,0 -DA:128,0 -FN:132,ModuleTest._assumeElemNotInSet +DA:129,0 +DA:130,0 +FN:134,ModuleTest._assumeElemNotInSet FNDA:0,ModuleTest._assumeElemNotInSet -DA:136,0 -DA:137,0 -FN:141,ModuleTest._assumeElemNotInSet +DA:138,0 +DA:139,0 +FN:143,ModuleTest._assumeElemNotInSet FNDA:0,ModuleTest._assumeElemNotInSet -DA:145,0 -DA:146,0 +DA:147,0 +DA:148,0 FNF:8 FNH:0 LF:17 @@ -2501,7 +2519,7 @@ DA:59,0 DA:61,0 DA:66,0 DA:72,0 -DA:75,0 +DA:76,0 FNF:1 FNH:0 LF:14 @@ -2539,8 +2557,8 @@ end_of_record TN: SF:test/modules/fundingManager/token/utils/mocks/ERC20Mock.sol FN:13,ERC20Mock.mint -FNDA:3607,ERC20Mock.mint -DA:14,3607 +FNDA:3429,ERC20Mock.mint +DA:14,3429 FN:17,ERC20Mock.burn FNDA:267,ERC20Mock.burn DA:18,267 @@ -2554,15 +2572,15 @@ end_of_record TN: SF:test/modules/fundingManager/token/utils/mocks/ElasticReceiptTokenBaseMock.sol FN:28,ElasticReceiptTokenBaseMock._supplyTarget -FNDA:6496,ElasticReceiptTokenBaseMock._supplyTarget -DA:34,6496 +FNDA:6511,ElasticReceiptTokenBaseMock._supplyTarget +DA:34,6511 FN:37,ElasticReceiptTokenBaseMock.mint FNDA:3338,ElasticReceiptTokenBaseMock.mint DA:38,3338 -DA:39,2932 +DA:39,2946 FN:42,ElasticReceiptTokenBaseMock.burn -FNDA:150,ElasticReceiptTokenBaseMock.burn -DA:43,150 +FNDA:163,ElasticReceiptTokenBaseMock.burn +DA:43,163 DA:44,0 FNF:3 FNH:3 @@ -2594,16 +2612,16 @@ end_of_record TN: SF:test/modules/fundingManager/token/utils/mocks/ElasticReceiptTokenUpgradeableMock.sol FN:18,ElasticReceiptTokenUpgradeableMock.init -FNDA:261,ElasticReceiptTokenUpgradeableMock.init -DA:24,261 +FNDA:83,ElasticReceiptTokenUpgradeableMock.init +DA:24,83 DA:26,5 FN:29,ElasticReceiptTokenUpgradeableMock._supplyTarget -FNDA:256,ElasticReceiptTokenUpgradeableMock._supplyTarget -DA:35,256 +FNDA:78,ElasticReceiptTokenUpgradeableMock._supplyTarget +DA:35,78 FN:38,ElasticReceiptTokenUpgradeableMock.mint -FNDA:256,ElasticReceiptTokenUpgradeableMock.mint -DA:39,256 -DA:40,256 +FNDA:78,ElasticReceiptTokenUpgradeableMock.mint +DA:39,78 +DA:40,78 FN:43,ElasticReceiptTokenUpgradeableMock.burn FNDA:0,ElasticReceiptTokenUpgradeableMock.burn DA:44,0 @@ -2616,32 +2634,32 @@ BRF:0 BRH:0 end_of_record TN: -SF:test/proposal/helper/TypeSanityHelper.sol +SF:test/orchestrator/helper/TypeSanityHelper.sol FN:16,TypeSanityHelper.assumeElemNotInSet FNDA:8960,TypeSanityHelper.assumeElemNotInSet DA:20,8960 -DA:21,595991 -FN:29,TypeSanityHelper.assumeValidProposalId -FNDA:2048,TypeSanityHelper.assumeValidProposalId +DA:21,625411 +FN:29,TypeSanityHelper.assumeValidOrchestratorId +FNDA:2048,TypeSanityHelper.assumeValidOrchestratorId DA:30,2048 FN:41,TypeSanityHelper.assumeValidModules FNDA:3072,TypeSanityHelper.assumeValidModules DA:42,3072 DA:43,3072 -DA:44,216524 -DA:47,216524 -DA:50,216524 +DA:44,226380 +DA:47,226380 +DA:50,226380 FN:54,TypeSanityHelper.assumeValidModule FNDA:2560,TypeSanityHelper.assumeValidModule -DA:55,219084 -DA:57,219084 -DA:58,657252 +DA:55,228940 +DA:57,228940 +DA:58,686820 FN:62,TypeSanityHelper.createInvalidModules FNDA:2,TypeSanityHelper.createInvalidModules -DA:63,219086 -DA:65,219086 -DA:66,219086 -DA:68,219086 +DA:63,228942 +DA:65,228942 +DA:66,228942 +DA:68,228942 FN:75,TypeSanityHelper.assumeValidFunders FNDA:0,TypeSanityHelper.assumeValidFunders FNF:6 @@ -2654,11 +2672,11 @@ end_of_record TN: SF:test/utils/mocks/ERC20Mock.sol FN:14,ERC20Mock.mint -FNDA:121464,ERC20Mock.mint -DA:15,121464 +FNDA:139782,ERC20Mock.mint +DA:15,139782 FN:18,ERC20Mock.burn -FNDA:25233,ERC20Mock.burn -DA:19,25233 +FNDA:27829,ERC20Mock.burn +DA:19,27829 FN:22,ERC20Mock.blockAddress FNDA:1,ERC20Mock.blockAddress DA:23,1 @@ -2670,32 +2688,32 @@ FNDA:2,ERC20Mock.toggleReturnFalse DA:31,2 FN:34,ERC20Mock.isBlockedAddress FNDA:2,ERC20Mock.isBlockedAddress -DA:35,130452 +DA:35,142149 FN:38,ERC20Mock.transfer -FNDA:53061,ERC20Mock.transfer -DA:39,53061 +FNDA:51890,ERC20Mock.transfer +DA:39,51890 BRDA:39,0,0,- -BRDA:39,0,1,53061 +BRDA:39,0,1,51890 DA:40,0 -DA:42,53061 +DA:42,51890 BRDA:42,1,0,- -BRDA:42,1,1,53061 -DA:43,53061 -DA:44,53061 -DA:45,52805 +BRDA:42,1,1,51890 +DA:43,51890 +DA:44,51890 +DA:45,51634 FN:48,ERC20Mock.transferFrom -FNDA:77390,ERC20Mock.transferFrom -DA:53,77390 +FNDA:90258,ERC20Mock.transferFrom +DA:53,90258 BRDA:53,2,0,1 -BRDA:53,2,1,77389 +BRDA:53,2,1,90257 DA:54,1 -DA:56,77389 +DA:56,90257 BRDA:56,3,0,1 -BRDA:56,3,1,77388 -DA:57,77388 -DA:58,77388 -DA:59,77388 -DA:60,77388 +BRDA:56,3,1,90256 +DA:57,90256 +DA:58,90256 +DA:59,90256 +DA:60,90256 FNF:8 FNH:8 LF:19 @@ -2706,12 +2724,12 @@ end_of_record TN: SF:test/utils/mocks/ERC721Mock.sol FN:15,ERC721Mock.mint -FNDA:1840,ERC721Mock.mint -DA:16,1840 -DA:17,1840 +FNDA:1863,ERC721Mock.mint +DA:16,1863 +DA:17,1863 FN:20,ERC721Mock.burn -FNDA:2096,ERC721Mock.burn -DA:21,2096 +FNDA:2119,ERC721Mock.burn +DA:21,2119 FN:24,ERC721Mock.blockAddress FNDA:0,ERC721Mock.blockAddress DA:25,0 @@ -2737,8 +2755,8 @@ end_of_record TN: SF:test/utils/mocks/factories/ModuleFactoryMock.sol FN:20,ModuleFactoryMock.createModule -FNDA:51465,ModuleFactoryMock.createModule -DA:24,51465 +FNDA:50554,ModuleFactoryMock.createModule +DA:24,50554 FN:27,ModuleFactoryMock.getBeaconAndId FNDA:0,ModuleFactoryMock.getBeaconAndId DA:32,0 @@ -2796,8 +2814,8 @@ end_of_record TN: SF:test/utils/mocks/modules/AuthorizerMock.sol FN:15,AuthorizerMock.setIsAuthorized -FNDA:3505,AuthorizerMock.setIsAuthorized -DA:16,3505 +FNDA:3523,AuthorizerMock.setIsAuthorized +DA:16,3523 FN:19,AuthorizerMock.setAllAuthorized FNDA:0,AuthorizerMock.setAllAuthorized DA:20,0 @@ -2817,14 +2835,14 @@ BRDA:43,1,0,- BRDA:43,1,1,256 DA:45,256 FN:51,AuthorizerMock.isAuthorized -FNDA:236518,AuthorizerMock.isAuthorized -DA:52,236518 +FNDA:245863,AuthorizerMock.isAuthorized +DA:52,245863 FN:57,AuthorizerMock.isAuthorized -FNDA:288479,AuthorizerMock.isAuthorized -DA:62,288479 +FNDA:294444,AuthorizerMock.isAuthorized +DA:62,294444 FN:67,AuthorizerMock.generateRoleId FNDA:0,AuthorizerMock.generateRoleId -DA:72,1456 +DA:72,1474 FN:75,AuthorizerMock.grantRoleFromModule FNDA:512,AuthorizerMock.grantRoleFromModule DA:76,512 @@ -2885,9 +2903,9 @@ DA:44,0 FN:47,FundingManagerMock.withdrawTo FNDA:0,FundingManagerMock.withdrawTo DA:48,0 -FN:51,FundingManagerMock.transferProposalToken -FNDA:33691,FundingManagerMock.transferProposalToken -DA:52,33691 +FN:51,FundingManagerMock.transferOrchestratorToken +FNDA:33764,FundingManagerMock.transferOrchestratorToken +DA:52,33764 FNF:8 FNH:3 LF:8 @@ -2897,16 +2915,16 @@ BRH:0 end_of_record TN: SF:test/utils/mocks/modules/PaymentProcessorMock.sol -FN:14,PaymentProcessorMock.processPayments -FNDA:22784,PaymentProcessorMock.processPayments -FN:16,PaymentProcessorMock.cancelRunningPayments +FN:15,PaymentProcessorMock.processPayments +FNDA:22107,PaymentProcessorMock.processPayments +FN:17,PaymentProcessorMock.cancelRunningPayments FNDA:768,PaymentProcessorMock.cancelRunningPayments -FN:18,PaymentProcessorMock.token +FN:19,PaymentProcessorMock.token FNDA:0,PaymentProcessorMock.token -DA:19,0 -FN:22,PaymentProcessorMock.deleteAllPayments -FNDA:2930,PaymentProcessorMock.deleteAllPayments -DA:23,2930 +DA:20,0 +FN:23,PaymentProcessorMock.deleteAllPayments +FNDA:3005,PaymentProcessorMock.deleteAllPayments +DA:24,3005 FNF:4 FNH:3 LF:2 @@ -2918,10 +2936,10 @@ TN: SF:test/utils/mocks/modules/base/ModuleMock.sol FN:7,ModuleMock.init FNDA:516,ModuleMock.init -DA:13,515 -FN:17,ModuleMock.initNoInitializer +DA:12,515 +FN:16,ModuleMock.initNoInitializer FNDA:1,ModuleMock.initNoInitializer -DA:22,1 +DA:21,1 FNF:2 FNH:2 LF:2 @@ -2930,35 +2948,35 @@ BRF:0 BRH:0 end_of_record TN: -SF:test/utils/mocks/modules/mixins/PaymentClientMock.sol -FN:29,PaymentClientMock.setIsAuthorized -FNDA:1,PaymentClientMock.setIsAuthorized +SF:test/utils/mocks/modules/mixins/ERC20PaymentClientMock.sol +FN:29,ERC20PaymentClientMock.setIsAuthorized +FNDA:1,ERC20PaymentClientMock.setIsAuthorized DA:30,1 -FN:36,PaymentClientMock.addPaymentOrder -FNDA:73809,PaymentClientMock.addPaymentOrder -DA:37,73809 -FN:41,PaymentClientMock.addPaymentOrderUnchecked -FNDA:5,PaymentClientMock.addPaymentOrderUnchecked +FN:36,ERC20PaymentClientMock.addPaymentOrder +FNDA:91097,ERC20PaymentClientMock.addPaymentOrder +DA:37,91097 +FN:41,ERC20PaymentClientMock.addPaymentOrderUnchecked +FNDA:5,ERC20PaymentClientMock.addPaymentOrderUnchecked DA:43,5 DA:46,5 DA:50,5 DA:52,5 -FN:55,PaymentClientMock.addPaymentOrders -FNDA:1,PaymentClientMock.addPaymentOrders +FN:55,ERC20PaymentClientMock.addPaymentOrders +FNDA:1,ERC20PaymentClientMock.addPaymentOrders DA:56,1 -FN:62,PaymentClientMock._ensureTokenBalance -FNDA:77656,PaymentClientMock._ensureTokenBalance -DA:66,77656 -BRDA:66,0,0,73342 -BRDA:66,0,1,77656 -DA:67,77656 -DA:69,73342 -DA:70,73342 -FN:74,PaymentClientMock._ensureTokenAllowance -FNDA:3844,PaymentClientMock._ensureTokenAllowance +FN:62,ERC20PaymentClientMock._ensureTokenBalance +FNDA:94944,ERC20PaymentClientMock._ensureTokenBalance +DA:66,94944 +BRDA:66,0,0,90592 +BRDA:66,0,1,94944 +DA:67,94944 +DA:69,90592 +DA:70,90592 +FN:74,ERC20PaymentClientMock._ensureTokenAllowance +FNDA:3844,ERC20PaymentClientMock._ensureTokenAllowance DA:78,3844 -FN:81,PaymentClientMock._isAuthorizedPaymentProcessor -FNDA:3845,PaymentClientMock._isAuthorizedPaymentProcessor +FN:81,ERC20PaymentClientMock._isAuthorizedPaymentProcessor +FNDA:3845,ERC20PaymentClientMock._isAuthorizedPaymentProcessor DA:87,3845 FNF:7 FNH:7 @@ -2968,22 +2986,22 @@ BRF:2 BRH:2 end_of_record TN: -SF:test/utils/mocks/proposal/base/ModuleManagerMock.sol -FN:14,ModuleManagerMock.__ModuleManager_setIsAuthorized +SF:test/utils/mocks/orchestrator/base/ModuleManagerMock.sol +FN:15,ModuleManagerMock.__ModuleManager_setIsAuthorized FNDA:768,ModuleManagerMock.__ModuleManager_setIsAuthorized -DA:15,768 -FN:18,ModuleManagerMock.__ModuleManager_setAllAuthorized +DA:16,768 +FN:19,ModuleManagerMock.__ModuleManager_setAllAuthorized FNDA:0,ModuleManagerMock.__ModuleManager_setAllAuthorized -DA:19,0 -FN:22,ModuleManagerMock.init +DA:20,0 +FN:23,ModuleManagerMock.init FNDA:2053,ModuleManagerMock.init -DA:23,2052 -FN:27,ModuleManagerMock.initNoInitializer +DA:24,2052 +FN:28,ModuleManagerMock.initNoInitializer FNDA:1,ModuleManagerMock.initNoInitializer -DA:28,1 -FN:31,ModuleManagerMock.__ModuleManager_isAuthorized -FNDA:111997,ModuleManagerMock.__ModuleManager_isAuthorized -DA:37,111997 +DA:29,1 +FN:32,ModuleManagerMock.__ModuleManager_isAuthorized +FNDA:116195,ModuleManagerMock.__ModuleManager_isAuthorized +DA:38,116195 FNF:5 FNH:4 LF:5 diff --git a/script/setup/SetupToyProposalScript.s.sol b/script/setup/SetupToyOrchestratorScript.s.sol similarity index 100% rename from script/setup/SetupToyProposalScript.s.sol rename to script/setup/SetupToyOrchestratorScript.s.sol