Skip to content

Commit 792af60

Browse files
authored
chore: remove npm tooling (#61)
* chore: remove npm tooling * chore: apply forge formatting * ci: pin workflow actions
1 parent 2d2c71b commit 792af60

16 files changed

Lines changed: 102 additions & 258 deletions

.github/workflows/coverage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
name: Foundry project
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2323
with:
2424
submodules: recursive
2525

2626
- name: Install Foundry
27-
uses: foundry-rs/foundry-toolchain@v1
27+
uses: foundry-rs/foundry-toolchain@c7450ba673e133f5ee30098b3b54f444d3a2ca2d # v1
2828
with:
2929
version: nightly
3030

@@ -41,7 +41,7 @@ jobs:
4141
sed -i '/Message summary:/,$d' coverage-report/summary.md
4242
4343
- name: Upload coverage report artifact
44-
uses: actions/upload-artifact@v4
44+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
4545
with:
4646
name: CoverageReport # Artifact name
4747
path: coverage-report # Directory containing files to upload

.github/workflows/lint.yaml

Lines changed: 14 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Lint
1+
name: Format
22

33
on:
44
push:
@@ -8,51 +8,19 @@ on:
88

99
jobs:
1010

11-
solidity:
12-
runs-on: ubuntu-latest
11+
solidity:
12+
runs-on: ubuntu-latest
1313

14-
steps:
15-
- name: Check out github repository
16-
uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 1
14+
steps:
15+
- name: Check out github repository
16+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
17+
with:
18+
fetch-depth: 1
1919

20-
- name: Setup node.js
21-
uses: actions/setup-node@v1
22-
with:
23-
node-version: 18
20+
- name: Install Foundry
21+
uses: foundry-rs/foundry-toolchain@c7450ba673e133f5ee30098b3b54f444d3a2ca2d # v1
22+
with:
23+
version: nightly
2424

25-
- name: Set yarn cache directory path
26-
id: yarn-cache-dir-path
27-
run: echo "::set-output name=dir::$(yarn cache dir)"
28-
29-
- name: Restore yarn cache
30-
uses: actions/cache@v3
31-
id: yarn-cache
32-
with:
33-
path: |
34-
${{ steps.yarn-cache-dir-path.outputs.dir }}
35-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
36-
restore-keys: |
37-
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
38-
${{ runner.os }}-yarn-
39-
- name: Install node.js dependencies
40-
run: yarn --frozen-lockfile
41-
42-
- name: Run formater check on *.sol and *.json
43-
run: yarn format:check
44-
45-
- name: run linter check on *.sol file
46-
run: yarn lint
47-
48-
commits:
49-
runs-on: ubuntu-latest
50-
51-
steps:
52-
- name: Check out github repository
53-
uses: actions/checkout@v3
54-
with:
55-
fetch-depth: 0
56-
57-
- name: Run commitlint
58-
uses: wagoid/commitlint-github-action@v5
25+
- name: Check Solidity formatting
26+
run: forge fmt --check

.github/workflows/slither.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ jobs:
99
analyze:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
1313
with:
1414
submodules: recursive
1515

1616
- name: Install Foundry
17-
uses: foundry-rs/foundry-toolchain@v1
17+
uses: foundry-rs/foundry-toolchain@c7450ba673e133f5ee30098b3b54f444d3a2ca2d # v1
1818
with:
1919
version: nightly
2020

2121
- name: Slither analysis
22-
uses: crytic/slither-action@v0.4.0
22+
uses: crytic/slither-action@f197989dea5b53e986d0f88c60a034ddd77ec9a8 # v0.4.0
2323
with:
2424
fail-on: 'medium'

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
name: Foundry project
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
1919
with:
2020
submodules: recursive
2121

2222
- name: Install Foundry
23-
uses: foundry-rs/foundry-toolchain@v1
23+
uses: foundry-rs/foundry-toolchain@c7450ba673e133f5ee30098b3b54f444d3a2ca2d # v1
2424
with:
2525
version: nightly
2626

@@ -33,4 +33,4 @@ jobs:
3333
- name: Run Forge tests
3434
run: |
3535
forge test -vvv --fork-url ${{ secrets.ETH_RPC_URL }}
36-
id: test
36+
id: test

.solhint.json

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

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,13 @@ For a more complete overview of how the Tokenized Strategies work please visit t
1212

1313
- First you will need to install [Foundry](https://book.getfoundry.sh/getting-started/installation).
1414
NOTE: If you are on a windows machine it is recommended to use [WSL](https://learn.microsoft.com/en-us/windows/wsl/install)
15-
- Install [Node.js](https://nodejs.org/en/download/package-manager/)
1615

1716
### Clone this repository
1817

1918
```sh
2019
git clone --recursive https://github.com/yearn/tokenized-strategy-foundry-mix
2120

2221
cd tokenized-strategy-foundry-mix
23-
24-
yarn
2522
```
2623

2724
### Set your environment Variables

package.json

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

src/Strategy.sol

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
2323
contract Strategy is BaseStrategy {
2424
using SafeERC20 for ERC20;
2525

26-
constructor(
27-
address _asset,
28-
string memory _name
29-
) BaseStrategy(_asset, _name) {}
26+
constructor(address _asset, string memory _name) BaseStrategy(_asset, _name) {}
3027

3128
/*//////////////////////////////////////////////////////////////
3229
NEEDED TO BE OVERRIDDEN BY STRATEGIST
@@ -98,11 +95,7 @@ contract Strategy is BaseStrategy {
9895
* @return _totalAssets A trusted and accurate account for the total
9996
* amount of 'asset' the strategy currently holds including idle funds.
10097
*/
101-
function _harvestAndReport()
102-
internal
103-
override
104-
returns (uint256 _totalAssets)
105-
{
98+
function _harvestAndReport() internal override returns (uint256 _totalAssets) {
10699
// TODO: Implement harvesting logic and accurate accounting EX:
107100
//
108101
// if(!TokenizedStrategy.isShutdown()) {
@@ -137,7 +130,12 @@ contract Strategy is BaseStrategy {
137130
*/
138131
function availableWithdrawLimit(
139132
address /*_owner*/
140-
) public view override returns (uint256) {
133+
)
134+
public
135+
view
136+
override
137+
returns (uint256)
138+
{
141139
// NOTE: Withdraw limitations such as liquidity constraints should be accounted for HERE
142140
// rather than _freeFunds in order to not count them as losses on withdraws.
143141

@@ -171,16 +169,16 @@ contract Strategy is BaseStrategy {
171169
* @param . The address that is depositing into the strategy.
172170
* @return . The available amount the `_owner` can deposit in terms of `asset`
173171
*
174-
function availableDepositLimit(
175-
address _owner
176-
) public view override returns (uint256) {
177-
TODO: If desired Implement deposit limit logic and any needed state variables .
178-
179-
EX:
180-
uint256 totalAssets = TokenizedStrategy.totalAssets();
181-
return totalAssets >= depositLimit ? 0 : depositLimit - totalAssets;
182-
}
183-
*/
172+
* function availableDepositLimit(
173+
* address _owner
174+
* ) public view override returns (uint256) {
175+
* TODO: If desired Implement deposit limit logic and any needed state variables .
176+
*
177+
* EX:
178+
* uint256 totalAssets = TokenizedStrategy.totalAssets();
179+
* return totalAssets >= depositLimit ? 0 : depositLimit - totalAssets;
180+
* }
181+
*/
184182

185183
/**
186184
* @dev Optional function for strategist to override that can
@@ -203,17 +201,17 @@ contract Strategy is BaseStrategy {
203201
*
204202
* @param _totalIdle The current amount of idle funds that are available to deploy.
205203
*
206-
function _tend(uint256 _totalIdle) internal override {}
207-
*/
204+
* function _tend(uint256 _totalIdle) internal override {}
205+
*/
208206

209207
/**
210208
* @dev Optional trigger to override if tend() will be used by the strategy.
211209
* This must be implemented if the strategy hopes to invoke _tend().
212210
*
213211
* @return . Should return true if tend() should be called by keeper or false if not.
214212
*
215-
function _tendTrigger() internal view override returns (bool) {}
216-
*/
213+
* function _tendTrigger() internal view override returns (bool) {}
214+
*/
217215

218216
/**
219217
* @dev Optional function for a strategist to override that will
@@ -236,13 +234,12 @@ contract Strategy is BaseStrategy {
236234
*
237235
* @param _amount The amount of asset to attempt to free.
238236
*
239-
function _emergencyWithdraw(uint256 _amount) internal override {
240-
TODO: If desired implement simple logic to free deployed funds.
241-
242-
EX:
243-
_amount = min(_amount, aToken.balanceOf(address(this)));
244-
_freeFunds(_amount);
245-
}
246-
247-
*/
237+
* function _emergencyWithdraw(uint256 _amount) internal override {
238+
* TODO: If desired implement simple logic to free deployed funds.
239+
*
240+
* EX:
241+
* _amount = min(_amount, aToken.balanceOf(address(this)));
242+
* _freeFunds(_amount);
243+
* }
244+
*/
248245
}

src/StrategyFactory.sol

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ contract StrategyFactory {
1616
/// @notice Track the deployments. asset => pool => strategy
1717
mapping(address => address) public deployments;
1818

19-
constructor(
20-
address _management,
21-
address _performanceFeeRecipient,
22-
address _keeper,
23-
address _emergencyAdmin
24-
) {
19+
constructor(address _management, address _performanceFeeRecipient, address _keeper, address _emergencyAdmin) {
2520
management = _management;
2621
performanceFeeRecipient = _performanceFeeRecipient;
2722
keeper = _keeper;
@@ -33,14 +28,9 @@ contract StrategyFactory {
3328
* @param _asset The underlying asset for the strategy to use.
3429
* @return . The address of the new strategy.
3530
*/
36-
function newStrategy(
37-
address _asset,
38-
string calldata _name
39-
) external virtual returns (address) {
31+
function newStrategy(address _asset, string calldata _name) external virtual returns (address) {
4032
// tokenized strategies available setters.
41-
IStrategyInterface _newStrategy = IStrategyInterface(
42-
address(new Strategy(_asset, _name))
43-
);
33+
IStrategyInterface _newStrategy = IStrategyInterface(address(new Strategy(_asset, _name)));
4434

4535
_newStrategy.setPerformanceFeeRecipient(performanceFeeRecipient);
4636

@@ -56,20 +46,14 @@ contract StrategyFactory {
5646
return address(_newStrategy);
5747
}
5848

59-
function setAddresses(
60-
address _management,
61-
address _performanceFeeRecipient,
62-
address _keeper
63-
) external {
49+
function setAddresses(address _management, address _performanceFeeRecipient, address _keeper) external {
6450
require(msg.sender == management, "!management");
6551
management = _management;
6652
performanceFeeRecipient = _performanceFeeRecipient;
6753
keeper = _keeper;
6854
}
6955

70-
function isDeployedStrategy(
71-
address _strategy
72-
) external view returns (bool) {
56+
function isDeployedStrategy(address _strategy) external view returns (bool) {
7357
address _asset = IStrategyInterface(_strategy).asset();
7458
return deployments[_asset] == _strategy;
7559
}

src/interfaces/IStrategyInterface.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ import {IStrategy} from "@tokenized-strategy/interfaces/IStrategy.sol";
55

66
interface IStrategyInterface is IStrategy {
77
//TODO: Add your specific implementation interface in here.
8-
}
8+
9+
}

0 commit comments

Comments
 (0)