creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\n  function decimals() external view returns (uint8);\n\n  function description() external view returns (string memory);\n\n  function version() external view returns (uint256);\n\n  function getRoundData(uint80 _roundId)\n    external\n    view\n    returns (\n      uint80 roundId,\n      int256 answer,\n      uint256 startedAt,\n      uint256 updatedAt,\n      uint80 answeredInRound\n    );\n\n  function latestRoundData()\n    external\n    view\n    returns (\n      uint80 roundId,\n      int256 answer,\n      uint256 startedAt,\n      uint256 updatedAt,\n      uint80 answeredInRound\n    );\n}\n"
      },
      "@openzeppelin/contracts/interfaces/draft-IERC6093.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard ERC20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.\n */\ninterface IERC20Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC20InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC20InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     * @param allowance Amount of tokens a `spender` is allowed to operate with.\n     * @param needed Minimum amount required to perform a transfer.\n     */\n    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC20InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n     * @param spender Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.\n */\ninterface IERC721Errors {\n    /**\n     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.\n     * Used in balance queries.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721InvalidOwner(address owner);\n\n    /**\n     * @dev Indicates a `tokenId` whose `owner` is the zero address.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721NonexistentToken(uint256 tokenId);\n\n    /**\n     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param tokenId Identifier number of a token.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC721InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC721InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC721InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.\n */\ninterface IERC1155Errors {\n    /**\n     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     * @param balance Current balance for the interacting account.\n     * @param needed Minimum amount required to perform a transfer.\n     * @param tokenId Identifier number of a token.\n     */\n    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n    /**\n     * @dev Indicates a failure with the token `sender`. Used in transfers.\n     * @param sender Address whose tokens are being transferred.\n     */\n    error ERC1155InvalidSender(address sender);\n\n    /**\n     * @dev Indicates a failure with the token `receiver`. Used in transfers.\n     * @param receiver Address to which tokens are being transferred.\n     */\n    error ERC1155InvalidReceiver(address receiver);\n\n    /**\n     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     * @param owner Address of the current owner of a token.\n     */\n    error ERC1155MissingApprovalForAll(address operator, address owner);\n\n    /**\n     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n     * @param approver Address initiating an approval operation.\n     */\n    error ERC1155InvalidApprover(address approver);\n\n    /**\n     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n     * @param operator Address that may be allowed to operate on tokens without being their owner.\n     */\n    error ERC1155InvalidOperator(address operator);\n\n    /**\n     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n     * Used in batch transfers.\n     * @param idsLength Length of the array of token identifiers\n     * @param valuesLength Length of the array of token amounts\n     */\n    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/ERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n    mapping(address account => uint256) private _balances;\n\n    mapping(address account => mapping(address spender => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `value`.\n     */\n    function transfer(address to, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 value) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, value);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `value`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `value`.\n     */\n    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, value);\n        _transfer(from, to, value);\n        return true;\n    }\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _transfer(address from, address to, uint256 value) internal {\n        if (from == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        if (to == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(from, to, value);\n    }\n\n    /**\n     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n     * this function.\n     *\n     * Emits a {Transfer} event.\n     */\n    function _update(address from, address to, uint256 value) internal virtual {\n        if (from == address(0)) {\n            // Overflow check required: The rest of the code assumes that totalSupply never overflows\n            _totalSupply += value;\n        } else {\n            uint256 fromBalance = _balances[from];\n            if (fromBalance < value) {\n                revert ERC20InsufficientBalance(from, fromBalance, value);\n            }\n            unchecked {\n                // Overflow not possible: value <= fromBalance <= totalSupply.\n                _balances[from] = fromBalance - value;\n            }\n        }\n\n        if (to == address(0)) {\n            unchecked {\n                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n                _totalSupply -= value;\n            }\n        } else {\n            unchecked {\n                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n                _balances[to] += value;\n            }\n        }\n\n        emit Transfer(from, to, value);\n    }\n\n    /**\n     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n     * Relies on the `_update` mechanism\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead.\n     */\n    function _mint(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidReceiver(address(0));\n        }\n        _update(address(0), account, value);\n    }\n\n    /**\n     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n     * Relies on the `_update` mechanism.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * NOTE: This function is not virtual, {_update} should be overridden instead\n     */\n    function _burn(address account, uint256 value) internal {\n        if (account == address(0)) {\n            revert ERC20InvalidSender(address(0));\n        }\n        _update(account, address(0), value);\n    }\n\n    /**\n     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     *\n     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n     */\n    function _approve(address owner, address spender, uint256 value) internal {\n        _approve(owner, spender, value, true);\n    }\n\n    /**\n     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n     *\n     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any\n     * `Approval` event during `transferFrom` operations.\n     *\n     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to\n     * true using the following override:\n     * ```\n     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n     *     super._approve(owner, spender, value, true);\n     * }\n     * ```\n     *\n     * Requirements are the same as {_approve}.\n     */\n    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n        if (owner == address(0)) {\n            revert ERC20InvalidApprover(address(0));\n        }\n        if (spender == address(0)) {\n            revert ERC20InvalidSpender(address(0));\n        }\n        _allowances[owner][spender] = value;\n        if (emitEvent) {\n            emit Approval(owner, spender, value);\n        }\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `value`.\n     *\n     * Does not update the allowance value in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Does not emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            if (currentAllowance < value) {\n                revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n            }\n            unchecked {\n                _approve(owner, spender, currentAllowance - value, false);\n            }\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the value of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the value of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 value) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n     * caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 value) external returns (bool);\n\n    /**\n     * @dev Moves a `value` amount of tokens from `from` to `to` using the\n     * allowance mechanism. `value` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\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    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n}\n"
      },
      "contracts/access/MultiOwnable.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport \"@openzeppelin/contracts/utils/Context.sol\";\r\nimport \"../utils/Strings.sol\";\r\n\r\nabstract contract MultiOwnable is Context {\r\n  mapping (address => bool) private _owners;\r\n  address[] private _ownersAddresses;\r\n  mapping (address => bool) private _operationConfirmations;\r\n  uint8 private _numConfirmations;\r\n\r\n  constructor(address[] memory _inputOwners) {\r\n    _ownersAddresses = _inputOwners;\r\n    for (uint i; i < _inputOwners.length; i++) {\r\n      _owners[_inputOwners[i]] = true;\r\n    }\r\n  }\r\n\r\n  modifier anyOwner() {\r\n    if (_owners[_msgSender()] != true) {\r\n      revert();\r\n    }\r\n    _;\r\n  }\r\n  \r\n  function processConfirmation(bool _confirm) internal anyOwner returns (bool) {\r\n    if (_ownersAddresses.length == 1) {\r\n      return true;\r\n    }\r\n\r\n    if (!_confirm) {\r\n      _clearOperationRequest();\r\n      return false;\r\n    }\r\n\r\n    if (_operationConfirmations[_msgSender()] == true) {\r\n      return false;\r\n    }\r\n\r\n    _numConfirmations++;\r\n\r\n    if (_numConfirmations == _ownersAddresses.length) {\r\n      _clearOperationRequest();\r\n\r\n      return true;\r\n    }\r\n\r\n    _operationConfirmations[_msgSender()] = true;\r\n    return false;\r\n  }\r\n\r\n  function _clearOperationRequest() private {\r\n    _numConfirmations = 0;\r\n    for (uint i; i < _ownersAddresses.length; i++) {\r\n      _operationConfirmations[_ownersAddresses[i]] = false;\r\n    }\r\n  }\r\n}"
      },
      "contracts/balance/claim/BalanceClaimable.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\nimport \"../../access/MultiOwnable.sol\";\r\nimport \"../../utils/Strings.sol\";\r\nimport \"./IBalanceClaimable.sol\";\r\n\r\nabstract contract BalanceClaimable is IBalanceClaimable, MultiOwnable {\r\n\r\n  function claim(\r\n    address _contractAddress,\r\n    address _recipient,\r\n    uint256 _amount,\r\n    bool _confirm\r\n  ) public anyOwner {\r\n    bool confirmed = processConfirmation(_confirm);\r\n    if (confirmed) {\r\n      if (_contractAddress == address(0)) {\r\n        payable(_recipient).transfer(_amount);\r\n      } else {\r\n        IERC20(_contractAddress).transfer(_recipient, _amount);\r\n      }\r\n    }\r\n  }\r\n}"
      },
      "contracts/balance/claim/IBalanceClaimable.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\ninterface IBalanceClaimable {\r\n  function claim(\r\n    address _contractAddress,\r\n    address _recipient,\r\n    uint256 _amount,\r\n    bool _confirm\r\n  ) external;\r\n}"
      },
      "contracts/balance/presale/ITokenPresale.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\ninterface ITokenPresale {\r\n  function buy(\r\n    address _contract,\r\n    uint256 _value,\r\n    uint256 _amountAllowed,\r\n    uint256 _stakedAmount,\r\n    uint256 _timestamp,\r\n    address _walletAddress,\r\n    uint256 _ttl,\r\n    bytes memory _signature\r\n  ) external payable returns(bool);\r\n\r\n  function boughtTotal() external view returns (uint256);\r\n}"
      },
      "contracts/balance/presale/TokenPresale.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\nimport \"../../access/MultiOwnable.sol\";\r\nimport \"../../signing/Signable.sol\";\r\nimport \"../../utils/Strings.sol\";\r\nimport \"./ITokenPresale.sol\";\r\n\r\nabstract contract TokenPresale is ITokenPresale, Signable {\r\n  uint256 private _boughtTotal;\r\n\r\n  function buy(\r\n    address _contract,\r\n    uint256 _value,\r\n    uint256 _amountAllowed,\r\n    uint256 _stakedAmount, \r\n    uint256 _timestamp,\r\n    address _walletAddress,\r\n    uint256 _ttl,\r\n    bytes memory _signature\r\n  ) public payable returns(bool) {\r\n    string memory data = string.concat(\r\n      Strings.toHexString(_contract),\r\n      \"-\",\r\n      Strings.toString(_value),\r\n      \"-\",\r\n      Strings.toString(_amountAllowed),\r\n      \"-\",\r\n      Strings.toString(_stakedAmount),\r\n      \"-\",\r\n      Strings.toString(_timestamp),\r\n      \"-\",\r\n      Strings.toHexString(_walletAddress),\r\n      \"-\",\r\n      Strings.toString(_ttl)\r\n    );\r\n\r\n    if (_walletAddress != _msgSender()) {\r\n      return true;\r\n    }\r\n\r\n    bool callSuccessful = _contract == address(0) ? msg.value >= _value : IERC20(_contract).transferFrom(_msgSender(), address(this), _value);\r\n    bool verifyResult = verifyOperation(abi.encodePacked(data), _ttl, _signature);\r\n\r\n    if (verifyResult && callSuccessful) {\r\n      _boughtTotal += _amountAllowed;\r\n      addTokens(_amountAllowed, _stakedAmount, _timestamp);\r\n    }\r\n\r\n    /*\r\n    * Transaction does not have to necessarily satisfy our conditions.\r\n    * If transaction gives us at least some money, then why not taking it?\r\n    * We just add to the user's balance if and only if user provides us with\r\n    * correct issued signature AND actually gives us the value desired.\r\n    */\r\n    return true;\r\n  }\r\n\r\n  function addTokens(\r\n    uint256 _numTokens,\r\n    uint256 _numTokensStaked,\r\n    uint256 _timestamp\r\n  ) internal virtual;\r\n\r\n  function boughtTotal() public view returns (uint256) {\r\n    return _boughtTotal;\r\n  }\r\n}"
      },
      "contracts/balance/staking/ITokenStakeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\ninterface ITokenStakeable {\r\n  function stake(\r\n    uint256 _amount,\r\n    uint256 _timestamp,\r\n    address _walletAddress,\r\n    bool _unstake,\r\n    uint256 _ttl,\r\n    bytes memory _signature\r\n  ) external returns (bool);\r\n\r\n  function processRewards(\r\n    uint256 _rewardsAllowed,\r\n    uint256 _timestamp,\r\n    address _walletAddress,\r\n    bool _claim,\r\n    uint256 _ttl,\r\n    bytes memory _signature\r\n  ) external returns (bool);\r\n\r\n  function amountStaked(address _addr) external view returns (uint256);\r\n\r\n  function claimedTokens(address _addr) external view returns (uint256);\r\n\r\n  function stakingTime(address _addr) external view returns (uint256);\r\n\r\n  function totalClaimed() external view returns (uint256);\r\n\r\n  // Amount of tokens staked in total.\r\n  function totalStaked() external view returns (uint256);\r\n\r\n  // Amount of tokens that are staked right now.\r\n  function totalStakedActive() external view returns (uint256);\r\n}"
      },
      "contracts/balance/staking/TokenStakeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport \"./ITokenStakeable.sol\";\r\nimport \"../../signing/Signable.sol\";\r\n\r\nabstract contract TokenStakeable is ITokenStakeable, Signable {\r\n  mapping(address => uint256) internal _stakedTokens;\r\n  mapping(address => uint256) internal _claimedTokens;\r\n  mapping(address => uint256) internal _stakingTimes;\r\n  uint256 internal _totalStaked;\r\n  uint256 internal _totalStakedActive;\r\n  uint256 private _totalClaimed;\r\n\r\n  function stake(\r\n    uint256 _amount,\r\n    uint256 _timestamp,\r\n    address _walletAddress,\r\n    bool _unstake,\r\n    uint256 _ttl,\r\n    bytes memory _signature\r\n  ) public returns (bool) {\r\n    string memory data = string.concat(\r\n      Strings.toString(_amount),\r\n      \"-\",\r\n      Strings.toString(_timestamp),\r\n      \"-\",\r\n      Strings.toHexString(_walletAddress),\r\n      _unstake ? \"-1-\" : \"-0-\",\r\n      Strings.toString(_ttl)\r\n    );\r\n\r\n    if (_walletAddress != _msgSender()) {\r\n      return true;\r\n    }\r\n\r\n    if (verifyOperation(abi.encodePacked(data), _ttl, _signature)) {\r\n      if (_unstake) {\r\n        _totalStaked -= _amount;\r\n        _totalStakedActive -= _amount;\r\n        _stakedTokens[_msgSender()] -= _amount;\r\n\r\n        addToBalance(_msgSender(), _amount);\r\n      } else {\r\n        removeFromBalance(_msgSender(), _amount);\r\n        _totalStaked += _amount;\r\n        _totalStakedActive += _amount;\r\n        _stakedTokens[_msgSender()] += _amount;\r\n        _stakingTimes[_msgSender()] = _timestamp;\r\n      }\r\n    }\r\n\r\n    return true;\r\n  }\r\n\r\n  function processRewards(\r\n    uint256 _rewardsAllowed,\r\n    uint256 _timestamp,\r\n    address _walletAddress,\r\n    bool _claim,\r\n    uint256 _ttl,\r\n    bytes memory _signature\r\n  ) public returns (bool) {\r\n    string memory data = string.concat(\r\n      Strings.toString(_rewardsAllowed),\r\n      \"-\",\r\n      Strings.toString(_timestamp),\r\n      \"-\",\r\n      Strings.toHexString(_walletAddress),\r\n      \"-\",\r\n      Strings.toString(_ttl)\r\n    );\r\n\r\n    if (_walletAddress != _msgSender()) {\r\n      return true;\r\n    }\r\n\r\n    if (verifyOperation(abi.encodePacked(data), _ttl, _signature)) {\r\n      _claimedTokens[_msgSender()] += _rewardsAllowed;\r\n\r\n      if (!_claim) {\r\n        _totalClaimed += _rewardsAllowed;\r\n        _totalStaked += _rewardsAllowed;\r\n        _totalStakedActive += _rewardsAllowed;\r\n        _stakedTokens[_msgSender()] += _rewardsAllowed;\r\n      }\r\n      _stakingTimes[_msgSender()] = _timestamp;\r\n\r\n      if (_claim) {\r\n        addToBalance(_msgSender(), _rewardsAllowed);\r\n      }\r\n    }\r\n\r\n    return true;\r\n  }\r\n  \r\n  function amountStaked(address _addr) public view returns (uint256) {\r\n    return _stakedTokens[_addr];\r\n  }\r\n  \r\n  function claimedTokens(address _addr) public view returns (uint256) {\r\n    return _claimedTokens[_addr];\r\n  }\r\n\r\n  function stakingTime(address _addr) public view returns (uint256) {\r\n    return _stakingTimes[_addr];\r\n  }\r\n\r\n  function totalClaimed() public view returns (uint256) {\r\n    return _totalClaimed;\r\n  }\r\n\r\n  function totalStaked() public view returns (uint256) {\r\n    return _totalStaked;\r\n  }\r\n\r\n  function totalStakedActive() public view returns (uint256) {\r\n    return _totalStakedActive;\r\n  }\r\n\r\n  function addToBalance(address _receiver, uint256 _amount) internal virtual;\r\n  function removeFromBalance(address _receiver, uint256 _amount) internal virtual;\r\n}"
      },
      "contracts/referral/ITokenReferrable.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\ninterface ITokenReferrable {\r\n  function claimRewards(\r\n    uint256[] memory _values,\r\n    address[] memory _contracts,\r\n    string memory _claimId,\r\n    address _walletAddress,\r\n    uint256 _ttl,\r\n    bytes memory _signature\r\n  ) external;\r\n}"
      },
      "contracts/referral/TokenReferrable.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\r\n\r\nimport \"../signing/Signable.sol\";\r\nimport \"./ITokenReferrable.sol\";\r\n\r\nabstract contract TokenReferrable is ITokenReferrable, Signable {\r\n  mapping(string => bool) private _claimsProcessing;\r\n\r\n  function claimRewards(\r\n    uint256[] memory _values,\r\n    address[] memory _contracts,\r\n    string memory _claimId,\r\n    address _walletAddress,\r\n    uint256 _ttl,\r\n    bytes memory _signature\r\n  ) public {\r\n    string memory values = \"\";\r\n    for (uint i; i < _contracts.length; i++) {\r\n      uint256 amount = _values[i];\r\n      address contractAddress = _contracts[i];\r\n      values = string.concat(values, Strings.toString(amount), \";\", Strings.toHexString(contractAddress), \":\");\r\n    }\r\n\r\n    string memory data = string.concat(\r\n      values,\r\n      \"-\",\r\n      _claimId,\r\n      \"-\",\r\n      Strings.toHexString(_walletAddress),\r\n      \"-\",\r\n      Strings.toString(_ttl)\r\n    );\r\n\r\n    if (_walletAddress != _msgSender()) {\r\n      return;\r\n    }\r\n\r\n    if (verifyOperation(abi.encodePacked(data), _ttl, _signature) && _claimsProcessing[_claimId] != true) {\r\n      _claimsProcessing[_claimId] = true;\r\n\r\n      for (uint i; i < _contracts.length; i++) {\r\n        uint256 amount = _values[i];\r\n        address contractAddress = _contracts[i];\r\n\r\n        if (contractAddress == address(0)) {\r\n          payable(_msgSender()).transfer(amount);\r\n        } else {\r\n          IERC20(contractAddress).transfer(_msgSender(), amount);\r\n        }\r\n      }\r\n    }\r\n  }\r\n}"
      },
      "contracts/RightbiteContract.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport \"./access/MultiOwnable.sol\";\r\nimport \"./balance/claim/BalanceClaimable.sol\";\r\nimport \"./balance/presale/TokenPresale.sol\";\r\nimport \"./balance/staking/TokenStakeable.sol\";\r\nimport \"./referral/TokenReferrable.sol\";\r\nimport \"./token/ERC20/ERC20Subset.sol\";\r\nimport \"./signing/Signable.sol\";\r\nimport \"./RightbiteTokenContract.sol\";\r\n\r\n/*\r\nWebsite: https://rightbite.io/\r\nTelegram: https://t.me/RightBiteOfficial\r\nTwitter: https://twitter.com/rightbite_io\r\n*/\r\n\r\ncontract RightbiteContract is MultiOwnable,\r\n                              Signable,\r\n                              TokenReferrable,\r\n                              BalanceClaimable,\r\n                              TokenPresale,\r\n                              TokenStakeable,\r\n                              ERC20Subset {\r\n  address private _token;\r\n\r\n  receive() external payable {\r\n    // We are not picky, so we allow people to send us money.\r\n  }\r\n\r\n  constructor(\r\n    address[] memory _inputOwners,\r\n    bytes memory _inputE,\r\n    bytes memory _inputM,\r\n    bool deployToken\r\n  )\r\n  MultiOwnable(_inputOwners)\r\n  Signable(_inputE, _inputM) {\r\n    if (deployToken) {\r\n      _token = address(new RightbiteTokenContract(\r\n        _inputOwners[0],\r\n        address(this)\r\n      ));\r\n    }\r\n  }\r\n\r\n  function tokenAddress() public view returns(address) {\r\n    return _token;\r\n  }\r\n\r\n  function addTokens(\r\n    uint256 _numTokens,\r\n    uint256 _numTokensStaked,\r\n    uint256 _timestamp\r\n  ) internal override {\r\n    uint256 tokensToBalance = _numTokens - _numTokensStaked;\r\n    _balances[_msgSender()] += tokensToBalance;\r\n\r\n    if (_numTokensStaked > 0) {\r\n      _totalStaked += _numTokensStaked;\r\n      _totalStakedActive += _numTokensStaked;\r\n      _stakedTokens[_msgSender()] += _numTokensStaked;\r\n      _stakingTimes[_msgSender()] = _timestamp;\r\n    }\r\n  }\r\n\r\n  function updateBalance(address _receiver, uint256 _amount, bool _create) public anyOwner {\r\n    if (_create) {\r\n      addToBalance(_receiver, _amount);\r\n    } else {\r\n      removeFromBalance(_receiver, _amount);\r\n    }\r\n  }\r\n    \r\n  function addToBalance(address _receiver, uint256 _amount) internal override {\r\n    _balances[_receiver] += _amount;\r\n  }\r\n  \r\n  function removeFromBalance(address _receiver, uint256 _amount) internal override {\r\n    _balances[_receiver] -= _amount;\r\n  }\r\n}"
      },
      "contracts/RightbiteTokenContract.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\r\n\r\n/*\r\nWebsite: https://rightbite.io/\r\nTelegram: https://t.me/RightBiteOfficial\r\nTwitter: https://twitter.com/rightbite_io\r\n*/\r\n\r\ncontract RightbiteTokenContract is ERC20 {\r\n  constructor(address _liquidityProvider, address _presaleContract) ERC20(\"RightBite\", \"BITES\") {\r\n    _mint(_liquidityProvider, 68000000 * 10 ** 18);\r\n    _mint(_presaleContract, 612000000 * 10 ** 18);\r\n  }\r\n\r\n  function burn(uint256 amount) public {\r\n    _burn(_msgSender(), amount);\r\n  }\r\n}"
      },
      "contracts/signing/Signable.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport \"../access/MultiOwnable.sol\";\r\nimport \"../utils/Strings.sol\";\r\n\r\nabstract contract Signable is MultiOwnable {\r\n  mapping(bytes32 => bool) private _executedOperations;\r\n  address private constant _modExpAddress = 0x0000000000000000000000000000000000000005;\r\n  bytes public _e;\r\n  bytes public _m;\r\n\r\n  constructor(bytes memory _inputE, bytes memory _inputM) {\r\n    _e = _inputE;\r\n    _m = _inputM;\r\n  }\r\n\r\n  function setPublicKey(bytes memory _inputE, bytes memory _inputM) public anyOwner {\r\n    _e = _inputE;\r\n    _m = _inputM;\r\n  }\r\n\r\n  function verifyOperation(bytes memory _data, uint256 _ttl, bytes memory _signature) internal returns(bool) {\r\n    bytes32 hashComputed = sha256(_data);\r\n    if (_executedOperations[hashComputed] == true) {\r\n      return false;\r\n    }\r\n\r\n    _executedOperations[hashComputed] = true;\r\n    bytes memory hashResult = modExp(_signature.length, _e.length, _m.length, _signature, _e, _m);\r\n    uint resLength = hashResult.length;\r\n\r\n    uint from = resLength - 32;\r\n    for (uint i; i < 32; i++) {\r\n      if (hashResult[i + from] != hashComputed[i]) {\r\n        return false;\r\n      }\r\n    }\r\n\r\n    if (block.timestamp > _ttl) {\r\n      return false;\r\n    }\r\n\r\n    return true;\r\n  }\r\n\r\n  function modExp(uint baseLength, uint expLength, uint modLength, bytes memory _base, bytes memory exp, bytes memory modulus) private returns(bytes memory) {\r\n    (bool _success, bytes memory result) = _modExpAddress.call(\r\n      abi.encodePacked(baseLength, expLength, modLength, _base, exp, modulus)\r\n    );\r\n\r\n    return result;\r\n  }\r\n}"
      },
      "contracts/token/ERC20/ERC20Subset.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nabstract contract ERC20Subset {\r\n  mapping(address => uint256) internal _balances;\r\n\r\n  function balanceOf(address _account) public view returns (uint256) {\r\n    return _balances[_account];\r\n  }\r\n}"
      },
      "contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nlibrary Math {\r\n  function log10(uint256 value) internal pure returns (uint256) {\r\n    uint256 result = 0;\r\n    unchecked {\r\n      if (value >= 10 ** 64) {\r\n        value /= 10 ** 64;\r\n        result += 64;\r\n      }\r\n      if (value >= 10 ** 32) {\r\n        value /= 10 ** 32;\r\n        result += 32;\r\n      }\r\n      if (value >= 10 ** 16) {\r\n        value /= 10 ** 16;\r\n        result += 16;\r\n      }\r\n      if (value >= 10 ** 8) {\r\n        value /= 10 ** 8;\r\n        result += 8;\r\n      }\r\n      if (value >= 10 ** 4) {\r\n        value /= 10 ** 4;\r\n        result += 4;\r\n      }\r\n      if (value >= 10 ** 2) {\r\n        value /= 10 ** 2;\r\n        result += 2;\r\n      }\r\n      if (value >= 10 ** 1) {\r\n        result += 1;\r\n      }\r\n    }\r\n    return result;\r\n  }\r\n\r\n  function log256(uint256 value) internal pure returns (uint256) {\r\n    uint256 result = 0;\r\n    uint256 isGt;\r\n    unchecked {\r\n      isGt = toUint(value > (1 << 128) - 1);\r\n      value >>= isGt * 128;\r\n      result += isGt * 16;\r\n\r\n      isGt = toUint(value > (1 << 64) - 1);\r\n      value >>= isGt * 64;\r\n      result += isGt * 8;\r\n\r\n      isGt = toUint(value > (1 << 32) - 1);\r\n      value >>= isGt * 32;\r\n      result += isGt * 4;\r\n\r\n      isGt = toUint(value > (1 << 16) - 1);\r\n      value >>= isGt * 16;\r\n      result += isGt * 2;\r\n\r\n      result += toUint(value > (1 << 8) - 1);\r\n    }\r\n    return result;\r\n  }\r\n\r\n  function toUint(bool b) internal pure returns (uint256 u) {\r\n    /// @solidity memory-safe-assembly\r\n    assembly {\r\n      u := iszero(iszero(b))\r\n    }\r\n  }\r\n}"
      },
      "contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.20;\r\n\r\nimport \"./math/Math.sol\";\r\n\r\nlibrary Strings {\r\n    bytes16 private constant HEX_DIGITS = \"0123456789abcdef\";\r\n    uint8 private constant ADDRESS_LENGTH = 20;\r\n\r\n    error StringsInsufficientHexLength(uint256 value, uint256 length);\r\n\r\n    function toString(uint256 value) internal pure returns (string memory) {\r\n        unchecked {\r\n            uint256 length = Math.log10(value) + 1;\r\n            string memory buffer = new string(length);\r\n            uint256 ptr;\r\n            /// @solidity memory-safe-assembly\r\n            assembly {\r\n                ptr := add(buffer, add(32, length))\r\n            }\r\n            while (true) {\r\n                ptr--;\r\n                /// @solidity memory-safe-assembly\r\n                assembly {\r\n                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))\r\n                }\r\n                value /= 10;\r\n                if (value == 0) break;\r\n            }\r\n            return buffer;\r\n        }\r\n    }\r\n\r\n    function toHexString(uint256 value) internal pure returns (string memory) {\r\n        unchecked {\r\n            return toHexString(value, Math.log256(value) + 1);\r\n        }\r\n    }\r\n\r\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\r\n        uint256 localValue = value;\r\n        bytes memory buffer = new bytes(2 * length + 2);\r\n        buffer[0] = \"0\";\r\n        buffer[1] = \"x\";\r\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\r\n            buffer[i] = HEX_DIGITS[localValue & 0xf];\r\n            localValue >>= 4;\r\n        }\r\n        if (localValue != 0) {\r\n            revert StringsInsufficientHexLength(value, length);\r\n        }\r\n        return string(buffer);\r\n    }\r\n\r\n    function toHexString(address addr) internal pure returns (string memory) {\r\n      return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);\r\n    }\r\n\r\n    function equal(string memory a, string memory b) internal pure returns (bool) {\r\n        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));\r\n    }\r\n}"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "evmVersion": "paris",
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}