creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin-4.5.0/contracts/access/Ownable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    constructor() {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n        _;\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby removing any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"
      },
      "@openzeppelin-4.5.0/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
      },
      "contracts/interfaces/IIFODeployerV8.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\n/** @title IIFODeployerV8.\n * @notice It is an interface for IFODeployerV8.sol\n */\ninterface IIFODeployerV8 {\n\n    function previousIFOAddress() external view returns (address);\n\n    function currIFOAddress() external view returns (address);\n}"
      },
      "contracts/interfaces/IIFOV8Minimal.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\n/** @title IIFOV8Minimal.\n * @notice It is an interface for IFOV8.sol\n */\ninterface IIFOV8Minimal {\n    function endTimestamp() external view returns (uint256);\n}\n"
      },
      "contracts/interfaces/IUserInfo.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.4;\n\ninterface IUserInfo {\n    struct UserProfilePack {\n        uint256 userId;\n        uint256 numberPoints;\n        address nftAddress;\n        uint256 tokenId;\n        bool isActive;\n    }\n\n    struct UserCreditPack {\n        uint256 userCredit;\n        uint256 lockStartTime;\n        uint256 lockEndTime;\n    }\n\n    struct UserVeCakePack {\n        int128 amount;\n        uint256 end;\n        address cakePoolProxy;\n        uint128 cakeAmount;\n        uint48 lockEndTime;\n    }\n\n    struct TotalVeCakePack {\n        address userAddress;\n        uint256 executionTimestamp;\n        uint256 supply;\n        bool syncVeCake;\n        bool syncProfile;\n    }\n}\n"
      },
      "contracts/PancakeProfileProxyV2.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport \"@openzeppelin-4.5.0/contracts/access/Ownable.sol\";\nimport \"./interfaces/IUserInfo.sol\";\nimport \"./interfaces/IIFODeployerV8.sol\";\nimport \"./interfaces/IIFOV8Minimal.sol\";\n\ncontract PancakeProfileProxyV2 is Ownable {\n    address public IFODeployerV8Address;\n\n    address public receiver;\n\n    /// @dev mapping [user][userProfilePack]\n    mapping(address => IUserInfo.UserProfilePack) public userProfiles;\n\n    /// @dev mapping [user][ifoAddress][expireDate]\n    mapping(address => mapping(address => uint256)) public dataExpireDates;\n\n    event UserProfileUpdated(address indexed userAddress, uint256 userId, bool isActive);\n\n    /**\n    * @notice Checks if the msg.sender is the receiver address\n     */\n    modifier onlyReceiver() {\n        require(msg.sender == receiver, \"None receiver!\");\n        _;\n    }\n\n    constructor(address _deployer, address _receiver) {\n        IFODeployerV8Address = _deployer;\n        receiver = _receiver;\n    }\n\n    /// @dev Update receiver address in this contract, this is called by owner only\n    /// @param _receiver the address of new receiver\n    function updateReceiver(address _receiver) external onlyOwner {\n        require(receiver != _receiver, \"receiver not change\");\n        receiver = _receiver;\n    }\n\n    function updateDeployer(address _deployer) external onlyOwner {\n        require(IFODeployerV8Address != _deployer, \"IFODeployerV8Address not change\");\n        IFODeployerV8Address = _deployer;\n    }\n\n    function setUserProfile(\n        address _userAddress,\n        uint256 _userId,\n        uint256 _numberPoints,\n        address _nftAddress,\n        uint256 _tokenId,\n        bool _isActive) external onlyReceiver {\n\n        require(_userAddress != address(0), \"setUserProfile: Invalid address\");\n\n        IUserInfo.UserProfilePack storage pack = userProfiles[_userAddress];\n        pack.userId = _userId;\n        pack.numberPoints = _numberPoints;\n        pack.nftAddress = _nftAddress;\n        pack.tokenId = _tokenId;\n        pack.isActive = _isActive;\n\n        address currIFOAddress = IIFODeployerV8(IFODeployerV8Address).currIFOAddress();\n\n        if (currIFOAddress != address(0)) {\n            uint256 ifoEndTimestamp = IIFOV8Minimal(currIFOAddress).endTimestamp();\n\n            if (block.timestamp < ifoEndTimestamp) {\n                dataExpireDates[_userAddress][currIFOAddress] = ifoEndTimestamp;\n            } else {\n                dataExpireDates[_userAddress][currIFOAddress] = type(uint256).max;\n            }\n        }\n\n        emit UserProfileUpdated(_userAddress, _userId, _isActive);\n    }\n\n    function getUserProfile(address _userAddress)\n    external\n    view\n    returns (\n        uint256,\n        uint256,\n        uint256,\n        address,\n        uint256,\n        bool\n    ) {\n        require(_userAddress != address(0), \"getUserProfile: Invalid address\");\n\n        address currIFOAddress = IIFODeployerV8(IFODeployerV8Address).currIFOAddress();\n\n        if (dataExpireDates[_userAddress][currIFOAddress] < block.timestamp) {\n            return (0, 0, 0, address(0x0), 0, false);\n        }\n        return (\n            userProfiles[_userAddress].userId,\n            userProfiles[_userAddress].numberPoints,\n            0,\n            userProfiles[_userAddress].nftAddress,\n            userProfiles[_userAddress].tokenId,\n            userProfiles[_userAddress].isActive\n        );\n    }\n\n    function getUserStatus(address _userAddress) external view returns (bool) {\n        require(_userAddress != address(0), \"getUserStatus: Invalid address\");\n\n        address currIFOAddress = IIFODeployerV8(IFODeployerV8Address).currIFOAddress();\n\n        if (dataExpireDates[_userAddress][currIFOAddress] < block.timestamp) {\n            return false;\n        }\n        return userProfiles[_userAddress].isActive;\n    }\n\n    function getTeamProfile(uint256)\n    external\n    pure\n    returns (\n        string memory,\n        string memory,\n        uint256,\n        uint256,\n        bool\n    ) {\n        return (\"\", \"\", 0, 0, false);\n    }\n\n    /**\n     * @dev To increase the number of points for a user.\n     * Callable only by point admins\n     */\n    function increaseUserPoints(\n        address _userAddress,\n        uint256 _numberPoints,\n        uint256 _campaignId\n    ) external {\n\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 1
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}