Skip to content

Commit

Permalink
Merge pull request #29 from tetu-io/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
belbix authored Nov 11, 2023
2 parents 7e398de + f559eda commit fa397f3
Show file tree
Hide file tree
Showing 175 changed files with 20,096 additions and 19,700 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
fetch-depth: 2
- uses: actions/setup-node@v2
with:
node-version: 14.x
node-version: 18.x
- uses: actions/cache@v2
id: cache
with:
Expand Down
18 changes: 17 additions & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
module.exports = {
skipFiles: ['third_party', 'test', 'tools', 'openzeppelin']
skipFiles: ['third_party', 'test', 'tools', 'openzeppelin'],
configureYulOptimizer: true,
mocha: {
grep: "@skip-on-coverage", // Find everything with this tag
invert: true // Run the grep's inverse set.
},
solcOptimizerDetails: {
peephole: false,
//inliner: false,
jumpdestRemover: false,
orderLiterals: false, // <-- TRUE! Stack too deep when false
deduplicate: false,
cse: false,
constantOptimizer: false,
yul: true,
}

};
2 changes: 2 additions & 0 deletions addresses_core_matic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ hw5 0x75766Be51F932E738dee52f3A46c394589A36233
// tetuQI vote power contract 0xDA67dBaB383A7cE922320a48D515f0Fd567AAC08

// xtetuBAL distributor 0x6DdD4dB035FC15F90D74C1E98ABa967D6b3Ce3Dd

// balancer GaugeDepositor 0x1F46804E2D4B11CE7a61E36720DF316B7343B023
6 changes: 3 additions & 3 deletions contracts/TetuProxyControlled.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

pragma solidity 0.8.4;

import "./interface/IControllable.sol";
import "./interface/IControllableExtended.sol";
import "./interface/ITetuProxy.sol";
import "./interfaces/IControllable.sol";
import "./interfaces/IControllableExtended.sol";
import "./interfaces/ITetuProxy.sol";
import "@tetu_io/tetu-contracts/contracts/base/UpgradeableProxy.sol";

/// @title EIP1967 Upgradable proxy implementation.
Expand Down
38 changes: 38 additions & 0 deletions contracts/impl/balancer/StrategyBalancerBoost.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: ISC
/**
* By using this software, you understand, acknowledge and accept that Tetu
* and/or the underlying software are provided “as is” and “as available”
* basis and without warranties or representations of any kind either expressed
* or implied. Any use of this open source software released under the ISC
* Internet Systems Consortium license is done at your own risk to the fullest
* extent permissible pursuant to applicable law any and all liability as well
* as all warranties, including any fitness for a particular purpose with respect
* to Tetu and/or the underlying software and the use thereof are disclaimed.
*/
pragma solidity 0.8.4;

import "../../strategies/balancer/BalancerBoostStrategyBase.sol";

contract StrategyBalancerBoost is BalancerBoostStrategyBase {

function initialize(
address controller_,
address vault_,
bytes32 poolId_,
address gauge_,
uint _bbRatio,
address depositToken_,
address gaugeDepositor_
) external initializer {
initializeStrategy(
controller_,
vault_,
poolId_,
gauge_,
_bbRatio,
depositToken_,
gaugeDepositor_
);
}

}
40 changes: 40 additions & 0 deletions contracts/impl/balancer/StrategyBalancerBoostBPT.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: ISC
/**
* By using this software, you understand, acknowledge and accept that Tetu
* and/or the underlying software are provided “as is” and “as available”
* basis and without warranties or representations of any kind either expressed
* or implied. Any use of this open source software released under the ISC
* Internet Systems Consortium license is done at your own risk to the fullest
* extent permissible pursuant to applicable law any and all liability as well
* as all warranties, including any fitness for a particular purpose with respect
* to Tetu and/or the underlying software and the use thereof are disclaimed.
*/
pragma solidity 0.8.4;

import "../../strategies/balancer/BalancerBoostBPTStrategyBase.sol";

contract StrategyBalancerBoostBPT is BalancerBoostBPTStrategyBase {

function initialize(
address controller_,
address vault_,
bytes32 poolId_,
address gauge_,
uint _bbRatio,
address depositToken_,
bytes32 depositBPTPoolId_,
address gaugeDepositor_
) external initializer {
initializeStrategy(
controller_,
vault_,
poolId_,
gauge_,
_bbRatio,
depositToken_,
depositBPTPoolId_,
gaugeDepositor_
);
}

}
34 changes: 34 additions & 0 deletions contracts/impl/balancer/StrategyBalancerBoostTetuUsdc.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: ISC
/**
* By using this software, you understand, acknowledge and accept that Tetu
* and/or the underlying software are provided “as is” and “as available”
* basis and without warranties or representations of any kind either expressed
* or implied. Any use of this open source software released under the ISC
* Internet Systems Consortium license is done at your own risk to the fullest
* extent permissible pursuant to applicable law any and all liability as well
* as all warranties, including any fitness for a particular purpose with respect
* to Tetu and/or the underlying software and the use thereof are disclaimed.
*/
pragma solidity 0.8.4;

import "../../strategies/balancer/BalancerBoostTetuUsdcStrategyBase.sol";

contract StrategyBalancerBoostTetuUsdc is BalancerBoostTetuUsdcStrategyBase {

function initialize(
address controller_,
address vault_,
address rewardsRecipient_,
address bribeReceiver_,
address gaugeDepositor_
) external initializer {
initializeStrategy(
controller_,
vault_,
rewardsRecipient_,
bribeReceiver_,
gaugeDepositor_
);
}

}
30 changes: 30 additions & 0 deletions contracts/impl/tangible/StrategyCaviarStaking.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: ISC
/**
* By using this software, you understand, acknowledge and accept that Tetu
* and/or the underlying software are provided “as is” and “as available”
* basis and without warranties or representations of any kind either expressed
* or implied. Any use of this open source software released under the ISC
* Internet Systems Consortium license is done at your own risk to the fullest
* extent permissible pursuant to applicable law any and all liability as well
* as all warranties, including any fitness for a particular purpose with respect
* to Tetu and/or the underlying software and the use thereof are disclaimed.
*/
pragma solidity 0.8.4;

import "../../strategies/tangible/CaviarStakingStrategyBase.sol";


contract StrategyCaviarStaking is CaviarStakingStrategyBase {

function initialize(
address controller_,
address vault_,
uint buybackRatio_
) external initializer {
initializeStrategy(
controller_,
vault_,
buybackRatio_
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
pragma solidity 0.8.4;

import "../../strategies/0vix/ZerovixStrategyBase.sol";
import "../../strategies/zerovix/ZerovixStrategyBase.sol";

contract ZerovixStrategy is ZerovixStrategyBase {
function initialize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
pragma solidity 0.8.4;

import "../../strategies/0vix/ZerovixstMaticStrategyBase.sol";
import "../../strategies/zerovix/ZerovixstMaticStrategyBase.sol";

contract ZerovixstMaticStrategy is ZerovixstMaticStrategyBase {
function initialize(
Expand Down
File renamed without changes.
File renamed without changes.
41 changes: 41 additions & 0 deletions contracts/interfaces/IBribeDistribution.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: ISC
/**
* By using this software, you understand, acknowledge and accept that Tetu
* and/or the underlying software are provided “as is” and “as available”
* basis and without warranties or representations of any kind either expressed
* or implied. Any use of this open source software released under the ISC
* Internet Systems Consortium license is done at your own risk to the fullest
* extent permissible pursuant to applicable law any and all liability as well
* as all warranties, including any fitness for a particular purpose with respect
* to Tetu and/or the underlying software and the use thereof are disclaimed.
*/

pragma solidity 0.8.4;

interface IBribeDistribution {
function VERSION() external view returns (string memory);

function acceptOwnership() external;

function autoNotify() external;

function bribe() external view returns (address);

function manualNotify(uint256 amount, bool fresh) external;

function offerOwnership(address newOwner) external;

function operator() external view returns (address);

function owner() external view returns (address);

function pendingOwner() external view returns (address);

function round() external view returns (uint256);

function setOperator(address operator_) external;

function token() external view returns (address);

function vault() external view returns (address);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions contracts/interfaces/ISwapper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.4;

interface ISwapper {

function swap(
address pool,
address tokenIn,
address tokenOut,
address recipient,
uint priceImpactTolerance
) external;

function getPrice(
address pool,
address tokenIn,
address tokenOut,
uint amount
) external view returns (uint);

}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ pragma solidity 0.8.4;
interface ITetuLiquidatorController {
function governance() external view returns (address);
function isOperator(address _adr) external view returns (bool);
function changeOperatorStatus(address operator, bool status) external;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 17 additions & 6 deletions contracts/strategies/UniversalLendStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ abstract contract UniversalLendStrategy is ProxyStrategyBase {
/// Constants and variables
/// ******************************************************
uint private constant _DUST = 10_000;
address private constant _PERF_FEE_TREASURY = 0x9Cc199D4353b5FB3e6C8EEBC99f5139e0d8eA06b;

uint internal localBalance;
uint public lastHw;
bool public isProfitSharingDisabled;

/// ******************************************************
/// Initialization
Expand All @@ -45,6 +47,7 @@ abstract contract UniversalLendStrategy is ProxyStrategyBase {
__rewardTokens,
buybackRatio_
);
isProfitSharingDisabled = true;
}

// *******************************************************
Expand All @@ -60,6 +63,10 @@ abstract contract UniversalLendStrategy is ProxyStrategyBase {
}
}

function setProfitSharingDisabled(bool value) external restricted {
isProfitSharingDisabled = value;
}

/// ******************************************************
/// Do hard work
/// ******************************************************
Expand Down Expand Up @@ -152,12 +159,16 @@ abstract contract UniversalLendStrategy is ProxyStrategyBase {
uint toCompound = amount - toBuyBacks;

if (toBuyBacks != 0) {
if (silent) {
try IFeeRewardForwarder(forwarder).distribute(toBuyBacks, rt, targetVault) returns (uint r) {
targetTokenEarned += r;
} catch {}
if (isProfitSharingDisabled) {
IERC20(rt).safeTransfer(_PERF_FEE_TREASURY, toBuyBacks);
} else {
targetTokenEarned += IFeeRewardForwarder(forwarder).distribute(toBuyBacks, rt, targetVault);
if (silent) {
try IFeeRewardForwarder(forwarder).distribute(toBuyBacks, rt, targetVault) returns (uint r) {
targetTokenEarned += r;
} catch {}
} else {
targetTokenEarned += IFeeRewardForwarder(forwarder).distribute(toBuyBacks, rt, targetVault);
}
}
}

Expand Down Expand Up @@ -259,5 +270,5 @@ abstract contract UniversalLendStrategy is ProxyStrategyBase {
}

//slither-disable-next-line unused-state
uint256[48] private ______gap;
uint256[47] private ______gap;
}
2 changes: 1 addition & 1 deletion contracts/strategies/aave/Aave2StrategyBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract contract Aave2StrategyBase is UniversalLendStrategy {

/// @notice Version of the contract
/// @dev Should be incremented when contract changed
string public constant VERSION = "1.0.3";
string public constant VERSION = "1.0.4";

IStrategy.Platform public constant override platform = IStrategy.Platform.AAVE_LEND;
/// @notice Strategy type for statistical purposes
Expand Down
2 changes: 1 addition & 1 deletion contracts/strategies/aave/Aave3StrategyBaseV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ abstract contract Aave3StrategyBaseV2 is UniversalLendStrategy {

/// @notice Version of the contract
/// @dev Should be incremented when contract changed
string public constant VERSION = "1.0.3";
string public constant VERSION = "1.0.4";

IStrategy.Platform public constant override platform = IStrategy.Platform.AAVE_LEND; // same as for AAVEv2

Expand Down
Loading

0 comments on commit fa397f3

Please sign in to comment.