From 8910b4bc73fedb3d8222c22b6720bbce7d7b5840 Mon Sep 17 00:00:00 2001 From: TilakMaddy Date: Mon, 10 Mar 2025 17:44:04 +0530 Subject: [PATCH] aderyn.toml env test --- .gitmodules | 6 ++ reports/nft-report-icm.md | 37 +++++++++++ .../.github/workflows/test.yml | 34 ++++++++++ tests/foundry-nft-f23-icm/.gitignore | 15 +++++ tests/foundry-nft-f23-icm/README.md | 66 +++++++++++++++++++ tests/foundry-nft-f23-icm/aderyn.toml | 8 +++ tests/foundry-nft-f23-icm/foundry.toml | 13 ++++ tests/foundry-nft-f23-icm/lib/forge-std | 1 + .../lib/openzeppelin-contracts | 1 + tests/foundry-nft-f23-icm/remappings | 7 ++ tests/foundry-nft-f23-icm/src/BasicNft.sol | 23 +++++++ tests/foundry-nft-f23-icm/src/F1.sol | 9 +++ tests/foundry-nft-f23-icm/src/F2.sol | 7 ++ tests/foundry-nft-f23-icm/src/Initializer.sol | 11 ++++ .../src/inner-core-modules/ICM.sol | 8 +++ 15 files changed, 246 insertions(+) create mode 100644 reports/nft-report-icm.md create mode 100644 tests/foundry-nft-f23-icm/.github/workflows/test.yml create mode 100644 tests/foundry-nft-f23-icm/.gitignore create mode 100644 tests/foundry-nft-f23-icm/README.md create mode 100644 tests/foundry-nft-f23-icm/aderyn.toml create mode 100644 tests/foundry-nft-f23-icm/foundry.toml create mode 160000 tests/foundry-nft-f23-icm/lib/forge-std create mode 160000 tests/foundry-nft-f23-icm/lib/openzeppelin-contracts create mode 100644 tests/foundry-nft-f23-icm/remappings create mode 100644 tests/foundry-nft-f23-icm/src/BasicNft.sol create mode 100644 tests/foundry-nft-f23-icm/src/F1.sol create mode 100644 tests/foundry-nft-f23-icm/src/F2.sol create mode 100644 tests/foundry-nft-f23-icm/src/Initializer.sol create mode 100644 tests/foundry-nft-f23-icm/src/inner-core-modules/ICM.sol diff --git a/.gitmodules b/.gitmodules index b0a34e89e..c1fc6702e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,3 +31,9 @@ [submodule "tests/2024-07-templegold"] path = tests/2024-07-templegold url = https://github.com/Cyfrin/2024-07-templegold.git +[submodule "tests/foundry-nft-f23-icm/lib/forge-std"] + path = tests/foundry-nft-f23-icm/lib/forge-std + url = https://github.com/foundry-rs/forge-std +[submodule "tests/foundry-nft-f23-icm/lib/openzeppelin-contracts"] + path = tests/foundry-nft-f23-icm/lib/openzeppelin-contracts + url = https://github.com/OpenZeppelin/openzeppelin-contracts diff --git a/reports/nft-report-icm.md b/reports/nft-report-icm.md new file mode 100644 index 000000000..668914676 --- /dev/null +++ b/reports/nft-report-icm.md @@ -0,0 +1,37 @@ +# Aderyn Analysis Report + +This report was generated by [Aderyn](https://github.com/Cyfrin/aderyn), a static analysis tool built by [Cyfrin](https://cyfrin.io), a blockchain security company. This report is not a substitute for manual audit or security review. It should not be relied upon for any purpose other than to assist in the identification of potential security vulnerabilities. +# Table of Contents + +- [Summary](#summary) + - [Files Summary](#files-summary) + - [Files Details](#files-details) + - [Issue Summary](#issue-summary) + + +# Summary + +## Files Summary + +| Key | Value | +| --- | --- | +| .sol Files | 1 | +| Total nSLOC | 5 | + + +## Files Details + +| Filepath | nSLOC | +| --- | --- | +| src/inner-core-modules/ICM.sol | 5 | +| **Total** | **5** | + + +## Issue Summary + +| Category | No. of Issues | +| --- | --- | +| High | 0 | +| Low | 0 | + + diff --git a/tests/foundry-nft-f23-icm/.github/workflows/test.yml b/tests/foundry-nft-f23-icm/.github/workflows/test.yml new file mode 100644 index 000000000..9282e8294 --- /dev/null +++ b/tests/foundry-nft-f23-icm/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: test + +on: workflow_dispatch + +env: + FOUNDRY_PROFILE: ci + +jobs: + check: + strategy: + fail-fast: true + + name: Foundry project + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Run Forge build + run: | + forge --version + forge build --sizes + id: build + + - name: Run Forge tests + run: | + forge test -vvv + id: test diff --git a/tests/foundry-nft-f23-icm/.gitignore b/tests/foundry-nft-f23-icm/.gitignore new file mode 100644 index 000000000..8d6f4732f --- /dev/null +++ b/tests/foundry-nft-f23-icm/.gitignore @@ -0,0 +1,15 @@ +# Compiler files +cache/ +out/ + +# Ignores development broadcast logs +!/broadcast +/broadcast/*/31337/ +/broadcast/**/dry-run/ + +# Docs +docs/ + +# Dotenv file +.env +broadcast diff --git a/tests/foundry-nft-f23-icm/README.md b/tests/foundry-nft-f23-icm/README.md new file mode 100644 index 000000000..9265b4558 --- /dev/null +++ b/tests/foundry-nft-f23-icm/README.md @@ -0,0 +1,66 @@ +## Foundry + +**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.** + +Foundry consists of: + +- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools). +- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data. +- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network. +- **Chisel**: Fast, utilitarian, and verbose solidity REPL. + +## Documentation + +https://book.getfoundry.sh/ + +## Usage + +### Build + +```shell +$ forge build +``` + +### Test + +```shell +$ forge test +``` + +### Format + +```shell +$ forge fmt +``` + +### Gas Snapshots + +```shell +$ forge snapshot +``` + +### Anvil + +```shell +$ anvil +``` + +### Deploy + +```shell +$ forge script script/Counter.s.sol:CounterScript --rpc-url --private-key +``` + +### Cast + +```shell +$ cast +``` + +### Help + +```shell +$ forge --help +$ anvil --help +$ cast --help +``` diff --git a/tests/foundry-nft-f23-icm/aderyn.toml b/tests/foundry-nft-f23-icm/aderyn.toml new file mode 100644 index 000000000..e6bc33c83 --- /dev/null +++ b/tests/foundry-nft-f23-icm/aderyn.toml @@ -0,0 +1,8 @@ +# Aderyn Configuration File +# Help Aderyn work with more granular control + +# DO NOT CHANGE version below. As of now, only 1 is supported +version = 1 + +[env] +FOUNDRY_PROFILE = "icm" diff --git a/tests/foundry-nft-f23-icm/foundry.toml b/tests/foundry-nft-f23-icm/foundry.toml new file mode 100644 index 000000000..1463fd659 --- /dev/null +++ b/tests/foundry-nft-f23-icm/foundry.toml @@ -0,0 +1,13 @@ +[profile.default] +src = "src" +out = "out" +libs = ["lib"] +remappings = ["@oz/contracts=lib/openzeppelin-contracts/contracts", "icm/=src/inner-core-modules"] + +[profile.icm] +src = "src/inner-core-modules" +out = "out" +libs = ["lib"] +remappings = ["@oz/contracts=lib/openzeppelin-contracts/contracts", "icm/=src/inner-core-modules"] + +# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options diff --git a/tests/foundry-nft-f23-icm/lib/forge-std b/tests/foundry-nft-f23-icm/lib/forge-std new file mode 160000 index 000000000..3b20d60d1 --- /dev/null +++ b/tests/foundry-nft-f23-icm/lib/forge-std @@ -0,0 +1 @@ +Subproject commit 3b20d60d14b343ee4f908cb8079495c07f5e8981 diff --git a/tests/foundry-nft-f23-icm/lib/openzeppelin-contracts b/tests/foundry-nft-f23-icm/lib/openzeppelin-contracts new file mode 160000 index 000000000..acd4ff74d --- /dev/null +++ b/tests/foundry-nft-f23-icm/lib/openzeppelin-contracts @@ -0,0 +1 @@ +Subproject commit acd4ff74de833399287ed6b31b4debf6b2b35527 diff --git a/tests/foundry-nft-f23-icm/remappings b/tests/foundry-nft-f23-icm/remappings new file mode 100644 index 000000000..7f65b75f4 --- /dev/null +++ b/tests/foundry-nft-f23-icm/remappings @@ -0,0 +1,7 @@ +@oz/contracts/=lib/openzeppelin-contracts/contracts/ +icm/=src/inner-core-modules/ +@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/ +ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/ +erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/ +forge-std/=lib/forge-std/src/ +openzeppelin-contracts/=lib/openzeppelin-contracts/ diff --git a/tests/foundry-nft-f23-icm/src/BasicNft.sol b/tests/foundry-nft-f23-icm/src/BasicNft.sol new file mode 100644 index 000000000..c6fe8ccf1 --- /dev/null +++ b/tests/foundry-nft-f23-icm/src/BasicNft.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.25; + +import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; +import "icm/ICM.sol"; // icm is remapped to src/inner-core-modules +import "./Initializer.sol"; + +contract BasicNft is ICM, ERC721 { + + uint256 public s_tokenId; + + constructor() ERC721(PROJECT_NAME, PROJECT_SYMBOL) { + Initializer initializer = new Initializer(); + s_tokenId = initializer.get_start_token_id(); + } + + function mint() public { + _safeMint(msg.sender, s_tokenId); + s_tokenId++; + } + +} \ No newline at end of file diff --git a/tests/foundry-nft-f23-icm/src/F1.sol b/tests/foundry-nft-f23-icm/src/F1.sol new file mode 100644 index 000000000..c463654cc --- /dev/null +++ b/tests/foundry-nft-f23-icm/src/F1.sol @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.10; + +import "./F2.sol"; + +contract F1 { + +} \ No newline at end of file diff --git a/tests/foundry-nft-f23-icm/src/F2.sol b/tests/foundry-nft-f23-icm/src/F2.sol new file mode 100644 index 000000000..b2483c83a --- /dev/null +++ b/tests/foundry-nft-f23-icm/src/F2.sol @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.21; + +contract F2 { + +} \ No newline at end of file diff --git a/tests/foundry-nft-f23-icm/src/Initializer.sol b/tests/foundry-nft-f23-icm/src/Initializer.sol new file mode 100644 index 000000000..463028755 --- /dev/null +++ b/tests/foundry-nft-f23-icm/src/Initializer.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.25; + +import "@oz/contracts/token/ERC721/ERC721.sol"; + +contract Initializer { + function get_start_token_id() public pure returns(uint256) { + return 10; + } +} \ No newline at end of file diff --git a/tests/foundry-nft-f23-icm/src/inner-core-modules/ICM.sol b/tests/foundry-nft-f23-icm/src/inner-core-modules/ICM.sol new file mode 100644 index 000000000..9f1a95803 --- /dev/null +++ b/tests/foundry-nft-f23-icm/src/inner-core-modules/ICM.sol @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.25; + +contract ICM { + string public PROJECT_NAME = "Dogie"; + string public PROJECT_SYMBOL = "DOG"; +} \ No newline at end of file