Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: updates to periphery #35

Merged
merged 7 commits into from
Jul 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: comment
Schlagonia committed Jul 25, 2024
commit e248eab6d597c28d325ff72f8c4b06e888a5b651
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Unchanged files with check annotations Beta

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

Check warning on line 6 in src/interfaces/IStrategyInterface.sol

GitHub Actions / solidity

Code contains empty blocks
//TODO: Add your specific implementation interface in here.
}
* @return . The expected apr for the strategy represented as 1e18.
*/
function aprAfterDebtChange(
address _strategy,

Check warning on line 29 in src/periphery/StrategyAprOracle.sol

GitHub Actions / solidity

Variable "_strategy" is unused
int256 _delta

Check warning on line 30 in src/periphery/StrategyAprOracle.sol

GitHub Actions / solidity

Variable "_delta" is unused
) external view override returns (uint256) {
// TODO: Implement any necessary logic to return the most accurate
// APR estimation for the strategy.
* @param _amount The amount of 'asset' that the strategy can attempt
* to deposit in the yield source.
*/
function _deployFunds(uint256 _amount) internal override {

Check warning on line 46 in src/Strategy.sol

GitHub Actions / solidity

Code contains empty blocks
// TODO: implement deposit logic EX:
//
// lendingPool.deposit(address(asset), _amount ,0);
*
* @param _amount, The amount of 'asset' to be freed.
*/
function _freeFunds(uint256 _amount) internal override {

Check warning on line 73 in src/Strategy.sol

GitHub Actions / solidity

Code contains empty blocks
// TODO: implement withdraw logic EX:
//
// lendingPool.withdraw(address(asset), _amount);
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;
import "forge-std/console2.sol";

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

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

GitHub Actions / solidity

imported name IStrategyInterface is not used
contract FunctionSignatureTest is Setup {
function setUp() public virtual override {
// This test should not be overridden and checks that
// no function signature collisions occurred from the custom functions.
// Does not check functions that are strategy dependant and will be checked in other tests
function test_functionCollisions() public {

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

GitHub Actions / solidity

Function body contains 76 lines but allowed no more than 50 lines

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

GitHub Actions / solidity

Function name must be in mixedCase
uint256 wad = 1e18;
vm.expectRevert("initialized");
strategy.initialize(
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;
import "forge-std/console2.sol";

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

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 {