- 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 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 {} |
{ | |
"0xe852abf44a5125852dde5df5712498aa99da20e7_BabySHIK": { | |
"num_txs": 20, | |
"balance": "0 BNB" | |
}, | |
"0xaf37f0021c5380a8b4ab889a85ea7b1d373f6d81_Burninu": { | |
"num_txs": 1, | |
"balance": "0 BNB" | |
}, | |
"0x7e3fbef6d223df71495cb071565ab3cea29f7d81_Hyco20": { |
{ | |
"language": "Solidity", | |
"sources": { | |
"contracts/loans/direct/loanTypes/DirectLoanFixedOfferRedeploy.sol": { | |
"content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity 0.8.4;\n\nimport \"./DirectLoanFixedOffer.sol\";\n\n/**\n * @title DirectLoanFixedOfferRedeploy\n * @author NFTfi\n * @notice Same as DirectLoanFixedOffer, we have to duplicate it because we have to re-deploy,\n * but we need the old and the new simultaneously in the coordinator\n *\n *\n * Main contract for NFTfi Direct Loans Fixed Type. This contract manages the ability to create NFT-backed\n * peer-to-peer loans of type Fixed (agreed to be a fixed-repayment loan) where the borrower pays the\n * maximumRepaymentAmount regardless of whether they repay early or not.\n *\n * There are two ways to commence an NFT-backed loan:\n *\n * a. The borrower accepts a lender's offer by calling `acceptOffer`.\n * 1. the borrower calls nftContract.approveAll(NFTfi), approving the NFTfi contract to move their NFT's on their\n * be1 |
{ | |
"SourceCode": "{{\r\n \"language\": \"Solidity\",\r\n \"sources\": {\r\n \"contracts/loans/direct/loanTypes/DirectLoanFixedOfferRedeploy.sol\": {\r\n \"content\": \"// SPDX-License-Identifier: BUSL-1.1\\n\\npragma solidity 0.8.4;\\n\\nimport \\\"./DirectLoanFixedOffer.sol\\\";\\n\\n/**\\n * @title DirectLoanFixedOfferRedeploy\\n * @author NFTfi\\n * @notice Same as DirectLoanFixedOffer, we have to duplicate it because we have to re-deploy,\\n * but we need the old and the new simultaneously in the coordinator\\n *\\n *\\n * Main contract for NFTfi Direct Loans Fixed Type. This contract manages the ability to create NFT-backed\\n * peer-to-peer loans of type Fixed (agreed to be a fixed-repayment loan) where the borrower pays the\\n * maximumRepaymentAmount regardless of whether they repay early or not.\\n *\\n * There are two ways to commence an NFT-backed loan:\\n *\\n * a. The borrower accepts a lender's offer by calling `acceptOffer`.\\n * 1. the borrower calls nftContract.approveAll(NFTfi) |