This repo demostrates how EtherFi smart contracts can use Venn to enable onchain protection on Holesky
.
The following contracts have been modified to import the VennFirewallConsumer
, adding the firewallProtected
modifier to various contract methods:
src/AuctionManager.sol
src/BNFT.sol
src/BucketRateLimiter.sol
src/DepositAdapter.sol
src/EarlyAdopterPool.sol
src/EETH.sol
src/EtherFiAdmin.sol
src/EtherFiNode.sol
src/EtherFiNodesManager.sol
src/EtherFiOracle.sol
src/LiquidityPool.sol
src/Liquifier.sol
src/LoyaltyPointsMarketSafe.sol
src/MembershipManager.sol
src/MembershipNFT.sol
src/NFTExchange.sol
src/NodeOperatorManager.sol
src/StakingManager.sol
src/TNFT.sol
src/Treasury.sol
src/WeETH.sol
src/WithdrawRequestNFT.sol
src/archive/MembershipManagerV0.sol
src/archive/ProtocolRevenueManager.sol
src/archive/RegulationsManager.sol
src/archive/RegulationsManagerV2.sol
src/helpers/AddressProvider.sol
src/helpers/EtherFiViewer.sol
In addition, due to EVM limitations on contract bytecode size, some of the original contracts have been modified to output optimized bytecode size.
To showcase the integration, the following transactions have been used:
-
Operator Registration: Etherscan | Phalcon Trace
-
Bid: Etherscan | Phalcon Trace
-
Deposit & Mint: Etherscan | Phalcon Trace
This version of EtherFi contracts will only accept transactions that have been verified by Venn.
You can try it out with the Venn DApp SDK
Venn is a decentralized cybersecurity infrastructure that protects blockchain applications and protocols from malicious transactions and economic risks.
Learn more at https://docs.venn.build/
original readme below
Smart Contracts for ether.fi ethereum staking protocol.
From 2024/02/15, we have migrated from our private repo to this public one. We start with the shallow copy of the latest commit of the private one.
curl -L https://foundry.paradigm.xyz | bash
foundryup
git submodule update --init --recursive
Run yarn
to install package.json
which includes our formatter and linter. We will switch over to Foundry's sol formatter and linter once released.
Check .env.example
to see some of the environment variables you should have set in .env
in order to run some of the commands.
forge build
forge test
forge test --fork-url <your_rpc_url>>
certoraRun certora/conf/<contract-name>.conf
In case you run into an issue of forge
not being able to find a compatible version of solidity compiler for one of your contracts/scripts, you may want to install the solidity version manager svm
. To be able to do so, you will need to have Rust installed on your system and with it the accompanying package manager cargo
. Once that is done, to install svm
run the following command:
cargo install svm-rs
To list the available versions of solidity compiler run:
svm list
Make sure the version you need is in this list, or choose the closest one and install it:
svm install "0.7.6"
Install Yarn or Node:
yarn or npm init
Install hardhat
yarn add hardhat --save-dev
Setup your Hardhat project as you see fit in the same directory. (We assume a typescript setup) If you have a ReadMe file and test folder already, move them off the root before creating your hardhat project. Then delete the HH generated ones and copy your original ones back.
yarn hardhat
You will have to run the below every time you modify the foundry library. Open remappings.txt when done and make sure all remappings are correct. Sometimes weird remappings can be generated.
forge remappings > remappings.txt
Now make the following changes to your Hardhat project.
yarn add hardhat-preprocessor --save-dev
Add import "hardhat-preprocessor"; to your hardhat.config.ts file.
Add import fs from "fs"; to your hardhat.config.ts file.
Add the following function to your hardhat.config.ts file.
function getRemappings() {
return fs
.readFileSync("remappings.txt", "utf8")
.split("\n")
.filter(Boolean) // remove empty lines
.map((line) => line.trim().split("="));
}
Add the following to your exported HardhatUserConfig object:
preprocess: {
eachLine: (hre) => ({
transform: (line: string) => {
if (line.match(/^\s*import /i)) {
for (const [from, to] of getRemappings()) {
if (line.includes(from)) {
line = line.replace(from, to);
break;
}
}
}
return line;
},
}),
},
paths: {
sources: "./src",
cache: "./cache_hardhat",
},