From 22ed6b145f56fb379f1ab4af05170369fbb625fe Mon Sep 17 00:00:00 2001 From: Izanagi WebSmith Date: Sat, 8 Nov 2025 23:30:24 +0300 Subject: [PATCH] Update UniProxy.sol --- contracts/UniProxy.sol | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/contracts/UniProxy.sol b/contracts/UniProxy.sol index 3e8a90c..061c48e 100644 --- a/contracts/UniProxy.sol +++ b/contracts/UniProxy.sol @@ -1,5 +1,4 @@ -/// SPDX-License-Identifier: BUSL-1.1 - +// SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.7.6; pragma abicoder v2; @@ -7,8 +6,7 @@ import "./interfaces/IHypervisor.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; interface IClearing { - - function clearDeposit( + function clearDeposit( uint256 deposit0, uint256 deposit1, address from, @@ -17,7 +15,7 @@ interface IClearing { uint256[4] memory minIn ) external view returns (bool cleared); - function clearShares( + function clearShares( address pos, uint256 shares ) external view returns (bool cleared); @@ -32,13 +30,12 @@ interface IClearing { /// @title UniProxy v1.2.3 /// @notice Proxy contract for hypervisor positions management contract UniProxy is ReentrancyGuard { - - IClearing public clearance; + IClearing public clearance; address public owner; constructor(address _clearance) { owner = msg.sender; - clearance = IClearing(_clearance); + clearance = IClearing(_clearance); } /// @notice Deposit into the given position @@ -46,7 +43,7 @@ contract UniProxy is ReentrancyGuard { /// @param deposit1 Amount of token1 to deposit /// @param to Address to receive liquidity tokens /// @param pos Hypervisor Address - /// @param minIn min assets to expect in position during a direct deposit + /// @param minIn Min assets to expect in position during a direct deposit /// @return shares Amount of liquidity tokens received function deposit( uint256 deposit0, @@ -54,33 +51,36 @@ contract UniProxy is ReentrancyGuard { address to, address pos, uint256[4] memory minIn - ) nonReentrant external returns (uint256 shares) { + ) external nonReentrant returns (uint256 shares) { require(to != address(0), "to should be non-zero"); - require(clearance.clearDeposit(deposit0, deposit1, msg.sender, to, pos, minIn), "deposit not cleared"); + require( + clearance.clearDeposit(deposit0, deposit1, msg.sender, to, pos, minIn), + "deposit not cleared" + ); - /// transfer assets from msg.sender and mint lp tokens to provided address - shares = IHypervisor(pos).deposit(deposit0, deposit1, to, msg.sender, minIn); - require(clearance.clearShares(pos, shares), "shares not cleared"); + // Transfer assets from msg.sender and mint LP tokens to provided address + shares = IHypervisor(pos).deposit(deposit0, deposit1, to, msg.sender, minIn); + require(clearance.clearShares(pos, shares), "shares not cleared"); } - /// @notice Get the amount of token to deposit for the given amount of pair token + /// @notice Get the amount of pair token to deposit for the given amount /// @param pos Hypervisor Address /// @param token Address of token to deposit /// @param _deposit Amount of token to deposit - /// @return amountStart Minimum amounts of the pair token to deposit - /// @return amountEnd Maximum amounts of the pair token to deposit + /// @return amountStart Minimum amount of the pair token to deposit + /// @return amountEnd Maximum amount of the pair token to deposit function getDepositAmount( address pos, address token, uint256 _deposit ) public view returns (uint256 amountStart, uint256 amountEnd) { - return clearance.getDepositAmount(pos, token, _deposit); - } + return clearance.getDepositAmount(pos, token, _deposit); + } - function transferClearance(address newClearance) external onlyOwner { + function transferClearance(address newClearance) external onlyOwner { require(newClearance != address(0), "newClearance should be non-zero"); - clearance = IClearing(newClearance); - } + clearance = IClearing(newClearance); + } function transferOwnership(address newOwner) external onlyOwner { require(newOwner != address(0), "newOwner should be non-zero");