creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/q/Account.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport {Errors} from \"src/libraries/Errors.sol\";\nimport {IAccount} from \"src/q/interfaces/IAccount.sol\";\nimport {IOperator} from \"src/storage/interfaces/IOperator.sol\";\n\n/// @title Account\n/// @notice Contract which is cloned and deployed for every `trader` interacting with STFX or OZO\ncontract Account is IAccount {\n    /*//////////////////////////////////////////////////////////////\n                        STATE VARIABLES\n    //////////////////////////////////////////////////////////////*/\n\n    address private immutable OPERATOR;\n\n    /*//////////////////////////////////////////////////////////////\n                            CONSTRUCTOR\n    //////////////////////////////////////////////////////////////*/\n\n    constructor(address _operator) {\n        OPERATOR = _operator;\n    }\n\n    receive() external payable {}\n\n    /*//////////////////////////////////////////////////////////////\n                        EXTERNAL FUNCTIONS\n    //////////////////////////////////////////////////////////////*/\n\n    /// @notice function to execute trades logic\n    /// @dev can only be called by a plugin\n    /// @param adapter address of the contract to execute logic\n    /// @param data calldata of the function to execute logic\n    function execute(address adapter, bytes calldata data, uint256 ethToSend) external payable returns (bytes memory) {\n        bool isPlugin = IOperator(OPERATOR).getPlugin(msg.sender);\n        if (!isPlugin) revert Errors.NoAccess();\n        (bool success, bytes memory returnData) = adapter.call{value: ethToSend}(data);\n        if (!success) revert Errors.CallFailed(returnData);\n        return returnData;\n    }\n}\n"
      },
      "src/libraries/Errors.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nlibrary Errors {\n    // Zero Errors\n    error ZeroAmount();\n    error ZeroAddress();\n    error ZeroTotalRaised();\n    error ZeroClaimableAmount();\n\n    // Modifier Errors\n    error NotOwner();\n    error NotAdmin();\n    error CallerNotVault();\n    error CallerNotTrade();\n    error CallerNotVaultOwner();\n    error CallerNotGenerate();\n    error NoAccess();\n    error NotPlugin();\n\n    // State Errors\n    error BelowMinFundraisingPeriod();\n    error AboveMaxFundraisingPeriod();\n    error BelowMinLeverage();\n    error AboveMaxLeverage();\n    error BelowMinEndTime();\n    error TradeTokenNotApplicable();\n\n    // STV errors\n    error StvDoesNotExist();\n    error AlreadyOpened();\n    error MoreThanTotalRaised();\n    error MoreThanTotalReceived();\n    error StvNotOpen();\n    error StvNotClose();\n    error ClaimNotApplicable();\n    error StvStatusMismatch();\n\n    // General Errors\n    error BalanceLessThanAmount();\n    error FundraisingPeriodEnded();\n    error TotalRaisedMoreThanCapacity();\n    error StillFundraising();\n    error CommandMisMatch();\n    error TradeCommandMisMatch();\n    error NotInitialised();\n    error Initialised();\n    error LengthMismatch();\n    error TransferFailed();\n    error DelegateCallFailed();\n    error CallFailed(bytes);\n    error AccountAlreadyExists();\n    error SwapFailed();\n    error ExchangeDataMismatch();\n    error AccountNotExists();\n    error InputMismatch();\n    error AboveMaxDistributeIndex();\n    error BelowMinStvDepositAmount();\n\n    // Protocol specific errors\n    error GmxFeesMisMatch();\n    error UpdateOrderRequestMisMatch();\n    error CancelOrderRequestMisMatch();\n\n    // Subscriptions\n    error NotASubscriber();\n    error AlreadySubscribed();\n    error MoreThanLimit();\n}\n"
      },
      "src/q/interfaces/IAccount.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IAccount {\n    function execute(address adapter, bytes calldata data, uint256 ethToSend)\n        external\n        payable\n        returns (bytes memory returnData);\n}\n"
      },
      "src/storage/interfaces/IOperator.sol": {
        "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\ninterface IOperator {\n    function getMaxDistributeIndex() external view returns (uint256);\n    function getAddress(string calldata adapter) external view returns (address);\n    function getAddresses(string[] calldata adapters) external view returns (address[] memory);\n    function getTraderAccount(address trader) external view returns (address);\n    function getPlugin(address plugin) external view returns (bool);\n    function getPlugins(address[] calldata plugins) external view returns (bool[] memory);\n    function setAddress(string calldata adapter, address addr) external;\n    function setAddresses(string[] calldata adapters, address[] calldata addresses) external;\n    function setPlugin(address plugin, bool isPlugin) external;\n    function setPlugins(address[] calldata plugins, bool[] calldata isPlugin) external;\n    function setTraderAccount(address trader, address account) external;\n    function getAllSubscribers(address manager) external view returns (address[] memory);\n    function getIsSubscriber(address manager, address subscriber) external view returns (bool);\n    function getSubscriptionAmount(address manager, address subscriber) external view returns (uint96);\n    function getTotalSubscribedAmountPerManager(address manager) external view returns (uint96);\n    function setSubscribe(address manager, address subscriber, uint96 maxLimit) external;\n    function setUnsubscribe(address manager, address subscriber) external;\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "forge-std/=lib/forge-std/src/",
        "@synthetix/=src/interfaces/synthetix/",
        "@openzeppelin/=lib/openzeppelin-contracts/",
        "@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
        "solmate/=lib/solmate/src/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "libraries": {
        "src/Generate.sol": {
          "Generate": "0x74e0ca6e1ecfb462a80f3b7ab6840013ee32c1c5"
        },
        "src/SpotTrade/SpotTrade.sol": {
          "SpotTrade": "0x019dfb87e218a07091c83cec604cb2d48fbdf194"
        },
        "src/Trade.sol": {
          "Trade": "0x16766913fae839da226a669c76f04b2b5e2380a0"
        },
        "src/libraries/BytesCheck.sol": {
          "BytesCheck": "0x3f3a5da6dbb99dc879a8ed2ec26c831da962231f"
        }
      }
    }
  }}