// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import { ConduitControllerInterface } from "../interfaces/ConduitControllerInterface.sol"; contract ConsiderationBase { bytes32 internal immutable _NAME_HASH; bytes32 internal immutable _VERSION_HASH; bytes32 internal immutable _EIP_712_DOMAIN_TYPEHASH; bytes32 internal immutable _ORDER_TYPEHASH; uint256 internal immutable _CHAIN_ID; bytes32 internal immutable _DOMAIN_SEPARATOR; ConduitControllerInterface internal immutable _CONDUIT_CONTROLLER; bytes32 internal immutable _CONDUIT_CREATION_CODE_HASH; constructor(address conduitController) { ( _NAME_HASH, _VERSION_HASH, _EIP_712_DOMAIN_TYPEHASH, _ORDER_TYPEHASH ) = _deriveTypehashes(); _CHAIN_ID = block.chainid; _DOMAIN_SEPARATOR = _deriveDomainSeparator(); _CONDUIT_CONTROLLER = ConduitControllerInterface(conduitController); (_CONDUIT_CREATION_CODE_HASH, ) = ( _CONDUIT_CONTROLLER.getConduitCodeHashes() ); } function _deriveDomainSeparator() internal view returns (bytes32) { return keccak256( abi.encode( _EIP_712_DOMAIN_TYPEHASH, _NAME_HASH, _VERSION_HASH, block.chainid, address(this) ) ); } function _nameString() internal pure virtual returns (string memory) { return "Consideration"; } function _deriveTypehashes() internal pure returns ( bytes32 nameHash, bytes32 versionHash, bytes32 eip712DomainTypehash, bytes32 orderTypehash ) { nameHash = keccak256(bytes(_nameString())); versionHash = keccak256(bytes("1.0")); bytes memory orderComponentsTypeString = abi.encodePacked( "OrderComponents(", "address offerer,", "address token,", "uint256 identifier,", "address currency,", "address artist,", "address platform,", "uint256 startTime,", "uint256 endTime,", "uint256 duration,", "uint256 periods,", "uint256 amount,", "uint256 ratio,", "uint256 royalty,", "uint256 fee,", "uint256 withdrawFee,", "uint256 salt,", "bytes32 conduitKey,", "uint256 counter", ")" ); eip712DomainTypehash = keccak256( abi.encodePacked( "EIP712Domain(", "string name,", "string version,", "uint256 chainId,", "address verifyingContract", ")" ) ); orderTypehash = keccak256(orderComponentsTypeString); } }