Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0xF5FB23bd7997c481492e49b6307EC5f95452A8eA
Balance 0 ETH
Nonce 1
Code Size 206 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

206 bytes
0x60806040908152600080356001600160e01b03191681527f79e2f5364a1794e543a069ea9d772e7a103a0756ed0aae5fe6d593fa5df39f0260205220546001600160a01b0316806074576040516319fa09f360e01b81526001600160e01b031960003516600482015260240160405180910390fd5b60405136600082376000803683855af43d806000843e8180156094578184f35b8184fdfea26469706673582212209f3289a5b3f08e6e81173f0893498b679309b37d32ed6f5f5aff38e614b4efde64736f6c63430008160033

Verified Source Code Full Match

Compiler: v0.8.22+commit.4fc1097e EVM: paris
TokensFactory.sol 26 lines
// Copyright 2024 DTCC All Rights Reserved
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import { BaseProxy } from "core-contexts-contracts/contracts/common/contracts/upgradability/BaseProxy.sol";
// prettier-ignore
import { 
    IContextPackageInitialization 
} from "core-contexts-contracts/contracts/common/contracts/context/context-factory/interfaces/IContextPackageInitialization.sol";
import { ITokensFactoryInit } from "./interfaces/ITokensFactoryInit.sol";

/// @title Factory of the tokens
/// @notice This contract serves as a factory for creating tokens.
contract TokensFactory is BaseProxy {
    /// @notice Initializes the contract
    /// @param initialPackage Initial package address
    constructor(
        address initialPackage
    )
        BaseProxy(
            initialPackage,
            ITokensFactoryInit.initialize.selector,
            type(IContextPackageInitialization).interfaceId
        )
    {}
}
ITokensFactoryInit.sol 27 lines
// Copyright 2024 DTCC All Rights Reserved
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

/// @title Tokens factory init package interface
/// @dev This interface defines the functions for initializing the tokens factory smart contract.
interface ITokensFactoryInit {
    /// @notice Initialize smart contract
    /// @param updatesRepository Updates repository address
    /// @param symbolRegistry Symbol registry address
    /// @param name tokens factory's name
    /// @param description tokens factory's description
    /// @param propertyRegistry Property Registry address
    /// @param dataContextFactoryAddress Data Context Factory address
    /// @param roleRegistry Role Registry address
    /// @param roleAddresses Role addresses
    function initialize(
        string memory name,
        string memory description,
        address updatesRepository,
        address symbolRegistry,
        address dataContextFactoryAddress,
        address propertyRegistry,
        address roleRegistry,
        address[] memory roleAddresses
    ) external;
}
IContextPackageInitialization.sol 28 lines
// Copyright 2024 DTCC All Rights Reserved
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

/// @title IContextPackageInitializationErrors
/// @notice Interface for context package initialization errors.
interface IContextPackageInitializationErrors {
    error OnlyInitializationOwnerAllowed();
    error UpdatesRepositoryCannotBeZeroAddress();
}

/// @title IContextPackageInitialization
/// @notice Interface for initializing a context package.
interface IContextPackageInitialization is IContextPackageInitializationErrors {
    /// @notice Initializes the context package with the provided data.
    /// @param name The name of the context package.
    /// @param description The description of the context package.
    /// @param updatesRepository The address of the updates repository.
    /// @param controller The address of the controller.
    /// @param data The initialization data.
    function initialize(
        string calldata name,
        string calldata description,
        address updatesRepository,
        address controller,
        bytes memory data
    ) external;
}
BaseProxy.sol 66 lines
// Copyright 2024 DTCC All Rights Reserved
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

import { IERC165 } from "updates-repository-contracts/src/common/interfaces/IERC165.sol";
import { AddressUtils } from "../../libraries/AddressUtils.sol";
import { UpgradabilityStorageLib } from "./UpgradabilityStorageLib.sol";

/// @title BaseProxy
/// @notice Base contract for proxy contracts.
abstract contract BaseProxy {
    using AddressUtils for address;

    error MethodNotFound(bytes4 selector);
    error InitialPackageCannotBeTheZeroAddress();
    error InitialPackageNotContract();

    /// @notice Initializes the BaseProxy contract with the initial package and the initialization selector.
    /// @param initialPackage Address of the initial package.
    /// @param initializeSelector Selector of the initialization function.
    constructor(address initialPackage, bytes4 initializeSelector, bytes4 initializationInterfaceId) {
        if (initialPackage == address(0)) {
            revert InitialPackageCannotBeTheZeroAddress();
        }
        if (!initialPackage._isContract()) {
            revert InitialPackageNotContract();
        }

        UpgradabilityStorageLib.UpgradabilityStorage storage upgradabilityStorage = UpgradabilityStorageLib
            ._getUpgradabilityStorage();

        upgradabilityStorage._initializationOwnerAddress = msg.sender;

        upgradabilityStorage._methodsImplementations[initializeSelector] = initialPackage;
        upgradabilityStorage._supportedInterfaces[initializationInterfaceId] = true;

        upgradabilityStorage._methodsImplementations[IERC165.supportsInterface.selector] = initialPackage;
        upgradabilityStorage._supportedInterfaces[type(IERC165).interfaceId] = true;
    }

    /// @notice Fallback function allowing to perform a delegatecall.
    /// @notice This function will return whatever the implementation call returns
    // solhint-disable-next-line comprehensive-interface
    fallback() external payable {
        address impl = UpgradabilityStorageLib._getUpgradabilityStorage()._methodsImplementations[msg.sig];
        if (impl == address(0)) {
            revert MethodNotFound(msg.sig);
        }

        assembly {
            let p := mload(0x40)
            calldatacopy(p, 0x00, calldatasize())
            let result := delegatecall(gas(), impl, p, calldatasize(), 0x00, 0x00)
            let size := returndatasize()
            returndatacopy(p, 0x00, size)

            switch result
            case 0x00 {
                revert(p, size)
            }
            default {
                return(p, size)
            }
        }
    }
}
UpgradabilityStorageLib.sol 36 lines
// Copyright 2024 DTCC All Rights Reserved
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.22;

/// @title UpgradabilityStorage
/// @notice Storage contract for upgradable contracts.
library UpgradabilityStorageLib {
    // keccak256(abi.encode(uint256(keccak256("Upgradability")) - 1)) & ~bytes32(uint256(0xff));
    bytes32 private constant UPGRADABILITY_STORAGE_LOCATION =
        0x79e2f5364a1794e543a069ea9d772e7a103a0756ed0aae5fe6d593fa5df39f00;

    /// @dev Storage of the Upgradability contract.
    /// It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
    /// when using with upgradeable contracts.
    /// @custom:storage-location erc7201:upgradability
    // solhint-disable-next-line ordering
    struct UpgradabilityStorage {
        // Address of the initialization owner
        address _initializationOwnerAddress;
        // Address of the updates repository
        address _updatesRepositoryAddress;
        // Mapping of method selectors to their implementation addresses
        mapping(bytes4 methodSelector => address implementationAddress) _methodsImplementations;
        // packageAddress => functionSelectors
        mapping(address packageAddress => bytes4[] functionSelectors) _packageFunctionSelectors;
        // Mapping of interface identifiers to their support status
        mapping(bytes4 interfaceId => bool isSupported) _supportedInterfaces;
    }

    /// @notice Returns the storage slot of UpgradabilityStorage struct
    function _getUpgradabilityStorage() internal pure returns (UpgradabilityStorage storage _storage) {
        assembly {
            _storage.slot := UPGRADABILITY_STORAGE_LOCATION
        }
    }
}
AddressUtils.sol 25 lines
/// Original work Copyright 2016 Smart Contract Solutions, Inc.
/// Modified work Copyright 2024 DTCC All Rights Reserved
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

/// @title AddressUtils
/// @notice Utility library of inline functions on addresses
library AddressUtils {
    /// @dev Returns whether the target address is a contract
    /// @dev This function will return false if invoked during the constructor of a contract,
    /// @dev as the code is not actually created until after the constructor finishes.
    /// @param _addr address to check
    /// @return whether the target address is a contract
    function _isContract(address _addr) internal view returns (bool) {
        uint256 size;
        // XXX Currently there is no better way to check if there is a contract in an address
        // than to check the size of the code at that address.
        // See https://ethereum.stackexchange.com/a/14016/36603
        // for more details about how this works.
        assembly {
            size := extcodesize(_addr)
        }
        return size > 0;
    }
}
IERC165.sol 14 lines
// SPDX-License-Identifier: MIT
pragma solidity 0.8.22;

interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

Recent Transactions

No transactions found for this address