Verified contractPartial
DealManagerFactory
Address0xeb5a6264bfa9d635d7da3fcce5daf348510d4d23
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.28
- Same code
1 more contract
Details
- Compiler
- solc 0.8.28+commit.7893614a
- Language
- solidity
- Optimization
- Yes, 15 runs
- EVM version
- prague
- Via IR
- yes
- License
- Not stated
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,300,441
- Creation transaction
- 0xa21fb4ded0…34ee0433a9
- Main copy (most transactions)
- 0x571f1b09…80074e20
70 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/DealManagerFactory.solmain15.2 KB
- dependencies/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol9.28 KB
- dependencies/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol6.57 KB
- dependencies/openzeppelin-contracts/contracts/access/Ownable.sol3.1 KB
- dependencies/openzeppelin-contracts/contracts/interfaces/IERC1363.sol4.45 KB
- dependencies/openzeppelin-contracts/contracts/interfaces/IERC165.sol192 B
- dependencies/openzeppelin-contracts/contracts/interfaces/IERC1967.sol636 B
- dependencies/openzeppelin-contracts/contracts/interfaces/IERC20.sol181 B
- dependencies/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol881 B
- dependencies/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol1.72 KB
- dependencies/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol6.24 KB
- dependencies/openzeppelin-contracts/contracts/proxy/Proxy.sol2.67 KB
- dependencies/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol472 B
- dependencies/openzeppelin-contracts/contracts/proxy/beacon/UpgradeableBeacon.sol2.22 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol4.75 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol10.08 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol4.93 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Enumerable.sol1.04 KB
- dependencies/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol792 B
- dependencies/openzeppelin-contracts/contracts/utils/Address.sol6.05 KB
- dependencies/openzeppelin-contracts/contracts/utils/Context.sol963 B
- dependencies/openzeppelin-contracts/contracts/utils/Create2.sol4.47 KB
- dependencies/openzeppelin-contracts/contracts/utils/Errors.sol896 B
- dependencies/openzeppelin-contracts/contracts/utils/Panic.sol1.97 KB
- dependencies/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol3.38 KB
- dependencies/openzeppelin-contracts/contracts/utils/StorageSlot.sol4.18 KB
- dependencies/openzeppelin-contracts/contracts/utils/Strings.sol18.95 KB
- dependencies/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol7.82 KB
- dependencies/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol4.25 KB
- dependencies/openzeppelin-contracts/contracts/utils/introspection/ERC165Checker.sol5.05 KB
- dependencies/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol870 B
- dependencies/openzeppelin-contracts/contracts/utils/math/Math.sol32.15 KB
- dependencies/openzeppelin-contracts/contracts/utils/math/SafeCast.sol34.94 KB
- dependencies/openzeppelin-contracts/contracts/utils/math/SignedMath.sol2.61 KB
- src/CyberCorpConstants.sol6.57 KB
- src/DealManager.sol38.06 KB
- src/creds/storage/lexchexBadgeStorage.sol8.27 KB
- src/interfaces/FeeTypes.sol4.06 KB
- src/interfaces/IAuthAdapter.sol3.91 KB
- src/interfaces/ICondition.sol3.85 KB
- src/interfaces/ICyberAgreementRegistry.sol7.81 KB
- src/interfaces/ICyberCorp.sol5.86 KB
- src/interfaces/IDealManager.sol6.82 KB
- src/interfaces/IDealManagerFactory.sol5.61 KB
- src/interfaces/IDealManagerStorage.sol3.34 KB
- src/interfaces/IERC5484.sol670 B
- src/interfaces/IIssuanceManager.sol14.27 KB
- src/interfaces/ILedgerEntryToken.sol15.73 KB
- src/interfaces/ILexChexBadge.sol14.47 KB
- src/interfaces/ILexScrowStorage.sol3.4 KB
- src/interfaces/ISecondaryTradeStorage.sol17.6 KB
- src/interfaces/ITransferRestrictionHook.sol5.25 KB
- src/interfaces/IUriBuilder.sol6.55 KB
- src/libs/EIP712Lib.sol4.49 KB
- src/libs/FactoryDeploymentLib.sol1.29 KB
- src/libs/JsonLib.sol7.29 KB
- src/libs/auth.sol9.6 KB
- src/libs/conditions/BaseSecondaryTradingCondition.sol2.61 KB
- src/libs/policies/LookThroughPolicy.sol3.31 KB
- src/libs/policies/USJurisdictionPolicy.sol873 B
- src/storage/BorgAuthStorage.sol4.39 KB
- src/storage/DealManagerFactoryStorage.sol6.23 KB
- src/storage/DealManagerStorage.sol21.89 KB
- src/storage/LedgerEntryTokenStorage.sol59.07 KB
- src/storage/LexScrowStorage.sol20.3 KB
- src/storage/SecondaryTradeStorage.sol58.43 KB
- src/storage/extensions/FundInterestExtensionV3.sol19.79 KB
- src/storage/extensions/ICertificateExtension.sol6.2 KB
- src/storage/extensions/ScopedDataLayerLib.sol2.93 KB
src/DealManagerFactory.sol
/* .o.
.888.
.8"888.
.8' `888.
.88ooo8888.
.8' `888.
o88o o8888o
ooo ooooo . ooooo ooooooo ooooo
`88. .888' .o8 `888' `8888 d8'
888b d'888 .ooooo. .o888oo .oooo. 888 .ooooo. Y888..8P
8 Y88. .P 888 d88' `88b 888 `P )88b 888 d88' `88b `8888'
8 `888' 888 888ooo888 888 .oP"888 888 888ooo888 .8PY888.
8 Y 888 888 .o 888 . d8( 888 888 o 888 .o d8' `888b
o8o o888o `Y8bod8P' "888" `Y888""8o o888ooooood8 `Y8bod8P' o888o o88888o
.oooooo. .o8 .oooooo.
d8P' `Y8b "888 d8P' `Y8b
888 oooo ooo 888oooo. .ooooo. oooo d8b 888 .ooooo. oooo d8b oo.ooooo.
888 `88. .8' d88' `88b d88' `88b `888""8P 888 d88' `88b `888""8P 888' `88b
888 `88..8' 888 888 888ooo888 888 888 888 888 888 888 888
`88b ooo `888' 888 888 888 .o 888 `88b ooo 888 888 888 888 888 .o.
`Y8bood8P' .8' `Y8bod8P' `Y8bod8P' d888b `Y8bood8P' `Y8bod8P' d888b 888bod8P' Y8P
.o..P' 888
`Y8P' o888o
_______________________________________________________________________________________________________
All software, documentation and other files and information in this repository (collectively, the "Software")
are copyright MetaLeX Labs, Inc., a Delaware corporation.
All rights reserved.
The Software is proprietary and shall not, in part or in whole, be used, copied, modified, merged, published,
distributed, transmitted, sublicensed, sold, or otherwise used in any form or by any means, electronic or
mechanical, including photocopying, recording, or by any information storage and retrieval system,
except with the express prior written permission of the copyright holder.*/
pragma solidity 0.8.28;
import "openzeppelin-contracts/proxy/ERC1967/ERC1967Proxy.sol";
import "openzeppelin-contracts/utils/Create2.sol";
import "openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "./DealManager.sol";
import "./libs/auth.sol";
import {FactoryDeploymentLib} from "./libs/FactoryDeploymentLib.sol";
import "./storage/DealManagerFactoryStorage.sol";
import "./interfaces/IDealManagerFactory.sol";
import {FeeOverride} from "./interfaces/FeeTypes.sol";
/// @title DealManagerFactory
/// @notice Factory contract for deploying DealManager instances
/// @dev Uses ERC1967Proxy+UUPSUpgradeable pattern for upgradeable DealManager instances
contract DealManagerFactory is UUPSUpgradeable, BorgAuthACL, IDealManagerFactory
{
error InvalidSalt();
error DeploymentFailed();
error ZeroAddress();
error InvalidFeeRatio();
event DealManagerDeployed(address dealManager, string version);
event RefImplementationSet(address refImplementation, string version);
event IntegratorSet(address indexed integrator, bool indexed approved, uint256 feeShare);
event InstanceFeeOverrideSet(address indexed dealManager, bool enabled, uint256 ratio);
event SecondaryInstanceFeeOverrideSet(address indexed dealManager, bool enabled, uint256 ratio);
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
/// @notice Initialize the factory with authentication and reference implementation
/// @param _auth Address of the BorgAuth contract
/// @param _refImplementation Address of the reference DealManager implementation
function initialize(address _auth, address _refImplementation) public initializer {
// Initialize BorgAuthACL
__BorgAuthACL_init(_auth);
DealManagerFactoryStorage.setRefImplementation(_refImplementation);
emit RefImplementationSet(_refImplementation, DealManager(_refImplementation).DEPLOY_VERSION());
}
/// @notice Salt used by a particular caller in this component factory.
function deploymentSalt(bytes32 salt, address deployer) public pure returns (bytes32) {
return FactoryDeploymentLib.deploymentSalt(salt, deployer);
}
function deployDealManager(bytes32 _salt) public returns (address) {
if (_salt == bytes32(0)) revert InvalidSalt();
_salt = deploymentSalt(_salt, msg.sender);
// Create proxy deployment bytecode
bytes memory proxyBytecode = _getBytecode();
// Deploy using CREATE2
address dealManagerProxy = Create2.deploy(0, _salt, proxyBytecode);
if(dealManagerProxy == address(0)) revert DeploymentFailed();
emit DealManagerDeployed(dealManagerProxy, DealManager(DealManagerFactoryStorage.getRefImplementation()).DEPLOY_VERSION());
return dealManagerProxy;
}
/// @notice Computes the deterministic address for a DealManagerBeaconProxy
/// @param _salt Salt used for CREATE2
/// @return computedAddress The precomputed address of the proxy
function computeDealManagerAddress(bytes32 _salt) external view returns (address) {
return computeDealManagerAddress(_salt, msg.sender);
}
/// @notice Predict a deployment by an explicit factory or individual caller.
function computeDealManagerAddress(bytes32 _salt, address deployer) public view returns (address) {
bytes memory proxyBytecode = _getBytecode();
return Create2.computeAddress(deploymentSalt(_salt, deployer), keccak256(proxyBytecode));
}
/// @notice Gets the bytecode for creating new DealManager proxies
/// @dev Internal function used by deployDealManager
/// @return bytecode The proxy contract creation bytecode
function _getBytecode() private view returns (bytes memory bytecode) {
bytes memory sourceCodeBytes = type(ERC1967Proxy).creationCode;
bytecode = abi.encodePacked(sourceCodeBytes, abi.encode(DealManagerFactoryStorage.getRefImplementation(), ""));
}
/// @notice Get the reference implementation contract for the next deployments
/// @return Current reference implementation contract address
function getRefImplementation() public view returns(address) {
return DealManagerFactoryStorage.getRefImplementation();
}
/// @notice Set the reference implementation contract for the next deployments
/// @dev Only callable by addresses with the admin role
/// @param _newImplementation Address of the new implementation
function setRefImplementation(address _newImplementation) public onlyOwner {
DealManagerFactoryStorage.setRefImplementation(_newImplementation);
emit RefImplementationSet(_newImplementation, DealManager(_newImplementation).DEPLOY_VERSION());
}
/// @notice Get the payable address for the fees
/// @return Payable address for the fees
function getPlatformPayable() external view returns (address) {
return DealManagerFactoryStorage.getPlatformPayable();
}
/// @notice Set the payable address for the fees
/// @dev Only callable by addresses with the admin role
/// @param platformPayable New payable address
function setPlatformPayable(address platformPayable) external onlyOwner {
DealManagerFactoryStorage.setPlatformPayable(platformPayable);
}
/// @notice Whether an integrator is whitelisted to receive a fee share (spec §12B.4)
function isIntegratorWhitelisted(address integrator) external view returns (bool) {
return DealManagerFactoryStorage.getIntegrator(integrator).approved;
}
/// @notice This integrator's share of the protocol fee (BASIS_POINTS = 100%)
function getIntegratorFeeShare(address integrator) external view returns (uint256) {
return DealManagerFactoryStorage.getIntegrator(integrator).feeShare;
}
/// @notice Set an integrator's whitelist status and its share of the protocol fee
/// @dev Only callable by addresses with the admin role. Pass approved=false to de-whitelist;
/// settlement then falls through to the unsplit platform-only flow (never reverts).
function setIntegrator(address integrator, bool approved, uint256 feeShare) external onlyOwner {
if (integrator == address(0)) revert ZeroAddress();
if (feeShare > DealManagerFactoryStorage.BASIS_POINTS) revert InvalidFeeRatio();
DealManagerFactoryStorage.setIntegrator(integrator, approved, feeShare);
emit IntegratorSet(integrator, approved, feeShare);
}
/// @notice Get the effective primary fee ratio for the calling DealManager instance.
/// @dev Primary issuance only. Returns the instance-specific override if set, otherwise the global default.
/// Intended to be called by DealManager instances (msg.sender = the DealManager address).
/// We intentionally name it `getDefaultFeeRatio` for backward compatibility so that older DealManagers can
/// still utilize the fee overrides. Secondary trades read `getSecondaryFeeRatio` instead.
/// @return Fee ratio (same unit as BASIS_POINTS)
function getDefaultFeeRatio() external view returns (uint256) {
DealManagerFactoryStorage.DealManagerFactoryData storage s = DealManagerFactoryStorage.dealManagerFactoryStorage();
FeeOverride storage fo = s.primaryFeeOverrides[msg.sender];
return fo.enabled ? fo.ratio : s.defaultPrimaryFeeRatio;
}
/// @notice Get the effective secondary fee ratio for the calling DealManager instance.
/// @dev Secondary trades only. Same keyed read as `getDefaultFeeRatio`, over the secondary config.
/// @return Fee ratio (same unit as BASIS_POINTS)
function getSecondaryFeeRatio() external view returns (uint256) {
DealManagerFactoryStorage.DealManagerFactoryData storage s = DealManagerFactoryStorage.dealManagerFactoryStorage();
FeeOverride storage fo = s.secondaryFeeOverrides[msg.sender];
return fo.enabled ? fo.ratio : s.defaultSecondaryFeeRatio;
}
/// @notice Get the underlying default primary fee ratio without overrides
/// @return Fee ratio (same unit as BASIS_POINTS)
function getUnderlyingDefaultFeeRatio() external view returns (uint256) {
return DealManagerFactoryStorage.getDefaultFeeRatio();
}
/// @notice Get the underlying default secondary fee ratio without overrides
/// @return Fee ratio (same unit as BASIS_POINTS)
function getUnderlyingDefaultSecondaryFeeRatio() external view returns (uint256) {
return DealManagerFactoryStorage.getDefaultSecondaryFeeRatio();
}
/// @notice Get the per-instance primary fee override for a specific DealManager
/// @return Fee override configs
function getInstanceFeeOverride(address dealManager) external view returns (FeeOverride memory) {
return DealManagerFactoryStorage.dealManagerFactoryStorage().primaryFeeOverrides[dealManager];
}
/// @notice Get the per-instance secondary fee override for a specific DealManager
/// @return Fee override configs
function getSecondaryInstanceFeeOverride(address dealManager) external view returns (FeeOverride memory) {
return DealManagerFactoryStorage.dealManagerFactoryStorage().secondaryFeeOverrides[dealManager];
}
/// @notice Set a per-instance primary fee override for a specific DealManager
/// @dev Only callable by the factory owner. Pass enabled=false to remove the override.
function setInstanceFeeOverride(address dealManager, bool enabled, uint256 ratio) external onlyOwner {
if (ratio > DealManagerFactoryStorage.BASIS_POINTS) revert InvalidFeeRatio();
DealManagerFactoryStorage.dealManagerFactoryStorage().primaryFeeOverrides[dealManager] = FeeOverride(enabled, ratio);
emit InstanceFeeOverrideSet(dealManager, enabled, ratio);
}
/// @notice Set a per-instance secondary fee override for a specific DealManager
/// @dev Only callable by the factory owner. Pass enabled=false to remove the override.
function setSecondaryInstanceFeeOverride(address dealManager, bool enabled, uint256 ratio) external onlyOwner {
if (ratio > DealManagerFactoryStorage.BASIS_POINTS) revert InvalidFeeRatio();
DealManagerFactoryStorage.dealManagerFactoryStorage().secondaryFeeOverrides[dealManager] = FeeOverride(enabled, ratio);
emit SecondaryInstanceFeeOverrideSet(dealManager, enabled, ratio);
}
/// @notice Set the primary fee ratio
/// @dev Only callable by the factory owner. Will check validity of the new value
/// @param feeRatio New fee ratio
function setDefaultFeeRatio(uint256 feeRatio) external onlyOwner {
if (feeRatio > DealManagerFactoryStorage.BASIS_POINTS) {
revert InvalidFeeRatio(); // fee ratio should not exceed 100%
}
DealManagerFactoryStorage.setDefaultFeeRatio(feeRatio);
}
/// @notice Set the secondary fee ratio
/// @dev Only callable by the factory owner. Will check validity of the new value
/// @param feeRatio New fee ratio
function setDefaultSecondaryFeeRatio(uint256 feeRatio) external onlyOwner {
if (feeRatio > DealManagerFactoryStorage.BASIS_POINTS) {
revert InvalidFeeRatio(); // fee ratio should not exceed 100%
}
DealManagerFactoryStorage.setDefaultSecondaryFeeRatio(feeRatio);
}
function _authorizeUpgrade(
address newImplementation
) internal override onlyOwner {}
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 15,
"enabled": true
},
"evmVersion": "prague",
"remappings": [
"openzeppelin-contracts/=dependencies/openzeppelin-contracts/contracts/",
"openzeppelin-contracts-upgradeable/=dependencies/openzeppelin-contracts-upgradeable/contracts/",
"erc721a/=dependencies/erc721a-4.3.0/",
"forge-std/=dependencies/forge-std/src/",
"ConditionManager/=dependencies/ConditionManager/src/",
"@openzeppelin/contracts-upgradeable/=dependencies/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=dependencies/openzeppelin-contracts/contracts/",
"erc4626-tests/=dependencies/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"halmos-cheatcodes/=dependencies/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.