- Contract names: Eleven.finance, Nerve Finance, NRV vault, Eleven "MasterMind" farming contract
- Contract hex addresses: Not mentioned in the article
- Bug types mentioned in the article:
- Vulnerable function (emergencyBurn()) in the intermediate vault contract
- Flashloan exploit
- Logic issue
- Unauthorized withdrawal
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
import "forge-std/Test.sol"; | |
contract Preservation { | |
// public library contracts | |
address public timeZone1Library; | |
address public timeZone2Library; | |
address public owner; |
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
import "forge-std/Test.sol"; | |
interface NaughtCoin{ | |
function totalSupply() external view returns (uint256); | |
function balanceOf(address account) external view returns (uint256); | |
function transfer(address recipient, uint256 amount) external returns (bool); | |
function allowance(address owner, address spender) external view returns (uint256); | |
function approve(address spender, uint256 amount) external returns (bool); |
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
import "forge-std/Test.sol"; | |
contract GatekeeperTwo { | |
address public entrant; | |
modifier gateOne() { | |
require(msg.sender != tx.origin); |
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
import "forge-std/Test.sol"; | |
contract GatekeeperOne { | |
address public entrant; | |
modifier gateOne() { | |
require(msg.sender != tx.origin); |
{ | |
"sources": { | |
"Filename.sol": { | |
"content": "import \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\npragma solidity >=0.7 <0.9.0;\n\n/**\n * @title Storage\n * @dev Store & retrieve value in a variable\n * @custom:dev-run-script ./scripts/deploy_with_ethers.ts\n */\ncontract Storage {\n\n uint256 number;\n\n /**\n * @dev Store value in variable\n * @param num value to store\n */\n function store(uint256 num) public {\n number = num;\n }\n\n /**\n * @dev Return value \n * @return value of 'number'\n */\n function retrieve() public view returns (uint256){\n return number;\n }\n}" | |
} | |
}, | |
"language": "Solidity", | |
"settings": { | |
"remappings": ["@openzeppelin=node_modules/@openzeppelin/", "@asldfas=none-exists"] | |
} |
import numpy as np | |
import matplotlib.pyplot as plt | |
# Define the function y = k/x | |
def f(x, k=100): | |
return k / x | |
# Generate x values | |
x = np.linspace(0.1, 10, 400) # Start from 0.1 to avoid division by zero | |
y = f(x) |
The repository you've provided is for a project called Foundry, which is a fast, portable, and modular toolkit for Ethereum application development written in Rust. Here's a general guide on how to read the source code of a Rust project like this one:
-
Understand the Project Structure: Rust projects usually have a specific structure. The main code is typically in the
src
directory. In this case, the project seems to be divided into multiple modules such asforge
,cast
,anvil
,chisel
, etc. Each of these directories represents a different component of the Foundry toolkit. -
Start with main.rs or lib.rs: In a Rust project, the entry point is usually a file named
main.rs
orlib.rs
. In this case, each module might have its own entry point. Look for these files to understand how the program starts. -
Read the README and Documentation: The
README.md
file and other documentation can provide a high-level overview of the project. Foundry's README gives a brief description of what ea
pragma solidity ^0.8.0; | |
import "hardhat/console.sol"; | |
contract A { | |
function willRevert() public pure { | |
revert("This is an error message"); | |
} | |
function willAssert() public pure { |
# python github-clone-by-user.py username --skip-forks --excluded project1 project2 | |
import requests | |
import subprocess | |
import argparse | |
import os | |
def clone_or_fetch_repo(username, token, skip_forks): | |
headers = {'Authorization': f'token {token}'} if token else {} |