Skip to content

Adapter authorization can be made optional #18

@lekhovitsky

Description

@lekhovitsky

Most adapters in the system are not configurable and do not require factory authorization, but currently they are unconditionally authorized/unauthorized causing higher gas costs of factory upgrades (or anything that iterates over all factory targets).

It might make sense to add a second overloading of allowAdapter with additional argument bool configurable here:

} else if (selector == ICreditConfigureActions.allowAdapter.selector) {
DeployParams memory params = abi.decode(callData[4:], (DeployParams));
address adapter = _deployAdapter(msg.sender, creditManager, params);
address oldAdapter = ICreditManagerV3(creditManager).contractToAdapter(IAdapter(adapter).targetContract());
Call memory unauthorizeCall = _unauthorizeFactory(msg.sender, creditManager, oldAdapter);
Call memory authorizeCall = _authorizeFactory(msg.sender, creditManager, adapter);
Call memory allowCall = _allowAdapter(_creditConfigurator(creditManager), adapter);
return oldAdapter != address(0)
? CallBuilder.build(unauthorizeCall, authorizeCall, allowCall)
: CallBuilder.build(authorizeCall, allowCall);

The other option might be including the skipConfiguration getter in the adapter itself to avoid changes in the factory interface.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions