Skip to content

Commit

Permalink
chore: updates to periphery (#35)
Browse files Browse the repository at this point in the history
* chore: remove old

* forge install: tokenized-strategy-periphery

6ce8d29b1e107a89754dd9f17337582734989b4d

* fix: remove version

* forge install: tokenized-strategy

v3.0.2-1

* fix: module versions

* chore: bump version (#34)

* chore: bump version

bump to 0.8.23

* chore: update submodules

* fix: greater than 18

* fix: redo requirements

* feat: one more bump

* fix: use console2

---------

Co-authored-by: Schlag <[email protected]>

* feat: comment

---------

Co-authored-by: dudesahn <[email protected]>
  • Loading branch information
Schlagonia and dudesahn authored Jul 25, 2024
1 parent 6c0deeb commit d185c78
Show file tree
Hide file tree
Showing 20 changed files with 41 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ docs/
node_modules/
.gas-snapshot

yarn.lock
yarn.lock
.DS_Store
11 changes: 6 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
branch = master
[submodule "lib/tokenized-strategy"]
path = lib/tokenized-strategy
url = https://github.com/yearn/tokenized-strategy
release = v3.0.2
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
branch = v4.9.5
[submodule "lib/tokenized-strategy-periphery"]
path = lib/tokenized-strategy-periphery
url = https://github.com/yearn/tokenized-strategy-periphery
branch = master
branch = master
[submodule "lib/tokenized-strategy"]
path = lib/tokenized-strategy
url = https://github.com/yearn/tokenized-strategy
branch = v3.0.2-1
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "solhint:recommended",
"plugins": [],
"rules": {
"compiler-version": ["error", "0.8.18"],
"compiler-version": ["error", "^0.8.18"],
"code-complexity": "warn",
"const-name-snakecase": "warn",
"function-max-lines": "warn",
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"solidity.compileUsingRemoteVersion": "v0.8.18",
"solidity.compileUsingRemoteVersion": "v0.8.23",
"solidity.remappings": [
"@openzeppelin/=./lib/openzeppelin-contracts/",
"forge-std/=lib/forge-std/src/",
Expand Down
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ size :; forge build --sizes
# storage inspection
inspect :; forge inspect ${contract} storage-layout --pretty

FORK_URL := ${ETH_RPC_URL}
# specify which fork to use. set this in our .env
# if we want to test multiple forks in one go, remove this as an argument below
FORK_URL := ${ETH_RPC_URL} # BASE_RPC_URL, ETH_RPC_URL, ARBITRUM_RPC_URL

# if we want to run only matching tests, set that here
test := test_

# local tests without fork
test :; forge test -vv --fork-url ${FORK_URL}
Expand All @@ -18,9 +23,15 @@ test-contract :; forge test -vv --match-contract $(contract) --fork-url ${FORK_
test-contract-gas :; forge test --gas-report --match-contract ${contract} --fork-url ${FORK_URL}
trace-contract :; forge test -vvv --match-contract $(contract) --fork-url ${FORK_URL}
test-test :; forge test -vv --match-test $(test) --fork-url ${FORK_URL}
trace-test :; forge test -vvv --match-test $(test) --fork-url ${FORK_URL}
test-test-trace :; forge test -vvv --match-test $(test) --fork-url ${FORK_URL}
trace-test :; forge test -vvvvv --match-test $(test) --fork-url ${FORK_URL}
snapshot :; forge snapshot -vv --fork-url ${FORK_URL}
snapshot-diff :; forge snapshot --diff -vv --fork-url ${FORK_URL}
trace-setup :; forge test -vvvv --fork-url ${FORK_URL}
trace-max :; forge test -vvvvv --fork-url ${FORK_URL}
coverage :; forge coverage --fork-url ${FORK_URL}
coverage-report :; forge coverage --report lcov --fork-url ${FORK_URL}
coverage-debug :; forge coverage --report debug --fork-url ${FORK_URL}


clean :; forge clean
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ make test

For a complete guide to creating a Tokenized Strategy please visit: https://docs.yearn.fi/developers/v3/strategy_writing_guide

NOTE: Compiler defaults to 8.23 but it can be adjusted in the foundry toml.

## Testing

Due to the nature of the BaseStrategy utilizing an external contract for the majority of its logic, the default interface for any tokenized strategy will not allow proper testing of all functions. Testing of your Strategy should utilize the pre-built [IStrategyInterface](https://github.com/yearn/tokenized-strategy-foundry-mix/blob/master/src/interfaces/IStrategyInterface.sol) to cast any deployed strategy through for testing, as seen in the Setup example. You can add any external functions that you add for your specific strategy to this interface to be able to test all functions with one variable.
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
src = 'src'
out = 'out'
libs = ['lib']
solc = "0.8.18"
solc = "0.8.23"

remappings = [
"@openzeppelin/=lib/openzeppelin-contracts/",
Expand Down
2 changes: 1 addition & 1 deletion lib/tokenized-strategy-periphery
Submodule tokenized-strategy-periphery updated 59 files
+1 −0 foundry.toml
+1 −1 script/DeployAprOracle.s.sol
+1 −1 script/DeployAuctionFactory.sol
+1 −1 script/DeployCommonTrigger.s.sol
+1 −1 src/AprOracle/AprOracle.sol
+1 −1 src/AprOracle/AprOracleBase.sol
+2 −2 src/Auctions/Auction.sol
+1 −1 src/Auctions/AuctionFactory.sol
+1 −1 src/Bases/4626Compounder/Base4626Compounder.sol
+1 −1 src/Bases/4626Compounder/IBase4626Compounder.sol
+619 −0 src/Bases/Auctioneer/BaseAuctioneer.sol
+97 −0 src/Bases/Auctioneer/IBaseAuctioneer.sol
+5 −3 src/Bases/HealthCheck/BaseHealthCheck.sol
+1 −1 src/Bases/HealthCheck/IBaseHealthCheck.sol
+1 −1 src/Bases/Hooks/BaseHooks.sol
+1 −1 src/Bases/Hooks/Hooks.sol
+1 −1 src/ReportTrigger/CommonReportTrigger.sol
+1 −1 src/ReportTrigger/CustomStrategyTriggerBase.sol
+1 −1 src/ReportTrigger/CustomVaultTriggerBase.sol
+1 −1 src/interfaces/ITaker.sol
+5 −5 src/interfaces/Solidly/ISolidly.sol
+1 −1 src/interfaces/TradeFactory/ITradeFactory.sol
+1 −1 src/libraries/Maths.sol
+1 −1 src/swappers/AuctionSwapper.sol
+1 −1 src/swappers/SolidlySwapper.sol
+85 −30 src/swappers/TradeFactorySwapper.sol
+1 −1 src/swappers/UniswapV2Swapper.sol
+1 −1 src/swappers/UniswapV3Swapper.sol
+1 −1 src/swappers/interfaces/IAuctionSwapper.sol
+1 −1 src/swappers/interfaces/ISolidlySwapper.sol
+1 −1 src/swappers/interfaces/ITradeFactorySwapper.sol
+1 −1 src/swappers/interfaces/IUniswapV2Swapper.sol
+1 −1 src/swappers/interfaces/IUniswapV3Swapper.sol
+1 −1 src/test/Auction.t.sol
+1 −1 src/test/AuctionSwapper.t.sol
+1 −1 src/test/Base4626.t.sol
+455 −0 src/test/BaseAuctioneer.t.sol
+1 −1 src/test/BaseHook.t.sol
+1 −1 src/test/CommonTrigger.t.sol
+1 −1 src/test/HealthCheck.t.sol
+1 −1 src/test/SolidlySwapper.t.sol
+1 −1 src/test/UniV2Swapper.t.sol
+1 −1 src/test/UniV3Swapper.t.sol
+1 −1 src/test/mocks/MockAuctionSwapper.sol
+95 −0 src/test/mocks/MockAuctioneer.sol
+1 −1 src/test/mocks/MockCustomStrategyTrigger.sol
+1 −1 src/test/mocks/MockCustomVaultTrigger.sol
+1 −1 src/test/mocks/MockHealthCheck.sol
+1 −1 src/test/mocks/MockHooks.sol
+1 −1 src/test/mocks/MockSolidlySwapper.sol
+1 −1 src/test/mocks/MockStrategy.sol
+1 −1 src/test/mocks/MockUniswapV2Swapper.sol
+1 −1 src/test/mocks/MockUniswapV3Swapper.sol
+1 −1 src/test/utils/ExtendedTest.sol
+1 −1 src/test/utils/Setup.sol
+1 −1 src/test/utils/VyperDeployer.sol
+1 −1 src/utils/Clonable.sol
+1 −1 src/utils/Governance.sol
+1 −1 src/utils/Governance2Step.sol
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"prettier": "^2.5.1",
"prettier-plugin-solidity": "^1.0.0-beta.19",
"pretty-quick": "^3.1.3",
"solc": "0.8.18",
"solc": "0.8.23",
"solhint": "^3.3.7",
"solhint-plugin-prettier": "^0.0.5"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Strategy.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.18;
pragma solidity ^0.8.18;

import {BaseStrategy, ERC20} from "@tokenized-strategy/BaseStrategy.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/IStrategyInterface.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.18;
pragma solidity ^0.8.18;

import {IStrategy} from "@tokenized-strategy/interfaces/IStrategy.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/periphery/StrategyAprOracle.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.18;
pragma solidity ^0.8.18;

import {AprOracleBase} from "@periphery/AprOracle/AprOracleBase.sol";

Expand Down
2 changes: 1 addition & 1 deletion src/test/FunctionSignature.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;

import "forge-std/console.sol";
import "forge-std/console2.sol";

Check warning on line 4 in src/test/FunctionSignature.t.sol

View workflow job for this annotation

GitHub Actions / solidity

global import of path forge-std/console2.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import {Setup, ERC20, IStrategyInterface} from "./utils/Setup.sol";

Check warning on line 5 in src/test/FunctionSignature.t.sol

View workflow job for this annotation

GitHub Actions / solidity

imported name IStrategyInterface is not used

contract FunctionSignatureTest is Setup {
Expand Down
4 changes: 2 additions & 2 deletions src/test/Operation.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;

import "forge-std/console.sol";
import "forge-std/console2.sol";

Check warning on line 4 in src/test/Operation.t.sol

View workflow job for this annotation

GitHub Actions / solidity

global import of path forge-std/console2.sol is not allowed. Specify names to import individually or bind all exports of the module into a name (import "path" as Name)
import {Setup, ERC20, IStrategyInterface} from "./utils/Setup.sol";

contract OperationTest is Setup {
Expand All @@ -10,7 +10,7 @@ contract OperationTest is Setup {
}

function test_setupStrategyOK() public {
console.log("address of strategy", address(strategy));
console2.log("address of strategy", address(strategy));
assertTrue(address(0) != address(strategy));
assertEq(strategy.asset(), address(asset));
assertEq(strategy.management(), management);
Expand Down
2 changes: 1 addition & 1 deletion src/test/Oracle.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.8.18;

import "forge-std/console.sol";
import "forge-std/console2.sol";
import {Setup} from "./utils/Setup.sol";

import {StrategyAprOracle} from "../periphery/StrategyAprOracle.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/test/Shutdown.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.8.18;

import "forge-std/console.sol";
import "forge-std/console2.sol";
import {Setup, ERC20, IStrategyInterface} from "./utils/Setup.sol";

contract ShutdownTest is Setup {
Expand Down
2 changes: 1 addition & 1 deletion src/test/utils/ExtendedTest.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.18;
pragma solidity ^0.8.18;

import {Test} from "forge-std/Test.sol";

Expand Down
4 changes: 2 additions & 2 deletions src/test/utils/Setup.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.18;
pragma solidity ^0.8.18;

import "forge-std/console.sol";
import "forge-std/console2.sol";
import {ExtendedTest} from "./ExtendedTest.sol";

import {Strategy, ERC20} from "../../Strategy.sol";
Expand Down

0 comments on commit d185c78

Please sign in to comment.