-
Notifications
You must be signed in to change notification settings - Fork 16
Orchestrator
File: Orchestrator.sol
- An orchestrator contract, orchestrates the logic, interactions and fundings between different inverter modules to run your customized workflows.
- An orchestrator is composed of a funding mechanism (FundingManager.sol) and a set of modules (ModuleManager.sol).
- Each orchestrator has a unique ID, assigned to it by the
OrchestratorFactory
. - The token being accepted for funding cannot be changed and is set during initialization.
- Authorizations are done via an
IAuthorizer
instance. This is also static and cannot be changed, once set. - Payments, which will be initiated by modules, are processed via a non-changeable
{IPaymentProcessor}
instance.
modifier onlyAuthorized()
- Modifier to guarantee function is only callable by authorized address.
modifier onlyAuthorizedOrManager()
- Modifier to guarantee function is only callable by authorized addresses.
- Uses the IAuthorizer module to check authorized addresses.
NOTE: In the future, the
Ownable
import may be removed and we can rely onIAuthorizer
to validate owners.
function version() external pure returns (string memory)
Returns the version of the proposal instance.
- string: Returned string represents the current version of the
Orchestrator
.
NOTE: Default Orchestrator returns a hardcoded
1
for this function.
function manager() public view override (OwnableUpgradeable, IOrchestrator) returns (address)
Returns the manager of the Proposal.
- address: Address of the manager of the Orchestrator. Currently returns the owner only.
function owner() external view returns (address);
Returns the address of the owner of the orchestrator.
- address: Address of the owner of the Orchestrator.
function orchestratorId() external view returns (unit);
Returns the orchestrator's id. This is a unique id set by the {OrchestratorFactory} during initialization.
- uint: ID of the current orchestrator contract.
function fundingManager() external view returns (IFundingManager);
The {IFundingManager} implementation used to hold and distribute funds.
- IFundingManger: IFundingManger instance of the orchestrator's funding manager.
function authorizer() external view returns (IAuthorizer);
The {IAuthorizer} implementation used to authorize addresses.
- IAuthorizer: IAuthorizer instance of the orchestrator's authorizer.
function paymentProcessor() external view returns (IPaymentProcessor);
The {IPaymentProcessor} implementation used to process module payments.
- IPaymentProcessor: IPaymentProcessor instance of the orchestrator's payment processor.
function findModuleAddressInOrchestrator(string calldata moduleName)
external
view
returns (address);
Finds the address of a given module using it's name in an orchestrator. If not found, function reverts.
- string moduleName: Name of the module that needs to be searched
- address: address of the module passed to the function.
function verifyAddressIsPaymentProcessor(address paymentProcessorAddress)
external
view
returns (bool);
Verify whether the given address is a payment processor. This is done by typecasting the address passed to the function in the relevant module and then calling a view function from that contract to see if the call passes or not.
- address paymentProcessorAddress: The address which is checked for being a paymentProcessor
- bool: bool that determines whether the address passed to the function was a paymentProcessor or not.
function verifyAddressIsRecurringPaymentManager(
address recurringPaymentManager
) external view returns (bool);
Verify whether the given address is the recurring payment manager. This is done by typecasting the address passed to the function in the relevant module and then calling a view function from that contract to see if the call passes or not.
- address recurringPaymentManager: The address which is checked for being a recurringPaymentManager
- bool: bool that determines whether the address passed to the function was a recurringPaymentManager or not.
function verifyAddressIsMilestoneManager(address milestoneManagerAddress)
external
view
returns (bool);
Verify whether the given address is the milestone manager module. This is done by typecasting the address passed to the function in the relevant module and then calling a view function from that contract to see if the call passes or not.
- address milestoneManagerAddress: The address which is checked for being a milestoneManager
- bool: bool that determines whether the address passed to the function was a milestoneManager or not.
function verifyAddressIsFundingManager(address fundingManagerAddress)
external
view
returns (bool);
Verify whether the given address is a funding manager. This is done by typecasting the address passed to the function in the relevant module and then calling a view function from that contract to see if the call passes or not.
- address fundingManagerAddress: The address which is checked for being a fundingManager
- bool: bool that determines whether the address passed to the function was a fundingManager or not.
function verifyAddressIsAuthorizerModule(address authModule)
external
view
returns (bool);
Verify whether the given address is an IAuthorizer module. This is done by typecasting the address passed to the function in the relevant module and then calling a view function from that contract to see if the call passes or not.
- address authModule: The address which is checked for being a authModule
- bool: bool that determines whether the address passed to the function was an authModule or not.
function init(
uint orchestratorId,
address owner,
IERC20 token,
address[] calldata modules,
IFundingManager fundingManager,
IAuthorizer authorizer,
IPaymentProcessor paymentProcessor
) external;
- This function is used to initialize an orchestrator including the transfer of ownership to
owner
, initialization of Module Manager, and setting the values fororchestratorId
and the orchestratortoken
. - The compulsory modules are initialized and added to the orchestrator contract, which includes the Funding Manager, Authorizer, and Payment Processor.
- The optional modules to be added to the Orchestrator are passed in the array
modules
and added to the orchestrator.
-
uint orchestratorId_
-> An unsigned integer that will be used as the ID of the orchestrator being created -
address owner_
-> Address of the owner of the orchestrator -
IERC20 token_
->IERC20
instance of the token which will be used for funding -
address[] modules
-> Array of addresses of modules that will be used in the orchestrator being created -
IFundingManager fundingManger_
->IFundingManager
instance of the fundingManager modules which will be used to handle all funding related operations in the orchestrator contract. -
IAuthorizer authorizer_
->IAuthorizer
instance of the authorizer module which will be used for access control in the orchestrator being created -
IPaymentProcessor paymentProcessor_
->IPaymentProcessor
instance of the payment processor module which will be used to handle all aspects of payments in the orchestrator being created.
function executeTx(address target, bytes memory data)
external
returns (bytes memory);
Executes a call on target target
with call data data
. This function is only callable by authorized caller and will revert if the transaction fails.
-
address target
-> The address to call -
bytes data
-> Calldata that will be used in the call
Return Data
-
bytes
-> The return data of the call made in the functionexecuteTx
.
function setAuthorizer(IAuthorizer authorizer_) external;
Replaces the current authorizer with _authorizer
. Only callable by authorized caller.
- IAuthorizer authorizer_: The IAuthorizer instance of the new authorizer module
function setFundingManager(IFundingManager fundingManager_) external;
Replaces the current funding manager with fundingManager_
. Only callable by authorized caller.
- IFundingManager fundingManager_: The IFundingManager instance of the new funding manager module.
function setPaymentProcessor(IPaymentProcessor paymentProcessor_)
external;
Replaces the current payment processor with paymentProcessor_
. Only callable by authorized caller.
- IPaymentProcessor paymentProcessor_: The IPaymentProcessor instance of the new payment processor module.