Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
a17 committed Jan 29, 2024
1 parent 4e0a103 commit 95330cb
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 48 deletions.
12 changes: 10 additions & 2 deletions script/Deploy.Unreal.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,20 @@ contract DeployUnreal is Script {
Factory factory = Factory(controller.factory());

// deploy IFO harvester
factory.deployIfoHarvester(UnrealLib.LIQUID_BOX_DAI_USDC, UnrealLib.ALM_GAUGE_DAI_USDC, "IFO Harvester DAI-USDC", "ifoTDT-DAI-USDC");
factory.deployIfoHarvester(
UnrealLib.LIQUID_BOX_DAI_USDC, UnrealLib.ALM_GAUGE_DAI_USDC, "IFO Harvester DAI-USDC", "ifoTDT-DAI-USDC"
);

// deploy compounder + harvester
CompounderVault compounderVault =
CompounderVault(factory.deployCompounder(UnrealLib.TOKEN_CVR, "Compounder CVR", "cCVR"));
factory.deployHarvester(UnrealLib.LIQUID_BOX_DAI_USDC, UnrealLib.ALM_GAUGE_DAI_USDC, "Harvester DAI-USDC", "xTDT-DAI-USDC", address(compounderVault));
factory.deployHarvester(
UnrealLib.LIQUID_BOX_DAI_USDC,
UnrealLib.ALM_GAUGE_DAI_USDC,
"Harvester DAI-USDC",
"xTDT-DAI-USDC",
address(compounderVault)
);

vm.stopBroadcast();
}
Expand Down
23 changes: 12 additions & 11 deletions src/DepositHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import "./interfaces/IVe.sol";
contract DepositHelper is ReentrancyGuard {
using SafeERC20 for IERC20;

function createLock(IVe ve, address token, uint value, uint lockDuration) external nonReentrant returns (
uint tokenId,
uint lockedAmount,
uint power,
uint unlockDate
) {
function createLock(
IVe ve,
address token,
uint value,
uint lockDuration
) external nonReentrant returns (uint tokenId, uint lockedAmount, uint power, uint unlockDate) {
IERC20(token).safeTransferFrom(msg.sender, address(this), value);
_approveIfNeeds(token, value, address(ve));
tokenId = ve.createLockFor(token, value, lockDuration, msg.sender);
Expand All @@ -25,11 +25,12 @@ contract DepositHelper is ReentrancyGuard {
_sendRemainingToken(token);
}

function increaseAmount(IVe ve, address token, uint tokenId, uint value) external nonReentrant returns (
uint lockedAmount,
uint power,
uint unlockDate
) {
function increaseAmount(
IVe ve,
address token,
uint tokenId,
uint value
) external nonReentrant returns (uint lockedAmount, uint power, uint unlockDate) {
IERC20(token).safeTransferFrom(msg.sender, address(this), value);
_approveIfNeeds(token, value, address(ve));
ve.increaseAmount(token, tokenId, value);
Expand Down
7 changes: 5 additions & 2 deletions src/Frontend.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ contract Frontend {
controller = IController(controller_);
}

function getLiquidBoxSharePrice(address alm, address priceToken) public view returns(uint price) {
function getLiquidBoxSharePrice(address alm, address priceToken) public view returns (uint price) {
ITetuLiquidator liquidator = ITetuLiquidator(controller.liquidator());
ILiquidBox lb = ILiquidBox(alm);
address token0 = lb.token0();
Expand All @@ -51,7 +51,10 @@ contract Frontend {
}
}

Check warning

Code scanning / Slither

Unused return Medium

Check notice

Code scanning / Slither

Calls inside a loop Low

Check notice

Code scanning / Slither

Calls inside a loop Low

Check notice

Code scanning / Slither

Calls inside a loop Low

Check notice

Code scanning / Slither

Calls inside a loop Low

Check notice

Code scanning / Slither

Calls inside a loop Low

Check notice

Code scanning / Slither

Calls inside a loop Low

Check notice

Code scanning / Slither

Calls inside a loop Low

Check notice

Code scanning / Slither

Calls inside a loop Low


function allVaults(address user, address priceToken)
function allVaults(
address user,
address priceToken
)
external
view
returns (
Expand Down
57 changes: 27 additions & 30 deletions src/interfaces/ILiquidBox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ pragma solidity ^0.8.21;

interface ILiquidBox {
/**
* @notice Deposits tokens into the vault, distributing them
* in proportion to the current holdings.
* @dev Tokens deposited remain in the vault until the next
* rebalance and are not utilized for liquidity on Pearl.
* @param amount0Desired Maximum amount of token0 to deposit
* @param amount1Desired Maximum amount of token1 to deposit
* @param to Recipient of shares
* @param amount0Min Reverts if the resulting amount0 is less than this
* @param amount1Min Reverts if the resulting amount1 is less than this
* @return shares Number of shares minted
* @return amount0 Amount of token0 deposited
* @return amount1 Amount of token1 deposited
*/
* @notice Deposits tokens into the vault, distributing them
* in proportion to the current holdings.
* @dev Tokens deposited remain in the vault until the next
* rebalance and are not utilized for liquidity on Pearl.
* @param amount0Desired Maximum amount of token0 to deposit
* @param amount1Desired Maximum amount of token1 to deposit
* @param to Recipient of shares
* @param amount0Min Reverts if the resulting amount0 is less than this
* @param amount1Min Reverts if the resulting amount1 is less than this
* @return shares Number of shares minted
* @return amount0 Amount of token0 deposited
* @return amount1 Amount of token1 deposited
*/
function deposit(
uint256 amount0Desired,
uint256 amount1Desired,
uint amount0Desired,

Check warning

Code scanning / Slither

Variable names too similar Warning

uint amount1Desired,
address to,
uint256 amount0Min,
uint256 amount1Min
) external returns (uint256 shares, uint256 amount0, uint256 amount1);
uint amount0Min,
uint amount1Min
) external returns (uint shares, uint amount0, uint amount1);

/**
* @notice Withdraws tokens in proportion to the vault's holdings.
Expand All @@ -34,26 +34,23 @@ interface ILiquidBox {
* @return amount1 Amount of token1 sent to recipient
*/
function withdraw(
uint256 shares,
uint shares,
address to,
uint256 amount0Min,
uint256 amount1Min
) external returns (uint256 amount0, uint256 amount1);
uint amount0Min,
uint amount1Min
) external returns (uint amount0, uint amount1);

/**
* @notice Calculates the vault's total holdings of token0 and token1 - in
* other words, how much of each token the vault would hold if it withdrew
* all its liquidity from Uniswap.
*/
function getTotalAmounts()
external
view
returns (uint256 total0, uint256 total1, uint128 liquidity);
* other words, how much of each token the vault would hold if it withdrew
* all its liquidity from Uniswap.
*/
function getTotalAmounts() external view returns (uint total0, uint total1, uint128 liquidity);

/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function totalSupply() external view returns (uint);

function token0() external view returns (address);

Expand Down
3 changes: 2 additions & 1 deletion src/lib/VeSTGNLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ library VeSTGNLib {
uint untilEnd,
uint _value
) public pure returns (string memory output) {
output = '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 2406.2 3609.2" style="enable-background:new 0 0 2406.2 3609.2;" xml:space="preserve"><style>.st0 {fill:#101035;}.st1 {fill:#5E78F7;}.st2 {font-family:"TimesNewRomanPS-BoldMT";}.st3 {font-size:189px;}.st4 {fill:#FFFFFF;}.st5 {font-family:"TimesNewRomanPSMT";}.st6 {font-size:164.1369px;}.st7 {fill:#212E6D;}.st8 {fill:#3D68D3;}</style><rect class="st0" width="2406.2" height="3609.2"/>';
output =
'<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 2406.2 3609.2" style="enable-background:new 0 0 2406.2 3609.2;" xml:space="preserve"><style>.st0 {fill:#101035;}.st1 {fill:#5E78F7;}.st2 {font-family:"TimesNewRomanPS-BoldMT";}.st3 {font-size:189px;}.st4 {fill:#FFFFFF;}.st5 {font-family:"TimesNewRomanPSMT";}.st6 {font-size:164.1369px;}.st7 {fill:#212E6D;}.st8 {fill:#3D68D3;}</style><rect class="st0" width="2406.2" height="3609.2"/>';

output = string(
abi.encodePacked(
Expand Down
4 changes: 2 additions & 2 deletions test/mock/MockTetuLiquidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ contract MockTetuLiquidator is ITetuLiquidator {
) external view returns (PoolData[] memory route, string memory errorMessage) {}

function liquidate(address tokenIn, address tokenOut, uint amount, uint /*priceImpactTolerance*/ ) external {
// console.log('liquidate tokenIn', IERC20Metadata(tokenIn).symbol());
// console.log('liquidate tokenOut', IERC20Metadata(tokenOut).symbol());
// console.log('liquidate tokenIn', IERC20Metadata(tokenIn).symbol());
// console.log('liquidate tokenOut', IERC20Metadata(tokenOut).symbol());
if (amount == 0) {
amount = 10 ** IERC20Metadata(tokenIn).decimals();
}
Expand Down

0 comments on commit 95330cb

Please sign in to comment.