zellic-audit
Initial commit
f998fcd
raw
history blame
7.89 kB
{
"language": "Solidity",
"sources": {
"utils/ConduitCreator.sol": {
"content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.14;\n\n/**\n * @title ConduitCreatorInterface\n * @author 0age\n * @notice ConduitCreatorInterface contains function endpoints and an error\n * declaration for the ConduitCreator contract.\n */\ninterface ConduitCreatorInterface {\n // Declare custom error for an invalid conduit creator.\n error InvalidConduitCreator();\n\n /**\n * @notice Deploy a new conduit on a given conduit controller using a\n * supplied conduit key and assigning an initial owner for the\n * deployed conduit. Only callable by the conduit creator.\n *\n * @param conduitController The conduit controller used to deploy the\n * conduit.\n * @param conduitKey The conduit key used to deploy the\n * conduit.\n * @param initialOwner The initial owner to set for the new\n * conduit.\n *\n * @return conduit The address of the newly deployed conduit.\n */\n function createConduit(\n ConduitControllerInterface conduitController,\n bytes32 conduitKey,\n address initialOwner\n ) external returns (address conduit);\n\n /**\n * @notice Initiate conduit ownership transfer by assigning a new potential\n * owner for the given conduit. Only callable by the conduit\n * creator.\n *\n * @param conduitController The conduit controller used to deploy the\n * conduit.\n * @param conduit The conduit for which to initiate ownership\n * transfer.\n */\n function transferOwnership(\n ConduitControllerInterface conduitController,\n address conduit,\n address newPotentialOwner\n ) external;\n\n /**\n * @notice Clear the currently set potential owner, if any, from a conduit.\n * Only callable by the conduit creator.\n *\n * @param conduitController The conduit controller used to deploy the\n * conduit.\n * @param conduit The conduit for which to cancel ownership\n * transfer.\n */\n function cancelOwnershipTransfer(\n ConduitControllerInterface conduitController,\n address conduit\n ) external;\n}\n\n/**\n * @title ConduitControllerInterface\n * @author 0age\n * @notice ConduitControllerInterface contains relevant external function\n * interfaces for a conduit controller contract.\n */\ninterface ConduitControllerInterface {\n /**\n * @notice Deploy a new conduit using a supplied conduit key and assign an\n * initial owner for the deployed conduit.\n *\n * @param conduitKey The conduit key used to deploy the conduit.\n * @param initialOwner The initial owner to set for the new conduit.\n *\n * @return conduit The address of the newly deployed conduit.\n */\n function createConduit(bytes32 conduitKey, address initialOwner)\n external\n returns (address conduit);\n\n /**\n * @notice Initiate conduit ownership transfer by assigning a new potential\n * owner for the given conduit. Once set, the new potential owner\n * may call `acceptOwnership` to claim ownership of the conduit.\n * Only the owner of the conduit in question may call this function.\n *\n * @param conduit The conduit for which to initiate ownership transfer.\n */\n function transferOwnership(address conduit, address newPotentialOwner)\n external;\n\n /**\n * @notice Clear the currently set potential owner, if any, from a conduit.\n * Only the owner of the conduit in question may call this function.\n *\n * @param conduit The conduit for which to cancel ownership transfer.\n */\n function cancelOwnershipTransfer(address conduit) external;\n}\n\n/**\n * @title ConduitCreator\n * @author 0age\n * @notice ConduitCreator allows a specific account to create new conduits on\n arbitrary conduit controllers.\n */\ncontract ConduitCreator is ConduitCreatorInterface {\n // Set the conduit creator as an immutable argument.\n address internal immutable _CONDUIT_CREATOR;\n\n /**\n * @notice Modifier to ensure that only the conduit creator can call a given\n * function.\n */\n modifier onlyCreator() {\n // Ensure that the caller is the conduit creator.\n if (msg.sender != _CONDUIT_CREATOR) {\n revert InvalidConduitCreator();\n }\n\n // Proceed with function execution.\n _;\n }\n\n /**\n * @dev Initialize contract by setting the conduit creator.\n */\n constructor(address conduitCreator) {\n // Set the conduit creator as an immutable argument.\n _CONDUIT_CREATOR = conduitCreator;\n }\n\n /**\n * @notice Deploy a new conduit on a given conduit controller using a\n * supplied conduit key and assigning an initial owner for the\n * deployed conduit. Only callable by the conduit creator.\n *\n * @param conduitController The conduit controller used to deploy the\n * conduit.\n * @param conduitKey The conduit key used to deploy the\n * conduit.\n * @param initialOwner The initial owner to set for the new\n * conduit.\n *\n * @return conduit The address of the newly deployed conduit.\n */\n function createConduit(\n ConduitControllerInterface conduitController,\n bytes32 conduitKey,\n address initialOwner\n ) external override onlyCreator returns (address conduit) {\n // Call the conduit controller to create the conduit.\n conduit = conduitController.createConduit(conduitKey, initialOwner);\n }\n\n /**\n * @notice Initiate conduit ownership transfer by assigning a new potential\n * owner for the given conduit. Only callable by the conduit\n * creator.\n *\n * @param conduitController The conduit controller used to deploy the\n * conduit.\n * @param conduit The conduit for which to initiate ownership\n * transfer.\n */\n function transferOwnership(\n ConduitControllerInterface conduitController,\n address conduit,\n address newPotentialOwner\n ) external override onlyCreator {\n // Call the conduit controller to transfer conduit ownership.\n conduitController.transferOwnership(conduit, newPotentialOwner);\n }\n\n /**\n * @notice Clear the currently set potential owner, if any, from a conduit.\n * Only callable by the conduit creator.\n *\n * @param conduitController The conduit controller used to deploy the\n * conduit.\n * @param conduit The conduit for which to cancel ownership\n * transfer.\n */\n function cancelOwnershipTransfer(\n ConduitControllerInterface conduitController,\n address conduit\n ) external override onlyCreator {\n // Call the conduit controller to cancel ownership transfer.\n conduitController.cancelOwnershipTransfer(conduit);\n }\n}"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}