### Quick Start Example Source: https://github.com/cyfrin/aderyn/blob/dev/aderyn/README.md Basic usage of Aderyn to analyze a Solidity project and generate a report. ```sh cd path/to/solidity/project/root aderyn ``` -------------------------------- ### Adding Dependency Install Command to Justfile Source: https://github.com/cyfrin/aderyn/blob/dev/CONTRIBUTING.md Example of adding a dependency installation command to the `justfile` for projects with npm/pnpm/yarn dependencies. ```just (run_install "my-project" \ pnpm install --prefix tests/my-project --frozen-lockfile) & pids+=($!) ``` -------------------------------- ### Homebrew Installation Source: https://github.com/cyfrin/aderyn/blob/dev/aderyn/README.md Installs Aderyn using Homebrew. After installation, run `brew upgrade cyfrin/tap/aderyn` to upgrade. ```sh brew install cyfrin/tap/aderyn ``` -------------------------------- ### Curl Installation Source: https://github.com/cyfrin/aderyn/blob/dev/aderyn/README.md Installs Aderyn using curl. After installation, run `aderyn-update` to upgrade. ```sh curl --proto '=https' --tlsv1.2 -LsSf https://github.com/cyfrin/aderyn/releases/latest/download/aderyn-installer.sh | bash ``` -------------------------------- ### npm Installation Source: https://github.com/cyfrin/aderyn/blob/dev/aderyn/README.md Installs Aderyn using npm. After installation, re-run `npm install @cyfrin/aderyn -g` to upgrade. ```sh npm install @cyfrin/aderyn -g ``` -------------------------------- ### Install gh CLI Source: https://github.com/cyfrin/aderyn/blob/dev/RELEASE_CHECKLIST.md Command to install the GitHub CLI, a requirement for the release process. ```bash brew install gh ``` -------------------------------- ### Install cargo-release Source: https://github.com/cyfrin/aderyn/blob/dev/RELEASE_CHECKLIST.md Command to install the cargo-release tool, a requirement for the release process. ```bash cargo install cargo-release ``` -------------------------------- ### Solidity Version ^0.8 Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md This code snippet shows a pragma directive for Solidity version ^0.8, indicating any version starting with 0.8. ```solidity pragma solidity ^0.8; ``` -------------------------------- ### Literal Usage Example 5 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal in a configuration check. ```solidity if (numSigners <= 3 * f) revert InvalidConfig("faulty-oracle f too high"); ``` -------------------------------- ### Public Function Not Used Internally - Example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'initialize' found in TempleTeamPaymentsV2.sol that might not be used internally. ```solidity function initialize(IERC20 _temple) public initializer { } ``` -------------------------------- ### Example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/core/OpsManager.sol ```solidity Exposure public templeExposure; ``` -------------------------------- ### Literal Usage Example 7 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal for bit shifting to create a prefix. ```solidity uint256 prefix = 0x0001 << (256 - 16); // 0x000100..00 ``` -------------------------------- ### Project Setup Source: https://github.com/cyfrin/aderyn/blob/dev/CONTRIBUTING.md Commands to clone the repository and set up the development environment. ```bash git clone https://github.com/Cyfrin/aderyn.git cd aderyn just setup ``` -------------------------------- ### PUSH0 Opcode Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/nft-report.md Example of a Solidity pragma that might lead to PUSH0 opcode issues if not handled carefully with EVM versioning. ```solidity pragma solidity ^0.8.10; ``` -------------------------------- ### Variable Declaration and Initialization Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Example of declaring and initializing a variable. ```solidity uint b = 100; ``` -------------------------------- ### Literal Usage Example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal for fee calculation. ```solidity return SafeCast.toUint72(_getJuelsFromUsd(s_config.donFeeCentsUsd) / 100); ``` -------------------------------- ### Literal Usage Example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal for fee calculation. ```solidity return SafeCast.toUint72(_getJuelsFromUsd(s_config.operationFeeCentsUsd) / 100); ``` -------------------------------- ### Uninitialized Local Variable Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of an uninitialized local variable in a for loop declaration. ```solidity for (uint256 i; i < _dests.length; ) { } ``` ```solidity for (uint256 i; i < _addresses.length; ) { } ``` ```solidity for (uint i; i < length; ++i) { } ``` ```solidity for (uint i; i < path.length - 1; i++) { } ``` ```solidity for (uint i; i < path.length - 1; i++) { } ``` ```solidity for (uint256 i; i < _length; ++i) { } ``` ```solidity for (uint256 i; i < _length; ++i) { } ``` ```solidity for (uint256 i; i < _length; ++i) { } ``` ```solidity for (uint256 i; i < _length; ++i) { } ``` ```solidity for (uint256 i; i < _nBuckets; ++i) { } ``` ```solidity for (uint256 i; i < length; ++i) { } ``` ```solidity for (uint256 i; i < _length; ++i) { } ``` ```solidity for (uint256 i; i < _numAccounts; ++i) { } ``` -------------------------------- ### Example 3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/core/OpsManager.sol ```solidity VaultedTemple public vaultedTemple; ``` -------------------------------- ### Example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/core/Exposure.sol ```solidity IERC20 public revalToken; ``` -------------------------------- ### Literal Usage Example 3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal for maximum length. ```solidity uint256 maxLen = 32; ``` -------------------------------- ### Example 5 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/deprecated/InstantExitQueue.sol ```solidity IERC20 templeToken; ``` -------------------------------- ### Literal Usage Example 8 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal for byte size calculation. ```solidity 32 + // 32 bytes per entry in _rs ``` -------------------------------- ### Literal Usage Example 9 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal for byte size calculation. ```solidity 32 + // 32 bytes per entry in _ss ``` -------------------------------- ### Public Function Not Used Internally - Example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'createExposure' found in OpsManagerLib.sol. ```solidity function createExposure( ) ``` -------------------------------- ### Unused Import Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/nft-report.md Example of an unused import statement. Redundant imports should be removed. ```solidity import "./F2.sol"; ``` -------------------------------- ### Sample Hardhat Tasks Source: https://github.com/cyfrin/aderyn/blob/dev/tests/hardhat-js-playground/README.md Demonstrates common Hardhat tasks that can be run from the command line. ```shell npx hardhat help npx hardhat test REPORT_GAS=true npx hardhat test npx hardhat node npx hardhat run scripts/deploy.js ``` -------------------------------- ### Unsafe Casting of integers example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/prb-report.md Example of unsafe downcasting from uint to uint40. ```solidity result = uint40(xUint); ``` -------------------------------- ### Example 4 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/deprecated/InstantExitQueue.sol ```solidity TempleStaking templeStaking; ``` -------------------------------- ### Public Function Not Used Internally - Example 17 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'setDelegate' found in TempleGoldAdmin.sol. ```solidity function setDelegate(address _delegate) public onlyElevatedAccess { } ``` -------------------------------- ### Example 5: uint public x Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md State variable 'x' in src/FunctionInitializingState.sol could be immutable. ```solidity uint public x; ``` -------------------------------- ### Example 25: _initialBuyTax Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md The state variable `_initialBuyTax` is not updated after deployment and can be declared constant. ```Solidity uint256 private _initialBuyTax=20; ``` -------------------------------- ### Example 15: Variable initialization with shift Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md This snippet initializes a variable with a value and a right shift. ```Solidity uint256 absXShift = 63; ``` -------------------------------- ### Incorrect Modifier Example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md This is an example of an incorrect modifier that does not execute `_` or revert. ```solidity modifier modifierIfRetBAD() { ``` -------------------------------- ### Unused State Variable Example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/adhoc-report.md An example of an unused private static state variable. ```solidity uint256 private staticPrivateNumber; ``` -------------------------------- ### Example 7 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/deprecated/TempleStaking.sol ```solidity uint256 public epochSizeSeconds; ``` -------------------------------- ### Callgraph Blog Post Excerpt Source: https://github.com/cyfrin/aderyn/blob/dev/aderyn_core/templates/mcp-tool-response/tool_guide.md An excerpt from a blog post detailing the process of preparing call graphs for Aderyn's MCP tools. ```blog #### Preparing call graphs The first step is to extract all deployable contracts in a project, that is, fully implemented, non-abstract contracts. A separate call graph for each contract was generated. If a function node is reused across contract classes, it will show up in multiple graphs. (Example - function node defined in a parent contract class which has 2 or more children inheriting from it) The duplication is intentional and necessary, since the same code in the function node can behave differently depending on where it’s called from. This has to do with function overriding and method resolution order during contract linearization. For each contract, start by identifying the entry points: public and external functions defined in the contract or inherited from parent contracts. These are inserted into a worklist. We go through each function in the worklist step by step, following the chain of calls within that function as far as it goes before moving on to the next one. This helps us build the full picture of how all functions connect. For every function in the worklist, we extract its inbound calls and resolve each one to its definition using Aderyn's router. We then draw an edge in the callgraph from the calling function node to the target function or modifier node. Each resolved target, whether a function or a modifier, is pushed back into the worklist for further exploration. This continues until all the function and modifier nodes reachable from the contract’s entrypoints have been visited. Side note: A worklist is a continuously updated list that contains all the subtasks that the algorithm must complete. These can be added to or removed from the list during the execution of the algorithm itself. Typically the algorithm runs until the worklist becomes empty. ``` -------------------------------- ### Literal Usage Example 4 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal for length comparison. ```solidity if (b.length < 32) { ``` -------------------------------- ### Adding a Test Project Configuration Source: https://github.com/cyfrin/aderyn/blob/dev/CONTRIBUTING.md Example TOML configuration for adding a new test project. ```toml [[reports]] name = "my-project" # Used as: cargo prep -n my-project description = "My test project" root = "tests/my-project" ci_setup = "pnpm install --prefix tests/my-project" # If dependencies needed ``` -------------------------------- ### Example 2: TempleStaking.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md This snippet demonstrates the use of literal values in TempleStaking.sol, specifically for time calculations and arithmetic operations. ```solidity require(_startTimestamp > (block.timestamp - (24 * 2 * 60 * 60)), "Start timestamp can't be more than 2 days in the past"); ``` ```solidity ABDKMath64x64.divu(amountOgTemple, 1e18).mul(_accumulationFactorAt(currentEpoch())) ``` ```solidity amountOgTemple = _overflowSafeMul1e18(ABDKMath64x64.divu(_amountTemple, 1e18).div(accumulationFactor)); ``` ```solidity uint256 fractionalDigits = amountFixedPoint.sub(ABDKMath64x64.fromUInt(integralDigits)).mul(ABDKMath64x64.fromUInt(1e18)).toUInt(); ``` ```solidity return (integralDigits * 1e18) + fractionalDigits; ``` -------------------------------- ### Incorrect Modifier Example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Another example of an incorrect modifier that does not execute `_` or revert. ```solidity modifier modifierIfPlaceBAD() { ``` -------------------------------- ### changeIt Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Example of changing a state variable in StateVariableCouldBeDeclaredConstant. ```solidity function changeIt() external { } ``` -------------------------------- ### Literal Usage Example 10 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal for array size declaration. ```solidity bytes32[3] calldata reportContext, ``` -------------------------------- ### Log in with gh CLI Source: https://github.com/cyfrin/aderyn/blob/dev/RELEASE_CHECKLIST.md Command to authenticate with the GitHub CLI. ```bash gh auth login ``` -------------------------------- ### Literal Usage Example 6 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of using a literal for bit shifting to create a prefix mask. ```solidity uint256 prefixMask = type(uint256).max << (256 - 16); // 0xFFFF00..00 ``` -------------------------------- ### Example 1: TempleUniswapV2Pair.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md This snippet shows the usage of literal values in calculations within TempleUniswapV2Pair.sol. ```solidity uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3)); ``` ```solidity uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3)); ``` ```solidity require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K'); ``` -------------------------------- ### Numeric Literal Examples Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Examples of large numeric literals found in various Solidity files, demonstrating the use of underscores for readability and large values. ```solidity uint256 private constant REASONABLE_GAS_PRICE_CEILING = 1_000_000_000_000_000; // 1 million gwei ``` ```solidity ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); ``` ```solidity uint32 public constant MAX_CALLBACK_GAS = 70_000; ``` ```solidity uint256 private constant REASONABLE_GAS_PRICE_CEILING = 1_000_000_000_000_000; // 1 million gwei ``` ```solidity ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); ``` ```solidity uint32 public constant MAX_CALLBACK_GAS = 70_000; ``` ```solidity uint256 private constant REASONABLE_GAS_PRICE_CEILING = 1_000_000_000_000_000; // 1 million gwei ``` ```solidity ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); ``` ```solidity uint256 private constant REASONABLE_GAS_PRICE_CEILING = 1_000_000_000_000_000; // 1 million gwei ``` ```solidity ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); ``` -------------------------------- ### Example 8 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/deprecated/TempleStaking.sol ```solidity uint256 public startTimestamp; ``` -------------------------------- ### Example 2: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF); ``` -------------------------------- ### Unsafe Casting of integers example 5 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/prb-report.md Example of unsafe downcasting from uint to uint128. ```solidity result = uint128(xUint); ``` -------------------------------- ### Unsafe Casting of integers example 4 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/prb-report.md Example of unsafe downcasting from uint to UD2x18. ```solidity result = UD2x18.wrap(uint64(xUint)); ``` -------------------------------- ### Example 4: f() in AssemblyExample.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md A public function 'f' found in AssemblyExample.sol. ```solidity function f(uint x) public view returns (uint r) { ``` -------------------------------- ### Example 9 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/NoopLiquidator.sol ```solidity TempleERC20Token templeToken; ``` -------------------------------- ### Example 5 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Conditional multiplication with a bitmask and a large hexadecimal multiplier. ```solidity if (xSignifier & 0x2000000000 > 0) resultSignifier = resultSignifier * 0x10000000000000000000000162E42FEF9 >> 128; ``` -------------------------------- ### Unused State Variable Examples Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Examples of unused state variables found in various Solidity files. ```solidity uint b; ``` ```solidity mapping(uint256 => uint other) u2uMapping; // 5 3 ``` ```solidity uint owner; ``` ```solidity uint256 private staticPrivateNumber; ``` ```solidity uint256 internal staticInternalNumber; ``` ```solidity uint256 private staticNonEmptyPrivateNumber = 1; ``` ```solidity uint256 internal staticNonEmptyInternalNumber = 2; ``` ```solidity uint256 private constant PRIVATE_CONSTANT = 1; ``` ```solidity uint256 internal constant INTERNAL_CONSTANT = 2; ``` ```solidity uint x; ``` ```solidity uint256 y; ``` ```solidity uint256 stateVarUint; ``` ```solidity mapping(uint256 => uint256[]) private map; // GOOD ``` ```solidity uint256 internal unusedUint256; ``` ```solidity address internal unusedAddress; ``` ```solidity bool private unusedBool; ``` ```solidity string private unusedString; ``` ```solidity uint256 s_1 = 0; ``` ```solidity uint256 s_2 = 0; ``` ```solidity uint256 s_3 = 0; // this is a side comment ``` ```solidity uint256 s_4 = 0; // scc-dblah ``` ```solidity this is longer comment */ uint256 s_5 = 0; ``` ```solidity uint256 s_1 = 0; ``` ```solidity uint256 s_2 = 0; ``` ```solidity uint256 s_3 = 0; // this is a side comment ``` ```solidity uint256 s_4 = 0; // scc-dblah ``` ```solidity ``` -------------------------------- ### Example 12 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/templegold/TempleGoldStakingMock.sol ```solidity ITempleGoldStaking public previousStaking; ``` -------------------------------- ### Unsafe Casting of integers example 3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/prb-report.md Example of unsafe downcasting from uint to SD1x18. ```solidity result = SD1x18.wrap(int64(uint64(xUint))); ``` -------------------------------- ### Example 1: Empty require() in OpsManager.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/core/OpsManager.sol. ```solidity require(address(pools[revalToken]) == address(0)); ``` -------------------------------- ### PUSH0 Opcode - Found Instances Source: https://github.com/cyfrin/aderyn/blob/dev/reports/adhoc-report.md Examples related to Solidity version pragmas and the PUSH0 opcode. ```solidity pragma solidity ^0.8.13; ``` ```solidity pragma solidity >=0.8.0; ``` ```solidity pragma solidity >=0.8.0; ``` ```solidity pragma solidity ^0.8.24; ``` ```solidity pragma solidity 0.8.20; ``` ```solidity pragma solidity 0.8.20; ``` ```solidity pragma solidity >=0.8.0; ``` ```solidity pragma solidity ^0.8.0; ``` ```solidity pragma solidity ^0.8.0; ``` ```solidity pragma solidity ^0.8.0; ``` -------------------------------- ### Example 6 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/deprecated/LockedOGTemple.sol ```solidity OGTemple public OG_TEMPLE; // The token being staked, for which TEMPLE rewards are generated ``` -------------------------------- ### Unsafe Casting of integers example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/prb-report.md Example of unsafe downcasting from int64 to SD1x18. ```solidity result = SD1x18.wrap(int64(xInt)); ``` -------------------------------- ### Example 7: Bitwise AND operation Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md This snippet demonstrates a bitwise AND operation with a literal. ```Solidity if (y & 0x1 != 0) { ``` -------------------------------- ### Loop in FunctionsSubscriptions.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of a for loop iterating over consumers in FunctionsSubscriptions.sol. ```solidity for (uint256 i = 0; i < consumers.length; ++i) { ``` -------------------------------- ### Inconsistent uint256/uint (or) int256/int types - Example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/detector-exclude-report.md Example of an inconsistent int declaration. ```solidity int public intVariable; // 1 ``` -------------------------------- ### Example 4: uint public v Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md State variable 'v' in src/FunctionInitializingState.sol could be immutable. ```solidity uint public v; ``` -------------------------------- ### Inconsistent uint256/uint (or) int256/int types - Example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/detector-exclude-report.md Example of an inconsistent uint declaration. ```solidity uint public uintVariable; // 1 ``` -------------------------------- ### Loop in FunctionsSubscriptions.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of a for loop iterating over subscription.consumers in FunctionsSubscriptions.sol. ```solidity for (uint256 i = 0; i < subscription.consumers.length; ++i) { ``` -------------------------------- ### Weak Randomness Examples Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Examples of weak randomness generation using keccak256 with predictable values, modulo operations, and blockhash, which are easily predictable and manipulable. The PREVRANDAO opcode is also shown as a source of randomness. ```solidity uint256 randomNumber = uint256(keccak256(abi.encodePacked(msg.sender, block.number, block.timestamp))); ``` ```solidity return uint256(keccak256(abi.encodePacked(block.number))); ``` ```solidity return uint256(keccak256(someBytes)); ``` ```solidity return uint256(keccak256(someBytes)); ``` ```solidity return block.timestamp % 10; ``` ```solidity return a % b; ``` ```solidity uint256 randomNumber = uint256(blockhash(block.number)) % 10; ``` ```solidity return hash % 10; ``` ```solidity uint256 randomNumber = block.prevrandao; ``` -------------------------------- ### Example 2: w Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md The state variable `w` is not updated after deployment and can be declared constant. ```Solidity uint public w = 5; ``` -------------------------------- ### Example 11 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/NoopVaultedTempleLiquidator.sol ```solidity VaultedTemple vaultedTemple; ``` -------------------------------- ### Unused State Variable Example 7 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/adhoc-report.md An example of an unused internal constant state variable. ```solidity uint256 internal constant INTERNAL_CONSTANT = 2; ``` -------------------------------- ### Example 5: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (result >= MIN_64x64 && result <= MAX_64x64); ``` -------------------------------- ### Unused State Variable Example 6 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/adhoc-report.md An example of an unused private constant state variable. ```solidity uint256 private constant PRIVATE_CONSTANT = 1; ``` -------------------------------- ### Example 7 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Conditional multiplication with a bitmask and a large hexadecimal multiplier. ```solidity if (xSignifier & 0x800000000 > 0) resultSignifier = resultSignifier * 0x10000000000000000000000058B90BFBD >> 128; ``` -------------------------------- ### Running Specific Tests Source: https://github.com/cyfrin/aderyn/blob/dev/CONTRIBUTING.md How to run individual tests using Cargo. ```bash cargo test ``` -------------------------------- ### Unused State Variable Example 3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/adhoc-report.md An example of an unused internal static state variable. ```solidity uint256 internal staticInternalNumber; ``` -------------------------------- ### Example 3: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (x <= 0x7FFFFFFFFFFFFFFF); ``` -------------------------------- ### Example 13 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/v2/strategies/DsrBaseStrategyTestnet.sol ```solidity uint256 public lastUpdatedAt; ``` -------------------------------- ### Unused State Variable Example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/adhoc-report.md An example of an unused state variable within a mapping. ```solidity mapping(uint256 => uint other) u2uMapping; // 5 3 ``` -------------------------------- ### OtcOffer swap function Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a swap function in OtcOffer. ```solidity function swap(uint256 sellTokenAmount) external whenNotPaused returns (uint256 buyTokenAmount) { ``` -------------------------------- ### Internal Function Used Only Once example 3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/prb-report.md Example of an internal function that could potentially be inlined. ```solidity function mul(SD59x18 x, SD59x18 y) pure returns (SD59x18 result) { ``` -------------------------------- ### Example 11: Bitwise AND operation (another alternative) Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md This snippet demonstrates yet another bitwise AND operation with a literal. ```Solidity if (y & 0x4 != 0) { ``` -------------------------------- ### Unused Import Example 3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/core/TempleERC20Token.sol at Line 7. ```solidity import "@openzeppelin/contracts/utils/Pausable.sol"; ``` -------------------------------- ### Internal Function Used Only Once example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/prb-report.md Example of an internal function that could potentially be inlined. ```solidity function abs(SD59x18 x) pure returns (SD59x18 result) { ``` -------------------------------- ### Loop with require/revert Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md An example of a loop containing a `require` statement. This pattern can be inefficient as the `require` check might be performed multiple times within the loop, potentially consuming unnecessary gas. ```solidity for (uint256 i = 0; i < rs.length; ++i) { ``` -------------------------------- ### ABDKMath64x64.sol - Line 710 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity assert (xh == hi >> 128); ``` -------------------------------- ### Example 3: TempleGoldStakingMock.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md This snippet illustrates the use of literal values in TempleGoldStakingMock.sol for setting vesting rates and calculating rewards. ```solidity vestingRate = 1e18; ``` ```solidity vestingRate = (block.timestamp - _stakeInfo.stakeTime) * 1e18 / vestingPeriod; ``` ```solidity if (vestingRate == 1e18) { ``` ```solidity _perTokenReward = _rewardPerToken() * vestingRate / 1e18; ``` ```solidity (_balance * (_perTokenReward - userRewardPerTokenPaid[_account][_index])) / 1e18 + ``` ```solidity vestingRate = 1e18; ``` ```solidity vestingRate = (block.timestamp - _stakeInfo.stakeTime) * 1e18 / vestingPeriod; ``` ```solidity rewardData.rewardRate * 1e18) ``` ```solidity userRewardPerTokenPaid[_account][_index] = vestingRate * uint256(rewardData.rewardPerTokenStored) / 1e18; ``` -------------------------------- ### Internal Function Used Only Once example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/prb-report.md Example of an internal function that could potentially be inlined. ```solidity function mulDiv(uint256 x, uint256 y, uint256 denominator) pure returns (uint256 result) { ``` -------------------------------- ### Solidity Version 0.8.20 Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md This code snippet shows the pragma directive for Solidity version 0.8.20, which enables the PUSH0 opcode by default. ```solidity pragma solidity 0.8.20; ``` -------------------------------- ### Inconsistent uint256/uint (or) int256/int types - Example 7 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/detector-exclude-report.md Example of a constructor with inconsistent uint types. ```solidity constructor(uint _uintInitial, uint256 _uint256Initial) { // 6 4 ``` -------------------------------- ### Inconsistent uint256/uint (or) int256/int types - Example 5 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/detector-exclude-report.md Example of an array with inconsistent uint declarations. ```solidity uint[] public uintArray; // 4 ``` -------------------------------- ### Unprotected initializer - Instance 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Found in src/UnprotectedInitialize.sol [Line: 70] ```Solidity function initializeWithoutProtection() external { ``` -------------------------------- ### goodSituation2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Example of a state change with an event in goodSituation2. ```solidity function goodSituation2() external { } ``` -------------------------------- ### UniswapV3Swapper ExactInputSingleParams initialization Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Initialization of `ExactInputSingleParams` in `src/uniswap/UniswapV3Swapper.sol`. ```solidity exactInputSingleParams = ExactInputSingleParams({ ``` -------------------------------- ### Inconsistent uint256/uint (or) int256/int types - Example 4 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/detector-exclude-report.md Example of a mapping with inconsistent uint types. ```solidity mapping (uint => uint256) personMap; // 3 2 ``` -------------------------------- ### For loop in OCR2Base.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of a for loop iterating over args.signers.length in OCR2Base.sol. ```solidity for (uint256 i = 0; i < args.signers.length; i++) { ``` -------------------------------- ### Unused State Variable Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/detector-include-report.md An example of an unused state variable found in the analyzed contract. ```solidity mapping(uint256 => uint other) u2uMapping; // 5 3 ``` -------------------------------- ### Example 15: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (y != 0); ``` -------------------------------- ### goodSituation3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Example of a state change with an event in goodSituation3. ```solidity function goodSituation3() external onlyOwner { } ``` -------------------------------- ### Unprotected initializer - Instance 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Found in src/UnprotectedInitialize.sol [Line: 37] ```Solidity function initializeWithoutModifierOrRevert() external { ``` -------------------------------- ### Public Function Not Used Internally - Example 16 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'checkExists' found in Templar.sol. ```solidity function checkExists(uint256 discordId) public view { } ``` -------------------------------- ### UniswapV3Swapper ExactInputParams initialization Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Initialization of `ExactInputParams` in `src/uniswap/UniswapV3Swapper.sol`. ```solidity exactInputParams = ExactInputParams({ ``` -------------------------------- ### Unused Import Example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/amm/TempleUniswapV2Pair.sol at Line 4. ```solidity import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol'; ``` -------------------------------- ### Public Function Not Used Internally - Example 15 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'balanceOf' found in TempleGoldStakingMock.sol. ```solidity function balanceOf(address account) public view returns (uint256) { } ``` -------------------------------- ### Example 10: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (absoluteResult <= ``` -------------------------------- ### ABDKMath64x64.sol - Line 706 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity lo = hi << 128; ``` -------------------------------- ### Public Function Not Used Internally - Example 14 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'circulatingSupply' found in TempleGoldMock.sol. ```solidity function circulatingSupply() public view returns (uint256) { } ``` -------------------------------- ### Example 4: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (x >= 0); ``` -------------------------------- ### ABDKMathQuad.sol - Line 77 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMathQuad.sol. ```solidity if (exponent < 16383) return 0; // Underflow ``` -------------------------------- ### Public Function Not Used Internally - Example 13 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'depositTempleFor' found in VaultProxy.sol. ```solidity function depositTempleFor(uint256 _amount, Vault vault) public { } ``` -------------------------------- ### Solidity Version ^0.8.20 Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md This code snippet shows the pragma directive for Solidity version ^0.8.20. ```solidity pragma solidity ^0.8.20; ``` -------------------------------- ### Public Function Not Used Internally - Example 12 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'depositTempleWithFaith' found in VaultProxy.sol. ```solidity function depositTempleWithFaith(uint256 _amountTemple, uint112 _amountFaith, Vault vault) public { } ``` -------------------------------- ### UniswapV3Swapper ExactOutputParams initialization Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Initialization of `ExactOutputParams` in `src/uniswap/UniswapV3Swapper.sol`. ```solidity exactOutputParams = ExactOutputParams({ ``` -------------------------------- ### Public Function Not Used Internally - Example 11 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'deposit' found in Vault.sol. ```solidity function deposit(uint256 amount) public { } ``` -------------------------------- ### Empty Block Example 26 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Found in src/UnprotectedInitialize.sol [Line: 43] ```solidity function initializeWithModifierNamedInitiliazer() external initializer { ``` -------------------------------- ### SwapExactTokensForETHSupportingFeeOnTransferTokens Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Example usage of `swapExactTokensForETHSupportingFeeOnTransferTokens` from `src/Trump.sol`. ```solidity uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( ``` -------------------------------- ### Weak Randomness Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Examples demonstrating weak randomness generation. ```solidity return block.timestamp % 10; ``` ```solidity uint256 randomNumber = uint256(blockhash(block.number)) % 10; ``` ```solidity return hash % 10; ``` -------------------------------- ### ABDKMath64x64.sol - Line 701 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity uint256 xh = x >> 192; ``` -------------------------------- ### Public Function Not Used Internally - Example 10 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'withdrawFor' found in Vault.sol. ```solidity function withdrawFor(address owner, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { } ``` -------------------------------- ### UniswapV3Swapper ExactOutputSingleParams initialization Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Initialization of `ExactOutputSingleParams` in `src/uniswap/UniswapV3Swapper.sol`. ```solidity exactOutputSingleParams = ExactOutputSingleParams({ ``` -------------------------------- ### ABDKMath64x64.sol - Line 702 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity uint256 xl = x << 64; ``` -------------------------------- ### Public Function Not Used Internally - Example 9 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'withdraw' found in Vault.sol. ```solidity function withdraw(uint256 amount) public { } ``` -------------------------------- ### Example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Demonstrates a conditional multiplication using a large hexadecimal literal for bitwise checking and arithmetic shift. ```solidity if (xSignifier & 0x2000000000000 > 0) resultSignifier = resultSignifier * 0x10000000000000000000162E42FEFA39D >> 128; ``` -------------------------------- ### Public Function Not Used Internally - Example 8 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'addRevenue' found in TreasuryFarmingRevenue.sol. ```solidity function addRevenue(uint256 revenueEarned) onlyOwner public { } ``` -------------------------------- ### Public Function Not Used Internally - Example 7 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'updateExposureReval' found in OpsManagerLib.sol. ```solidity function updateExposureReval(IERC20[] memory exposureTokens, uint256[] memory revals, mapping(IERC20 => TreasuryFarmingRevenue) storage pools) public { } ``` -------------------------------- ### Example 9: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF && ``` -------------------------------- ### Public Function Not Used Internally - Example 6 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'requiresRebalance' found in OpsManagerLib.sol. ```solidity function requiresRebalance( ) ``` -------------------------------- ### ABDKMath64x64.sol - Line 699 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); ``` -------------------------------- ### badSituation2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Example of a state change without an event in badSituation2. ```solidity function badSituation2() external { } ``` -------------------------------- ### ABDKMath64x64.sol - Line 736 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity if (xx >= 0x10000) { xx >>= 16; r <<= 8; } ``` -------------------------------- ### Public Function Not Used Internally - Example 5 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'rebalance' found in OpsManagerLib.sol. ```solidity function rebalance( ) ``` -------------------------------- ### ABDKMath64x64.sol - Line 739 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity if (xx >= 0x8) { r <<= 1; } ``` -------------------------------- ### ABDKMath64x64.sol - Line 698 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity uint256 hi = result * (y >> 128); ``` -------------------------------- ### Example 24: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (x != 0); ``` -------------------------------- ### Public Function Not Used Internally - Example 4 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'setExposureMinterState' found in OpsManagerLib.sol. ```solidity function setExposureMinterState( ) ``` -------------------------------- ### ABDKMath64x64.sol - Line 735 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } ``` -------------------------------- ### While loop in OCR2Base.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of a while loop checking s_signers.length in OCR2Base.sol. ```solidity while (s_signers.length != 0) { ``` -------------------------------- ### Public Function Not Used Internally - Example 3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a public function 'setExposureLiquidator' found in OpsManagerLib.sol. ```solidity function setExposureLiquidator( ) ``` -------------------------------- ### Unused Import Example 9 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/UniswapV2Router02NoEth.sol at Line 17. ```solidity import '@uniswap/v2-periphery/contracts/interfaces/IWETH.sol'; ``` -------------------------------- ### badSituation3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Example of a state change without an event in badSituation3. ```solidity function badSituation3() external { } ``` -------------------------------- ### ABDKMath64x64.sol - Line 733 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of using a literal in ABDKMath64x64.sol. ```solidity if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } ``` -------------------------------- ### main Function Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Example of a function that might lead to state change without an event. ```solidity function main() public { ``` -------------------------------- ### Unsafe ERC20 Operation Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Examples of unsafe ERC20 approve operations, which can lead to unexpected behavior. ```solidity protocolToken.approve(previousVault, 0); ``` ```solidity quoteToken.approve(previousVault, 0); ``` ```solidity quoteToken.approve(address(balancerVault), 0); ``` ```solidity daiToken.approve(previousTrv, 0); ``` -------------------------------- ### RamosTestnetTempleTokenVault repayProtocolToken function Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of a repayProtocolToken function in RamosTestnetTempleTokenVault. ```solidity function repayProtocolToken(uint256 amount) external { ``` -------------------------------- ### Example 19: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); ``` -------------------------------- ### Unused Import Example 8 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/UniswapV2Factory.sol at Line 6. ```solidity import '@uniswap/v2-core/contracts/UniswapV2Factory.sol'; ``` -------------------------------- ### Unused Import Example 10 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/templegold/TempleGoldMock.sol at Line 10. ```solidity import { IDaiGoldAuction } from "contracts/interfaces/templegold/IDaiGoldAuction.sol"; ``` -------------------------------- ### Loop in FunctionsRouter.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of a for loop iterating over s_proposedContractSet.ids in FunctionsRouter.sol. ```solidity for (uint256 i = 0; i < s_proposedContractSet.ids.length; ++i) { ``` -------------------------------- ### Example 10: Bitwise AND operation (alternative) Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md This snippet demonstrates another bitwise AND operation with a literal. ```Solidity if (y & 0x2 != 0) { ``` -------------------------------- ### Inconsistent uint256/uint (or) int256/int types - Example 3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/detector-exclude-report.md Example of an inconsistent uint declaration within a function. ```solidity uint personUint; // 2 ``` -------------------------------- ### Empty `require()` / `revert()` Statement Source: https://github.com/cyfrin/aderyn/blob/dev/reports/adhoc-report.md Use descriptive reason strings or custom errors for revert paths. ```solidity require(to != address(0)); ``` -------------------------------- ### Unused Import Example 6 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/NoopLiquidator.sol at Line 4. ```solidity import "@openzeppelin/contracts/access/Ownable.sol"; ``` -------------------------------- ### Unspecific Solidity Pragma Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/detector-include-report.md An example of an unspecific Solidity pragma statement found in the analyzed contract. ```solidity pragma solidity ^0.8.24; ``` -------------------------------- ### Example 13: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); ``` -------------------------------- ### Unused Import Example 13 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/templegold/TempleGoldStakingMock.sol at Line 6. ```solidity import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; ``` -------------------------------- ### Unused State Variable - Example 2 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of an unused private state variable '_accountStakes' found in TempleGoldStakingMock.sol. ```solidity mapping(address account => EnumerableSet.UintSet indexes) private _accountStakes; ``` -------------------------------- ### Example 6: Casting.sol (unsafeUintCasting) Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md A function in Casting.sol demonstrating unsafe uint casting, potentially related to state changes. ```solidity function unsafeUintCasting() external { ``` -------------------------------- ### Unused State Variable - Example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example of an unused private state variable '_delegateBalances' found in TempleGoldStakingMock.sol. ```solidity mapping(address delegate => uint256 balance) private _delegateBalances; ``` -------------------------------- ### Example 21: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (result <= uint128 (MAX_64x64)); ``` -------------------------------- ### Example 14: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (hi <= ``` -------------------------------- ### ABDKMath64x64.sol - Literal Usage Example 3 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Another example of using a hexadecimal literal in multiplication and right shift. ```solidity result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128; ``` -------------------------------- ### Loop in FunctionsBilling.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Example of a for loop iterating over transmitters in FunctionsBilling.sol. ```solidity for (uint256 i = 0; i < transmitters.length; ++i) { ``` -------------------------------- ### Example of require with a function call Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md This code snippet illustrates a `require` statement that calls a function, likely to check a condition before proceeding. ```solidity require(token.approve(spender, value)); ``` -------------------------------- ### Unused State Variable Example 5 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/adhoc-report.md An example of an unused internal static state variable with an initial value. ```solidity uint256 internal staticNonEmptyInternalNumber = 2; ``` -------------------------------- ### Uninitialized Local Variables Source: https://github.com/cyfrin/aderyn/blob/dev/reports/playground-report.md Examples related to uninitialized local variables. ```solidity 0x0000000000000000000000000000000000000001 ``` ```solidity delayedAddress = 0x0000000000000000000000000000000000000001; ``` ```solidity delayedAddress = 0x0000000000000000000000000000000000000001; ``` ```solidity delayedUintArray[0] = 21; ``` ```solidity delayedIntArray[0] = -21; ``` -------------------------------- ### Unused State Variable Example 4 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/adhoc-report.md An example of an unused private static state variable with an initial value. ```solidity uint256 private staticNonEmptyPrivateNumber = 1; ``` -------------------------------- ### Result Initialization Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Initializes the result variable in ABDKMath64x64.sol. ```solidity uint256 result = 0x80000000000000000000000000000000; ``` -------------------------------- ### Public Function Not Used Internally Example Source: https://github.com/cyfrin/aderyn/blob/dev/reports/nft-report.md Example of a public function that is not used internally. Consider marking it as external. ```solidity function mint() public { ``` ```solidity function get_start_token_id() public pure returns(uint256) { ``` -------------------------------- ### Return Formatted Value (Part 1) Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md This snippet starts the construction of the return value, handling the sign and exponent. ```solidity return bytes16 (uint128 ((resultNegative ? 0x80000000000000000000000000000000 : 0) | ``` -------------------------------- ### Unused Error Examples Source: https://github.com/cyfrin/aderyn/blob/dev/reports/ccip-report.md Examples of unused errors found across different versions of the project's smart contracts. ```solidity error InvalidSubscription(); ``` ```solidity error UnauthorizedSender(); ``` ```solidity error MustBeSubOwner(address owner); ``` ```solidity error PaymentTooLarge(); ``` ```solidity error InconsistentReportData(); ``` ```solidity error UnauthorizedPublicKeyChange(); ``` ```solidity error IdentifierIsReserved(bytes32 id); ``` -------------------------------- ### Unused Import Example 11 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Found in contracts/fakes/templegold/TempleGoldMock.sol at Line 13. ```solidity import { ITempleGoldStaking} from "contracts/interfaces/templegold/ITempleGoldStaking.sol"; ``` -------------------------------- ### Example 22: Empty require() in ABDKMath64x64.sol Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md An empty require statement found in contracts/util/ABDKMath64x64.sol. ```solidity require (x != MIN_64x64); ``` -------------------------------- ### ABDKMath64x64.sol - Literal Usage Example 1 Source: https://github.com/cyfrin/aderyn/blob/dev/reports/temple-report.md Example demonstrating the use of a large hexadecimal literal in a multiplication and right shift operation. ```solidity result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128; ```