Skip to content

Commit 99b87c9

Browse files
lekhovitsky0xmikko
andauthored
feat: small repo upgrade (#44)
In this PR: * make contracts compatible with newer core (remove core-v2 references, add contract types) * remove Aave and Compound price feeds * move from `yarn` to `forge` Solidity dependencies management * bump `solc` version to `0.8.23` --------- Co-authored-by: 0xmikko <26343374+0xmikko@users.noreply.github.com>
1 parent 5edfa66 commit 99b87c9

File tree

76 files changed

+279
-628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+279
-628
lines changed

.gitmodules

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
[submodule "lib/forge-std"]
22
path = lib/forge-std
33
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/@gearbox-protocol/core-v3"]
5+
path = lib/@gearbox-protocol/core-v3
6+
url = https://github.com/Gearbox-protocol/core-v3
7+
branch = next
8+
[submodule "lib/@gearbox-protocol/sdk-gov"]
9+
path = lib/@gearbox-protocol/sdk-gov
10+
url = https://github.com/Gearbox-protocol/sdk-gov
11+
[submodule "lib/@1inch/solidity-utils"]
12+
path = lib/@1inch/solidity-utils
13+
url = https://github.com/1inch/solidity-utils
14+
[submodule "lib/@openzeppelin"]
15+
path = lib/@openzeppelin
16+
url = https://github.com/OpenZeppelin/openzeppelin-contracts

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"files.eol": "\n",
1414
"solidity.formatter": "forge",
1515
"solidity.packageDefaultDependenciesContractsDirectory": "contracts",
16-
"solidity.packageDefaultDependenciesDirectory": "node_modules",
17-
"solidity.compileUsingRemoteVersion": "v0.8.17"
16+
"solidity.packageDefaultDependenciesDirectory": "lib",
17+
"solidity.compileUsingRemoteVersion": "v0.8.23"
1818
}

contracts/interfaces/ILPPriceFeed.sol

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
// SPDX-License-Identifier: MIT
22
// Gearbox Protocol. Generalized leverage for DeFi protocols
3-
// (c) Gearbox Foundation, 2023.
4-
pragma solidity ^0.8.17;
3+
// (c) Gearbox Foundation, 2024.
4+
pragma solidity ^0.8.23;
55

6-
import {IPriceFeed} from "@gearbox-protocol/core-v2/contracts/interfaces/IPriceFeed.sol";
6+
import {IPriceFeed} from "@gearbox-protocol/core-v3/contracts/interfaces/base/IPriceFeed.sol";
77

8-
interface ILPPriceFeedEvents {
8+
/// @title LP price feed interface
9+
interface ILPPriceFeed is IPriceFeed {
910
/// @notice Emitted when new LP token exchange rate bounds are set
1011
event SetBounds(uint256 lowerBound, uint256 upperBound);
1112

1213
/// @notice Emitted when permissionless bounds update is allowed or forbidden
1314
event SetUpdateBoundsAllowed(bool allowed);
14-
}
1515

16-
interface ILPPriceFeedExceptions {
1716
/// @notice Thrown when trying to set exchange rate lower bound to zero
1817
error LowerBoundCantBeZeroException();
1918

@@ -29,10 +28,7 @@ interface ILPPriceFeedExceptions {
2928

3029
/// @notice Thrown when price oracle's reserve price feed is the LP price feed itself
3130
error ReserveFeedMustNotBeSelfException();
32-
}
3331

34-
/// @title LP price feed interface
35-
interface ILPPriceFeed is IPriceFeed, ILPPriceFeedEvents, ILPPriceFeedExceptions {
3632
function priceOracle() external view returns (address);
3733

3834
function lpToken() external view returns (address);

contracts/interfaces/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(c) Gearbox Foundation, 2023.
1+
(c) Gearbox Foundation, 2024.
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
44

contracts/interfaces/aave/IWAToken.sol

Lines changed: 0 additions & 8 deletions
This file was deleted.

contracts/interfaces/balancer/IBalancerStablePool.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
// Gearbox Protocol. Generalized leverage for DeFi protocols
3-
// (c) Gearbox Foundation, 2023.
4-
pragma solidity ^0.8.17;
3+
// (c) Gearbox Foundation, 2024.
4+
pragma solidity ^0.8.23;
55

66
interface IBalancerStablePool {
77
function getRate() external view returns (uint256);

contracts/interfaces/balancer/IBalancerVault.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
// Gearbox Protocol. Generalized leverage for DeFi protocols
3-
// (c) Gearbox Foundation, 2023.
4-
pragma solidity ^0.8.17;
3+
// (c) Gearbox Foundation, 2024.
4+
pragma solidity ^0.8.23;
55

66
interface IBalancerVault {
77
function getPoolTokens(bytes32 poolId)

contracts/interfaces/balancer/IBalancerWeightedPool.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
// Gearbox Protocol. Generalized leverage for DeFi protocols
3-
// (c) Gearbox Foundation, 2023.
4-
pragma solidity ^0.8.17;
3+
// (c) Gearbox Foundation, 2024.
4+
pragma solidity ^0.8.23;
55

66
interface IBalancerWeightedPool {
77
function getRate() external view returns (uint256);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0;
3+
4+
interface AggregatorInterface {
5+
function latestAnswer() external view returns (int256);
6+
7+
function latestTimestamp() external view returns (uint256);
8+
9+
function latestRound() external view returns (uint256);
10+
11+
function getAnswer(uint256 roundId) external view returns (int256);
12+
13+
function getTimestamp(uint256 roundId) external view returns (uint256);
14+
15+
event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);
16+
17+
event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);
18+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0;
3+
4+
import "./AggregatorInterface.sol";
5+
import "./AggregatorV3Interface.sol";
6+
7+
interface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface {}

0 commit comments

Comments
 (0)