{"constructor_args":"0x00000000000000000000000073d37a98c0fcbd049bffffe67bf9af36d603c0f60000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000006c15b25e9750dccb698c1a4023f34015bfe576490000000000000000000000006c15b25e9750dccb698c1a4023f34015bfe57649","is_partially_verified":false,"is_changed_bytecode":false,"abi":[{"inputs":[{"internalType":"address","name":"_depositTokenRegistry","type":"address"},{"internalType":"uint256","name":"_initialSharePrice","type":"uint256"},{"internalType":"address","name":"_admin","type":"address"},{"internalType":"address","name":"_priceSetter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"AmountTooLow","type":"error"},{"inputs":[],"name":"InvalidPrice","type":"error"},{"inputs":[],"name":"InvalidTokenAddress","type":"error"},{"inputs":[],"name":"InvalidTokenPrice","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"TokenNotAcceptedOrPaused","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"SharePriceSet","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertFromShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositTokenRegistry","outputs":[{"internalType":"contract IDepositTokenRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSharePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"setSharePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}],"conflicting_implementations":null,"certified":false,"additional_sources":[{"file_path":"@openzeppelin/contracts/access/AccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.20;\n\nimport {IAccessControl} from \"./IAccessControl.sol\";\nimport {Context} from \"../utils/Context.sol\";\nimport {ERC165} from \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n    struct RoleData {\n        mapping(address account => bool) hasRole;\n        bytes32 adminRole;\n    }\n\n    mapping(bytes32 role => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /**\n     * @dev Modifier that checks that an account has a specific role. Reverts\n     * with an {AccessControlUnauthorizedAccount} error including the required role.\n     */\n    modifier onlyRole(bytes32 role) {\n        _checkRole(role);\n        _;\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view virtual returns (bool) {\n        return _roles[role].hasRole[account];\n    }\n\n    /**\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`\n     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.\n     */\n    function _checkRole(bytes32 role) internal view virtual {\n        _checkRole(role, _msgSender());\n    }\n\n    /**\n     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`\n     * is missing `role`.\n     */\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!hasRole(role, account)) {\n            revert AccessControlUnauthorizedAccount(account, role);\n        }\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `callerConfirmation`.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) public virtual {\n        if (callerConfirmation != _msgSender()) {\n            revert AccessControlBadConfirmation();\n        }\n\n        _revokeRole(role, callerConfirmation);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        bytes32 previousAdminRole = getRoleAdmin(role);\n        _roles[role].adminRole = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /**\n     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {\n        if (!hasRole(role, account)) {\n            _roles[role].hasRole[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {\n        if (hasRole(role, account)) {\n            _roles[role].hasRole[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\n            return true;\n        } else {\n            return false;\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/access/IAccessControl.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev The `account` is missing a role.\n     */\n    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);\n\n    /**\n     * @dev The caller of a function is not the expected one.\n     *\n     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.\n     */\n    error AccessControlBadConfirmation();\n\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {AccessControl-_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `callerConfirmation`.\n     */\n    function renounceRole(bytes32 role, address callerConfirmation) external;\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/utils/Context.sol","source_code":"// 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"},{"file_path":"@openzeppelin/contracts/utils/introspection/ERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/utils/introspection/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"},{"file_path":"@openzeppelin/contracts/utils/math/Math.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    /**\n     * @dev Muldiv operation overflow.\n     */\n    error MathOverflowedMulDiv();\n\n    enum Rounding {\n        Floor, // Toward negative infinity\n        Ceil, // Toward positive infinity\n        Trunc, // Toward zero\n        Expand // Away from zero\n    }\n\n    /**\n     * @dev Returns the addition of two unsigned integers, with an overflow flag.\n     */\n    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            uint256 c = a + b;\n            if (c < a) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n     */\n    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b > a) return (false, 0);\n            return (true, a - b);\n        }\n    }\n\n    /**\n     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n     */\n    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n            // benefit is lost if 'b' is also tested.\n            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n            if (a == 0) return (true, 0);\n            uint256 c = a * b;\n            if (c / a != b) return (false, 0);\n            return (true, c);\n        }\n    }\n\n    /**\n     * @dev Returns the division of two unsigned integers, with a division by zero flag.\n     */\n    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a / b);\n        }\n    }\n\n    /**\n     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n     */\n    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n        unchecked {\n            if (b == 0) return (false, 0);\n            return (true, a % b);\n        }\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds towards infinity instead\n     * of rounding towards zero.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        if (b == 0) {\n            // Guarantee the same behavior as in a regular Solidity division.\n            return a / b;\n        }\n\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or\n     * denominator == 0.\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by\n     * Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0 = x * y; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            if (denominator <= prod1) {\n                revert MathOverflowedMulDiv();\n            }\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.\n            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.\n\n            uint256 twos = denominator & (0 - denominator);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also\n            // works in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded\n     * towards zero.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256 of a positive value rounded towards zero.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.\n     */\n    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {\n        return uint8(rounding) % 2 == 1;\n    }\n}\n"},{"file_path":"contracts/interfaces/IDepositTokenRegistry.sol","source_code":"//SPDX-License-Identifier: ISC\npragma solidity 0.8.20;\n\ninterface IDepositTokenRegistry {\n  struct TokenInfo {\n    bool isAccepted;\n    uint256 fixedDepositFee;\n    uint256 percentageDepositFee;\n    address priceOracle;\n    bool paused;\n    bool eligibleAsCollateral;\n    uint8 decimals;\n    string name;\n    string symbol;\n    uint256 defaultSlippageTolerance;\n    uint256 minDeposit;\n  }\n\n  function isDepositEnabled(address token) external view returns (bool);\n  function getTokenInfo(\n    address token\n  )\n    external\n    view\n    returns (\n      bool isAccepted,\n      uint256 fixedDepositFee,\n      uint256 percentageDepositFee,\n      address priceOracle,\n      bool paused,\n      string memory name,\n      string memory symbol,\n      uint256 slippage,\n      uint256 minDeposit,\n      uint256 decimals,\n      bool nativeToken\n    );\n\n  /// @notice Returns only the essential token information needed for share price calculations\n  /// @param token The address of the token to query\n  /// @return isAccepted Whether the token is accepted\n  /// @return paused Whether the token is paused\n  /// @return priceOracle The address of the price oracle for this token\n  /// @return decimals The number of decimals for the token\n  function getTokenPriceInfo(\n    address token\n  )\n    external\n    view\n    returns (bool isAccepted, bool paused, address priceOracle, uint8 decimals);\n\n  function getAcceptedTokens() external view returns (address[] memory);\n\n  function previewMintFees(\n    address token,\n    uint256 amount\n  ) external view returns (uint256);\n\n  function previewDepositFees(\n    address token,\n    uint256 amount\n  ) external view returns (uint256);\n\n  function isEligibleAsCollateral(address token) external view returns (bool);\n\n  function getCollateralTokens() external view returns (address[] memory);\n\n  function getWrappedNative() external view returns (address);\n}\n"},{"file_path":"contracts/interfaces/IPriceOracle.sol","source_code":"pragma solidity 0.8.20;\n\ninterface IPriceOracle {\n  enum PriceStatus {\n    VALID,\n    CAPPED,\n    INVALID,\n    STALE,\n    VOLATILE,\n    CIRCUIT_BREAKER\n  }\n\n  struct PriceInfo {\n    uint96 price;\n    PriceStatus status;\n  }\n\n  /**\n   * @notice Retrieves the latest price information for the configured token\n   * @return PriceInfo Struct containing the price and its status\n   */\n  function latestPriceInfo() external view returns (PriceInfo memory);\n\n  /**\n   * @notice Retrieves the number of decimals for the token's price feed\n   * @return uint8 Number of decimals\n   */\n  function decimals() external view returns (uint8);\n}\n"},{"file_path":"contracts/interfaces/ISharePriceCalculator.sol","source_code":"// SPDX-License-Identifier: ISC\npragma solidity 0.8.20;\n\ninterface ISharePriceCalculator {\n  event SharePriceSet(uint256 oldPrice, uint256 newPrice);\n\n  function setSharePrice(uint256 newPrice) external;\n  function convertToShares(\n    address token,\n    uint256 amount\n  ) external view returns (uint256);\n  function convertFromShares(\n    address token,\n    uint256 shares\n  ) external view returns (uint256);\n  function getSharePrice() external view returns (uint256);\n}\n"}],"is_verified_via_sourcify":false,"can_be_visualized_via_sol2uml":true,"evm_version":"paris","language":"solidity","is_verified_via_eth_bytecode_db":true,"is_fully_verified":true,"license_type":"none","is_blueprint":false,"name":"SharePriceCalculator","creation_bytecode":"0x60a0346200011457601f62000fb238819003918201601f191683019291906001600160401b0384118385101762000119578160809284926040968752833981010312620001145762000051816200012f565b9060208101516200007260606200006a8685016200012f565b93016200012f565b926001600160a01b03908116908115620000f3578215620001045780841615620000f357841615620000e257608052600155620000bc9190620000b59062000144565b50620001c4565b5051610d2b90816200026782396080518181816101490152818161024901526105570152f35b845163d92e233d60e01b8152600490fd5b855163d92e233d60e01b8152600490fd5b855162bfc92160e01b8152600490fd5b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036200011457565b6001600160a01b031660008181527fad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5602052604081205490919060ff16620001c057818052816020526040822081835260205260408220600160ff19825416179055339160008051602062000f928339815191528180a4600190565b5090565b6001600160a01b031660008181527f8d5cb4327480bbdc0a15a97d281cd69565d1fec0215661a926532db447d2678060205260408120549091907f04824fcb60e7cc526d70b264caa65b62ed44d9c8e5d230e8ff6b0c7373843b8a9060ff166200026157808352826020526040832082845260205260408320600160ff1982541617905560008051602062000f92833981519152339380a4600190565b50509056fe608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a7146108835750816316b60249146107c5578163248a9ca31461079b5781632b38e266146105055781632f2ff15d146104db57816336568abe146104955781633e5541f1146101f85781635b1dac60146101d957816391d1485414610193578163a217fddf14610178578163a981c7b414610134578163d547741f146100f1575063f00acbaa146100b457600080fd5b346100ed57816003193601126100ed57602090517f04824fcb60e7cc526d70b264caa65b62ed44d9c8e5d230e8ff6b0c7373843b8a8152f35b5080fd5b9190503461013057806003193601126101305761012c913561012760016101166108f1565b938387528660205286200154610907565b6109c9565b5080f35b8280fd5b5050346100ed57816003193601126100ed57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5050346100ed57816003193601126100ed5751908152602090f35b9050346101305781600319360112610130578160209360ff926101b46108f1565b903582528186528282206001600160a01b039091168252855220549151911615158152f35b5050346100ed57816003193601126100ed576020906001549051908152f35b8284346103825781600319360112610382576102126108d6565b60243591906001600160a01b0390811690811561048557831561047557845191633557b21b60e11b835286830152608082602481847f0000000000000000000000000000000000000000000000000000000000000000165afa91821561046b5783849085928695610433575b501590811561042b575b5061041b5716908451956308244fc360e21b875285878281865afa9687156104115784976103e2575b50602096878101805160068110156103cf57151590816103a6575b50610397576001600160601b03889151169387519283809263313ce56760e01b82525afa93841561038c57809461033a575b50509161032461031e610333959361031861032a96610b2f565b90610bdd565b91610b2f565b91610c7f565b60015490610bdd565b9051908152f35b909193508682813d8311610385575b6103538183610a3e565b8101031261038257509161032461031e610333959361031861037761032a97610a83565b9650509395506102fe565b80fd5b503d610349565b8651903d90823e3d90fd5b508551637841c2c960e11b8152fd5b90505160068110156103bc5760011415896102cc565b634e487b7160e01b865260218352602486fd5b634e487b7160e01b875260218452602487fd5b610403919750863d881161040a575b6103fb8183610a3e565b810190610adb565b95876102b1565b503d6103f1565b86513d86823e3d90fd5b8551636859399d60e11b81528790fd5b905088610288565b9250505061045991925060803d8111610464575b6104518183610a3e565b810190610a91565b93929091908961027e565b503d610447565b85513d85823e3d90fd5b8451631fbaba3560e01b81528690fd5b8451630f58058360e11b81528690fd5b8383346100ed57806003193601126100ed576104af6108f1565b90336001600160a01b038316036104cc575061012c9192356109c9565b5163334bd91960e11b81528390fd5b9190503461013057806003193601126101305761012c913561050060016101166108f1565b61094b565b8383346100ed57806003193601126100ed5761051f6108d6565b602493843593916001600160a01b0390811690811561078b57851561077b57845191633557b21b60e11b8352838301526080828881847f0000000000000000000000000000000000000000000000000000000000000000165afa9182156107715784859086928795610749575b5015908115610741575b506107315716928451956308244fc360e21b875285878581885afa968715610727578297610708575b50602096878101805160068110156106f657151590816106ce575b506106be5790876001600160601b03869351169688519687809263313ce56760e01b82525afa9485156106b4578395610672575b506106226106226106289260015490610b56565b94610b2f565b9384810294818604149015171561066057670de0b6b3a764000094858102958187041490151715610660575050906103339291610c7f565b634e487b7160e01b8252601190528690fd5b9094508781813d83116106ad575b61068a8183610a3e565b81010312610130576106226106226106a461062893610a83565b9692505061060e565b503d610680565b87513d85823e3d90fd5b8651637841c2c960e11b81528590fd5b90505160068110156106e457600114158a6105da565b634e487b7160e01b8452602186528984fd5b634e487b7160e01b8552602187528a85fd5b610720919750863d881161040a576103fb8183610a3e565b95886105bf565b86513d84823e3d90fd5b8551636859399d60e11b81528490fd5b905089610596565b9250505061076691925060803d8111610464576104518183610a3e565b93929091908a61058c565b85513d86823e3d90fd5b8451631fbaba3560e01b81528390fd5b8451630f58058360e11b81528390fd5b90503461013057602036600319011261013057816020936001923581528085522001549051908152f35b905034610130576020366003190112610130578035907f04824fcb60e7cc526d70b264caa65b62ed44d9c8e5d230e8ff6b0c7373843b8a8085528460205283852033865260205260ff848620541615610866575081156108595750907f4a1ac874d2c95dbf06e8751911760755154ef5c49e9ecfd9b5e71a11664a239c91600154908060015582519182526020820152a180f35b825162bfc92160e01b8152fd5b6044925083519163e2517d3f60e01b835233908301526024820152fd5b849134610130576020366003190112610130573563ffffffff60e01b81168091036101305760209250637965db0b60e01b81149081156108c5575b5015158152f35b6301ffc9a760e01b149050836108be565b600435906001600160a01b03821682036108ec57565b600080fd5b602435906001600160a01b03821682036108ec57565b80600052600060205260406000203360005260205260ff604060002054161561092d5750565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b9060009180835282602052604083209160018060a01b03169182845260205260ff604084205416156000146109c457808352826020526040832082845260205260408320600160ff198254161790557f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a4600190565b505090565b9060009180835282602052604083209160018060a01b03169182845260205260ff6040842054166000146109c45780835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4600190565b90601f8019910116810190811067ffffffffffffffff821117610a6057604052565b634e487b7160e01b600052604160045260246000fd5b519081151582036108ec57565b519060ff821682036108ec57565b91908260809103126108ec57610aa682610a76565b91610ab360208201610a76565b60408201519092906001600160a01b03811681036108ec576060610ad8919301610a83565b90565b908160409103126108ec57604051906040820182811067ffffffffffffffff821117610a60576040528051906001600160601b03821682036108ec576020918352015160068110156108ec57602082015290565b60ff16604d8111610b4057600a0a90565b634e487b7160e01b600052601160045260246000fd5b908082029060001981840990828083109203918083039214610bcc57670de0b6b3a76400009082821115610bba577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac10669940990828211900360ee1b910360121c170290565b60405163227bc15360e01b8152600490fd5b5050670de0b6b3a764000091500490565b670de0b6b3a7640000918183029160001984820993838086109503948086039514610c5b5784831115610bba5782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b505080925015610c69570490565b634e487b7160e01b600052601260045260246000fd5b90918282029160001984820993838086109503948086039514610c5b5784831115610bba578291098160000382168092046002808260030218808302820302808302820302808302820302808302820302808302820302809202900302936001838060000304019084831190030292030417029056fea2646970667358221220be3b213d2d48e2135fa0723104737e40df73a1e37bd3436c8ce8861f08ab78a664736f6c634300081400332f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d00000000000000000000000073d37a98c0fcbd049bffffe67bf9af36d603c0f60000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000006c15b25e9750dccb698c1a4023f34015bfe576490000000000000000000000006c15b25e9750dccb698c1a4023f34015bfe57649","external_libraries":[],"proxy_type":null,"implementations":[],"verified_at":"2025-07-03T19:32:31.439253Z","is_verified_via_verifier_alliance":true,"compiler_version":"0.8.20+commit.a1b79de6","decoded_constructor_args":[["0x73d37A98C0fCBd049BfFFfe67Bf9af36d603c0F6",{"internalType":"address","name":"_depositTokenRegistry","type":"address"}],["1000000000000000000",{"internalType":"uint256","name":"_initialSharePrice","type":"uint256"}],["0x6C15B25E9750Dccb698C1a4023f34015bFe57649",{"internalType":"address","name":"_admin","type":"address"}],["0x6C15B25E9750Dccb698C1a4023f34015bFe57649",{"internalType":"address","name":"_priceSetter","type":"address"}]],"sourcify_repo_url":null,"optimization_runs":100,"compiler_settings":{"evmVersion":"paris","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":100},"remappings":[],"viaIR":true},"is_verified":true,"verified_twin_address_hash":null,"optimization_enabled":true,"deployed_bytecode":"0x608060408181526004918236101561001657600080fd5b600092833560e01c91826301ffc9a7146108835750816316b60249146107c5578163248a9ca31461079b5781632b38e266146105055781632f2ff15d146104db57816336568abe146104955781633e5541f1146101f85781635b1dac60146101d957816391d1485414610193578163a217fddf14610178578163a981c7b414610134578163d547741f146100f1575063f00acbaa146100b457600080fd5b346100ed57816003193601126100ed57602090517f04824fcb60e7cc526d70b264caa65b62ed44d9c8e5d230e8ff6b0c7373843b8a8152f35b5080fd5b9190503461013057806003193601126101305761012c913561012760016101166108f1565b938387528660205286200154610907565b6109c9565b5080f35b8280fd5b5050346100ed57816003193601126100ed57517f00000000000000000000000073d37a98c0fcbd049bffffe67bf9af36d603c0f66001600160a01b03168152602090f35b5050346100ed57816003193601126100ed5751908152602090f35b9050346101305781600319360112610130578160209360ff926101b46108f1565b903582528186528282206001600160a01b039091168252855220549151911615158152f35b5050346100ed57816003193601126100ed576020906001549051908152f35b8284346103825781600319360112610382576102126108d6565b60243591906001600160a01b0390811690811561048557831561047557845191633557b21b60e11b835286830152608082602481847f00000000000000000000000073d37a98c0fcbd049bffffe67bf9af36d603c0f6165afa91821561046b5783849085928695610433575b501590811561042b575b5061041b5716908451956308244fc360e21b875285878281865afa9687156104115784976103e2575b50602096878101805160068110156103cf57151590816103a6575b50610397576001600160601b03889151169387519283809263313ce56760e01b82525afa93841561038c57809461033a575b50509161032461031e610333959361031861032a96610b2f565b90610bdd565b91610b2f565b91610c7f565b60015490610bdd565b9051908152f35b909193508682813d8311610385575b6103538183610a3e565b8101031261038257509161032461031e610333959361031861037761032a97610a83565b9650509395506102fe565b80fd5b503d610349565b8651903d90823e3d90fd5b508551637841c2c960e11b8152fd5b90505160068110156103bc5760011415896102cc565b634e487b7160e01b865260218352602486fd5b634e487b7160e01b875260218452602487fd5b610403919750863d881161040a575b6103fb8183610a3e565b810190610adb565b95876102b1565b503d6103f1565b86513d86823e3d90fd5b8551636859399d60e11b81528790fd5b905088610288565b9250505061045991925060803d8111610464575b6104518183610a3e565b810190610a91565b93929091908961027e565b503d610447565b85513d85823e3d90fd5b8451631fbaba3560e01b81528690fd5b8451630f58058360e11b81528690fd5b8383346100ed57806003193601126100ed576104af6108f1565b90336001600160a01b038316036104cc575061012c9192356109c9565b5163334bd91960e11b81528390fd5b9190503461013057806003193601126101305761012c913561050060016101166108f1565b61094b565b8383346100ed57806003193601126100ed5761051f6108d6565b602493843593916001600160a01b0390811690811561078b57851561077b57845191633557b21b60e11b8352838301526080828881847f00000000000000000000000073d37a98c0fcbd049bffffe67bf9af36d603c0f6165afa9182156107715784859086928795610749575b5015908115610741575b506107315716928451956308244fc360e21b875285878581885afa968715610727578297610708575b50602096878101805160068110156106f657151590816106ce575b506106be5790876001600160601b03869351169688519687809263313ce56760e01b82525afa9485156106b4578395610672575b506106226106226106289260015490610b56565b94610b2f565b9384810294818604149015171561066057670de0b6b3a764000094858102958187041490151715610660575050906103339291610c7f565b634e487b7160e01b8252601190528690fd5b9094508781813d83116106ad575b61068a8183610a3e565b81010312610130576106226106226106a461062893610a83565b9692505061060e565b503d610680565b87513d85823e3d90fd5b8651637841c2c960e11b81528590fd5b90505160068110156106e457600114158a6105da565b634e487b7160e01b8452602186528984fd5b634e487b7160e01b8552602187528a85fd5b610720919750863d881161040a576103fb8183610a3e565b95886105bf565b86513d84823e3d90fd5b8551636859399d60e11b81528490fd5b905089610596565b9250505061076691925060803d8111610464576104518183610a3e565b93929091908a61058c565b85513d86823e3d90fd5b8451631fbaba3560e01b81528390fd5b8451630f58058360e11b81528390fd5b90503461013057602036600319011261013057816020936001923581528085522001549051908152f35b905034610130576020366003190112610130578035907f04824fcb60e7cc526d70b264caa65b62ed44d9c8e5d230e8ff6b0c7373843b8a8085528460205283852033865260205260ff848620541615610866575081156108595750907f4a1ac874d2c95dbf06e8751911760755154ef5c49e9ecfd9b5e71a11664a239c91600154908060015582519182526020820152a180f35b825162bfc92160e01b8152fd5b6044925083519163e2517d3f60e01b835233908301526024820152fd5b849134610130576020366003190112610130573563ffffffff60e01b81168091036101305760209250637965db0b60e01b81149081156108c5575b5015158152f35b6301ffc9a760e01b149050836108be565b600435906001600160a01b03821682036108ec57565b600080fd5b602435906001600160a01b03821682036108ec57565b80600052600060205260406000203360005260205260ff604060002054161561092d5750565b6044906040519063e2517d3f60e01b82523360048301526024820152fd5b9060009180835282602052604083209160018060a01b03169182845260205260ff604084205416156000146109c457808352826020526040832082845260205260408320600160ff198254161790557f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d339380a4600190565b505090565b9060009180835282602052604083209160018060a01b03169182845260205260ff6040842054166000146109c45780835282602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4600190565b90601f8019910116810190811067ffffffffffffffff821117610a6057604052565b634e487b7160e01b600052604160045260246000fd5b519081151582036108ec57565b519060ff821682036108ec57565b91908260809103126108ec57610aa682610a76565b91610ab360208201610a76565b60408201519092906001600160a01b03811681036108ec576060610ad8919301610a83565b90565b908160409103126108ec57604051906040820182811067ffffffffffffffff821117610a60576040528051906001600160601b03821682036108ec576020918352015160068110156108ec57602082015290565b60ff16604d8111610b4057600a0a90565b634e487b7160e01b600052601160045260246000fd5b908082029060001981840990828083109203918083039214610bcc57670de0b6b3a76400009082821115610bba577faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac10669940990828211900360ee1b910360121c170290565b60405163227bc15360e01b8152600490fd5b5050670de0b6b3a764000091500490565b670de0b6b3a7640000918183029160001984820993838086109503948086039514610c5b5784831115610bba5782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b505080925015610c69570490565b634e487b7160e01b600052601260045260246000fd5b90918282029160001984820993838086109503948086039514610c5b5784831115610bba578291098160000382168092046002808260030218808302820302808302820302808302820302808302820302808302820302809202900302936001838060000304019084831190030292030417029056fea2646970667358221220be3b213d2d48e2135fa0723104737e40df73a1e37bd3436c8ce8861f08ab78a664736f6c63430008140033","source_code":"// SPDX-License-Identifier: ISC\npragma solidity 0.8.20;\n\nimport \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport \"./interfaces/ISharePriceCalculator.sol\";\nimport \"./interfaces/IDepositTokenRegistry.sol\";\nimport \"./interfaces/IPriceOracle.sol\";\nimport \"@openzeppelin/contracts/utils/math/Math.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\n/// @title SharePriceCalculator\n/// @notice Handles conversion between token amounts and shares based on current share price\n/// @dev Uses price oracles to determine token values and maintains a global share price\ncontract SharePriceCalculator is ISharePriceCalculator, AccessControl {\n  using Math for uint256;\n\n  error ZeroAddress();\n  error InvalidPrice();\n  error InvalidTokenAddress();\n  error AmountTooLow();\n  error TokenNotAcceptedOrPaused();\n  error InvalidTokenPrice();\n\n  bytes32 public constant PRICE_SETTER_ROLE = keccak256(\"PRICE_SETTER_ROLE\");\n\n  uint256 private sharePrice;\n  IDepositTokenRegistry public immutable depositTokenRegistry;\n\n  /// @notice Initializes the SharePriceCalculator with a deposit token registry\n  /// @param _depositTokenRegistry Address of the deposit token registry contract\n  /// @dev Sets initial share price to 1e18 (1:1 ratio)\n  constructor(\n    address _depositTokenRegistry,\n    uint256 _initialSharePrice,\n    address _admin,\n    address _priceSetter\n  ) {\n    if (_depositTokenRegistry == address(0)) revert ZeroAddress();\n    if (_initialSharePrice == 0) revert InvalidPrice();\n    if (_admin == address(0)) revert ZeroAddress();\n    if (_priceSetter == address(0)) revert ZeroAddress();\n\n    depositTokenRegistry = IDepositTokenRegistry(_depositTokenRegistry);\n    sharePrice = _initialSharePrice; // Initialize with 1:1 ratio\n\n    _grantRole(DEFAULT_ADMIN_ROLE, _admin);\n    _grantRole(PRICE_SETTER_ROLE, _priceSetter);\n  }\n\n  /// @notice Updates the global share price\n  /// @param newPrice New share price value (scaled by 1e18)\n  /// @dev Only callable by addresses with PRICE_SETTER_ROLE\n  /// @dev Emits SharePriceSet event\n  function setSharePrice(\n    uint256 newPrice\n  ) external onlyRole(PRICE_SETTER_ROLE) {\n    if (newPrice == 0) revert InvalidPrice();\n    uint256 oldPrice = sharePrice;\n    sharePrice = newPrice;\n    emit SharePriceSet(oldPrice, newPrice);\n  }\n\n  /// @notice Returns the current share price\n  /// @return Current share price scaled by 1e18\n  function getSharePrice() external view returns (uint256) {\n    return sharePrice;\n  }\n\n  /// @notice Converts a token amount to equivalent shares\n  /// @param token Address of the token to convert\n  /// @param amount Amount of tokens to convert (in token's native decimals)\n  /// @return Number of shares equivalent to the token amount\n  /// @dev Formula: shares = (amount * tokenPrice * 1e18) / (10^tokenDecimals * 10^oracleDecimals * sharePrice)\n  function convertToShares(\n    address token,\n    uint256 amount\n  ) external view returns (uint256) {\n    if (token == address(0)) revert InvalidTokenAddress();\n    if (amount == 0) revert AmountTooLow();\n\n    (\n      bool isAccepted,\n      bool paused,\n      address priceOracle,\n      uint8 tokenDecimals\n    ) = depositTokenRegistry.getTokenPriceInfo(token);\n    if (!isAccepted || paused) revert TokenNotAcceptedOrPaused();\n\n    IPriceOracle oracle = IPriceOracle(priceOracle);\n    IPriceOracle.PriceInfo memory priceInfo = oracle.latestPriceInfo();\n\n    if (\n      priceInfo.status != IPriceOracle.PriceStatus.VALID &&\n      priceInfo.status != IPriceOracle.PriceStatus.CAPPED\n    ) revert InvalidTokenPrice();\n\n    uint256 tokenPrice = priceInfo.price;\n    uint8 oracleDecimals = oracle.decimals();\n\n    uint256 tokenValue = amount.mulDiv(\n      tokenPrice.mulDiv(1e18, 10 ** tokenDecimals),\n      10 ** oracleDecimals\n    );\n    return tokenValue.mulDiv(1e18, sharePrice);\n  }\n\n  /// @notice Converts a number of shares to equivalent token amount\n  /// @param token Address of the token to convert to\n  /// @param shares Number of shares to convert\n  /// @return Amount of tokens equivalent to the shares (in token's native decimals)\n  /// @dev Formula: tokens = (shares * sharePrice * 10^tokenDecimals * 10^oracleDecimals) / (tokenPrice * 1e36)\n  function convertFromShares(\n    address token,\n    uint256 shares\n  ) external view returns (uint256) {\n    if (token == address(0)) revert InvalidTokenAddress();\n    if (shares == 0) revert AmountTooLow();\n\n    (\n      bool isAccepted,\n      bool paused,\n      address priceOracle,\n      uint8 tokenDecimals\n    ) = depositTokenRegistry.getTokenPriceInfo(token);\n    if (!isAccepted || paused) revert TokenNotAcceptedOrPaused();\n\n    IPriceOracle oracle = IPriceOracle(priceOracle);\n    IPriceOracle.PriceInfo memory priceInfo = oracle.latestPriceInfo();\n\n    if (\n      priceInfo.status != IPriceOracle.PriceStatus.VALID &&\n      priceInfo.status != IPriceOracle.PriceStatus.CAPPED\n    ) revert InvalidTokenPrice();\n\n    uint256 tokenPrice = priceInfo.price;\n    uint8 oracleDecimals = oracle.decimals();\n\n    uint256 tokenValue = shares.mulDiv(sharePrice, 1e18);\n    return\n      tokenValue.mulDiv(\n        10 ** tokenDecimals * 10 ** oracleDecimals,\n        tokenPrice * 1e18\n      );\n  }\n}\n","creation_status":"success","file_path":"contracts/SharePriceCalculator.sol"}