From a198bf3ab20ca2b34cb7b24d562616487a4901e7 Mon Sep 17 00:00:00 2001 From: Schlagonia Date: Thu, 25 Jul 2024 11:34:15 -0600 Subject: [PATCH 1/7] chore: remove old --- .gitmodules | 6 +----- lib/forge-std | 2 +- lib/tokenized-strategy-periphery | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) delete mode 160000 lib/tokenized-strategy-periphery diff --git a/.gitmodules b/.gitmodules index dc57e40f..e63d700e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,8 +8,4 @@ release = v3.0.2 [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts - url = https://github.com/OpenZeppelin/openzeppelin-contracts -[submodule "lib/tokenized-strategy-periphery"] - path = lib/tokenized-strategy-periphery - url = https://github.com/yearn/tokenized-strategy-periphery - branch = master \ No newline at end of file + url = https://github.com/OpenZeppelin/openzeppelin-contracts \ No newline at end of file diff --git a/lib/forge-std b/lib/forge-std index bb4ceea9..fc560fa3 160000 --- a/lib/forge-std +++ b/lib/forge-std @@ -1 +1 @@ -Subproject commit bb4ceea94d6f10eeb5b41dc2391c6c8bf8e734ef +Subproject commit fc560fa34fa12a335a50c35d92e55a6628ca467c diff --git a/lib/tokenized-strategy-periphery b/lib/tokenized-strategy-periphery deleted file mode 160000 index bbc3a035..00000000 --- a/lib/tokenized-strategy-periphery +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bbc3a0354f45dab087a4c82650e42225433c8fef From ab6d31a406566a373936d30797b359aa7e8b743b Mon Sep 17 00:00:00 2001 From: Schlagonia Date: Thu, 25 Jul 2024 11:37:51 -0600 Subject: [PATCH 2/7] forge install: tokenized-strategy-periphery 6ce8d29b1e107a89754dd9f17337582734989b4d --- .gitmodules | 5 ++++- lib/tokenized-strategy-periphery | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) create mode 160000 lib/tokenized-strategy-periphery diff --git a/.gitmodules b/.gitmodules index e63d700e..b8f63c5a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,4 +8,7 @@ release = v3.0.2 [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts - url = https://github.com/OpenZeppelin/openzeppelin-contracts \ No newline at end of file + url = https://github.com/OpenZeppelin/openzeppelin-contracts +[submodule "lib/tokenized-strategy-periphery"] + path = lib/tokenized-strategy-periphery + url = https://github.com/yearn/tokenized-strategy-periphery diff --git a/lib/tokenized-strategy-periphery b/lib/tokenized-strategy-periphery new file mode 160000 index 00000000..6ce8d29b --- /dev/null +++ b/lib/tokenized-strategy-periphery @@ -0,0 +1 @@ +Subproject commit 6ce8d29b1e107a89754dd9f17337582734989b4d From b2671ba367408b920eac33c1ba8b58c1327330de Mon Sep 17 00:00:00 2001 From: dudesahn <23222916+dudesahn@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:52:39 -0400 Subject: [PATCH 3/7] 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 <89420541+Schlagonia@users.noreply.github.com> --- .gitignore | 3 ++- .gitmodules | 2 +- .solhint.json | 2 +- .vscode/settings.json | 2 +- Makefile | 15 +++++++++++++-- foundry.toml | 2 +- lib/tokenized-strategy | 2 +- package.json | 2 +- src/Strategy.sol | 2 +- src/interfaces/IStrategyInterface.sol | 2 +- src/periphery/StrategyAprOracle.sol | 2 +- src/test/FunctionSignature.t.sol | 2 +- src/test/Operation.t.sol | 4 ++-- src/test/Oracle.t.sol | 2 +- src/test/Shutdown.t.sol | 2 +- src/test/utils/ExtendedTest.sol | 2 +- src/test/utils/Setup.sol | 4 ++-- 17 files changed, 32 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 01c15f79..dc0661d1 100644 --- a/.gitignore +++ b/.gitignore @@ -16,4 +16,5 @@ docs/ node_modules/ .gas-snapshot -yarn.lock \ No newline at end of file +yarn.lock +.DS_Store diff --git a/.gitmodules b/.gitmodules index b8f63c5a..3c6efe14 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,7 +5,7 @@ [submodule "lib/tokenized-strategy"] path = lib/tokenized-strategy url = https://github.com/yearn/tokenized-strategy - release = v3.0.2 + release = v3.0.2-1 [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts url = https://github.com/OpenZeppelin/openzeppelin-contracts diff --git a/.solhint.json b/.solhint.json index d5e18963..f40d9b02 100644 --- a/.solhint.json +++ b/.solhint.json @@ -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", diff --git a/.vscode/settings.json b/.vscode/settings.json index d43cdd74..eb095a44 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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/", diff --git a/Makefile b/Makefile index 9a7a7d10..4ab15174 100644 --- a/Makefile +++ b/Makefile @@ -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} @@ -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 diff --git a/foundry.toml b/foundry.toml index f3e432f9..262de881 100644 --- a/foundry.toml +++ b/foundry.toml @@ -2,7 +2,7 @@ src = 'src' out = 'out' libs = ['lib'] -solc = "0.8.18" +solc = "0.8.23" remappings = [ "@openzeppelin/=lib/openzeppelin-contracts/", diff --git a/lib/tokenized-strategy b/lib/tokenized-strategy index 0d90dee1..cf791a6f 160000 --- a/lib/tokenized-strategy +++ b/lib/tokenized-strategy @@ -1 +1 @@ -Subproject commit 0d90dee170d53a0e04af3ff41d2f7a4f3ac395bd +Subproject commit cf791a6f2d360e5c33866c9f0de10e83085920e9 diff --git a/package.json b/package.json index 441bb9f0..2a4917ea 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/src/Strategy.sol b/src/Strategy.sol index b97517cf..def08717 100644 --- a/src/Strategy.sol +++ b/src/Strategy.sol @@ -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"; diff --git a/src/interfaces/IStrategyInterface.sol b/src/interfaces/IStrategyInterface.sol index 49799bac..917e2d0c 100644 --- a/src/interfaces/IStrategyInterface.sol +++ b/src/interfaces/IStrategyInterface.sol @@ -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"; diff --git a/src/periphery/StrategyAprOracle.sol b/src/periphery/StrategyAprOracle.sol index ac2ae6e0..1c0bfb8f 100644 --- a/src/periphery/StrategyAprOracle.sol +++ b/src/periphery/StrategyAprOracle.sol @@ -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"; diff --git a/src/test/FunctionSignature.t.sol b/src/test/FunctionSignature.t.sol index ea8ad4f6..0389a271 100644 --- a/src/test/FunctionSignature.t.sol +++ b/src/test/FunctionSignature.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.18; -import "forge-std/console.sol"; +import "forge-std/console2.sol"; import {Setup, ERC20, IStrategyInterface} from "./utils/Setup.sol"; contract FunctionSignatureTest is Setup { diff --git a/src/test/Operation.t.sol b/src/test/Operation.t.sol index bfaad36a..9a3f25be 100644 --- a/src/test/Operation.t.sol +++ b/src/test/Operation.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.18; -import "forge-std/console.sol"; +import "forge-std/console2.sol"; import {Setup, ERC20, IStrategyInterface} from "./utils/Setup.sol"; contract OperationTest is Setup { @@ -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); diff --git a/src/test/Oracle.t.sol b/src/test/Oracle.t.sol index 4b1f80dd..f7c349c4 100644 --- a/src/test/Oracle.t.sol +++ b/src/test/Oracle.t.sol @@ -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"; diff --git a/src/test/Shutdown.t.sol b/src/test/Shutdown.t.sol index b8313328..a9ce1e5e 100644 --- a/src/test/Shutdown.t.sol +++ b/src/test/Shutdown.t.sol @@ -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 { diff --git a/src/test/utils/ExtendedTest.sol b/src/test/utils/ExtendedTest.sol index e8fcc6ce..4dfd4f1f 100644 --- a/src/test/utils/ExtendedTest.sol +++ b/src/test/utils/ExtendedTest.sol @@ -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"; diff --git a/src/test/utils/Setup.sol b/src/test/utils/Setup.sol index 99793794..a24c4dc5 100644 --- a/src/test/utils/Setup.sol +++ b/src/test/utils/Setup.sol @@ -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"; From e248eab6d597c28d325ff72f8c4b06e888a5b651 Mon Sep 17 00:00:00 2001 From: Schlagonia Date: Thu, 25 Jul 2024 11:42:10 -0600 Subject: [PATCH 4/7] feat: comment --- README.md | 2 ++ lib/tokenized-strategy | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a793f001..5a810072 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/lib/tokenized-strategy b/lib/tokenized-strategy index cf791a6f..0d90dee1 160000 --- a/lib/tokenized-strategy +++ b/lib/tokenized-strategy @@ -1 +1 @@ -Subproject commit cf791a6f2d360e5c33866c9f0de10e83085920e9 +Subproject commit 0d90dee170d53a0e04af3ff41d2f7a4f3ac395bd From da960e81170abaf832a3216c30037e80501ca58e Mon Sep 17 00:00:00 2001 From: Schlagonia Date: Thu, 25 Jul 2024 11:44:27 -0600 Subject: [PATCH 5/7] fix: remove version --- .gitmodules | 4 ---- lib/tokenized-strategy | 1 - 2 files changed, 5 deletions(-) delete mode 160000 lib/tokenized-strategy diff --git a/.gitmodules b/.gitmodules index 3c6efe14..5fc7930e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,10 +2,6 @@ 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-1 [submodule "lib/openzeppelin-contracts"] path = lib/openzeppelin-contracts url = https://github.com/OpenZeppelin/openzeppelin-contracts diff --git a/lib/tokenized-strategy b/lib/tokenized-strategy deleted file mode 160000 index 0d90dee1..00000000 --- a/lib/tokenized-strategy +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0d90dee170d53a0e04af3ff41d2f7a4f3ac395bd From 6f38d8878bd51d7b3c0e88c949ffcbb0b66ba1cd Mon Sep 17 00:00:00 2001 From: Schlagonia Date: Thu, 25 Jul 2024 11:46:04 -0600 Subject: [PATCH 6/7] forge install: tokenized-strategy v3.0.2-1 --- .gitmodules | 3 +++ lib/tokenized-strategy | 1 + 2 files changed, 4 insertions(+) create mode 160000 lib/tokenized-strategy diff --git a/.gitmodules b/.gitmodules index 5fc7930e..aff46f69 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,3 +8,6 @@ [submodule "lib/tokenized-strategy-periphery"] path = lib/tokenized-strategy-periphery url = https://github.com/yearn/tokenized-strategy-periphery +[submodule "lib/tokenized-strategy"] + path = lib/tokenized-strategy + url = https://github.com/yearn/tokenized-strategy diff --git a/lib/tokenized-strategy b/lib/tokenized-strategy new file mode 160000 index 00000000..7bf18701 --- /dev/null +++ b/lib/tokenized-strategy @@ -0,0 +1 @@ +Subproject commit 7bf187015f5f7159276f80cd52204431ab1b3b8b From 8d9b6239570601dcdcca07c46dc29e35ea93fffa Mon Sep 17 00:00:00 2001 From: Schlagonia Date: Thu, 25 Jul 2024 11:50:54 -0600 Subject: [PATCH 7/7] fix: module versions --- .gitmodules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitmodules b/.gitmodules index aff46f69..37f73502 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,9 +5,12 @@ [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 [submodule "lib/tokenized-strategy"] path = lib/tokenized-strategy url = https://github.com/yearn/tokenized-strategy + branch = v3.0.2-1 \ No newline at end of file