{"file_path":"contracts/Position.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./utils/Ownable.sol\";\r\nimport \"./utils/MathUtil.sol\";\r\n\r\nimport \"./interface/IERC20.sol\";\r\nimport \"./interface/IPosition.sol\";\r\nimport \"./interface/IReserve.sol\";\r\nimport \"./interface/IFrankencoin.sol\";\r\n\r\n/**\r\n * @title Position\r\n * @notice A collateralized minting position.\r\n */\r\ncontract Position is Ownable, IPosition, MathUtil {\r\n    /**\r\n     * @notice Note that this contract is intended to be cloned. All clones will share the same values for\r\n     * the constant and immutable fields, but have their own values for the other fields.\r\n     */\r\n\r\n    /**\r\n     * @notice The zchf price per unit of the collateral below which challenges succeed, (36 - collateral.decimals) decimals\r\n     */\r\n    uint256 public price;\r\n\r\n    /**\r\n     * @notice Net minted amount, including reserve.\r\n     */\r\n    uint256 public minted;\r\n\r\n    /**\r\n     * @notice Amount of the collateral that is currently under a challenge.\r\n     * Used to figure out whether there are pending challenges.\r\n     */\r\n    uint256 public challengedAmount;\r\n\r\n    /**\r\n     * @notice Challenge period in seconds.\r\n     */\r\n    uint64 public immutable challengePeriod;\r\n\r\n    /**\r\n     * @notice End of the latest cooldown. If this is in the future, minting is suspended.\r\n     */\r\n    uint256 public cooldown;\r\n\r\n    /**\r\n     * @notice How much can be minted at most.\r\n     */\r\n    uint256 public limit;\r\n\r\n    /**\r\n     * @notice Timestamp when minting can start and the position no longer denied.\r\n     */\r\n    uint256 public immutable start;\r\n\r\n    /**\r\n     * @notice Timestamp of the expiration of the position. After expiration, challenges cannot be averted\r\n     * any more. This is also the basis for fee calculations.\r\n     */\r\n    uint256 public expiration;\r\n\r\n    /**\r\n     * @notice The original position to help identifying clones.\r\n     */\r\n    address public immutable original;\r\n\r\n    /**\r\n     * @notice Pointer to the minting hub.\r\n     */\r\n    address public immutable hub;\r\n\r\n    /**\r\n     * @notice The Frankencoin contract.\r\n     */\r\n    IFrankencoin public immutable zchf;\r\n\r\n    /**\r\n     * @notice The collateral token.\r\n     */\r\n    IERC20 public immutable override collateral;\r\n\r\n    /**\r\n     * @notice Minimum acceptable collateral amount to prevent dust.\r\n     */\r\n    uint256 public immutable override minimumCollateral;\r\n\r\n    /**\r\n     * @notice Always pay interest for at least four weeks.\r\n     */\r\n    uint256 private constant MIN_INTEREST_DURATION = 4 weeks;\r\n\r\n    /**\r\n     * @notice The interest in parts per million per year that is deducted when minting Frankencoins.\r\n     * To be paid upfront.\r\n     */\r\n    uint32 public immutable annualInterestPPM;\r\n\r\n    /**\r\n     * @notice The reserve contribution in parts per million of the minted amount.\r\n     */\r\n    uint32 public immutable reserveContribution;\r\n\r\n    event MintingUpdate(uint256 collateral, uint256 price, uint256 minted, uint256 limit);\r\n    event PositionDenied(address indexed sender, string message); // emitted if closed by governance\r\n\r\n    error InsufficientCollateral();\r\n    error TooLate();\r\n    error RepaidTooMuch(uint256 excess);\r\n    error LimitExceeded();\r\n    error ChallengeTooSmall();\r\n    error Expired();\r\n    error Hot();\r\n    error Challenged();\r\n    error NotHub();\r\n\r\n    modifier alive() {\r\n        if (block.timestamp >= expiration) revert Expired();\r\n        _;\r\n    }\r\n\r\n    modifier noCooldown() {\r\n        if (block.timestamp <= cooldown) revert Hot();\r\n        _;\r\n    }\r\n\r\n    modifier noChallenge() {\r\n        if (challengedAmount > 0) revert Challenged();\r\n        _;\r\n    }\r\n\r\n    modifier onlyHub() {\r\n        if (msg.sender != address(hub)) revert NotHub();\r\n        _;\r\n    }\r\n\r\n    /**\r\n     * @dev See MintingHub.openPosition\r\n     */\r\n    constructor(\r\n        address _owner,\r\n        address _hub,\r\n        address _zchf,\r\n        address _collateral,\r\n        uint256 _minCollateral,\r\n        uint256 _initialLimit,\r\n        uint256 _initPeriod,\r\n        uint256 _duration,\r\n        uint64 _challengePeriod,\r\n        uint32 _annualInterestPPM,\r\n        uint256 _liqPrice,\r\n        uint32 _reservePPM\r\n    ) {\r\n        require(_initPeriod >= 3 days); // must be at least three days, recommended to use higher values\r\n        _setOwner(_owner);\r\n        original = address(this);\r\n        hub = _hub;\r\n        zchf = IFrankencoin(_zchf);\r\n        collateral = IERC20(_collateral);\r\n        annualInterestPPM = _annualInterestPPM;\r\n        reserveContribution = _reservePPM;\r\n        minimumCollateral = _minCollateral;\r\n        challengePeriod = _challengePeriod;\r\n        start = block.timestamp + _initPeriod; // at least three days time to deny the position\r\n        cooldown = start;\r\n        expiration = start + _duration;\r\n        limit = _initialLimit;\r\n        _setPrice(_liqPrice);\r\n    }\r\n\r\n    /**\r\n     * @notice Method to initialize a freshly created clone. It is the responsibility of the creator to make sure this is only\r\n     * called once and to call reduceLimitForClone on the original position before initializing the clone.\r\n     */\r\n    function initializeClone(\r\n        address owner,\r\n        uint256 _price,\r\n        uint256 _coll,\r\n        uint256 _initialMint,\r\n        uint256 expirationTime\r\n    ) external onlyHub {\r\n        if (_coll < minimumCollateral) revert InsufficientCollateral();\r\n        uint256 impliedPrice = (_initialMint * ONE_DEC18) / _coll;\r\n        _initialMint = (impliedPrice * _coll) / ONE_DEC18; // to cancel potential rounding errors\r\n        if (impliedPrice > _price) revert InsufficientCollateral();\r\n        _setOwner(owner);\r\n        limit = _initialMint;\r\n        expiration = expirationTime;\r\n        _setPrice(impliedPrice);\r\n        _mint(owner, _initialMint, _coll);\r\n    }\r\n\r\n    function limitForClones() public view returns (uint256) {\r\n        uint256 backedLimit = (_collateralBalance() * price) / ONE_DEC18;\r\n        if (backedLimit >= limit) {\r\n            return 0;\r\n        } else {\r\n            // due to invariants, this is always below (limit - minted)\r\n            return limit - backedLimit;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @notice Adjust this position's limit to allow a clone to mint its own Frankencoins.\r\n     * Invariant: global limit stays the same.\r\n     *\r\n     * Cloning a position is only allowed if the position is not challenged, not expired and not in cooldown.\r\n     */\r\n    function reduceLimitForClone(uint256 mint_) external noChallenge noCooldown alive onlyHub {\r\n        if (mint_ > limitForClones()) revert LimitExceeded();\r\n        limit -= mint_;\r\n    }\r\n\r\n    /**\r\n     * @notice Qualified pool share holders can call this method to immediately expire a freshly proposed position.\r\n     */\r\n    function deny(address[] calldata helpers, string calldata message) external {\r\n        if (block.timestamp >= start) revert TooLate();\r\n        IReserve(zchf.reserve()).checkQualified(msg.sender, helpers);\r\n        _close(); // since expiration is immutable, we put it under eternal cooldown\r\n        emit PositionDenied(msg.sender, message);\r\n    }\r\n\r\n    function _close() internal {\r\n        cooldown = type(uint256).max;\r\n    }\r\n\r\n    function isClosed() public view returns (bool) {\r\n        return cooldown == type(uint256).max;\r\n    }\r\n\r\n    /**\r\n     * @notice This is how much the minter can actually use when minting ZCHF, with the rest being used\r\n     * assigned to the minter reserve or (if applicable) fees.\r\n     */\r\n    function getUsableMint(uint256 totalMint, bool afterFees) external view returns (uint256) {\r\n        if (afterFees) {\r\n            return (totalMint * (1000_000 - reserveContribution - calculateCurrentFee())) / 1000_000;\r\n        } else {\r\n            return (totalMint * (1000_000 - reserveContribution)) / 1000_000;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @notice \"All in one\" function to adjust the outstanding amount of ZCHF, the collateral amount,\r\n     * and the price in one transaction.\r\n     */\r\n    function adjust(uint256 newMinted, uint256 newCollateral, uint256 newPrice) external onlyOwner {\r\n        uint256 colbal = _collateralBalance();\r\n        if (newCollateral > colbal) {\r\n            collateral.transferFrom(msg.sender, address(this), newCollateral - colbal);\r\n        }\r\n        // Must be called after collateral deposit, but before withdrawal\r\n        if (newMinted < minted) {\r\n            zchf.burnFromWithReserve(msg.sender, minted - newMinted, reserveContribution);\r\n            minted = newMinted;\r\n        }\r\n        if (newCollateral < colbal) {\r\n            withdrawCollateral(msg.sender, colbal - newCollateral);\r\n        }\r\n        // Must be called after collateral withdrawal\r\n        if (newMinted > minted) {\r\n            mint(msg.sender, newMinted - minted);\r\n        }\r\n        if (newPrice != price) {\r\n            adjustPrice(newPrice);\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @notice Allows the position owner to adjust the liquidation price as long as there is no pending challenge.\r\n     * Lowering the liquidation price can be done with immediate effect, given that there is enough collateral.\r\n     * Increasing the liquidation price triggers a cooldown period of 3 days, during which minting is suspended.\r\n     */\r\n    function adjustPrice(uint256 newPrice) public onlyOwner noChallenge {\r\n        if (newPrice > price) {\r\n            _restrictMinting(3 days);\r\n        } else {\r\n            _checkCollateral(_collateralBalance(), newPrice);\r\n        }\r\n        _setPrice(newPrice);\r\n        emit MintingUpdate(_collateralBalance(), price, minted, limit);\r\n    }\r\n\r\n    function _setPrice(uint256 newPrice) internal {\r\n        require(newPrice * minimumCollateral <= limit * ONE_DEC18); // sanity check\r\n        price = newPrice;\r\n    }\r\n\r\n    function _collateralBalance() internal view returns (uint256) {\r\n        return IERC20(collateral).balanceOf(address(this));\r\n    }\r\n\r\n    /**\r\n     * @notice Mint ZCHF as long as there is no open challenge, the position is not subject to a cooldown,\r\n     * and there is sufficient collateral.\r\n     */\r\n    function mint(address target, uint256 amount) public onlyOwner noChallenge noCooldown alive {\r\n        _mint(target, amount, _collateralBalance());\r\n    }\r\n\r\n    function calculateCurrentFee() public view returns (uint32) {\r\n        uint256 exp = expiration;\r\n        uint256 time = block.timestamp < start ? start : block.timestamp;\r\n        uint256 timePassed = time >= exp - MIN_INTEREST_DURATION ? MIN_INTEREST_DURATION : exp - time;\r\n        // Time resolution is in the range of minutes for typical interest rates.\r\n        return uint32((timePassed * annualInterestPPM) / 365 days);\r\n    }\r\n\r\n    function _mint(address target, uint256 amount, uint256 collateral_) internal {\r\n        if (minted + amount > limit) revert LimitExceeded();\r\n        zchf.mintWithReserve(target, amount, reserveContribution, calculateCurrentFee());\r\n        minted += amount;\r\n\r\n        _checkCollateral(collateral_, price);\r\n        emit MintingUpdate(_collateralBalance(), price, minted, limit);\r\n    }\r\n\r\n    function _restrictMinting(uint256 period) internal {\r\n        uint256 horizon = block.timestamp + period;\r\n        if (horizon > cooldown) {\r\n            cooldown = horizon;\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @notice Repay some ZCHF. If too much is repaid, the call fails.\r\n     * It is possible to repay while there are challenges, but the collateral is locked until all is clear again.\r\n     *\r\n     * The repaid amount should fulfill the following equation in order to close the position,\r\n     * i.e. bring the minted amount to 0:\r\n     * minted = amount + zchf.calculateAssignedReserve(amount, reservePPM)\r\n     *\r\n     * Under normal circumstances, this implies:\r\n     * amount = minted * (1000000 - reservePPM)\r\n     *\r\n     * E.g. if minted is 50 and reservePPM is 200000, it is necessary to repay 40 to be able to close the position.\r\n     */\r\n    function repay(uint256 amount) public {\r\n        IERC20(zchf).transferFrom(msg.sender, address(this), amount);\r\n        uint256 actuallyRepaid = IFrankencoin(zchf).burnWithReserve(amount, reserveContribution);\r\n        _notifyRepaid(actuallyRepaid);\r\n        emit MintingUpdate(_collateralBalance(), price, minted, limit);\r\n    }\r\n\r\n    function _notifyRepaid(uint256 amount) internal {\r\n        if (amount > minted) revert RepaidTooMuch(amount - minted);\r\n        minted -= amount;\r\n    }\r\n\r\n    /**\r\n     * @notice Withdraw any ERC20 token that might have ended up on this address.\r\n     * Withdrawing collateral is subject to the same restrictions as withdrawCollateral(...).\r\n     */\r\n    function withdraw(address token, address target, uint256 amount) external onlyOwner {\r\n        if (token == address(collateral)) {\r\n            withdrawCollateral(target, amount);\r\n        } else {\r\n            uint256 balance = _collateralBalance();\r\n            IERC20(token).transfer(target, amount);\r\n            require(balance == _collateralBalance()); // guard against double-entry-point tokens\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @notice Withdraw collateral from the position up to the extent that it is still well collateralized afterwards.\r\n     * Not possible as long as there is an open challenge or the contract is subject to a cooldown.\r\n     *\r\n     * Withdrawing collateral below the minimum collateral amount formally closes the position.\r\n     */\r\n    function withdrawCollateral(address target, uint256 amount) public onlyOwner noChallenge {\r\n        if (block.timestamp <= cooldown && !isClosed()) revert Hot();\r\n        uint256 balance = _withdrawCollateral(target, amount);\r\n        _checkCollateral(balance, price);\r\n        if (balance < minimumCollateral && balance > 0) revert InsufficientCollateral(); // Prevent dust amounts\r\n    }\r\n\r\n    function _withdrawCollateral(address target, uint256 amount) internal returns (uint256) {\r\n        if (amount > 0) {\r\n            // Some weird tokens fail when trying to transfer 0 amounts\r\n            IERC20(collateral).transfer(target, amount);\r\n        }\r\n        uint256 balance = _collateralBalance();\r\n        _considerClose(balance);\r\n        emit MintingUpdate(balance, price, minted, limit);\r\n        return balance;\r\n    }\r\n\r\n    function _considerClose(uint256 collateralBalance) internal {\r\n        if (collateralBalance < minimumCollateral && challengedAmount == 0) {\r\n            // This leaves a slightly unsatisfying possibility open: if the withdrawal happens due to a successful\r\n            // challenge, there might be a small amount of collateral left that is not withheld in case there are no\r\n            // other pending challenges. The only way to cleanly solve this would be to have two distinct cooldowns,\r\n            // one for minting and one for withdrawals.\r\n            _close();\r\n        }\r\n    }\r\n\r\n    /**\r\n     * @notice This invariant must always hold and must always be checked when any of the three\r\n     * variables change in an adverse way.\r\n     */\r\n    function _checkCollateral(uint256 collateralReserve, uint256 atPrice) internal view {\r\n        if (collateralReserve * atPrice < minted * ONE_DEC18) revert InsufficientCollateral();\r\n    }\r\n\r\n    /**\r\n     * @notice Returns the liquidation price and the durations for phase1 and phase2 of the challenge.\r\n     * Both phases are usually of equal duration, but near expiration, phase one is adjusted such that\r\n     * it cannot last beyond the expiration date of the position.\r\n     */\r\n    function challengeData(uint256 challengeStart) external view returns (uint256 liqPrice, uint64 phase1, uint64 phase2) {\r\n        uint256 timeToExpiration = challengeStart >= expiration ? 0 : expiration - challengeStart;\r\n        return (price, uint64(_min(timeToExpiration, challengePeriod)), challengePeriod);\r\n    }\r\n\r\n    function notifyChallengeStarted(uint256 size) external onlyHub {\r\n        // Require minimum size. Collateral balance can be below minimum if it was partially challenged before.\r\n        if (size < minimumCollateral && size < _collateralBalance()) revert ChallengeTooSmall();\r\n        if (size == 0) revert ChallengeTooSmall();\r\n        challengedAmount += size;\r\n    }\r\n\r\n    /**\r\n     * @param size   amount of collateral challenged (dec18)\r\n     */\r\n    function notifyChallengeAverted(uint256 size) external onlyHub {\r\n        challengedAmount -= size;\r\n\r\n        // Don't allow minter to close the position immediately so challenge can be repeated before\r\n        // the owner has a chance to mint more on an undercollateralized position\r\n        _restrictMinting(1 days);\r\n\r\n        // If this was the last open challenge and there is only a dust amount of collateral left, the position should be closed\r\n        _considerClose(_collateralBalance());\r\n    }\r\n\r\n    /**\r\n     * @notice Notifies the position that a challenge was successful.\r\n     * Triggers the payout of the challenged part of the collateral.\r\n     * Everything else is assumed to be handled by the hub.\r\n     *\r\n     * @param _bidder   address of the bidder that receives the collateral\r\n     * @param _size     amount of the collateral bid for\r\n     * @return (position owner, effective challenge size in ZCHF, amount to be repaid, reserve ppm)\r\n     */\r\n    function notifyChallengeSucceeded(\r\n        address _bidder,\r\n        uint256 _size\r\n    ) external onlyHub returns (address, uint256, uint256, uint32) {\r\n        challengedAmount -= _size;\r\n        uint256 colBal = _collateralBalance();\r\n        if (colBal < _size) {\r\n            _size = colBal;\r\n        }\r\n        uint256 repayment = colBal == 0 ? 0 : minted * _size / colBal; // for enormous colBal, this could be rounded to 0, which is ok\r\n        _notifyRepaid(repayment); // we assume the caller takes care of the actual repayment\r\n\r\n        // Give time for additional challenges before the owner can mint again. In particular,\r\n        // the owner might have added collateral only seconds before the challenge ended, preventing a close.\r\n        _restrictMinting(3 days);\r\n        \r\n        _withdrawCollateral(_bidder, _size); // transfer collateral to the bidder and emit update\r\n\r\n        return (owner, _size, repayment, reserveContribution);\r\n    }\r\n}\r\n","deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106102065760003560e01c8063787a08a61161011a578063babe7c74116100ad578063d6e8f96b1161007c578063d6e8f96b146104e1578063d8dfeb451461051a578063d9caed1214610541578063f2fde38b14610554578063f3f480d91461056757600080fd5b8063babe7c7414610456578063be9a65551461047d578063c2b6b58c146104a4578063c4d4803a146104ba57600080fd5b8063a4d66daf116100e9578063a4d66daf1461041f578063a9ced3f014610428578063aee1a95914610430578063b0c2ec821461044357600080fd5b8063787a08a6146103d35780637bd6fb9b146103dc5780638da5cb5b14610403578063a035b1fe1461041657600080fd5b80633a7c29fb1161019d57806346c715fa1161016c57806346c715fa1461036a57806349746f10146103915780634f02c420146103a45780636f871cec146103ad57806372bf079e146103c057600080fd5b80633a7c29fb1461031457806340c10f191461033b57806342d020411461034e5780634665096d1461036157600080fd5b8063350c35e9116101d9578063350c35e914610292578063365a86fc146102a5578063371fd8e6146102e4578063383ef46e146102f757600080fd5b8063082629401461020b5780631bbea34c1461023157806320aa9e721461024657806324e657fe14610289575b600080fd5b61021e610219366004611936565b6105a7565b6040519081526020015b60405180910390f35b61024461023f366004611966565b610647565b005b610259610254366004611a40565b6107bc565b604080516001600160a01b03909516855260208501939093529183015263ffffffff166060820152608001610228565b61021e60035481565b6102446102a0366004611a40565b6108c0565b6102cc7f0000000000000000000000007546762fdb1a6d9146b33960545c3f639426521981565b6040516001600160a01b039091168152602001610228565b6102446102f2366004611a6c565b61098a565b6102ff610b2e565b60405163ffffffff9091168152602001610228565b6102ff7f00000000000000000000000000000000000000000000000000000000000186a081565b610244610349366004611a40565b610bf9565b61024461035c366004611a6c565b610c7d565b61021e60065481565b6102cc7f000000000000000000000000fc22a33e5746a45517e9725c1d5cd958c37538a781565b61024461039f366004611a6c565b610d54565b61021e60025481565b6102446103bb366004611a85565b610dd4565b6102446103ce366004611a6c565b610fda565b61021e60045481565b6102ff7f000000000000000000000000000000000000000000000000000000000000753081565b6000546102cc906001600160a01b031681565b61021e60015481565b61021e60055481565b61021e61107f565b61024461043e366004611ab1565b6110d1565b610244610451366004611a6c565b6111eb565b61021e7f0000000000000000000000000000000000000000000000000000000001406f4081565b61021e7f0000000000000000000000000000000000000000000000000000000066b0a09b81565b6004546040516000199091148152602001610228565b6102cc7f000000000000000000000000b58e61c3098d85632df34eecfb899a1ed80921cb81565b6104f46104ef366004611a6c565b6112d3565b6040805193845267ffffffffffffffff9283166020850152911690820152606001610228565b6102cc7f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c59981565b61024461054f366004611af5565b611360565b610244610562366004611b36565b611441565b61058e7f000000000000000000000000000000000000000000000000000000000001518081565b60405167ffffffffffffffff9091168152602001610228565b6000811561061357620f42406105bb610b2e565b6105e87f00000000000000000000000000000000000000000000000000000000000186a0620f4240611b69565b6105f29190611b69565b6106029063ffffffff1685611b8d565b61060c9190611ba4565b9050610641565b620f42406105f27f00000000000000000000000000000000000000000000000000000000000186a082611b69565b92915050565b7f0000000000000000000000000000000000000000000000000000000066b0a09b42106106875760405163ecdd1c2960e01b815260040160405180910390fd5b7f000000000000000000000000b58e61c3098d85632df34eecfb899a1ed80921cb6001600160a01b031663cd3293de6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107099190611bc6565b6001600160a01b031663352e3a833386866040518463ffffffff1660e01b815260040161073893929190611be3565b60006040518083038186803b15801561075057600080fd5b505afa158015610764573d6000803e3d6000fd5b50505050610773600019600455565b336001600160a01b03167faca80c800ec0d2aa9d9d31b7f886a1dd3067d4676abc637626a18ffb9381653d83836040516107ae929190611c3f565b60405180910390a250505050565b6000808080336001600160a01b037f0000000000000000000000007546762fdb1a6d9146b33960545c3f6394265219161461080a576040516313bd2e8360e31b815260040160405180910390fd5b846003600082825461081c9190611c6e565b909155506000905061082c611453565b90508581101561083a578095505b600081156108605781876002546108519190611b8d565b61085b9190611ba4565b610863565b60005b905061086e816114e3565b61087a6203f480611531565b610884888861154f565b506000546001600160a01b031698969750957f00000000000000000000000000000000000000000000000000000000000186a095509350505050565b6108c933611646565b600354156108ea5760405163d26e2de960e01b815260040160405180910390fd5b6004544211158015610900575060045460001914155b1561091e57604051631c02820f60e21b815260040160405180910390fd5b600061092a838361154f565b905061093881600154611674565b7f0000000000000000000000000000000000000000000000000000000001406f40811080156109675750600081115b1561098557604051633a23d82560e01b815260040160405180910390fd5b505050565b6040516323b872dd60e01b8152336004820152306024820152604481018290527f000000000000000000000000b58e61c3098d85632df34eecfb899a1ed80921cb6001600160a01b0316906323b872dd906064016020604051808303816000875af11580156109fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a219190611c81565b5060405163a47d75ad60e01b81526004810182905263ffffffff7f00000000000000000000000000000000000000000000000000000000000186a01660248201526000907f000000000000000000000000b58e61c3098d85632df34eecfb899a1ed80921cb6001600160a01b03169063a47d75ad906044016020604051808303816000875af1158015610ab8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adc9190611c9e565b9050610ae7816114e3565b600080516020611ccb833981519152610afe611453565b60015460025460055460408051948552602085019390935291830152606082015260800160405180910390a15050565b600654600090817f0000000000000000000000000000000000000000000000000000000066b0a09b4210610b625742610b84565b7f0000000000000000000000000000000000000000000000000000000066b0a09b5b90506000610b956224ea0084611c6e565b821015610bab57610ba68284611c6e565b610bb0565b6224ea005b90506301e13380610be763ffffffff7f00000000000000000000000000000000000000000000000000000000000075301683611b8d565b610bf19190611ba4565b935050505090565b610c0233611646565b60035415610c235760405163d26e2de960e01b815260040160405180910390fd5b6004544211610c4557604051631c02820f60e21b815260040160405180910390fd5b6006544210610c6757604051630407b05b60e31b815260040160405180910390fd5b610c798282610c74611453565b6116b3565b5050565b336001600160a01b037f0000000000000000000000007546762fdb1a6d9146b33960545c3f63942652191614610cc6576040516313bd2e8360e31b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000001406f4081108015610cfb5750610cf8611453565b81105b15610d1957604051633c80636b60e21b815260040160405180910390fd5b80600003610d3a57604051633c80636b60e21b815260040160405180910390fd5b8060036000828254610d4c9190611cb7565b909155505050565b336001600160a01b037f0000000000000000000000007546762fdb1a6d9146b33960545c3f63942652191614610d9d576040516313bd2e8360e31b815260040160405180910390fd5b8060036000828254610daf9190611c6e565b90915550610dc1905062015180611531565b610dd1610dcc611453565b61181e565b50565b610ddd33611646565b6000610de7611453565b905080831115610ea6576001600160a01b037f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599166323b872dd3330610e2c8588611c6e565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015610e80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea49190611c81565b505b600254841015610f90577f000000000000000000000000b58e61c3098d85632df34eecfb899a1ed80921cb6001600160a01b031663315f3e723386600254610eee9190611c6e565b6040516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482015263ffffffff7f00000000000000000000000000000000000000000000000000000000000186a01660448201526064016020604051808303816000875af1158015610f65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f899190611c9e565b5060028490555b80831015610fa657610fa6336102a08584611c6e565b600254841115610fc257610fc233600254866103499190611c6e565b6001548214610fd457610fd482610fda565b50505050565b610fe333611646565b600354156110045760405163d26e2de960e01b815260040160405180910390fd5b60015481111561101f5761101a6203f480611531565b611030565b61103061102a611453565b82611674565b6110398161185d565b600080516020611ccb833981519152611050611453565b60015460025460055460408051948552602085019390935291830152606082015260800160405180910390a150565b600080670de0b6b3a7640000600154611096611453565b6110a09190611b8d565b6110aa9190611ba4565b905060055481106110bd57600091505090565b806005546110cb9190611c6e565b91505090565b336001600160a01b037f0000000000000000000000007546762fdb1a6d9146b33960545c3f6394265219161461111a576040516313bd2e8360e31b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000001406f4083101561115b57604051633a23d82560e01b815260040160405180910390fd5b600083611170670de0b6b3a764000085611b8d565b61117a9190611ba4565b9050670de0b6b3a764000061118f8583611b8d565b6111999190611ba4565b9250848111156111bc57604051633a23d82560e01b815260040160405180910390fd5b6111c5866118ad565b600583905560068290556111d88161185d565b6111e38684866116b3565b505050505050565b6003541561120c5760405163d26e2de960e01b815260040160405180910390fd5b600454421161122e57604051631c02820f60e21b815260040160405180910390fd5b600654421061125057604051630407b05b60e31b815260040160405180910390fd5b336001600160a01b037f0000000000000000000000007546762fdb1a6d9146b33960545c3f63942652191614611299576040516313bd2e8360e31b815260040160405180910390fd5b6112a161107f565b8111156112c157604051631930e3c960e11b815260040160405180910390fd5b8060056000828254610d4c9190611c6e565b6000806000806006548510156112f657846006546112f19190611c6e565b6112f9565b60005b9050600154611332827f000000000000000000000000000000000000000000000000000000000001518067ffffffffffffffff16611910565b90969095507f0000000000000000000000000000000000000000000000000000000000015180945092505050565b61136933611646565b7f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5996001600160a01b0316836001600160a01b0316036113ac5761098582826108c0565b60006113b6611453565b60405163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529192509085169063a9059cbb906044016020604051808303816000875af1158015611409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142d9190611c81565b50611436611453565b8114610fd457600080fd5b61144a33611646565b610dd1816118ad565b6040516370a0823160e01b81523060048201526000907f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5996001600160a01b0316906370a0823190602401602060405180830381865afa1580156114ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114de9190611c9e565b905090565b60025481111561151f576002546114fa9082611c6e565b604051635795d46960e11b815260040161151691815260200190565b60405180910390fd5b8060026000828254610d4c9190611c6e565b600061153d8242611cb7565b9050600454811115610c795760045550565b600081156115ec5760405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490527f0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599169063a9059cbb906044016020604051808303816000875af11580156115c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ea9190611c81565b505b60006115f6611453565b90506116018161181e565b6001546002546005546040805185815260208101949094528301919091526060820152600080516020611ccb8339815191529060800160405180910390a19392505050565b6000546001600160a01b03828116911614610dd1576040516330cd747160e01b815260040160405180910390fd5b670de0b6b3a764000060025461168a9190611b8d565b6116948284611b8d565b1015610c7957604051633a23d82560e01b815260040160405180910390fd5b600554826002546116c49190611cb7565b11156116e357604051631930e3c960e11b815260040160405180910390fd5b7f000000000000000000000000b58e61c3098d85632df34eecfb899a1ed80921cb6001600160a01b0316638112eb2b84847f00000000000000000000000000000000000000000000000000000000000186a061173d610b2e565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602484019290925263ffffffff9081166044840152166064820152608401600060405180830381600087803b15801561179957600080fd5b505af11580156117ad573d6000803e3d6000fd5b5050505081600260008282546117c39190611cb7565b925050819055506117d681600154611674565b600080516020611ccb8339815191526117ed611453565b60015460025460055460408051948552602085019390935291830152606082015260800160405180910390a1505050565b7f0000000000000000000000000000000000000000000000000000000001406f408110801561184d5750600354155b15610dd157610dd1600019600455565b670de0b6b3a76400006005546118739190611b8d565b61189d7f0000000000000000000000000000000000000000000000000000000001406f4083611b8d565b11156118a857600080fd5b600155565b6001600160a01b0381166118c057600080fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081831061191f5781611921565b825b9392505050565b8015158114610dd157600080fd5b6000806040838503121561194957600080fd5b82359150602083013561195b81611928565b809150509250929050565b6000806000806040858703121561197c57600080fd5b843567ffffffffffffffff8082111561199457600080fd5b818701915087601f8301126119a857600080fd5b8135818111156119b757600080fd5b8860208260051b85010111156119cc57600080fd5b6020928301965094509086013590808211156119e757600080fd5b818701915087601f8301126119fb57600080fd5b813581811115611a0a57600080fd5b886020828501011115611a1c57600080fd5b95989497505060200194505050565b6001600160a01b0381168114610dd157600080fd5b60008060408385031215611a5357600080fd5b8235611a5e81611a2b565b946020939093013593505050565b600060208284031215611a7e57600080fd5b5035919050565b600080600060608486031215611a9a57600080fd5b505081359360208301359350604090920135919050565b600080600080600060a08688031215611ac957600080fd5b8535611ad481611a2b565b97602087013597506040870135966060810135965060800135945092505050565b600080600060608486031215611b0a57600080fd5b8335611b1581611a2b565b92506020840135611b2581611a2b565b929592945050506040919091013590565b600060208284031215611b4857600080fd5b813561192181611a2b565b634e487b7160e01b600052601160045260246000fd5b63ffffffff828116828216039080821115611b8657611b86611b53565b5092915050565b808202811582820484141761064157610641611b53565b600082611bc157634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215611bd857600080fd5b815161192181611a2b565b6001600160a01b03848116825260406020808401829052908301849052600091859160608501845b87811015611c32578435611c1e81611a2b565b841682529382019390820190600101611c0b565b5098975050505050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b8181038181111561064157610641611b53565b600060208284031215611c9357600080fd5b815161192181611928565b600060208284031215611cb057600080fd5b5051919050565b8082018082111561064157610641611b5356fecb2040b7eb3265a4335698c9ecbe81a5f9857e92aa32e07ce235f44c321a7e35a264697066735822122033a1d869823b066283198911926f6f789832b83aa6f7e1ee38d0848552f7e9e664736f6c63430008140033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"paris","libraries":{},"metadata":{"bytecodeHash":"ipfs","useLiteralContent":true},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"optimization_runs":200,"sourcify_repo_url":"https://repo.sourcify.dev/contracts/full_match/1/0xfC22a33e5746a45517E9725C1D5cd958c37538A7/","decoded_constructor_args":[["0xbfE145DcFac110Df1efD27B403Dd68fd2C61494e",{"internalType":"address","name":"_owner","type":"address"}],["0x7546762fdb1a6d9146b33960545C3f6394265219",{"internalType":"address","name":"_hub","type":"address"}],["0xB58E61C3098d85632Df34EecfB899A1Ed80921cB",{"internalType":"address","name":"_zchf","type":"address"}],["0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",{"internalType":"address","name":"_collateral","type":"address"}],["21000000",{"internalType":"uint256","name":"_minCollateral","type":"uint256"}],["200000000000000000000000",{"internalType":"uint256","name":"_initialLimit","type":"uint256"}],["259200",{"internalType":"uint256","name":"_initPeriod","type":"uint256"}],["124416000",{"internalType":"uint256","name":"_duration","type":"uint256"}],["86400",{"internalType":"uint64","name":"_challengePeriod","type":"uint64"}],["30000",{"internalType":"uint32","name":"_annualInterestPPM","type":"uint32"}],["300000000000000000000000000000000",{"internalType":"uint256","name":"_liqPrice","type":"uint256"}],["100000",{"internalType":"uint32","name":"_reservePPM","type":"uint32"}]],"compiler_version":"0.8.20+commit.a1b79de6","is_verified_via_verifier_alliance":false,"verified_at":"2024-08-02T09:52:07.301142Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x6101a06040523480156200001257600080fd5b5060405162002136380380620021368339810160408190526200003591620001ac565b6203f4808610156200004657600080fd5b620000518c620000dd565b3060c0526001600160a01b038b811660e0528a81166101005289166101205263ffffffff808416610160528116610180526101408890526001600160401b038416608052620000a1864262000296565b60a08190526004819055620000b890869062000296565b6006556005879055620000cb8262000141565b505050505050505050505050620002cc565b6001600160a01b038116620000f157600080fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b670de0b6b3a7640000600554620001599190620002b2565b61014051620001699083620002b2565b11156200017557600080fd5b600155565b80516001600160a01b03811681146200019257600080fd5b919050565b805163ffffffff811681146200019257600080fd5b6000806000806000806000806000806000806101808d8f031215620001d057600080fd5b620001db8d6200017a565b9b50620001eb60208e016200017a565b9a50620001fb60408e016200017a565b99506200020b60608e016200017a565b985060808d0151975060a08d0151965060c08d0151955060e08d015194506101008d015160018060401b03811681146200024457600080fd5b9350620002556101208e0162000197565b92506101408d015191506200026e6101608e0162000197565b90509295989b509295989b509295989b565b634e487b7160e01b600052601160045260246000fd5b80820180821115620002ac57620002ac62000280565b92915050565b8082028115828204841417620002ac57620002ac62000280565b60805160a05160c05160e0516101005161012051610140516101605161018051611d206200041660003960008181610319015281816105c00152818161061c0152818161089801528181610a3d01528181610f1e01526117160152600081816103e10152610bc101526000818161045b0152818161093a01528181610cc80152818161111c01528181611820015261187801526000818161051f01528181610dfb0152818161136b0152818161146b015261157d0152600081816104bf01528181610689015281816109ac01528181610a6701528181610eb201526116e50152600081816102aa015281816107cc01528181610c8801528181610d5f015281816110dc015261125b0152600061036f0152600081816104820152818161064901528181610b370152610b6401526000818161056c0152818161130401526113390152611d206000f3fe608060405234801561001057600080fd5b50600436106102065760003560e01c8063787a08a61161011a578063babe7c74116100ad578063d6e8f96b1161007c578063d6e8f96b146104e1578063d8dfeb451461051a578063d9caed1214610541578063f2fde38b14610554578063f3f480d91461056757600080fd5b8063babe7c7414610456578063be9a65551461047d578063c2b6b58c146104a4578063c4d4803a146104ba57600080fd5b8063a4d66daf116100e9578063a4d66daf1461041f578063a9ced3f014610428578063aee1a95914610430578063b0c2ec821461044357600080fd5b8063787a08a6146103d35780637bd6fb9b146103dc5780638da5cb5b14610403578063a035b1fe1461041657600080fd5b80633a7c29fb1161019d57806346c715fa1161016c57806346c715fa1461036a57806349746f10146103915780634f02c420146103a45780636f871cec146103ad57806372bf079e146103c057600080fd5b80633a7c29fb1461031457806340c10f191461033b57806342d020411461034e5780634665096d1461036157600080fd5b8063350c35e9116101d9578063350c35e914610292578063365a86fc146102a5578063371fd8e6146102e4578063383ef46e146102f757600080fd5b8063082629401461020b5780631bbea34c1461023157806320aa9e721461024657806324e657fe14610289575b600080fd5b61021e610219366004611936565b6105a7565b6040519081526020015b60405180910390f35b61024461023f366004611966565b610647565b005b610259610254366004611a40565b6107bc565b604080516001600160a01b03909516855260208501939093529183015263ffffffff166060820152608001610228565b61021e60035481565b6102446102a0366004611a40565b6108c0565b6102cc7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610228565b6102446102f2366004611a6c565b61098a565b6102ff610b2e565b60405163ffffffff9091168152602001610228565b6102ff7f000000000000000000000000000000000000000000000000000000000000000081565b610244610349366004611a40565b610bf9565b61024461035c366004611a6c565b610c7d565b61021e60065481565b6102cc7f000000000000000000000000000000000000000000000000000000000000000081565b61024461039f366004611a6c565b610d54565b61021e60025481565b6102446103bb366004611a85565b610dd4565b6102446103ce366004611a6c565b610fda565b61021e60045481565b6102ff7f000000000000000000000000000000000000000000000000000000000000000081565b6000546102cc906001600160a01b031681565b61021e60015481565b61021e60055481565b61021e61107f565b61024461043e366004611ab1565b6110d1565b610244610451366004611a6c565b6111eb565b61021e7f000000000000000000000000000000000000000000000000000000000000000081565b61021e7f000000000000000000000000000000000000000000000000000000000000000081565b6004546040516000199091148152602001610228565b6102cc7f000000000000000000000000000000000000000000000000000000000000000081565b6104f46104ef366004611a6c565b6112d3565b6040805193845267ffffffffffffffff9283166020850152911690820152606001610228565b6102cc7f000000000000000000000000000000000000000000000000000000000000000081565b61024461054f366004611af5565b611360565b610244610562366004611b36565b611441565b61058e7f000000000000000000000000000000000000000000000000000000000000000081565b60405167ffffffffffffffff9091168152602001610228565b6000811561061357620f42406105bb610b2e565b6105e87f0000000000000000000000000000000000000000000000000000000000000000620f4240611b69565b6105f29190611b69565b6106029063ffffffff1685611b8d565b61060c9190611ba4565b9050610641565b620f42406105f27f000000000000000000000000000000000000000000000000000000000000000082611b69565b92915050565b7f000000000000000000000000000000000000000000000000000000000000000042106106875760405163ecdd1c2960e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cd3293de6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107099190611bc6565b6001600160a01b031663352e3a833386866040518463ffffffff1660e01b815260040161073893929190611be3565b60006040518083038186803b15801561075057600080fd5b505afa158015610764573d6000803e3d6000fd5b50505050610773600019600455565b336001600160a01b03167faca80c800ec0d2aa9d9d31b7f886a1dd3067d4676abc637626a18ffb9381653d83836040516107ae929190611c3f565b60405180910390a250505050565b6000808080336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461080a576040516313bd2e8360e31b815260040160405180910390fd5b846003600082825461081c9190611c6e565b909155506000905061082c611453565b90508581101561083a578095505b600081156108605781876002546108519190611b8d565b61085b9190611ba4565b610863565b60005b905061086e816114e3565b61087a6203f480611531565b610884888861154f565b506000546001600160a01b031698969750957f000000000000000000000000000000000000000000000000000000000000000095509350505050565b6108c933611646565b600354156108ea5760405163d26e2de960e01b815260040160405180910390fd5b6004544211158015610900575060045460001914155b1561091e57604051631c02820f60e21b815260040160405180910390fd5b600061092a838361154f565b905061093881600154611674565b7f0000000000000000000000000000000000000000000000000000000000000000811080156109675750600081115b1561098557604051633a23d82560e01b815260040160405180910390fd5b505050565b6040516323b872dd60e01b8152336004820152306024820152604481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af11580156109fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a219190611c81565b5060405163a47d75ad60e01b81526004810182905263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a47d75ad906044016020604051808303816000875af1158015610ab8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adc9190611c9e565b9050610ae7816114e3565b600080516020611ccb833981519152610afe611453565b60015460025460055460408051948552602085019390935291830152606082015260800160405180910390a15050565b600654600090817f00000000000000000000000000000000000000000000000000000000000000004210610b625742610b84565b7f00000000000000000000000000000000000000000000000000000000000000005b90506000610b956224ea0084611c6e565b821015610bab57610ba68284611c6e565b610bb0565b6224ea005b90506301e13380610be763ffffffff7f00000000000000000000000000000000000000000000000000000000000000001683611b8d565b610bf19190611ba4565b935050505090565b610c0233611646565b60035415610c235760405163d26e2de960e01b815260040160405180910390fd5b6004544211610c4557604051631c02820f60e21b815260040160405180910390fd5b6006544210610c6757604051630407b05b60e31b815260040160405180910390fd5b610c798282610c74611453565b6116b3565b5050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610cc6576040516313bd2e8360e31b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000081108015610cfb5750610cf8611453565b81105b15610d1957604051633c80636b60e21b815260040160405180910390fd5b80600003610d3a57604051633c80636b60e21b815260040160405180910390fd5b8060036000828254610d4c9190611cb7565b909155505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d9d576040516313bd2e8360e31b815260040160405180910390fd5b8060036000828254610daf9190611c6e565b90915550610dc1905062015180611531565b610dd1610dcc611453565b61181e565b50565b610ddd33611646565b6000610de7611453565b905080831115610ea6576001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166323b872dd3330610e2c8588611c6e565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af1158015610e80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea49190611c81565b505b600254841015610f90577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663315f3e723386600254610eee9190611c6e565b6040516001600160e01b031960e085901b1681526001600160a01b039092166004830152602482015263ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660448201526064016020604051808303816000875af1158015610f65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f899190611c9e565b5060028490555b80831015610fa657610fa6336102a08584611c6e565b600254841115610fc257610fc233600254866103499190611c6e565b6001548214610fd457610fd482610fda565b50505050565b610fe333611646565b600354156110045760405163d26e2de960e01b815260040160405180910390fd5b60015481111561101f5761101a6203f480611531565b611030565b61103061102a611453565b82611674565b6110398161185d565b600080516020611ccb833981519152611050611453565b60015460025460055460408051948552602085019390935291830152606082015260800160405180910390a150565b600080670de0b6b3a7640000600154611096611453565b6110a09190611b8d565b6110aa9190611ba4565b905060055481106110bd57600091505090565b806005546110cb9190611c6e565b91505090565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461111a576040516313bd2e8360e31b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000083101561115b57604051633a23d82560e01b815260040160405180910390fd5b600083611170670de0b6b3a764000085611b8d565b61117a9190611ba4565b9050670de0b6b3a764000061118f8583611b8d565b6111999190611ba4565b9250848111156111bc57604051633a23d82560e01b815260040160405180910390fd5b6111c5866118ad565b600583905560068290556111d88161185d565b6111e38684866116b3565b505050505050565b6003541561120c5760405163d26e2de960e01b815260040160405180910390fd5b600454421161122e57604051631c02820f60e21b815260040160405180910390fd5b600654421061125057604051630407b05b60e31b815260040160405180910390fd5b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611299576040516313bd2e8360e31b815260040160405180910390fd5b6112a161107f565b8111156112c157604051631930e3c960e11b815260040160405180910390fd5b8060056000828254610d4c9190611c6e565b6000806000806006548510156112f657846006546112f19190611c6e565b6112f9565b60005b9050600154611332827f000000000000000000000000000000000000000000000000000000000000000067ffffffffffffffff16611910565b90969095507f0000000000000000000000000000000000000000000000000000000000000000945092505050565b61136933611646565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036113ac5761098582826108c0565b60006113b6611453565b60405163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529192509085169063a9059cbb906044016020604051808303816000875af1158015611409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142d9190611c81565b50611436611453565b8114610fd457600080fd5b61144a33611646565b610dd1816118ad565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156114ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114de9190611c9e565b905090565b60025481111561151f576002546114fa9082611c6e565b604051635795d46960e11b815260040161151691815260200190565b60405180910390fd5b8060026000828254610d4c9190611c6e565b600061153d8242611cb7565b9050600454811115610c795760045550565b600081156115ec5760405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af11580156115c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ea9190611c81565b505b60006115f6611453565b90506116018161181e565b6001546002546005546040805185815260208101949094528301919091526060820152600080516020611ccb8339815191529060800160405180910390a19392505050565b6000546001600160a01b03828116911614610dd1576040516330cd747160e01b815260040160405180910390fd5b670de0b6b3a764000060025461168a9190611b8d565b6116948284611b8d565b1015610c7957604051633a23d82560e01b815260040160405180910390fd5b600554826002546116c49190611cb7565b11156116e357604051631930e3c960e11b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638112eb2b84847f000000000000000000000000000000000000000000000000000000000000000061173d610b2e565b6040516001600160e01b031960e087901b1681526001600160a01b039094166004850152602484019290925263ffffffff9081166044840152166064820152608401600060405180830381600087803b15801561179957600080fd5b505af11580156117ad573d6000803e3d6000fd5b5050505081600260008282546117c39190611cb7565b925050819055506117d681600154611674565b600080516020611ccb8339815191526117ed611453565b60015460025460055460408051948552602085019390935291830152606082015260800160405180910390a1505050565b7f00000000000000000000000000000000000000000000000000000000000000008110801561184d5750600354155b15610dd157610dd1600019600455565b670de0b6b3a76400006005546118739190611b8d565b61189d7f000000000000000000000000000000000000000000000000000000000000000083611b8d565b11156118a857600080fd5b600155565b6001600160a01b0381166118c057600080fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081831061191f5781611921565b825b9392505050565b8015158114610dd157600080fd5b6000806040838503121561194957600080fd5b82359150602083013561195b81611928565b809150509250929050565b6000806000806040858703121561197c57600080fd5b843567ffffffffffffffff8082111561199457600080fd5b818701915087601f8301126119a857600080fd5b8135818111156119b757600080fd5b8860208260051b85010111156119cc57600080fd5b6020928301965094509086013590808211156119e757600080fd5b818701915087601f8301126119fb57600080fd5b813581811115611a0a57600080fd5b886020828501011115611a1c57600080fd5b95989497505060200194505050565b6001600160a01b0381168114610dd157600080fd5b60008060408385031215611a5357600080fd5b8235611a5e81611a2b565b946020939093013593505050565b600060208284031215611a7e57600080fd5b5035919050565b600080600060608486031215611a9a57600080fd5b505081359360208301359350604090920135919050565b600080600080600060a08688031215611ac957600080fd5b8535611ad481611a2b565b97602087013597506040870135966060810135965060800135945092505050565b600080600060608486031215611b0a57600080fd5b8335611b1581611a2b565b92506020840135611b2581611a2b565b929592945050506040919091013590565b600060208284031215611b4857600080fd5b813561192181611a2b565b634e487b7160e01b600052601160045260246000fd5b63ffffffff828116828216039080821115611b8657611b86611b53565b5092915050565b808202811582820484141761064157610641611b53565b600082611bc157634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215611bd857600080fd5b815161192181611a2b565b6001600160a01b03848116825260406020808401829052908301849052600091859160608501845b87811015611c32578435611c1e81611a2b565b841682529382019390820190600101611c0b565b5098975050505050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b8181038181111561064157610641611b53565b600060208284031215611c9357600080fd5b815161192181611928565b600060208284031215611cb057600080fd5b5051919050565b8082018082111561064157610641611b5356fecb2040b7eb3265a4335698c9ecbe81a5f9857e92aa32e07ce235f44c321a7e35a264697066735822122033a1d869823b066283198911926f6f789832b83aa6f7e1ee38d0848552f7e9e664736f6c63430008140033000000000000000000000000bfe145dcfac110df1efd27b403dd68fd2c61494e0000000000000000000000007546762fdb1a6d9146b33960545c3f6394265219000000000000000000000000b58e61c3098d85632df34eecfb899a1ed80921cb0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5990000000000000000000000000000000000000000000000000000000001406f40000000000000000000000000000000000000000000002a5a058fc295ed000000000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000076a7000000000000000000000000000000000000000000000000000000000000001518000000000000000000000000000000000000000000000000000000000000075300000000000000000000000000000000000000eca8847c4129106ce830000000000000000000000000000000000000000000000000000000000000000000186a0","name":"Position","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"paris","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":true,"additional_sources":[{"file_path":"contracts/interface/IERC20.sol","source_code":"/**\r\n * SPDX-License-Identifier: MIT\r\n *\r\n * Copyright (c) 2016-2019 zOS Global Limited\r\n *\r\n */\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP. Does not include\r\n * the optional functions; to access them see `ERC20Detailed`.\r\n */\r\n\r\ninterface IERC20 {\r\n    function name() external view returns (string memory);\r\n\r\n    function symbol() external view returns (string memory);\r\n\r\n    function decimals() external view returns (uint8);\r\n\r\n    /**\r\n     * @dev Returns the amount of tokens in existence.\r\n     */\r\n    function totalSupply() external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Returns the amount of tokens owned by `account`.\r\n     */\r\n    function balanceOf(address account) external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Moves `amount` tokens from the caller's account to `recipient`.\r\n     *\r\n     * Returns always true. Throws error on failure.\r\n     *\r\n     * Emits a `Transfer` event.\r\n     */\r\n    function transfer(address recipient, uint256 amount) external returns (bool);\r\n\r\n    /**\r\n     * @dev Returns the remaining number of tokens that `spender` will be\r\n     * allowed to spend on behalf of `owner` through `transferFrom`. This is\r\n     * zero by default.\r\n     *\r\n     * This value can change when `approve` or `transferFrom` are called.\r\n     */\r\n    function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * > Beware that changing an allowance with this method brings the risk\r\n     * that someone may use both the old and the new allowance by unfortunate\r\n     * transaction ordering. One possible solution to mitigate this race\r\n     * condition is to first reduce the spender's allowance to 0 and set the\r\n     * desired value afterwards:\r\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n     *\r\n     * Emits an `Approval` event.\r\n     */\r\n    function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n    /**\r\n     * @dev Moves `amount` tokens from `sender` to `recipient` using the\r\n     * allowance mechanism. `amount` is then deducted from the caller's\r\n     * allowance.\r\n     *\r\n     * Returns always true. Throws error on failure.\r\n     *\r\n     * Emits a `Transfer` event.\r\n     */\r\n    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);\r\n\r\n    /**\r\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n     * another (`to`).\r\n     *\r\n     * Note that `value` may be zero.\r\n     */\r\n    event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n    /**\r\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n     * a call to `approve`. `value` is the new allowance.\r\n     */\r\n    event Approval(address indexed owner, address indexed spender, uint256 value);\r\n}\r\n"},{"file_path":"contracts/interface/IFrankencoin.sol","source_code":"// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20.sol\";\r\nimport \"./IReserve.sol\";\r\n\r\ninterface IFrankencoin is IERC20 {\r\n    function suggestMinter(address _minter, uint256 _applicationPeriod, uint256 _applicationFee, string calldata _message) external;\r\n\r\n    function registerPosition(address position) external;\r\n\r\n    function denyMinter(address minter, address[] calldata helpers, string calldata message) external;\r\n\r\n    function reserve() external view returns (IReserve);\r\n\r\n    function minterReserve() external view returns (uint256);\r\n\r\n    function calculateAssignedReserve(uint256 mintedAmount, uint32 _reservePPM) external view returns (uint256);\r\n\r\n    function equity() external view returns (uint256);\r\n\r\n    function isMinter(address minter) external view returns (bool);\r\n\r\n    function getPositionParent(address position) external view returns (address);\r\n\r\n    function mint(address target, uint256 amount) external;\r\n\r\n    function mintWithReserve(address target, uint256 amount, uint32 reservePPM, uint32 feePPM) external;\r\n\r\n    function burnFrom(address target, uint256 amount) external;\r\n\r\n    function burnWithoutReserve(uint256 amountIncludingReserve, uint32 reservePPM) external;\r\n\r\n    function burnFromWithReserve(address payer, uint256 targetTotalBurnAmount, uint32 _reservePPM) external returns (uint256);\r\n\r\n    function burnWithReserve(uint256 amountExcludingReserve, uint32 reservePPM) external returns (uint256);\r\n\r\n    function coverLoss(address source, uint256 amount) external;\r\n\r\n    function collectProfits(address source, uint256 _amount) external;\r\n}\r\n"},{"file_path":"contracts/interface/IPosition.sol","source_code":"// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20.sol\";\r\nimport \"./IReserve.sol\";\r\nimport \"./IFrankencoin.sol\";\r\n\r\ninterface IPosition {\r\n\r\n    function original() external returns (address);\r\n\r\n    function collateral() external returns (IERC20);\r\n\r\n    function minimumCollateral() external returns (uint256);\r\n\r\n    function challengePeriod() external returns (uint64);\r\n\r\n    function expiration() external returns (uint256);\r\n\r\n    function price() external returns (uint256);\r\n\r\n    function reduceLimitForClone(uint256 amount) external;\r\n\r\n    function initializeClone(address owner, uint256 _price, uint256 _coll, uint256 _mint, uint256 expiration) external;\r\n\r\n    function deny(address[] calldata helpers, string calldata message) external;\r\n\r\n    function mint(address target, uint256 amount) external;\r\n\r\n    function minted() external returns (uint256);\r\n\r\n    function reserveContribution() external returns (uint32);\r\n\r\n    function getUsableMint(uint256 totalMint, bool beforeFees) external view returns (uint256);\r\n\r\n    function challengeData(uint256 challengeStart) external view returns (uint256 liqPrice, uint64 phase1, uint64 phase2);\r\n\r\n    function notifyChallengeStarted(uint256 size) external;\r\n\r\n    function notifyChallengeAverted(uint256 size) external;\r\n\r\n    function notifyChallengeSucceeded(address _bidder, uint256 _size) external returns (address, uint256, uint256, uint32);\r\n\r\n}"},{"file_path":"contracts/interface/IReserve.sol","source_code":"// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\nimport \"./IERC20.sol\";\r\n\r\ninterface IReserve is IERC20 {\r\n   function invest(uint256 amount, uint256 expected) external returns (uint256);\r\n   function checkQualified(address sender, address[] calldata helpers) external view;\r\n}"},{"file_path":"contracts/utils/MathUtil.sol","source_code":"// SPDX-License-Identifier: MIT\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @title Functions for share valuation\r\n */\r\ncontract MathUtil {\r\n    uint256 internal constant ONE_DEC18 = 10 ** 18;\r\n\r\n    // Let's go for 12 digits of precision (18-6)\r\n    uint256 internal constant THRESH_DEC18 = 10 ** 6;\r\n\r\n    /**\r\n     * @notice Cubic root with Halley approximation\r\n     *         Number 1e18 decimal\r\n     * @param _v     number for which we calculate x**(1/3)\r\n     * @return returns _v**(1/3)\r\n     */\r\n    function _cubicRoot(uint256 _v) internal pure returns (uint256) {\r\n        // Good first guess for _v slightly above 1.0, which is often the case in the Frankencoin system\r\n        uint256 x = _v > ONE_DEC18 && _v < 10 ** 19 ? (_v - ONE_DEC18) / 3 + ONE_DEC18 : ONE_DEC18;\r\n        uint256 diff;\r\n        do {\r\n            uint256 powX3 = _mulD18(_mulD18(x, x), x);\r\n            uint256 xnew = x * (powX3 + 2 * _v) / (2 * powX3 + _v);\r\n            diff = xnew > x ? xnew - x : x - xnew;\r\n            x = xnew;\r\n        } while (diff > THRESH_DEC18);\r\n        return x;\r\n    }\r\n\r\n    function _mulD18(uint256 _a, uint256 _b) internal pure returns (uint256) {\r\n        return (_a * _b) / ONE_DEC18;\r\n    }\r\n\r\n    function _divD18(uint256 _a, uint256 _b) internal pure returns (uint256) {\r\n        return (_a * ONE_DEC18) / _b;\r\n    }\r\n\r\n    function _power3(uint256 _x) internal pure returns (uint256) {\r\n        return _mulD18(_mulD18(_x, _x), _x);\r\n    }\r\n\r\n    function _min(uint256 a, uint256 b) internal pure returns (uint256) {\r\n        return a < b ? a : b;\r\n    }\r\n}\r\n"},{"file_path":"contracts/utils/Ownable.sol","source_code":"// SPDX-License-Identifier: MIT\r\n//\r\n// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol\r\n//\r\n// Modifications:\r\n// - Replaced Context._msgSender() with msg.sender\r\n// - Made leaner\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership}.\r\n */\r\ncontract Ownable {\r\n    address public owner;\r\n\r\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n    error NotOwner();\r\n\r\n    /**\r\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n     * Can only be called by the current owner.\r\n     */\r\n    function transferOwnership(address newOwner) public onlyOwner {\r\n        _setOwner(newOwner);\r\n    }\r\n\r\n    /**\r\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n     * Internal function without access restriction.\r\n     */\r\n    function _setOwner(address newOwner) internal {\r\n        require(newOwner != address(0x0));\r\n        address oldOwner = owner;\r\n        owner = newOwner;\r\n        emit OwnershipTransferred(oldOwner, newOwner);\r\n    }\r\n\r\n    function _requireOwner(address sender) internal view {\r\n        if (owner != sender) revert NotOwner();\r\n    }\r\n\r\n    modifier onlyOwner() {\r\n        _requireOwner(msg.sender);\r\n        _;\r\n    }\r\n}\r\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_hub","type":"address"},{"internalType":"address","name":"_zchf","type":"address"},{"internalType":"address","name":"_collateral","type":"address"},{"internalType":"uint256","name":"_minCollateral","type":"uint256"},{"internalType":"uint256","name":"_initialLimit","type":"uint256"},{"internalType":"uint256","name":"_initPeriod","type":"uint256"},{"internalType":"uint256","name":"_duration","type":"uint256"},{"internalType":"uint64","name":"_challengePeriod","type":"uint64"},{"internalType":"uint32","name":"_annualInterestPPM","type":"uint32"},{"internalType":"uint256","name":"_liqPrice","type":"uint256"},{"internalType":"uint32","name":"_reservePPM","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ChallengeTooSmall","type":"error"},{"inputs":[],"name":"Challenged","type":"error"},{"inputs":[],"name":"Expired","type":"error"},{"inputs":[],"name":"Hot","type":"error"},{"inputs":[],"name":"InsufficientCollateral","type":"error"},{"inputs":[],"name":"LimitExceeded","type":"error"},{"inputs":[],"name":"NotHub","type":"error"},{"inputs":[],"name":"NotOwner","type":"error"},{"inputs":[{"internalType":"uint256","name":"excess","type":"uint256"}],"name":"RepaidTooMuch","type":"error"},{"inputs":[],"name":"TooLate","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"collateral","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"limit","type":"uint256"}],"name":"MintingUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"string","name":"message","type":"string"}],"name":"PositionDenied","type":"event"},{"inputs":[{"internalType":"uint256","name":"newMinted","type":"uint256"},{"internalType":"uint256","name":"newCollateral","type":"uint256"},{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"adjust","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPrice","type":"uint256"}],"name":"adjustPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"annualInterestPPM","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"calculateCurrentFee","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"challengeStart","type":"uint256"}],"name":"challengeData","outputs":[{"internalType":"uint256","name":"liqPrice","type":"uint256"},{"internalType":"uint64","name":"phase1","type":"uint64"},{"internalType":"uint64","name":"phase2","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"challengePeriod","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"challengedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateral","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cooldown","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"helpers","type":"address[]"},{"internalType":"string","name":"message","type":"string"}],"name":"deny","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"expiration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalMint","type":"uint256"},{"internalType":"bool","name":"afterFees","type":"bool"}],"name":"getUsableMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hub","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"_price","type":"uint256"},{"internalType":"uint256","name":"_coll","type":"uint256"},{"internalType":"uint256","name":"_initialMint","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"name":"initializeClone","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isClosed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"limit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"limitForClones","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"size","type":"uint256"}],"name":"notifyChallengeAverted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"size","type":"uint256"}],"name":"notifyChallengeStarted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_bidder","type":"address"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"notifyChallengeSucceeded","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"original","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mint_","type":"uint256"}],"name":"reduceLimitForClone","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"repay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reserveContribution","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"start","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"zchf","outputs":[{"internalType":"contract IFrankencoin","name":"","type":"address"}],"stateMutability":"view","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"000000000000000000000000bfe145dcfac110df1efd27b403dd68fd2c61494e0000000000000000000000007546762fdb1a6d9146b33960545c3f6394265219000000000000000000000000b58e61c3098d85632df34eecfb899a1ed80921cb0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c5990000000000000000000000000000000000000000000000000000000001406f40000000000000000000000000000000000000000000002a5a058fc295ed000000000000000000000000000000000000000000000000000000000000000003f48000000000000000000000000000000000000000000000000000000000076a7000000000000000000000000000000000000000000000000000000000000001518000000000000000000000000000000000000000000000000000000000000075300000000000000000000000000000000000000eca8847c4129106ce830000000000000000000000000000000000000000000000000000000000000000000186a0"}