{"file_path":"contracts/MintingHubV2/PositionRoller.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IDecentralizedEURO} from \"../interface/IDecentralizedEURO.sol\";\nimport {IERC165} from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {IMintingHubGateway} from \"../gateway/interface/IMintingHubGateway.sol\";\nimport {IMintingHub} from \"./interface/IMintingHub.sol\";\nimport {IPosition} from \"./interface/IPosition.sol\";\nimport {IReserve} from \"../interface/IReserve.sol\";\nimport {Ownable} from \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @title PositionRoller\n *\n * Helper to roll over a debt from an old position to a new one.\n * Both positions should have the same collateral. Otherwise, it does not make much sense.\n */\ncontract PositionRoller {\n    IDecentralizedEURO private deuro;\n\n    error NotOwner(address pos);\n    error NotPosition(address pos);\n    error Log(uint256, uint256, uint256);\n\n    event Roll(address source, uint256 collWithdraw, uint256 repay, address target, uint256 collDeposit, uint256 mint);\n\n    constructor(address deuro_) {\n        deuro = IDecentralizedEURO(deuro_);\n    }\n\n    /**\n     * Convenience method to roll an old position into a new one.\n     *\n     * Pre-condition: an allowance for the roller to spend the collateral asset on behalf of the caller,\n     * i.e., one should set collateral.approve(roller, collateral.balanceOf(sourcePosition)).\n     *\n     * The following is assumed:\n     * - If the limit of the target position permits, the user wants to roll everything.\n     * - The user does not want to add additional collateral, but excess collateral is returned.\n     * - If not enough can be minted in the new position, it is acceptable for the roller to use dEURO from the msg.sender.\n     */\n    function rollFully(IPosition source, IPosition target) external {\n        rollFullyWithExpiration(source, target, target.expiration());\n    }\n\n    /**\n     * Like rollFully, but with a custom expiration date for the new position.\n     */\n    function rollFullyWithExpiration(IPosition source, IPosition target, uint40 expiration) public {\n        require(source.collateral() == target.collateral());\n        uint256 principal = source.principal();\n        uint256 interest = source.getInterest();\n        uint256 usableMint = source.getUsableMint(principal) + interest; // Roll interest into principal\n        uint256 mintAmount = target.getMintAmount(usableMint);\n        uint256 collateralToWithdraw = IERC20(source.collateral()).balanceOf(address(source));\n        uint256 targetPrice = target.price();\n        uint256 depositAmount = (mintAmount * 10 ** 18 + targetPrice - 1) / targetPrice; // round up\n        if (depositAmount > collateralToWithdraw) {\n            // If we need more collateral than available from the old position, we opt for taking\n            // the missing funds from the caller instead of requiring additional collateral.\n            depositAmount = collateralToWithdraw;\n            mintAmount = (depositAmount * target.price()) / 10 ** 18; // round down, rest will be taken from caller\n        }\n\n        roll(source, principal + interest, collateralToWithdraw, target, mintAmount, depositAmount, expiration);\n    }\n\n    /**\n     * Rolls the source position into the target position using a flash loan.\n     * Both the source and the target position must recognize this roller.\n     * It is the responsibility of the caller to ensure that both positions are valid contracts.\n     *\n     * @param source The source position, must be owned by the msg.sender.\n     * @param repay The amount of principal to repay from the source position using a flash loan, freeing up some or all collateral .\n     * @param collWithdraw Collateral to move from the source position to the msg.sender.\n     * @param target The target position. If not owned by msg.sender or if it does not have the desired expiration,\n     *               it is cloned to create a position owned by the msg.sender.\n     * @param mint The amount to be minted from the target position using collateral from msg.sender.\n     * @param collDeposit The amount of collateral to be sent from msg.sender to the target position.\n     * @param expiration The desired expiration date for the target position.\n     */\n    function roll(\n        IPosition source,\n        uint256 repay,\n        uint256 collWithdraw,\n        IPosition target,\n        uint256 mint,\n        uint256 collDeposit,\n        uint40 expiration\n    ) public valid(source) valid(target) own(source) {\n        deuro.mint(address(this), repay); // take a flash loan\n        uint256 used = source.repay(repay);\n        source.withdrawCollateral(msg.sender, collWithdraw);\n        if (mint > 0) {\n            IERC20 targetCollateral = IERC20(target.collateral());\n            if (Ownable(address(target)).owner() != msg.sender || expiration != target.expiration()) {\n                targetCollateral.transferFrom(msg.sender, address(this), collDeposit); // get the new collateral\n                targetCollateral.approve(target.hub(), collDeposit); // approve the new collateral and clone:\n                target = _cloneTargetPosition(target, source, collDeposit, mint, expiration);\n            } else {\n                // We can roll into the provided existing position.\n                // We do not verify whether the target position was created by the known minting hub in order\n                // to allow positions to be rolled into future versions of the minting hub.\n                targetCollateral.transferFrom(msg.sender, address(target), collDeposit);\n                target.mint(msg.sender, mint);\n            }\n        }\n\n        // Transfer remaining flash loan to caller for repayment\n        if (repay > used) {\n            deuro.transfer(msg.sender, repay - used);\n        }\n\n        deuro.burnFrom(msg.sender, repay); // repay the flash loan\n        emit Roll(address(source), collWithdraw, repay, address(target), collDeposit, mint);\n    }\n\n    /**\n     * Clones the target position and mints the specified amount using the given collateral.\n     */\n    function _cloneTargetPosition (\n        IPosition target,\n        IPosition source,\n        uint256 collDeposit,\n        uint256 mint,\n        uint40 expiration\n    ) internal returns (IPosition) {\n        if (IERC165(target.hub()).supportsInterface(type(IMintingHubGateway).interfaceId)) {\n            bytes32 frontendCode = IMintingHubGateway(target.hub()).GATEWAY().getPositionFrontendCode(\n                address(source)\n            );\n            return IPosition(\n                IMintingHubGateway(target.hub()).clone(\n                    msg.sender,\n                    address(target),\n                    collDeposit,\n                    mint,\n                    expiration,\n                    frontendCode // use the same frontend code\n                )\n            );\n        } else {\n            return IPosition(\n                IMintingHub(target.hub()).clone(msg.sender, address(target), collDeposit, mint, expiration)\n            );\n        }\n    }\n\n    modifier own(IPosition pos) {\n        if (Ownable(address(pos)).owner() != msg.sender) revert NotOwner(address(pos));\n        _;\n    }\n\n    modifier valid(IPosition pos) {\n        if (deuro.getPositionParent(address(pos)) == address(0x0)) revert NotPosition(address(pos));\n        _;\n    }\n}\n","deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106100415760003560e01c80635e871b541461004657806389523c331461005b578063c2a1c5061461006e575b600080fd5b610059610054366004611225565b610081565b005b610059610069366004611270565b61053b565b61005961007c3660046112e2565b610d85565b816001600160a01b031663d8dfeb456040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e3919061131b565b6001600160a01b0316836001600160a01b031663d8dfeb456040518163ffffffff1660e01b8152600401602060405180830381865afa15801561012a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014e919061131b565b6001600160a01b03161461016157600080fd5b6000836001600160a01b031663ba5d30786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c5919061133f565b90506000846001600160a01b031663e5a4bed36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022b919061133f565b9050600081866001600160a01b031663c54a89ca856040518263ffffffff1660e01b815260040161025e91815260200190565b602060405180830381865afa15801561027b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029f919061133f565b6102a9919061136e565b604051634ef17bcb60e11b8152600481018290529091506000906001600160a01b03871690639de2f79690602401602060405180830381865afa1580156102f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610318919061133f565b90506000876001600160a01b031663d8dfeb456040518163ffffffff1660e01b8152600401602060405180830381865afa15801561035a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037e919061131b565b6040516370a0823160e01b81526001600160a01b038a8116600483015291909116906370a0823190602401602060405180830381865afa1580156103c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ea919061133f565b90506000876001600160a01b031663a035b1fe6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561042c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610450919061133f565b905060008160018161046a87670de0b6b3a7640000611387565b610474919061136e565b61047e919061139e565b61048891906113b1565b90508281111561051757829050670de0b6b3a7640000896001600160a01b031663a035b1fe6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610500919061133f565b61050a9083611387565b61051491906113b1565b93505b61052f8a610525888a61136e565b858c88868e61053b565b50505050505050505050565b6000805460405163aa5dd7f160e01b81526001600160a01b03808b1660048301528a9392169063aa5dd7f190602401602060405180830381865afa158015610587573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ab919061131b565b6001600160a01b0316036105e257604051631a71b9a760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b6000805460405163aa5dd7f160e01b81526001600160a01b038089166004830152889392169063aa5dd7f190602401602060405180830381865afa15801561062e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610652919061131b565b6001600160a01b03160361068457604051631a71b9a760e01b81526001600160a01b03821660048201526024016105d9565b88336001600160a01b0316816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f1919061131b565b6001600160a01b0316146107235760405163245aecd360e01b81526001600160a01b03821660048201526024016105d9565b6000546040516340c10f1960e01b8152306004820152602481018b90526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561076f57600080fd5b505af1158015610783573d6000803e3d6000fd5b5050604051631b8fec7360e11b8152600481018c9052600092506001600160a01b038d16915063371fd8e6906024016020604051808303816000875af11580156107d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f5919061133f565b60405163350c35e960e01b8152336004820152602481018b90529091506001600160a01b038c169063350c35e990604401600060405180830381600087803b15801561084057600080fd5b505af1158015610854573d6000803e3d6000fd5b505050506000871115610c09576000886001600160a01b031663d8dfeb456040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c5919061131b565b9050336001600160a01b0316896001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561090f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610933919061131b565b6001600160a01b03161415806109b85750886001600160a01b0316634665096d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a691906113d3565b64ffffffffff168664ffffffffff1614155b15610b2c576040516323b872dd60e01b8152336004820152306024820152604481018890526001600160a01b038216906323b872dd906064016020604051808303816000875af1158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3491906113f0565b50806001600160a01b031663095ea7b38a6001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa6919061131b565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018a90526044016020604051808303816000875af1158015610af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1791906113f0565b50610b25898d898b8a610df0565b9850610c07565b6040516323b872dd60e01b81523360048201526001600160a01b038a81166024830152604482018990528216906323b872dd906064016020604051808303816000875af1158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba591906113f0565b506040516340c10f1960e01b8152336004820152602481018990526001600160a01b038a16906340c10f1990604401600060405180830381600087803b158015610bee57600080fd5b505af1158015610c02573d6000803e3d6000fd5b505050505b505b808a1115610c9e576000546001600160a01b031663a9059cbb33610c2d848e61139e565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610c78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9c91906113f0565b505b60005460405163079cc67960e41b8152336004820152602481018c90526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015610cea57600080fd5b505af1158015610cfe573d6000803e3d6000fd5b505050507f8ba6e48d27ab46e18ba0971bb468a2e47a7fac577d846de107eb2fe948c2f5958b8a8c8b8a8c604051610d70969594939291906001600160a01b0396871681526020810195909552604085019390935293166060830152608082019290925260a081019190915260c00190565b60405180910390a15050505050505050505050565b610dec8282836001600160a01b0316634665096d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dc8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061005491906113d3565b5050565b6000856001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e54919061131b565b6040516301ffc9a760e01b8152632464e41b60e21b60048201526001600160a01b0391909116906301ffc9a790602401602060405180830381865afa158015610ea1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec591906113f0565b156110fd576000866001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2e919061131b565b6001600160a01b031663338c53716040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8f919061131b565b60405163d8f2174760e01b81526001600160a01b038881166004830152919091169063d8f2174790602401602060405180830381865afa158015610fd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffb919061133f565b9050866001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561103b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105f919061131b565b6040516324ea0e8960e21b81523360048201526001600160a01b038981166024830152604482018890526064820187905264ffffffffff8616608483015260a4820184905291909116906393a83a249060c4016020604051808303816000875af11580156110d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f5919061131b565b9150506111f1565b856001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561113b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115f919061131b565b604051634ec7f95360e11b81523360048201526001600160a01b038881166024830152604482018790526064820186905264ffffffffff851660848301529190911690639d8ff2a69060a4016020604051808303816000875af11580156111ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ee919061131b565b90505b95945050505050565b6001600160a01b038116811461120f57600080fd5b50565b64ffffffffff8116811461120f57600080fd5b60008060006060848603121561123a57600080fd5b8335611245816111fa565b92506020840135611255816111fa565b9150604084013561126581611212565b809150509250925092565b600080600080600080600060e0888a03121561128b57600080fd5b8735611296816111fa565b9650602088013595506040880135945060608801356112b4816111fa565b93506080880135925060a0880135915060c08801356112d281611212565b8091505092959891949750929550565b600080604083850312156112f557600080fd5b8235611300816111fa565b91506020830135611310816111fa565b809150509250929050565b60006020828403121561132d57600080fd5b8151611338816111fa565b9392505050565b60006020828403121561135157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561138157611381611358565b92915050565b808202811582820484141761138157611381611358565b8181038181111561138157611381611358565b6000826113ce57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156113e557600080fd5b815161133881611212565b60006020828403121561140257600080fd5b8151801515811461133857600080fdfea2646970667358221220d18b82d891c34613a784e8bea810453be0e5c8f287a4de7aa42f9fa84e08b6d564736f6c634300081a0033","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/0x4CE0AB2FC21Bd27a47A64F594Fdf7654Ea57Dc79/","decoded_constructor_args":[["0xbA3f535bbCcCcA2A154b573Ca6c5A49BAAE0a3ea",{"internalType":"address","name":"deuro_","type":"address"}]],"compiler_version":"0.8.26+commit.8a97fa7a","is_verified_via_verifier_alliance":false,"verified_at":"2026-03-14T09:16:17.209765Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x6080604052348015600f57600080fd5b506040516114d53803806114d5833981016040819052602c916050565b600080546001600160a01b0319166001600160a01b0392909216919091179055607e565b600060208284031215606157600080fd5b81516001600160a01b0381168114607757600080fd5b9392505050565b6114488061008d6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635e871b541461004657806389523c331461005b578063c2a1c5061461006e575b600080fd5b610059610054366004611225565b610081565b005b610059610069366004611270565b61053b565b61005961007c3660046112e2565b610d85565b816001600160a01b031663d8dfeb456040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e3919061131b565b6001600160a01b0316836001600160a01b031663d8dfeb456040518163ffffffff1660e01b8152600401602060405180830381865afa15801561012a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061014e919061131b565b6001600160a01b03161461016157600080fd5b6000836001600160a01b031663ba5d30786040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c5919061133f565b90506000846001600160a01b031663e5a4bed36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022b919061133f565b9050600081866001600160a01b031663c54a89ca856040518263ffffffff1660e01b815260040161025e91815260200190565b602060405180830381865afa15801561027b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029f919061133f565b6102a9919061136e565b604051634ef17bcb60e11b8152600481018290529091506000906001600160a01b03871690639de2f79690602401602060405180830381865afa1580156102f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610318919061133f565b90506000876001600160a01b031663d8dfeb456040518163ffffffff1660e01b8152600401602060405180830381865afa15801561035a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061037e919061131b565b6040516370a0823160e01b81526001600160a01b038a8116600483015291909116906370a0823190602401602060405180830381865afa1580156103c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ea919061133f565b90506000876001600160a01b031663a035b1fe6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561042c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610450919061133f565b905060008160018161046a87670de0b6b3a7640000611387565b610474919061136e565b61047e919061139e565b61048891906113b1565b90508281111561051757829050670de0b6b3a7640000896001600160a01b031663a035b1fe6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610500919061133f565b61050a9083611387565b61051491906113b1565b93505b61052f8a610525888a61136e565b858c88868e61053b565b50505050505050505050565b6000805460405163aa5dd7f160e01b81526001600160a01b03808b1660048301528a9392169063aa5dd7f190602401602060405180830381865afa158015610587573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ab919061131b565b6001600160a01b0316036105e257604051631a71b9a760e01b81526001600160a01b03821660048201526024015b60405180910390fd5b6000805460405163aa5dd7f160e01b81526001600160a01b038089166004830152889392169063aa5dd7f190602401602060405180830381865afa15801561062e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610652919061131b565b6001600160a01b03160361068457604051631a71b9a760e01b81526001600160a01b03821660048201526024016105d9565b88336001600160a01b0316816001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f1919061131b565b6001600160a01b0316146107235760405163245aecd360e01b81526001600160a01b03821660048201526024016105d9565b6000546040516340c10f1960e01b8152306004820152602481018b90526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561076f57600080fd5b505af1158015610783573d6000803e3d6000fd5b5050604051631b8fec7360e11b8152600481018c9052600092506001600160a01b038d16915063371fd8e6906024016020604051808303816000875af11580156107d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f5919061133f565b60405163350c35e960e01b8152336004820152602481018b90529091506001600160a01b038c169063350c35e990604401600060405180830381600087803b15801561084057600080fd5b505af1158015610854573d6000803e3d6000fd5b505050506000871115610c09576000886001600160a01b031663d8dfeb456040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c5919061131b565b9050336001600160a01b0316896001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561090f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610933919061131b565b6001600160a01b03161415806109b85750886001600160a01b0316634665096d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a691906113d3565b64ffffffffff168664ffffffffff1614155b15610b2c576040516323b872dd60e01b8152336004820152306024820152604481018890526001600160a01b038216906323b872dd906064016020604051808303816000875af1158015610a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a3491906113f0565b50806001600160a01b031663095ea7b38a6001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa6919061131b565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018a90526044016020604051808303816000875af1158015610af3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b1791906113f0565b50610b25898d898b8a610df0565b9850610c07565b6040516323b872dd60e01b81523360048201526001600160a01b038a81166024830152604482018990528216906323b872dd906064016020604051808303816000875af1158015610b81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba591906113f0565b506040516340c10f1960e01b8152336004820152602481018990526001600160a01b038a16906340c10f1990604401600060405180830381600087803b158015610bee57600080fd5b505af1158015610c02573d6000803e3d6000fd5b505050505b505b808a1115610c9e576000546001600160a01b031663a9059cbb33610c2d848e61139e565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610c78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9c91906113f0565b505b60005460405163079cc67960e41b8152336004820152602481018c90526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015610cea57600080fd5b505af1158015610cfe573d6000803e3d6000fd5b505050507f8ba6e48d27ab46e18ba0971bb468a2e47a7fac577d846de107eb2fe948c2f5958b8a8c8b8a8c604051610d70969594939291906001600160a01b0396871681526020810195909552604085019390935293166060830152608082019290925260a081019190915260c00190565b60405180910390a15050505050505050505050565b610dec8282836001600160a01b0316634665096d6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dc8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061005491906113d3565b5050565b6000856001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e54919061131b565b6040516301ffc9a760e01b8152632464e41b60e21b60048201526001600160a01b0391909116906301ffc9a790602401602060405180830381865afa158015610ea1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec591906113f0565b156110fd576000866001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2e919061131b565b6001600160a01b031663338c53716040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8f919061131b565b60405163d8f2174760e01b81526001600160a01b038881166004830152919091169063d8f2174790602401602060405180830381865afa158015610fd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ffb919061133f565b9050866001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561103b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061105f919061131b565b6040516324ea0e8960e21b81523360048201526001600160a01b038981166024830152604482018890526064820187905264ffffffffff8616608483015260a4820184905291909116906393a83a249060c4016020604051808303816000875af11580156110d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f5919061131b565b9150506111f1565b856001600160a01b031663365a86fc6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561113b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115f919061131b565b604051634ec7f95360e11b81523360048201526001600160a01b038881166024830152604482018790526064820186905264ffffffffff851660848301529190911690639d8ff2a69060a4016020604051808303816000875af11580156111ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ee919061131b565b90505b95945050505050565b6001600160a01b038116811461120f57600080fd5b50565b64ffffffffff8116811461120f57600080fd5b60008060006060848603121561123a57600080fd5b8335611245816111fa565b92506020840135611255816111fa565b9150604084013561126581611212565b809150509250925092565b600080600080600080600060e0888a03121561128b57600080fd5b8735611296816111fa565b9650602088013595506040880135945060608801356112b4816111fa565b93506080880135925060a0880135915060c08801356112d281611212565b8091505092959891949750929550565b600080604083850312156112f557600080fd5b8235611300816111fa565b91506020830135611310816111fa565b809150509250929050565b60006020828403121561132d57600080fd5b8151611338816111fa565b9392505050565b60006020828403121561135157600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561138157611381611358565b92915050565b808202811582820484141761138157611381611358565b8181038181111561138157611381611358565b6000826113ce57634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156113e557600080fd5b815161133881611212565b60006020828403121561140257600080fd5b8151801515811461133857600080fdfea2646970667358221220d18b82d891c34613a784e8bea810453be0e5c8f287a4de7aa42f9fa84e08b6d564736f6c634300081a0033000000000000000000000000ba3f535bbcccca2a154b573ca6c5a49baae0a3ea","name":"PositionRoller","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/MintingHubV2/interface/IMintingHub.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.10;\n\nimport {ILeadrate} from \"../../interface/ILeadrate.sol\";\nimport {IPosition} from \"./IPosition.sol\";\nimport {PositionRoller} from \"../PositionRoller.sol\";\n\ninterface IMintingHub {\n    function RATE() external view returns (ILeadrate);\n\n    function ROLLER() external view returns (PositionRoller);\n\n    function challenge(\n        address _positionAddr,\n        uint256 _collateralAmount,\n        uint256 minimumPrice\n    ) external returns (uint256);\n\n    function bid(uint32 _challengeNumber, uint256 size, bool postponeCollateralReturn) external;\n\n    function returnPostponedCollateral(address collateral, address target) external;\n\n    function buyExpiredCollateral(IPosition pos, uint256 upToAmount) external returns (uint256);\n\n    function clone(address owner, address parent, uint256 _initialCollateral, uint256 _initialMint, uint40 expiration) external returns (address);\n}\n"},{"file_path":"contracts/MintingHubV2/interface/IPosition.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IPosition {\n    function hub() external view returns (address);\n\n    function collateral() external view returns (IERC20);\n\n    function minimumCollateral() external view returns (uint256);\n\n    function price() external view returns (uint256);\n\n    function virtualPrice() external view returns (uint256);\n\n    function challengedAmount() external view returns (uint256);\n\n    function original() external view returns (address);\n\n    function expiration() external view returns (uint40);\n\n    function cooldown() external view returns (uint40);\n\n    function limit() external view returns (uint256);\n\n    function challengePeriod() external view returns (uint40);\n\n    function start() external view returns (uint40);\n\n    function riskPremiumPPM() external view returns (uint24);\n\n    function reserveContribution() external view returns (uint24);\n\n    function principal() external view returns (uint256);\n\n    function interest() external view returns (uint256);\n\n    function lastAccrual() external view returns (uint40);\n\n    function initialize(address parent, uint40 _expiration) external;\n\n    function assertCloneable() external;\n\n    function notifyMint(uint256 mint_) external;\n\n    function notifyRepaid(uint256 repaid_) external;\n\n    function availableForClones() external view returns (uint256);\n\n    function availableForMinting() external view returns (uint256);\n\n    function deny(address[] calldata helpers, string calldata message) external;\n\n    function getUsableMint(uint256 totalMint) external view returns (uint256);\n\n    function getMintAmount(uint256 usableMint) external view returns (uint256);\n\n    function adjust(uint256 newMinted, uint256 newCollateral, uint256 newPrice) external;\n\n    function adjustPrice(uint256 newPrice) external;\n\n    function mint(address target, uint256 amount) external;\n\n    function getDebt() external view returns (uint256);\n\n    function getInterest() external view returns (uint256);\n\n    function repay(uint256 amount) external returns (uint256);\n\n    function repayFull() external returns (uint256);\n\n    function forceSale(address buyer, uint256 colAmount, uint256 proceeds) external;\n\n    function withdraw(address token, address target, uint256 amount) external;\n\n    function withdrawCollateral(address target, uint256 amount) external;\n\n    function transferChallengedCollateral(address target, uint256 amount) external;\n\n    function challengeData() external view returns (uint256 liqPrice, uint40 phase);\n\n    function notifyChallengeStarted(uint256 size, uint256 _price) external;\n\n    function notifyChallengeAverted(uint256 size) external;\n\n    function notifyChallengeSucceeded(\n        uint256 _size\n    ) external returns (address, uint256, uint256, uint256, uint32);\n}\n"},{"file_path":"contracts/gateway/interface/IFrontendGateway.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IFrontendGateway {\n    struct FrontendCode {\n        uint256 balance;\n        address owner;\n    }\n\n    event FrontendCodeRegistered(address owner, bytes32 frontendCode);\n    event FrontendCodeTransferred(address from, address to, bytes32 frontendCode);\n    event FrontendCodeRewardsWithdrawn(address to, uint256 amount, bytes32 frontendCode);\n    event NewPositionRegistered(address position, bytes32 frontendCode);\n    event RateChangesProposed(address who, uint24 nextFeeRate, uint24 nextSavingsFeeRate, uint24 nextMintingFeeRate, uint256 nextChange);\n    event RateChangesExecuted(address who, uint24 nextFeeRate, uint24 nextSavingsFeeRate, uint24 nextMintingFeeRate);\n    \n    event InvestRewardAdded(bytes32 frontendCode, address user, uint256 amount, uint256 reward);\n    event RedeemRewardAdded(bytes32 frontendCode, address user, uint256 amount, uint256 reward);\n    event UnwrapAndSellRewardAdded(bytes32 frontendCode, address user, uint256 amount, uint256 reward);\n    event SavingsRewardAdded(bytes32 frontendCode, address saver, uint256 interest, uint256 reward);\n    event PositionRewardAdded(bytes32 frontendCode, address position, uint256 amount, uint256 reward);\n\n    error FrontendCodeAlreadyExists();\n    error NotFrontendCodeOwner();\n    error NotGatewayService();\n    error ProposedChangesToHigh();\n    error NoOpenChanges();\n    error NotDoneWaiting(uint256 minmumExecutionTime);\n    error EquityTooLow();\n\n    function invest(uint256 amount, uint256 expectedShares, bytes32 frontendCode) external returns (uint256);\n    function redeem(address target, uint256 shares, uint256 expectedProceeds, bytes32 frontendCode) external returns (uint256);\n    function unwrapAndSell(uint256 amount, bytes32 frontendCode) external returns (uint256);\n\n    function updateSavingCode(address savingsOwner, bytes32 frontendCode) external;\n    function updateSavingRewards(address saver, uint256 interest) external;\n\n    function registerPosition(address position, bytes32 frontendCode) external;\n    function updatePositionRewards(address position, uint256 amount) external;\n    function getPositionFrontendCode(address position)view external  returns(bytes32);\n\n    // Frontend Code Logic\n    function registerFrontendCode(bytes32 frontendCode) external returns (bool);\n    function transferFrontendCode(bytes32 frontendCode, address to) external returns (bool);\n    function withdrawRewards(bytes32 frontendCode) external returns (uint256);\n    function withdrawRewardsTo(bytes32 frontendCode, address to) external returns (uint256);\n\n    // Governance\n    function proposeChanges(uint24 newFeeRatePPM_, uint24 newSavingsFeeRatePPM_, uint24 newMintingFeeRatePPM_, address[] calldata helpers) external;\n    function executeChanges() external;\n}\n"},{"file_path":"contracts/gateway/interface/IMintingHubGateway.sol","source_code":"// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.10;\n\nimport {IMintingHub} from \"../../MintingHubV2/interface/IMintingHub.sol\";\nimport {IFrontendGateway} from \"./IFrontendGateway.sol\";\n\ninterface IMintingHubGateway {\n    function GATEWAY() external view returns (IFrontendGateway);\n    function notifyInterestPaid(uint256 amount) external;\n    function openPosition(address _collateralAddress, uint256 _minCollateral, uint256 _initialCollateral, uint256 _mintingMaximum, uint40 _initPeriodSeconds, uint40 _expirationSeconds, uint40 _challengeSeconds, uint24 _riskPremium, uint256 _liqPrice, uint24 _reservePPM, bytes32 _frontendCode) external returns (address);\n    function clone(address owner, address parent, uint256 _initialCollateral, uint256 _initialMint, uint40 expiration, bytes32 frontendCode) external returns (address);\n}\n"},{"file_path":"@openzeppelin/contracts/access/Ownable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)\n\npragma solidity ^0.8.20;\n\nimport {Context} from \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * The initial owner is set to the address provided by the deployer. This can\n * later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n    address private _owner;\n\n    /**\n     * @dev The caller account is not authorized to perform an operation.\n     */\n    error OwnableUnauthorizedAccount(address account);\n\n    /**\n     * @dev The owner is not a valid owner account. (eg. `address(0)`)\n     */\n    error OwnableInvalidOwner(address owner);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.\n     */\n    constructor(address initialOwner) {\n        if (initialOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(initialOwner);\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        if (owner() != _msgSender()) {\n            revert OwnableUnauthorizedAccount(_msgSender());\n        }\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        if (newOwner == address(0)) {\n            revert OwnableInvalidOwner(address(0));\n        }\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts/token/ERC20/IERC20.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\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/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/IERC165.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\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[ERC 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":"contracts/interface/IDecentralizedEURO.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IReserve} from \"./IReserve.sol\";\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IDecentralizedEURO is IERC20 {\n    function suggestMinter(\n        address _minter,\n        uint256 _applicationPeriod,\n        uint256 _applicationFee,\n        string calldata _message\n    ) external;\n\n    function registerPosition(address position) external;\n\n    function denyMinter(address minter, address[] calldata helpers, string calldata message) external;\n\n    function reserve() external view returns (IReserve);\n\n    function minterReserve() external view returns (uint256);\n\n    function calculateAssignedReserve(uint256 mintedAmount, uint32 _reservePPM) external view returns (uint256);\n\n    function calculateFreedAmount(uint256 amountExcludingReserve, uint32 _reservePPM) external view returns (uint256);\n\n    function equity() external view returns (uint256);\n\n    function isMinter(address minter) external view returns (bool);\n\n    function getPositionParent(address position) external view returns (address);\n\n    function mint(address target, uint256 amount) external;\n\n    function mintWithReserve(address target, uint256 amount, uint32 reservePPM) external;\n\n    function burn(uint256 amount) external;\n\n    function burnFrom(address target, uint256 amount) external;\n\n    function burnWithoutReserve(uint256 amount, uint32 reservePPM) external;\n\n    function burnFromWithReserve(\n        address payer,\n        uint256 targetTotalBurnAmount,\n        uint32 reservePPM\n    ) external returns (uint256);\n\n    function coverLoss(address source, uint256 amount) external;\n\n    function distributeProfits(address recipient, uint256 amount) external;\n\n    function collectProfits(address source, uint256 _amount) external;\n}\n"},{"file_path":"contracts/interface/ILeadrate.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface ILeadrate {\n   function currentRatePPM() external view returns (uint24);\n   function currentTicks() external view returns (uint64);\n}"},{"file_path":"contracts/interface/IReserve.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IReserve is IERC20 {\n    function invest(uint256 amount, uint256 expected) external returns (uint256);\n    function checkQualified(address sender, address[] calldata helpers) external view;\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address","name":"deuro_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"Log","type":"error"},{"inputs":[{"internalType":"address","name":"pos","type":"address"}],"name":"NotOwner","type":"error"},{"inputs":[{"internalType":"address","name":"pos","type":"address"}],"name":"NotPosition","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"source","type":"address"},{"indexed":false,"internalType":"uint256","name":"collWithdraw","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"repay","type":"uint256"},{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"collDeposit","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mint","type":"uint256"}],"name":"Roll","type":"event"},{"inputs":[{"internalType":"contract IPosition","name":"source","type":"address"},{"internalType":"uint256","name":"repay","type":"uint256"},{"internalType":"uint256","name":"collWithdraw","type":"uint256"},{"internalType":"contract IPosition","name":"target","type":"address"},{"internalType":"uint256","name":"mint","type":"uint256"},{"internalType":"uint256","name":"collDeposit","type":"uint256"},{"internalType":"uint40","name":"expiration","type":"uint40"}],"name":"roll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPosition","name":"source","type":"address"},{"internalType":"contract IPosition","name":"target","type":"address"}],"name":"rollFully","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPosition","name":"source","type":"address"},{"internalType":"contract IPosition","name":"target","type":"address"},{"internalType":"uint40","name":"expiration","type":"uint40"}],"name":"rollFullyWithExpiration","outputs":[],"stateMutability":"nonpayable","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"0x000000000000000000000000ba3f535bbcccca2a154b573ca6c5a49baae0a3ea"}