diff --git a/CLAUDE.md b/CLAUDE.md index d5c472d03..d65853a10 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,4 +1,4 @@ -# EtherFi Smart Contracts +# ether.fi's Liquid Staking Protocol Contracts ## Build & Test @@ -14,20 +14,26 @@ forge test --match-test --fork-url $MAINNET_RPC_URL # mainnet fork tests ## Project Layout ``` -src/ # Core contracts - EtherFiNode.sol # Per-validator-group contract, owns an EigenPod - EtherFiNodesManager.sol # Entry point for pod operations (0x8B71...6F) - LiquidityPool.sol # Main ETH pool (0x3088...16) - EtherFiRestaker.sol # Manages stETH restaking via EigenLayer (0x1B7a...Ff) - EtherFiRedemptionManager.sol # Instant redemptions with rate limiting (0xDadE...e0) - StakingManager.sol # Validator lifecycle - WeETH.sol / EETH.sol # Token contracts - eigenlayer-interfaces/ # EigenLayer interface definitions (no implementations) +src/ + core/ # LiquidityPool (0x3088...16), EETH, WeETH + staking/ # StakingManager, EtherFiNodesManager (0x8B71...6F), EtherFiNode, AuctionManager + restaking/ # EtherFiRestaker (0x1B7a...Ff): stETH restaking via EigenLayer + deposits/ # DepositAdapter, Liquifier, LiquidRefer + withdrawals/ # WithdrawRequestNFT, PriorityWithdrawalQueue, + # EtherFiRedemptionManager (0xDadE...e0), WeETHWithdrawAdapter + oracle/ # EtherFiOracle, EtherFiAdmin + rewards/ # EtherFiRewardsRouter, CumulativeMerkleRewardsDistributor + governance/ # RoleRegistry, EtherFiTimelock, Blacklister, rate-limiting/ + helpers/ # AddressProvider, EtherFiViewer + interfaces/eigenlayer-interfaces/ # EigenLayer interface definitions (no implementations) + archive/ # Retired contracts kept for storage-layout reference test/ TestSetup.sol # Base test with initializeRealisticFork() / initializeTestingFork() + invariant/ # Stateful invariant fuzzing behaviour-tests/ # PreludeTest - validator lifecycle on mainnet fork integration-tests/ # Cross-contract integration tests on mainnet fork fork-tests/ # Additional fork-based tests +certora/ # specs/ and config/ for formal verification script/ operations/ # Operational tooling (Python + Solidity for Gnosis Safe txns) deploys/Deployed.s.sol # All mainnet deployed addresses as constants diff --git a/README.md b/README.md index fc583a7ac..8a3684b8e 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,115 @@ -# ether.fi Liquid Restaking Protocol +# ether.fi's Liquid Staking Protocol Contracts +Solidity contracts behind ether.fi's liquid staking on Ethereum mainnet. Users deposit ETH +into the `LiquidityPool` and receive eETH, a rebasing token, or its non-rebasing wrapper weETH. +The protocol runs validators whose withdrawal credentials point at EigenLayer EigenPods. +[Docs](https://etherfi.gitbook.io/etherfi/) · +[Audits](audits/) · +[Deployed addresses](https://etherfi.gitbook.io/etherfi/developers/contracts-and-integrations/deployed-contracts) · +[weETH cross-chain](https://github.com/etherfi-protocol/weETH-cross-chain/) -## Overview +## Contracts -The ether.fi Liquid Restaking Protocol represents the core infrastructure powering ether.fi's vision of becoming the most secure and efficient liquid staking solution in DeFi. This protocol enables: +| Module | Path | Contracts | +|--------|------|-----------| +| Core | `src/core` | `LiquidityPool`, `EETH`, `WeETH` | +| Staking | `src/staking` | `StakingManager`, `EtherFiNodesManager`, `EtherFiNode`, `AuctionManager`, `NodeOperatorManager` | +| Restaking | `src/restaking` | `EtherFiRestaker`, `RestakingRewardsRouter` | +| Deposits | `src/deposits` | `DepositAdapter`, `Liquifier`, `LiquidRefer` | +| Withdrawals | `src/withdrawals` | `WithdrawRequestNFT`, `PriorityWithdrawalQueue`, `EtherFiRedemptionManager`, `WeETHWithdrawAdapter` | +| Oracle | `src/oracle` | `EtherFiOracle`, `EtherFiAdmin` | +| Rewards | `src/rewards` | `EtherFiRewardsRouter`, `CumulativeMerkleRewardsDistributor` | +| Governance | `src/governance` | `RoleRegistry`, `EtherFiTimelock`, `Blacklister`, `RevokeAdmin`, rate limiting | +| Helpers | `src/helpers` | `AddressProvider`, `EtherFiViewer` | -- **Liquid Staking**: Seamless ETH staking with immediate liquidity through eETH -- **Native Restaking**: Effortless & Secure restaking of staked ETH. Restaking & AVS management is strictly controlled by the Protocol via ether.fi's AVS operator contracts ([link](https://github.com/etherfi-protocol/etherfi-avs-operator)). Restaking rewards are distributed via KING ([link](https://github.com/orgs/King-Protocol/repositories)) -- **Massive Integration with DeFi**: Wide integration with DeFi protocols -- **Cross-Chain Capabilities**: Native support for cross-chain staking & bridging of weETH ([link](https://github.com/etherfi-protocol/weETH-cross-chain/)) -- **Enterprise-Grade Security**: Rigorous security measures through audits, formal verification, and continuous monitoring +`src/archive` holds retired contracts kept for storage-layout reference. +Contract addresses live in the ether.fi docs under +[Deployed Contracts](https://etherfi.gitbook.io/etherfi/developers/contracts-and-integrations/deployed-contracts). -## 🔒 Security +## Architecture -Security is paramount at ether.fi. Our protocol undergoes: +- Every contract sits behind a UUPS proxy. Upgrades go through the upgrade timelock; parameter + changes go through the operating timelock. +- `RoleRegistry` owns all role checks. Contracts ask it before running privileged functions. +- Each `EtherFiNode` owns one EigenPod. `EtherFiNodesManager` is the entry point for pod + operations: checkpoints, withdrawals, consolidations, and exits. +- `EtherFiOracle` reports rewards and validator state. `EtherFiAdmin` applies those reports to + the `LiquidityPool` rebase and finalizes withdrawal requests. +- `EtherFiRedemptionManager` handles instant redemptions under a bucket rate limiter. + `WithdrawRequestNFT` and `PriorityWithdrawalQueue` handle queued withdrawals. -- Regular & Continuous audits by industry leaders -- Formal verification through Certora -- Continuous monitoring and testing +## Getting started +Requirements: [Foundry](https://book.getfoundry.sh/getting-started/installation) (CI pins +v1.5.1) and a mainnet RPC URL for fork tests. +```bash +git clone https://github.com/etherfi-protocol/smart-contracts.git +cd smart-contracts +git submodule update --init --recursive +forge build +``` -## 🛠️ Development Setup +The build uses Solidity 0.8.27 with 1500 optimizer runs. +### Tests ```bash -# Install & Setup -curl -L https://foundry.paradigm.xyz | bash -git clone https://github.com/etherfi-protocol/smart-contracts.git && cd smart-contracts -git submodule update --init --recursive -forge build +export MAINNET_RPC_URL= + +forge test # all tests +forge test --match-test # one test +forge test --match-path "test/invariant/*" # invariant suite +forge test --match-path "test/fork-tests/*" --fork-url $MAINNET_RPC_URL +``` -# Testing -forge test # Run all tests -forge test --fork-url # Fork testing -certoraRun certora/conf/.conf # Formal verification +| Directory | Contents | +|-----------|----------| +| `test/*.t.sol` | Unit tests per contract | +| `test/invariant` | Stateful invariant fuzzing | +| `test/integration-tests` | Cross-contract flows on a mainnet fork | +| `test/fork-tests` | Upgrade and migration checks against live state | +| `test/behaviour-tests` | Validator lifecycle on a mainnet fork | + +Fork tests run against the latest block, so assert deltas against the live state you read at +setup instead of assuming zero balances. + +### Formal verification + +Certora specs live in `certora/specs` with run configs in `certora/config`: + +```bash +certoraRun certora/config/LiquidityPoolPeg.conf ``` -## 📚 Documentation +Configs cover `LiquidityPool` peg and share accounting, `EtherFiOracle`, and `RoleRegistry` +authority. + +## Repository layout + +| Path | Purpose | +|------|---------| +| `src/` | Protocol contracts | +| `test/` | Foundry tests | +| `certora/` | Formal verification specs and configs | +| `script/` | Deploy, upgrade, and operations scripts (Solidity and Python) | +| `operations/`, `proposals/` | Gnosis Safe and timelock transaction batches | +| `deployment/`, `release/` | Deployment artifacts and release records | +| `audits/` | Audit reports | + +## Security -- [Protocol Documentation](https://etherfi.gitbook.io/etherfi/) +Certora, Zellic, Nethermind, Halborn, Omniscia, Decurity, Solidified, Paladin, CertiK, and +Hats Finance have audited these contracts. Reports sit in [`audits/`](audits/); the most +recent is the Certora 26Q2 Security Upgrade review (June 2026). +CI runs the Forge test suite and a storage-layout check on pull requests into `master`, which +catches upgrades that would shift proxy storage. +Report vulnerabilities through the ether.fi bug bounty program. Do not open public issues for +security bugs. ## 📄 License @@ -51,4 +117,4 @@ ether.fi is open-source and licensed under the [MIT License](LICENSE). --- -

Built with ❤️ by the ether.fi team

\ No newline at end of file +

Built with ❤️ by the ether.fi team

diff --git a/docs/book.css b/docs/book.css deleted file mode 100644 index b5ce903f9..000000000 --- a/docs/book.css +++ /dev/null @@ -1,13 +0,0 @@ -table { - margin: 0 auto; - border-collapse: collapse; - width: 100%; -} - -table td:first-child { - width: 15%; -} - -table td:nth-child(2) { - width: 25%; -} \ No newline at end of file diff --git a/docs/book.toml b/docs/book.toml deleted file mode 100644 index 236e95d90..000000000 --- a/docs/book.toml +++ /dev/null @@ -1,11 +0,0 @@ -[book] -src = 'src' -title = '' -[output.html] -no-section-label = true -additional-js = ['solidity.min.js'] -additional-css = ['book.css'] -git-repository-url = 'https://github.com/GadzeFinance/dappContracts' - -[output.html.fold] -enable = true diff --git a/docs/solidity.min.js b/docs/solidity.min.js deleted file mode 100644 index 192493291..000000000 --- a/docs/solidity.min.js +++ /dev/null @@ -1,74 +0,0 @@ -hljs.registerLanguage("solidity",(()=>{"use strict";function e(){try{return!0 -}catch(e){return!1}} -var a=/-?(\b0[xX]([a-fA-F0-9]_?)*[a-fA-F0-9]|(\b[1-9](_?\d)*(\.((\d_?)*\d)?)?|\.\d(_?\d)*)([eE][-+]?\d(_?\d)*)?|\b0)(?!\w|\$)/ -;e()&&(a=a.source.replace(/\\b/g,"(?{ -var a=r(e),o=l(e),c=/[A-Za-z_$][A-Za-z_$0-9.]*/,d=e.inherit(e.TITLE_MODE,{ -begin:/[A-Za-z$_][0-9A-Za-z$_]*/,lexemes:c,keywords:n}),u={className:"params", -begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,lexemes:c,keywords:n, -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,o,s]},_={ -className:"operator",begin:/:=|->/};return{keywords:n,lexemes:c, -contains:[a,o,i,t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,s,_,{ -className:"function",lexemes:c,beginKeywords:"function",end:"{",excludeEnd:!0, -contains:[d,u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,_]}]}}, -solAposStringMode:r,solQuoteStringMode:l,HEX_APOS_STRING_MODE:i, -HEX_QUOTE_STRING_MODE:t,SOL_NUMBER:s,isNegativeLookbehindAvailable:e} -;const{baseAssembly:c,solAposStringMode:d,solQuoteStringMode:u,HEX_APOS_STRING_MODE:_,HEX_QUOTE_STRING_MODE:m,SOL_NUMBER:b,isNegativeLookbehindAvailable:E}=o -;return e=>{for(var a=d(e),s=u(e),n=[],i=0;i<32;i++)n[i]=i+1 -;var t=n.map((e=>8*e)),r=[];for(i=0;i<=80;i++)r[i]=i -;var l=n.map((e=>"bytes"+e)).join(" ")+" ",o=t.map((e=>"uint"+e)).join(" ")+" ",g=t.map((e=>"int"+e)).join(" ")+" ",M=[].concat.apply([],t.map((e=>r.map((a=>e+"x"+a))))),p={ -keyword:"var bool string int uint "+g+o+"byte bytes "+l+"fixed ufixed "+M.map((e=>"fixed"+e)).join(" ")+" "+M.map((e=>"ufixed"+e)).join(" ")+" enum struct mapping address new delete if else for while continue break return throw emit try catch revert unchecked _ function modifier event constructor fallback receive error virtual override constant immutable anonymous indexed storage memory calldata external public internal payable pure view private returns import from as using pragma contract interface library is abstract type assembly", -literal:"true false wei gwei szabo finney ether seconds minutes hours days weeks years", -built_in:"self this super selfdestruct suicide now msg block tx abi blockhash gasleft assert require Error Panic sha3 sha256 keccak256 ripemd160 ecrecover addmod mulmod log0 log1 log2 log3 log4" -},O={className:"operator",begin:/[+\-!~*\/%<>&^|=]/ -},C=/[A-Za-z_$][A-Za-z_$0-9]*/,N={className:"params",begin:/\(/,end:/\)/, -excludeBegin:!0,excludeEnd:!0,lexemes:C,keywords:p, -contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,a,s,b,"self"]},f={ -begin:/\.\s*/,end:/[^A-Za-z0-9$_\.]/,excludeBegin:!0,excludeEnd:!0,keywords:{ -built_in:"gas value selector address length push pop send transfer call callcode delegatecall staticcall balance code codehash wrap unwrap name creationCode runtimeCode interfaceId min max" -},relevance:2},y=e.inherit(e.TITLE_MODE,{begin:/[A-Za-z$_][0-9A-Za-z$_]*/, -lexemes:C,keywords:p}),w={className:"built_in", -begin:(E()?"(?> -``` - -### Build Troubleshooting Tips - -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](https://www.rust-lang.org/tools/install) installed on your system and with it the accompanying package manager `cargo`. Once that is done, to install `svm` run the following command: - -```zsh -cargo install svm-rs -``` - -To list the available versions of solidity compiler run: - -```zsh -svm list -``` - -Make sure the version you need is in this list, or choose the closest one and install it: - -```zsh -svm install "0.7.6" -``` - -## Deployment Instructions - -### Update foundry.toml - -The foundry.toml file allows foundry to read which network it should deploy smart contracts to. It is here where you set this variable. For example (deploying to Goerli): - -```zsh -[rpc_endpoints] -goerli = "${GOERLI_RPC_URL}" - -[etherscan] -goerli = { key = "${ETHERSCAN_API_KEY}" } -``` - -The first part refers to the RPC endpoint to be used when deploying. You can get this through Alchemy or Infura. Simply create an account and create a new RPC endpoint, selecting the respective network you wish to deploy to. - -The second part relates to the etherscan API key that will be used for verifying the contracts on etherscan. If you prefer to keep your contracts unverified, this part can be skipped. To generate an API key, create an account on etherscan and select generate API key. - -### Updating env file - -Many variables used in deployment, such as the deployer private key, are advised to be kept private. An env file is a great way to achieve this. Make a copy of the .example.env file and create a new file called .env in the root directory. In this file, you will store your RPC endpoint, private key as well as etherscan api key. Fill in the required parameters in the .env to aid the deployment process. - -### Deploy Script - -The deploy script controls the actual deployment of the contracts to the specified network. The following part refers to the generation of the merkletree and merkle root: - -```zsh -Merkle merkle = new Merkle(); -bytes32[] memory data = new bytes32[](5); -data[0] = bytes32(keccak256( - abi.encodePacked(0x1c5fffDbFDE331A10Ab1e32da8c4Dff210B43145) - )); -data[1] = bytes32(keccak256( - abi.encodePacked(0x2f2806e8b288428f23707A69faA60f52BC565c17) - )); -data[2] = bytes32(keccak256( - abi.encodePacked(0x5dfb8BC4830ccF60d469D546aEC36531c97B96b5) - )); -data[3] = bytes32(keccak256( - abi.encodePacked(0x4507cfB4B077d5DBdDd520c701E30173d5b59Fad) - )); -data[4] = bytes32(keccak256( - abi.encodePacked(0xCd5EBC2dD4Cb3dc52ac66CEEcc72c838B40A5931) - )); - -bytes32 root = merkle.getRoot(data); -bytes32[] memory proofOne = merkle.getProof(data, 0); -bytes32[] memory proofTwo = merkle.getProof(data, 1); -bytes32[] memory proofThree = merkle.getProof(data, 2); -bytes32[] memory proofFour = merkle.getProof(data, 3); -bytes32[] memory proofFive = merkle.getProof(data, 4); -``` - -The above generates a bytes32 array holding five public addresses. If you want more or less, you can add and remove lines as you see fit. However it is important to update the following line accordingly: - -```zsh -bytes32[] memory data = new bytes32[](5); -``` - -Make sure the number in the ( ) corresponds to how many addresses are being whitelisted. - -The next set of code refers to the actual deployment of the contracts: - -```zsh -uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); -vm.startBroadcast(deployerPrivateKey); - -Treasury treasury = new Treasury(); -Auction auction = new Auction(address(treasury)); -Deposit deposit = new Deposit(address(auction)); -``` - -The first part of the above code retrieves the private key from the .env file and uses that address to deploy the contracts. The second part is the functionality of actually creating the new contracts. - -Once this is all populated, you can run the deploy function to perform the deployment to the provided network. When you ready, run the following command: - -```zsh -source .env -``` - -followed by: - -```zsh -forge script script/Deploy.s.sol:MyScript --rpc-url $GOERLI_RPC_URL --broadcast --verify -vvvv -``` - -This will run the deployment and verify the contracts on the provided network. It will print data to the terminal which will provide you with the relevant contract addresses and merkle proofs for each whitelisted address. - -### Inside your Foundry project working directory: - -Install Yarn or Node: - -```zsh -yarn or npm init -``` - -Install hardhat - -```zsh -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. - -```zsh -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. - -```zsh -forge remappings > remappings.txt -``` - -Now make the following changes to your Hardhat project. - -```zsh -yarn add hardhat-preprocessor --save-dev -``` - -```zsh -Add import "hardhat-preprocessor"; to your hardhat.config.ts file. -``` - -```zsh -Add import fs from "fs"; to your hardhat.config.ts file. -``` - -Add the following function to your hardhat.config.ts file. - -```zsh -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: - -```zsh -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", -}, -``` diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md deleted file mode 100644 index 4e9d48f2f..000000000 --- a/docs/src/SUMMARY.md +++ /dev/null @@ -1,29 +0,0 @@ -# Summary -- [Home](README.md) -# src - - [❱ interfaces](src/interfaces/README.md) - - [IAuctionManager](src/interfaces/IAuctionManager.sol/interface.IAuctionManager.md) - - [IBNFT](src/interfaces/IBNFT.sol/interface.IBNFT.md) - - [IDepositContract](src/interfaces/IDepositContract.sol/interface.IDepositContract.md) - - [IEETH](src/interfaces/IEETH.sol/interface.IEETH.md) - - [IEtherFiNode](src/interfaces/IEtherFiNode.sol/interface.IEtherFiNode.md) - - [IEtherFiNodesManager](src/interfaces/IEtherFiNodesManager.sol/interface.IEtherFiNodesManager.md) - - [INodeOperatorManager](src/interfaces/INodeOperatorManager.sol/interface.INodeOperatorManager.md) - - [IProtocolRevenueManager](src/interfaces/IProtocolRevenueManager.sol/interface.IProtocolRevenueManager.md) - - [IStakingManager](src/interfaces/IStakingManager.sol/interface.IStakingManager.md) - - [ITNFT](src/interfaces/ITNFT.sol/interface.ITNFT.md) - - [ITreasury](src/interfaces/ITreasury.sol/interface.ITreasury.md) - - [IWETH](src/interfaces/IWeth.sol/interface.IWETH.md) - - [AuctionManager](src/AuctionManager.sol/contract.AuctionManager.md) - - [BNFT](src/BNFT.sol/contract.BNFT.md) - - [ConversionPool](src/ClaimReceiverPool.sol/contract.ConversionPool.md) - - [EETH](src/EETH.sol/contract.EETH.md) - - [EarlyAdopterPool](src/EarlyAdopterPool.sol/contract.EarlyAdopterPool.md) - - [EtherFiNode](src/EtherFiNode.sol/contract.EtherFiNode.md) - - [EtherFiNodesManager](src/EtherFiNodesManager.sol/contract.EtherFiNodesManager.md) - - [LiquidityPool](src/LiquidityPool.sol/contract.LiquidityPool.md) - - [NodeOperatorManager](src/NodeOperatorManager.sol/contract.NodeOperatorManager.md) - - [ProtocolRevenueManager](src/ProtocolRevenueManager.sol/contract.ProtocolRevenueManager.md) - - [StakingManager](src/StakingManager.sol/contract.StakingManager.md) - - [TNFT](src/TNFT.sol/contract.TNFT.md) - - [Treasury](src/Treasury.sol/contract.Treasury.md) diff --git a/docs/src/src/AuctionManager.sol/contract.AuctionManager.md b/docs/src/src/AuctionManager.sol/contract.AuctionManager.md deleted file mode 100644 index 17bae7bed..000000000 --- a/docs/src/src/AuctionManager.sol/contract.AuctionManager.md +++ /dev/null @@ -1,359 +0,0 @@ -# AuctionManager - -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/AuctionManager.sol) - -**Inherits:** -[IAuctionManager](/src/interfaces/IAuctionManager.sol/interface.IAuctionManager.md), Pausable, Ownable - -## State Variables - -### whitelistBidAmount - -```solidity -uint256 public whitelistBidAmount = 0.001 ether; -``` - -### minBidAmount - -```solidity -uint256 public minBidAmount = 0.01 ether; -``` - -### maxBidAmount - -```solidity -uint256 public maxBidAmount = 5 ether; -``` - -### numberOfBids - -```solidity -uint256 public numberOfBids = 1; -``` - -### numberOfActiveBids - -```solidity -uint256 public numberOfActiveBids; -``` - -### stakingManagerContractAddress - -```solidity -address public stakingManagerContractAddress; -``` - -### nodeOperatorManagerContractAddress - -```solidity -address public nodeOperatorManagerContractAddress; -``` - -### whitelistEnabled - -```solidity -bool public whitelistEnabled = true; -``` - -### bids - -```solidity -mapping(uint256 => Bid) public bids; -``` - -### nodeOperatorManagerInterface - -```solidity -INodeOperatorManager nodeOperatorManagerInterface; -``` - -### protocolRevenueManager - -```solidity -IProtocolRevenueManager protocolRevenueManager; -``` - -## Functions - -### receive - -```solidity -receive() external payable; -``` - -### constructor - -Constructor to set variables on deployment - -```solidity -constructor(address _nodeOperatorManagerContract); -``` - -### createBid - -Creates bid(s) for the right to run a validator node when ETH is deposited - -```solidity -function createBid(uint256 _bidSize, uint256 _bidAmountPerBid) - external - payable - whenNotPaused - returns (uint256[] memory); -``` - -**Parameters** - -| Name | Type | Description | -| ------------------ | --------- | -------------------------------------------------------------- | -| `_bidSize` | `uint256` | the number of bids that the node operator would like to create | -| `_bidAmountPerBid` | `uint256` | the ether value of each bid that is created | - -**Returns** - -| Name | Type | Description | -| -------- | ----------- | ------------------------------------------------ | -| `` | `uint256[]` | bidIdArray array of the bidIDs that were created | - -### cancelBid - -Cancels a specified bid by de-activating it - -_Require the bid to exist and be active_ - -```solidity -function cancelBid(uint256 _bidId) external whenNotPaused; -``` - -**Parameters** - -| Name | Type | Description | -| -------- | --------- | --------------------------- | -| `_bidId` | `uint256` | the ID of the bid to cancel | - -### updateSelectedBidInformation - -Updates a bid winning bids details - -_Called by batchDepositWithBidIds() in StakingManager.sol_ - -```solidity -function updateSelectedBidInformation(uint256 _bidId) public onlyStakingManagerContract; -``` - -**Parameters** - -| Name | Type | Description | -| -------- | --------- | ----------------------------------------------------------------------------- | -| `_bidId` | `uint256` | the ID of the bid being removed from the auction (since it has been selected) | - -### reEnterAuction - -Lets a bid that was matched to a cancelled stake re-enter the auction - -```solidity -function reEnterAuction(uint256 _bidId) external onlyStakingManagerContract whenNotPaused; -``` - -**Parameters** - -| Name | Type | Description | -| -------- | --------- | ----------------------------------------------------------- | -| `_bidId` | `uint256` | the ID of the bid which was matched to the cancelled stake. | - -### Transfer - -Transfer the auction fee received from the node operator to the protocol revenue manager - -_Called by registerValidator() in StakingManager.sol_ - -```solidity -function processAuctionFeeTransfer(uint256 _bidId) external onlyStakingManagerContract; -``` - -**Parameters** - -| Name | Type | Description | -| -------- | --------- | ----------------------- | -| `_bidId` | `uint256` | the ID of the validator | - -### disableWhitelist - -Disables the bid whitelist - -_Allows both regular users and whitelisted users to bid_ - -```solidity -function disableWhitelist() public onlyOwner; -``` - -### enableWhitelist - -Enables the bid whitelist - -_Only users who are on a whitelist can bid_ - -```solidity -function enableWhitelist() public onlyOwner; -``` - -### pauseContract - -```solidity -function pauseContract() external onlyOwner; -``` - -### unPauseContract - -```solidity -function unPauseContract() external onlyOwner; -``` - -### uncheckedInc - -```solidity -function uncheckedInc(uint256 x) private pure returns (uint256); -``` - -### getBidOwner - -Fetches the address of the user who placed a bid for a specific bid ID - -_Needed for registerValidator() function in Staking Contract_ - -```solidity -function getBidOwner(uint256 _bidId) external view returns (address); -``` - -**Returns** - -| Name | Type | Description | -| -------- | --------- | --------------------------- | -| `` | `address` | the user who placed the bid | - -### isBidActive - -Fetches if a selected bid is currently active - -_Needed for batchDepositWithBidIds() function in Staking Contract_ - -```solidity -function isBidActive(uint256 _bidId) external view returns (bool); -``` - -**Returns** - -| Name | Type | Description | -| -------- | ------ | -------------------------------------------- | -| `` | `bool` | the boolean value of the active flag in bids | - -### setProtocolRevenueManager - -Sets an instance of the protocol revenue manager - -Performed this way due to circular dependencies - -_Needed to process an auction fee_ - -```solidity -function setProtocolRevenueManager(address _protocolRevenueManager) external onlyOwner; -``` - -**Parameters** - -| Name | Type | Description | -| ------------------------- | --------- | ---------------------------------- | -| `_protocolRevenueManager` | `address` | the addres of the protocol manager | - -### setStakingManagerContractAddress - -Sets the stakingManagerContractAddress address in the current contract - -```solidity -function setStakingManagerContractAddress(address _stakingManagerContractAddress) external onlyOwner; -``` - -**Parameters** - -| Name | Type | Description | -| -------------------------------- | --------- | ---------------------------------- | -| `_stakingManagerContractAddress` | `address` | new stakingManagerContract address | - -### setMinBidPrice - -Updates the minimum bid price - -```solidity -function setMinBidPrice(uint256 _newMinBidAmount) external onlyOwner; -``` - -**Parameters** - -| Name | Type | Description | -| ------------------ | --------- | ---------------------------------------------- | -| `_newMinBidAmount` | `uint256` | the new amount to set the minimum bid price as | - -### setMaxBidPrice - -Updates the maximum bid price - -```solidity -function setMaxBidPrice(uint256 _newMaxBidAmount) external onlyOwner; -``` - -**Parameters** - -| Name | Type | Description | -| ------------------ | --------- | ---------------------------------------------- | -| `_newMaxBidAmount` | `uint256` | the new amount to set the maximum bid price as | - -### updateWhitelistMinBidAmount - -Updates the minimum bid price for a whitelisted address - -```solidity -function updateWhitelistMinBidAmount(uint256 _newAmount) external onlyOwner; -``` - -**Parameters** - -| Name | Type | Description | -| ------------ | --------- | ---------------------------------------------- | -| `_newAmount` | `uint256` | the new amount to set the minimum bid price as | - -### onlyStakingManagerContract - -```solidity -modifier onlyStakingManagerContract(); -``` - -### onlyNodeOperatorManagerContract - -```solidity -modifier onlyNodeOperatorManagerContract(); -``` - -## Events - -### BidCreated - -```solidity -event BidCreated(address indexed bidder, uint256 amountPerBid, uint256[] bidIdArray, uint64[] ipfsIndexArray); -``` - -### BidCancelled - -```solidity -event BidCancelled(uint256 indexed bidId); -``` - -### BidReEnteredAuction - -```solidity -event BidReEnteredAuction(uint256 indexed bidId); -``` - -### Received - -```solidity -event Received(address indexed sender, uint256 value); -``` diff --git a/docs/src/src/BNFT.sol/contract.BNFT.md b/docs/src/src/BNFT.sol/contract.BNFT.md deleted file mode 100644 index fa2e6c2ce..000000000 --- a/docs/src/src/BNFT.sol/contract.BNFT.md +++ /dev/null @@ -1,58 +0,0 @@ -# BNFT -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/BNFT.sol) - -**Inherits:** -ERC721 - - -## State Variables -### tokenIds - -```solidity -uint256 private tokenIds; -``` - - -### nftValue - -```solidity -uint256 public nftValue = 0.002 ether; -``` - - -### stakingManagerContractAddress - -```solidity -address public stakingManagerContractAddress; -``` - - -## Functions -### constructor - - -```solidity -constructor() ERC721("Bond NFT", "BNFT"); -``` - -### mint - - -```solidity -function mint(address _reciever, uint256 _validatorId) external onlyStakingManagerContract; -``` - -### transferFrom - - -```solidity -function transferFrom(address from, address to, uint256 tokenId) public virtual override(ERC721); -``` - -### onlyStakingManagerContract - - -```solidity -modifier onlyStakingManagerContract(); -``` - diff --git a/docs/src/src/ClaimReceiverPool.sol/contract.ConversionPool.md b/docs/src/src/ClaimReceiverPool.sol/contract.ConversionPool.md deleted file mode 100644 index 745c2f189..000000000 --- a/docs/src/src/ClaimReceiverPool.sol/contract.ConversionPool.md +++ /dev/null @@ -1,150 +0,0 @@ -# ConversionPool -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/ClaimReceiverPool.sol) - -**Inherits:** -Ownable, ReentrancyGuard, Pausable - - -## State Variables -### poolFee - -```solidity -uint24 public constant poolFee = 500; -``` - - -### wEth - -```solidity -address private immutable wEth; -``` - - -### rETH - -```solidity -address private immutable rETH; -``` - - -### wstETH - -```solidity -address private immutable wstETH; -``` - - -### sfrxETH - -```solidity -address private immutable sfrxETH; -``` - - -### cbETH - -```solidity -address private immutable cbETH; -``` - - -### swapRouter - -```solidity -ISwapRouter public immutable swapRouter; -``` - - -### wethContract - -```solidity -IWETH public wethContract; -``` - - -### adopterPool - -```solidity -EarlyAdopterPool public adopterPool; -``` - - -### userToERC20Deposit - -```solidity -mapping(address => mapping(address => uint256)) public userToERC20Deposit; -``` - - -### etherBalance - -```solidity -mapping(address => uint256) public etherBalance; -``` - - -### userPoints - -```solidity -mapping(address => uint256) public userPoints; -``` - - -## Functions -### constructor - - -```solidity -constructor( - address _routerAddress, - address _adopterPool, - address _rEth, - address _wstEth, - address _sfrxEth, - address _cbEth, - address _wEth -); -``` - -### setPointsData - - -```solidity -function setPointsData(address _user, uint256 _points) external; -``` - -### depositEther - - -```solidity -function depositEther() external payable; -``` - -### depositERC20 - - -```solidity -function depositERC20(address _erc20Contract, uint256 _amount) external; -``` - -### pauseContract - - -```solidity -function pauseContract() external onlyOwner; -``` - -### unPauseContract - - -```solidity -function unPauseContract() external onlyOwner; -``` - -### _swapExactInputSingle - - -```solidity -function _swapExactInputSingle(uint256 _amountIn, address _tokenIn) internal returns (uint256 amountOut); -``` - diff --git a/docs/src/src/EETH.sol/contract.EETH.md b/docs/src/src/EETH.sol/contract.EETH.md deleted file mode 100644 index f10500087..000000000 --- a/docs/src/src/EETH.sol/contract.EETH.md +++ /dev/null @@ -1,52 +0,0 @@ -# EETH -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/EETH.sol) - -**Inherits:** -ERC20 - - -## State Variables -### liquidityPool - -```solidity -address public liquidityPool; -``` - - -## Functions -### constructor - - -```solidity -constructor(address _liquidityPool) ERC20("EtherFi ETH", "eETH"); -``` - -### mint - -function to mint eETH - -*only able to mint from LiquidityPool contract* - - -```solidity -function mint(address _account, uint256 _amount) external onlyPoolContract; -``` - -### burn - -function to burn eETH - -*only able to burn from LiquidityPool contract* - - -```solidity -function burn(address _account, uint256 _amount) external onlyPoolContract; -``` - -### onlyPoolContract - - -```solidity -modifier onlyPoolContract(); -``` - diff --git a/docs/src/src/EarlyAdopterPool.sol/contract.EarlyAdopterPool.md b/docs/src/src/EarlyAdopterPool.sol/contract.EarlyAdopterPool.md deleted file mode 100644 index be07a7c5f..000000000 --- a/docs/src/src/EarlyAdopterPool.sol/contract.EarlyAdopterPool.md +++ /dev/null @@ -1,356 +0,0 @@ -# EarlyAdopterPool -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/EarlyAdopterPool.sol) - -**Inherits:** -Ownable, ReentrancyGuard, Pausable - - -## State Variables -### claimDeadline - -```solidity -uint256 public claimDeadline; -``` - - -### endTime - -```solidity -uint256 public endTime; -``` - - -### rETH - -```solidity -address private immutable rETH; -``` - - -### wstETH - -```solidity -address private immutable wstETH; -``` - - -### sfrxETH - -```solidity -address private immutable sfrxETH; -``` - - -### cbETH - -```solidity -address private immutable cbETH; -``` - - -### claimReceiverContract - -```solidity -address public claimReceiverContract; -``` - - -### claimingOpen - -```solidity -uint8 public claimingOpen; -``` - - -### userToErc20Balance - -```solidity -mapping(address => mapping(address => uint256)) public userToErc20Balance; -``` - - -### depositInfo - -```solidity -mapping(address => UserDepositInfo) public depositInfo; -``` - - -### rETHInstance - -```solidity -IERC20 rETHInstance; -``` - - -### wstETHInstance - -```solidity -IERC20 wstETHInstance; -``` - - -### sfrxETHInstance - -```solidity -IERC20 sfrxETHInstance; -``` - - -### cbETHInstance - -```solidity -IERC20 cbETHInstance; -``` - - -## Functions -### receive - -Allows ether to be sent to this contract - - -```solidity -receive() external payable; -``` - -### constructor - -Sets state variables needed for future functions - - -```solidity -constructor(address _rETH, address _wstETH, address _sfrxETH, address _cbETH); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_rETH`|`address`|address of the rEth contract to receive| -|`_wstETH`|`address`|address of the wstEth contract to receive| -|`_sfrxETH`|`address`|address of the sfrxEth contract to receive| -|`_cbETH`|`address`|address of the _cbEth contract to receive| - - -### deposit - -deposits ERC20 tokens into contract - -*User must have approved contract before* - - -```solidity -function deposit(address _erc20Contract, uint256 _amount) - external - OnlyCorrectAmount(_amount) - DepositingOpen - whenNotPaused; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_erc20Contract`|`address`|erc20 token contract being deposited| -|`_amount`|`uint256`|amount of the erc20 token being deposited| - - -### depositEther - -deposits Ether into contract - - -```solidity -function depositEther() external payable OnlyCorrectAmount(msg.value) DepositingOpen whenNotPaused; -``` - -### withdraw - -withdraws all funds from pool for the user calling - -*no points allocated to users who withdraw* - - -```solidity -function withdraw() public nonReentrant; -``` - -### claim - -Transfers users funds to a new contract such as LP - -*can only call once receiver contract is ready and claiming is open* - - -```solidity -function claim() public nonReentrant; -``` - -### setClaimingOpen - -Sets claiming to be open, to allow users to claim their points - - -```solidity -function setClaimingOpen(uint256 _claimDeadline) public onlyOwner; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_claimDeadline`|`uint256`|the amount of time in days until claiming will close| - - -### setClaimReceiverContract - -Set the contract which will receive claimed funds - - -```solidity -function setClaimReceiverContract(address _receiverContract) public onlyOwner; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_receiverContract`|`address`|contract address for where claiming will send the funds| - - -### calculateUserPoints - -Calculates how many points a user currently has owed to them - - -```solidity -function calculateUserPoints(address _user) public view returns (uint256); -``` -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`uint256`|the amount of points a user currently has accumulated| - - -### pauseContract - - -```solidity -function pauseContract() external onlyOwner; -``` - -### unPauseContract - - -```solidity -function unPauseContract() external onlyOwner; -``` - -### transferFunds - -Transfers funds to relevant parties and updates data structures - - -```solidity -function transferFunds(uint256 _identifier) internal; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_identifier`|`uint256`|identifies which contract function called the function| - - -### getContractTVL - -*Returns the total value locked of all currencies in contract* - - -```solidity -function getContractTVL() public view returns (uint256 tvl); -``` - -### getUserTVL - - -```solidity -function getUserTVL(address _user) - public - view - returns (uint256 rETHBal, uint256 wstETHBal, uint256 sfrxETHBal, uint256 cbETHBal, uint256 ethBal, uint256 totalBal); -``` - -### OnlyCorrectAmount - - -```solidity -modifier OnlyCorrectAmount(uint256 _amount); -``` - -### DepositingOpen - - -```solidity -modifier DepositingOpen(); -``` - -## Events -### DepositERC20 - -```solidity -event DepositERC20(address indexed sender, uint256 amount); -``` - -### DepositEth - -```solidity -event DepositEth(address indexed sender, uint256 amount); -``` - -### Withdrawn - -```solidity -event Withdrawn(address indexed sender); -``` - -### ClaimReceiverContractSet - -```solidity -event ClaimReceiverContractSet(address indexed receiverAddress); -``` - -### ClaimingOpened - -```solidity -event ClaimingOpened(uint256 deadline); -``` - -### Fundsclaimed - -```solidity -event Fundsclaimed(address indexed user, uint256 indexed pointsAccumulated); -``` - -### ERC20TVLUpdated - -```solidity -event ERC20TVLUpdated( - uint256 rETHBal, uint256 wstETHBal, uint256 sfrxETHBal, uint256 cbETHBal, uint256 ETHBal, uint256 tvl -); -``` - -### EthTVLUpdated - -```solidity -event EthTVLUpdated(uint256 ETHBal, uint256 tvl); -``` - -## Structs -### UserDepositInfo - -```solidity -struct UserDepositInfo { - uint256 depositTime; - uint256 etherBalance; - uint256 totalERC20Balance; -} -``` - diff --git a/docs/src/src/EtherFiNode.sol/contract.EtherFiNode.md b/docs/src/src/EtherFiNode.sol/contract.EtherFiNode.md deleted file mode 100644 index 2684307b2..000000000 --- a/docs/src/src/EtherFiNode.sol/contract.EtherFiNode.md +++ /dev/null @@ -1,338 +0,0 @@ -# EtherFiNode -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/EtherFiNode.sol) - -**Inherits:** -[IEtherFiNode](/src/interfaces/IEtherFiNode.sol/interface.IEtherFiNode.md) - - -## State Variables -### etherfiNodesManager - -```solidity -address etherfiNodesManager; -``` - - -### protocolRevenueManager - -```solidity -address protocolRevenueManager; -``` - - -### localRevenueIndex - -```solidity -uint256 public localRevenueIndex; -``` - - -### vestedAuctionRewards - -```solidity -uint256 public vestedAuctionRewards; -``` - - -### ipfsHashForEncryptedValidatorKey - -```solidity -string public ipfsHashForEncryptedValidatorKey; -``` - - -### exitRequestTimestamp - -```solidity -uint32 public exitRequestTimestamp; -``` - - -### exitTimestamp - -```solidity -uint32 public exitTimestamp; -``` - - -### stakingStartTimestamp - -```solidity -uint32 public stakingStartTimestamp; -``` - - -### phase - -```solidity -VALIDATOR_PHASE public phase; -``` - - -## Functions -### initialize - - -```solidity -function initialize(address _protocolRevenueManager) public; -``` - -### receive - - -```solidity -receive() external payable; -``` - -### setPhase - -Set the validator phase - - -```solidity -function setPhase(VALIDATOR_PHASE _phase) external onlyEtherFiNodeManagerContract; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_phase`|`VALIDATOR_PHASE`|the new phase| - - -### setIpfsHashForEncryptedValidatorKey - -Set the deposit data - - -```solidity -function setIpfsHashForEncryptedValidatorKey(string calldata _ipfsHash) external onlyEtherFiNodeManagerContract; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_ipfsHash`|`string`|the deposit data| - - -### setLocalRevenueIndex - - -```solidity -function setLocalRevenueIndex(uint256 _localRevenueIndex) external payable onlyEtherFiNodeManagerContract; -``` - -### setExitRequestTimestamp - - -```solidity -function setExitRequestTimestamp() external onlyEtherFiNodeManagerContract; -``` - -### markExited - - -```solidity -function markExited(uint32 _exitTimestamp) external onlyEtherFiNodeManagerContract; -``` - -### receiveVestedRewardsForStakers - - -```solidity -function receiveVestedRewardsForStakers() external payable onlyProtocolRevenueManagerContract; -``` - -### processVestedAuctionFeeWithdrawal - - -```solidity -function processVestedAuctionFeeWithdrawal() external; -``` - -### moveRewardsToManager - - -```solidity -function moveRewardsToManager(uint256 _amount) external onlyEtherFiNodeManagerContract; -``` - -### withdrawFunds - - -```solidity -function withdrawFunds( - address _treasury, - uint256 _treasuryAmount, - address _operator, - uint256 _operatorAmount, - address _tnftHolder, - uint256 _tnftAmount, - address _bnftHolder, - uint256 _bnftAmount -) external onlyEtherFiNodeManagerContract; -``` - -### getStakingRewardsPayouts - -get the accrued staking rewards payouts to (toNodeOperator, toTnft, toBnft, toTreasury) - - -```solidity -function getStakingRewardsPayouts(IEtherFiNodesManager.RewardsSplit memory _splits, uint256 _scale) - public - view - onlyEtherFiNodeManagerContract - returns (uint256 toNodeOperator, uint256 toTnft, uint256 toBnft, uint256 toTreasury); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_splits`|`RewardsSplit.IEtherFiNodesManager`|the splits for the staking rewards| -|`_scale`|`uint256`|the scale = SUM(_splits)| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`toNodeOperator`|`uint256`| the payout to the Node Operator| -|`toTnft`|`uint256`| the payout to the T-NFT holder| -|`toBnft`|`uint256`| the payout to the B-NFT holder| -|`toTreasury`|`uint256`| the payout to the Treasury| - - -### getProtocolRewards - -get the accrued protocol rewards payouts to (toNodeOperator, toTnft, toBnft, toTreasury) - - -```solidity -function getProtocolRewards(IEtherFiNodesManager.RewardsSplit memory _splits, uint256 _scale) - public - view - onlyEtherFiNodeManagerContract - returns (uint256 toNodeOperator, uint256 toTnft, uint256 toBnft, uint256 toTreasury); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_splits`|`RewardsSplit.IEtherFiNodesManager`|the splits for the protocol rewards| -|`_scale`|`uint256`|the scale = SUM(_splits)| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`toNodeOperator`|`uint256`| the payout to the Node Operator| -|`toTnft`|`uint256`| the payout to the T-NFT holder| -|`toBnft`|`uint256`| the payout to the B-NFT holder| -|`toTreasury`|`uint256`| the payout to the Treasury| - - -### getNonExitPenalty - -compute the non exit penalty for the b-nft holder - - -```solidity -function getNonExitPenalty(uint256 _principal, uint256 _dailyPenalty, uint32 _exitTimestamp) - public - view - onlyEtherFiNodeManagerContract - returns (uint256); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_principal`|`uint256`|the principal for the non exit penalty (e.g., 1 ether)| -|`_dailyPenalty`|`uint256`|the dailty penalty for the non exit penalty| -|`_exitTimestamp`|`uint32`|the exit timestamp for the validator node| - - -### getFullWithdrawalPayouts - -Given the current balance of the ether fi node after its EXIT, -Compute the payouts to {node operator, t-nft holder, b-nft holder, treasury} - - -```solidity -function getFullWithdrawalPayouts( - IEtherFiNodesManager.RewardsSplit memory _splits, - uint256 _scale, - uint256 _principal, - uint256 _dailyPenalty -) external view returns (uint256 toNodeOperator, uint256 toTnft, uint256 toBnft, uint256 toTreasury); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_splits`|`RewardsSplit.IEtherFiNodesManager`|the splits for the staking rewards| -|`_scale`|`uint256`|the scale = SUM(_splits)| -|`_principal`|`uint256`|the principal for the non exit penalty (e.g., 1 ether)| -|`_dailyPenalty`|`uint256`|the dailty penalty for the non exit penalty| - -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|`toNodeOperator`|`uint256`| the payout to the Node Operator| -|`toTnft`|`uint256`| the payout to the T-NFT holder| -|`toBnft`|`uint256`| the payout to the B-NFT holder| -|`toTreasury`|`uint256`| the payout to the Treasury| - - -### _getClaimableVestedRewards - - -```solidity -function _getClaimableVestedRewards() internal view returns (uint256); -``` - -### _getDaysPassedSince - - -```solidity -function _getDaysPassedSince(uint32 _startTimestamp, uint32 _endTimestamp) internal view returns (uint256); -``` - -### calculatePayouts - - -```solidity -function calculatePayouts(uint256 _totalAmount, IEtherFiNodesManager.RewardsSplit memory _splits, uint256 _scale) - public - view - returns (uint256, uint256, uint256, uint256); -``` - -### etherfiNodesManagerAddress - - -```solidity -function etherfiNodesManagerAddress() internal view returns (address); -``` - -### protocolRevenueManagerAddress - - -```solidity -function protocolRevenueManagerAddress() internal view returns (address); -``` - -### onlyEtherFiNodeManagerContract - - -```solidity -modifier onlyEtherFiNodeManagerContract(); -``` - -### onlyProtocolRevenueManagerContract - - -```solidity -modifier onlyProtocolRevenueManagerContract(); -``` - diff --git a/docs/src/src/EtherFiNodesManager.sol/contract.EtherFiNodesManager.md b/docs/src/src/EtherFiNodesManager.sol/contract.EtherFiNodesManager.md deleted file mode 100644 index e90b690c0..000000000 --- a/docs/src/src/EtherFiNodesManager.sol/contract.EtherFiNodesManager.md +++ /dev/null @@ -1,491 +0,0 @@ -# EtherFiNodesManager -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/EtherFiNodesManager.sol) - -**Inherits:** -[IEtherFiNodesManager](/src/interfaces/IEtherFiNodesManager.sol/interface.IEtherFiNodesManager.md) - - -## State Variables -### nonExitPenaltyPrincipal - -```solidity -uint256 private constant nonExitPenaltyPrincipal = 1 ether; -``` - - -### nonExitPenaltyDailyRate - -```solidity -uint256 private constant nonExitPenaltyDailyRate = 3; -``` - - -### implementationContract - -```solidity -address public immutable implementationContract; -``` - - -### numberOfValidators - -```solidity -uint256 public numberOfValidators; -``` - - -### owner - -```solidity -address public owner; -``` - - -### treasuryContract - -```solidity -address public treasuryContract; -``` - - -### auctionContract - -```solidity -address public auctionContract; -``` - - -### stakingManagerContract - -```solidity -address public stakingManagerContract; -``` - - -### protocolRevenueManagerContract - -```solidity -address public protocolRevenueManagerContract; -``` - - -### etherfiNodeAddress - -```solidity -mapping(uint256 => address) public etherfiNodeAddress; -``` - - -### tnftInstance - -```solidity -TNFT public tnftInstance; -``` - - -### bnftInstance - -```solidity -BNFT public bnftInstance; -``` - - -### stakingManagerInstance - -```solidity -IStakingManager public stakingManagerInstance; -``` - - -### auctionInterfaceInstance - -```solidity -IAuctionManager public auctionInterfaceInstance; -``` - - -### protocolRevenueManagerInstance - -```solidity -IProtocolRevenueManager public protocolRevenueManagerInstance; -``` - - -### SCALE - -```solidity -uint256 public constant SCALE = 1000000; -``` - - -### stakingRewardsSplit - -```solidity -RewardsSplit public stakingRewardsSplit; -``` - - -### protocolRewardsSplit - -```solidity -RewardsSplit public protocolRewardsSplit; -``` - - -## Functions -### constructor - -Constructor to set variables on deployment - -*Sets the revenue splits on deployment* - -*AuctionManager, treasury and deposit contracts must be deployed first* - - -```solidity -constructor( - address _treasuryContract, - address _auctionContract, - address _stakingManagerContract, - address _tnftContract, - address _bnftContract, - address _protocolRevenueManagerContract -); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_treasuryContract`|`address`|the address of the treasury contract for interaction| -|`_auctionContract`|`address`|the address of the auction contract for interaction| -|`_stakingManagerContract`|`address`|the address of the deposit contract for interaction| -|`_tnftContract`|`address`|| -|`_bnftContract`|`address`|| -|`_protocolRevenueManagerContract`|`address`|| - - -### receive - - -```solidity -receive() external payable; -``` - -### createEtherfiNode - - -```solidity -function createEtherfiNode(uint256 _validatorId) external returns (address); -``` - -### registerEtherFiNode - -Sets the validator ID for the EtherFiNode contract - - -```solidity -function registerEtherFiNode(uint256 _validatorId, address _address) public onlyStakingManagerContract; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|id of the validator associated to the node| -|`_address`|`address`|address of the EtherFiNode contract| - - -### unregisterEtherFiNode - -UnSet the EtherFiNode contract for the validator ID - - -```solidity -function unregisterEtherFiNode(uint256 _validatorId) public onlyStakingManagerContract; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|id of the validator associated| - - -### sendExitRequest - -send the request to exit the validator node - - -```solidity -function sendExitRequest(uint256 _validatorId) external; -``` - -### processNodeExit - -Once the node's exit is observed, the protocol calls this function: -For each node, -- mark it EXITED -- distribute the protocol (auction) revenue -- stop sharing the protocol revenue; by setting their local revenue index to '0' - - -```solidity -function processNodeExit(uint256[] calldata _validatorIds, uint32[] calldata _exitTimestamps) external onlyOwner; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorIds`|`uint256[]`|the list of validators which exited| -|`_exitTimestamps`|`uint32[]`|the list of exit timestamps of the validators| - - -### partialWithdraw - -process the rewards skimming - - -```solidity -function partialWithdraw(uint256 _validatorId, bool _stakingRewards, bool _protocolRewards, bool _vestedAuctionFee) - public; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|the validator Id| -|`_stakingRewards`|`bool`|| -|`_protocolRewards`|`bool`|| -|`_vestedAuctionFee`|`bool`|| - - -### partialWithdraw - -batch-process the rewards skimming - - -```solidity -function partialWithdraw( - uint256[] calldata _validatorIds, - bool _stakingRewards, - bool _protocolRewards, - bool _vestedAuctionFee -) external; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorIds`|`uint256[]`|a list of the validator Ids| -|`_stakingRewards`|`bool`|| -|`_protocolRewards`|`bool`|| -|`_vestedAuctionFee`|`bool`|| - - -### partialWithdrawBatchGroupByOperator - -batch-process the rewards skimming for the validator nodes belonging to the same operator - - -```solidity -function partialWithdrawBatchGroupByOperator( - address _operator, - uint256[] memory _validatorIds, - bool _stakingRewards, - bool _protocolRewards, - bool _vestedAuctionFee -) external; -``` - -### fullWithdraw - -process the full withdrawal - - -```solidity -function fullWithdraw(uint256 _validatorId) public; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|the validator Id| - - -### fullWithdrawBatch - -process the full withdrawal - - -```solidity -function fullWithdrawBatch(uint256[] calldata _validatorIds) external; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorIds`|`uint256[]`|the validator Ids| - - -### setEtherFiNodePhase - -Sets the phase of the validator - - -```solidity -function setEtherFiNodePhase(uint256 _validatorId, IEtherFiNode.VALIDATOR_PHASE _phase) - public - onlyStakingManagerContract; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|id of the validator associated to this withdraw safe| -|`_phase`|`VALIDATOR_PHASE.IEtherFiNode`|phase of the validator| - - -### setEtherFiNodeIpfsHashForEncryptedValidatorKey - -Sets the ipfs hash of the validator's encrypted private key - - -```solidity -function setEtherFiNodeIpfsHashForEncryptedValidatorKey(uint256 _validatorId, string calldata _ipfs) - external - onlyStakingManagerContract; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|id of the validator associated to this withdraw safe| -|`_ipfs`|`string`|ipfs hash| - - -### incrementNumberOfValidators - - -```solidity -function incrementNumberOfValidators(uint256 _count) external onlyStakingManagerContract; -``` - -### phase - - -```solidity -function phase(uint256 _validatorId) public view returns (IEtherFiNode.VALIDATOR_PHASE phase); -``` - -### ipfsHashForEncryptedValidatorKey - - -```solidity -function ipfsHashForEncryptedValidatorKey(uint256 _validatorId) external view returns (string memory); -``` - -### localRevenueIndex - - -```solidity -function localRevenueIndex(uint256 _validatorId) external view returns (uint256); -``` - -### vestedAuctionRewards - - -```solidity -function vestedAuctionRewards(uint256 _validatorId) external returns (uint256); -``` - -### generateWithdrawalCredentials - - -```solidity -function generateWithdrawalCredentials(address _address) public pure returns (bytes memory); -``` - -### getWithdrawalCredentials - - -```solidity -function getWithdrawalCredentials(uint256 _validatorId) external view returns (bytes memory); -``` - -### isExitRequested - - -```solidity -function isExitRequested(uint256 _validatorId) external view returns (bool); -``` - -### getNonExitPenalty - - -```solidity -function getNonExitPenalty(uint256 _validatorId, uint32 _endTimestamp) public view returns (uint256); -``` - -### getStakingRewardsPayouts - - -```solidity -function getStakingRewardsPayouts(uint256 _validatorId) public view returns (uint256, uint256, uint256, uint256); -``` - -### getRewardsPayouts - - -```solidity -function getRewardsPayouts(uint256 _validatorId, bool _stakingRewards, bool _protocolRewards, bool _vestedAuctionFee) - public - view - returns (uint256, uint256, uint256, uint256); -``` - -### getFullWithdrawalPayouts - - -```solidity -function getFullWithdrawalPayouts(uint256 _validatorId) public view returns (uint256, uint256, uint256, uint256); -``` - -### isExited - - -```solidity -function isExited(uint256 _validatorId) external view returns (bool); -``` - -### onlyOwner - - -```solidity -modifier onlyOwner(); -``` - -### onlyStakingManagerContract - - -```solidity -modifier onlyStakingManagerContract(); -``` - -### onlyProtocolRevenueManagerContract - - -```solidity -modifier onlyProtocolRevenueManagerContract(); -``` - -## Events -### FundsWithdrawn - -```solidity -event FundsWithdrawn(uint256 indexed _validatorId, uint256 amount); -``` - -### NodeExitRequested - -```solidity -event NodeExitRequested(uint256 _validatorId); -``` - diff --git a/docs/src/src/LiquidityPool.sol/contract.LiquidityPool.md b/docs/src/src/LiquidityPool.sol/contract.LiquidityPool.md deleted file mode 100644 index eb84e23a1..000000000 --- a/docs/src/src/LiquidityPool.sol/contract.LiquidityPool.md +++ /dev/null @@ -1,104 +0,0 @@ -# LiquidityPool -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/LiquidityPool.sol) - -**Inherits:** -Ownable - - -## State Variables -### eETH - -```solidity -address public eETH; -``` - - -## Functions -### constructor - -initializes owner address - - -```solidity -constructor(); -``` - -### setTokenAddress - -sets the contract address for eETH - -*can't do it in constructor due to circular dependencies* - - -```solidity -function setTokenAddress(address _eETH) external; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_eETH`|`address`|address of eETH contract| - - -### deposit - -deposit into pool - -*mints the amount of eTH 1:1 with ETH sent* - - -```solidity -function deposit() external payable; -``` - -### withdraw - -withdraw from pool - -*Burns user balance from msg.senders account & Sends equal amount of ETH back to user* - - -```solidity -function withdraw(uint256 _amount) external payable; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_amount`|`uint256`|the amount to withdraw from contract| - - -### receive - -Allows ether to be sent to this contract - - -```solidity -receive() external payable; -``` - -## Events -### Received - -```solidity -event Received(address indexed sender, uint256 value); -``` - -### TokenAddressChanged - -```solidity -event TokenAddressChanged(address indexed newAddress); -``` - -### Deposit - -```solidity -event Deposit(address indexed sender, uint256 amount); -``` - -### Withdraw - -```solidity -event Withdraw(address indexed sender, uint256 amount); -``` - diff --git a/docs/src/src/NodeOperatorManager.sol/contract.NodeOperatorManager.md b/docs/src/src/NodeOperatorManager.sol/contract.NodeOperatorManager.md deleted file mode 100644 index 0b581a179..000000000 --- a/docs/src/src/NodeOperatorManager.sol/contract.NodeOperatorManager.md +++ /dev/null @@ -1,142 +0,0 @@ -# NodeOperatorManager -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/NodeOperatorManager.sol) - -**Inherits:** -[INodeOperatorManager](/src/interfaces/INodeOperatorManager.sol/interface.INodeOperatorManager.md), Ownable - -TODO Test whitelist bidding in auction -TODO Test permissionless bidding in auction - - -## State Variables -### auctionManagerContractAddress - -```solidity -address public auctionManagerContractAddress; -``` - - -### auctionMangerInterface - -```solidity -IAuctionManager auctionMangerInterface; -``` - - -### auctionContractAddress - -```solidity -address auctionContractAddress; -``` - - -### merkleRoot - -```solidity -bytes32 public merkleRoot; -``` - - -### addressToOperatorData - -```solidity -mapping(address => KeyData) public addressToOperatorData; -``` - - -### whitelistedAddresses - -```solidity -mapping(address => bool) private whitelistedAddresses; -``` - - -## Functions -### registerNodeOperator - - -```solidity -function registerNodeOperator(bytes32[] calldata _merkleProof, bytes memory _ipfsHash, uint64 _totalKeys) public; -``` - -### fetchNextKeyIndex - - -```solidity -function fetchNextKeyIndex(address _user) external onlyAuctionManagerContract returns (uint64); -``` - -### updateMerkleRoot - -Updates the merkle root whitelists have been updated - -*merkleroot gets generated in JS offline and sent to the contract* - - -```solidity -function updateMerkleRoot(bytes32 _newMerkle) external onlyOwner; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_newMerkle`|`bytes32`|new merkle root to be used for bidding| - - -### getUserTotalKeys - - -```solidity -function getUserTotalKeys(address _user) external view returns (uint64 totalKeys); -``` - -### getNumKeysRemaining - - -```solidity -function getNumKeysRemaining(address _user) external view returns (uint64 numKeysRemaining); -``` - -### isWhitelisted - - -```solidity -function isWhitelisted(address _user) public view returns (bool whitelisted); -``` - -### setAuctionContractAddress - - -```solidity -function setAuctionContractAddress(address _auctionContractAddress) public onlyOwner; -``` - -### _verifyWhitelistedAddress - - -```solidity -function _verifyWhitelistedAddress(address _user, bytes32[] calldata _merkleProof) - internal - returns (bool whitelisted); -``` - -### onlyAuctionManagerContract - - -```solidity -modifier onlyAuctionManagerContract(); -``` - -## Events -### OperatorRegistered - -```solidity -event OperatorRegistered(uint64 totalKeys, uint64 keysUsed, bytes ipfsHash); -``` - -### MerkleUpdated - -```solidity -event MerkleUpdated(bytes32 oldMerkle, bytes32 indexed newMerkle); -``` - diff --git a/docs/src/src/ProtocolRevenueManager.sol/contract.ProtocolRevenueManager.md b/docs/src/src/ProtocolRevenueManager.sol/contract.ProtocolRevenueManager.md deleted file mode 100644 index ddbe70d2e..000000000 --- a/docs/src/src/ProtocolRevenueManager.sol/contract.ProtocolRevenueManager.md +++ /dev/null @@ -1,163 +0,0 @@ -# ProtocolRevenueManager -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/ProtocolRevenueManager.sol) - -**Inherits:** -[IProtocolRevenueManager](/src/interfaces/IProtocolRevenueManager.sol/interface.IProtocolRevenueManager.md), Pausable - - -## State Variables -### owner - -```solidity -address public owner; -``` - - -### etherFiNodesManager - -```solidity -IEtherFiNodesManager etherFiNodesManager; -``` - - -### auctionManager - -```solidity -IAuctionManager auctionManager; -``` - - -### globalRevenueIndex - -```solidity -uint256 public globalRevenueIndex = 1; -``` - - -### vestedAuctionFeeSplitForStakers - -```solidity -uint256 public constant vestedAuctionFeeSplitForStakers = 50; -``` - - -### auctionFeeVestingPeriodForStakersInDays - -```solidity -uint256 public constant auctionFeeVestingPeriodForStakersInDays = 6 * 7 * 4; -``` - - -## Functions -### constructor - -Constructor to set variables on deployment - - -```solidity -constructor(); -``` - -### pauseContract - - -```solidity -function pauseContract() external onlyOwner; -``` - -### unPauseContract - - -```solidity -function unPauseContract() external onlyOwner; -``` - -### receive - -All of the received Ether is shared to all validators! Cool! - - -```solidity -receive() external payable; -``` - -### addAuctionRevenue - -add the revenue from the auction fee paid by the node operator for the corresponding validator - - -```solidity -function addAuctionRevenue(uint256 _validatorId) external payable onlyAuctionManager; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|the validator ID| - - -### distributeAuctionRevenue - -Distribute the accrued rewards to the validator - - -```solidity -function distributeAuctionRevenue(uint256 _validatorId) external onlyEtherFiNodesManager returns (uint256); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|id of the validator| - - -### setEtherFiNodesManagerAddress - - -```solidity -function setEtherFiNodesManagerAddress(address _etherFiNodesManager) external onlyOwner; -``` - -### setAuctionManagerAddress - - -```solidity -function setAuctionManagerAddress(address _auctionManager) external onlyOwner; -``` - -### getAccruedAuctionRevenueRewards - -Compute the accrued rewards for a validator - - -```solidity -function getAccruedAuctionRevenueRewards(uint256 _validatorId) public view returns (uint256); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|id of the validator| - - -### onlyOwner - - -```solidity -modifier onlyOwner(); -``` - -### onlyEtherFiNodesManager - - -```solidity -modifier onlyEtherFiNodesManager(); -``` - -### onlyAuctionManager - - -```solidity -modifier onlyAuctionManager(); -``` - diff --git a/docs/src/src/README.md b/docs/src/src/README.md deleted file mode 100644 index a9af2f7ea..000000000 --- a/docs/src/src/README.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# Contents -- [interfaces](/src/interfaces) -- [AuctionManager](AuctionManager.sol/contract.AuctionManager.md) -- [BNFT](BNFT.sol/contract.BNFT.md) -- [ConversionPool](ClaimReceiverPool.sol/contract.ConversionPool.md) -- [EETH](EETH.sol/contract.EETH.md) -- [EarlyAdopterPool](EarlyAdopterPool.sol/contract.EarlyAdopterPool.md) -- [EtherFiNode](EtherFiNode.sol/contract.EtherFiNode.md) -- [EtherFiNodesManager](EtherFiNodesManager.sol/contract.EtherFiNodesManager.md) -- [LiquidityPool](LiquidityPool.sol/contract.LiquidityPool.md) -- [NodeOperatorManager](NodeOperatorManager.sol/contract.NodeOperatorManager.md) -- [ProtocolRevenueManager](ProtocolRevenueManager.sol/contract.ProtocolRevenueManager.md) -- [StakingManager](StakingManager.sol/contract.StakingManager.md) -- [TNFT](TNFT.sol/contract.TNFT.md) -- [Treasury](Treasury.sol/contract.Treasury.md) diff --git a/docs/src/src/StakingManager.sol/contract.StakingManager.md b/docs/src/src/StakingManager.sol/contract.StakingManager.md deleted file mode 100644 index 2a3bf9169..000000000 --- a/docs/src/src/StakingManager.sol/contract.StakingManager.md +++ /dev/null @@ -1,349 +0,0 @@ -# StakingManager -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/StakingManager.sol) - -**Inherits:** -[IStakingManager](/src/interfaces/IStakingManager.sol/interface.IStakingManager.md), Ownable, Pausable, ReentrancyGuard - - -## State Variables -### test -*please remove before mainnet deployment* - - -```solidity -bool public test = true; -``` - - -### maxBatchDepositSize - -```solidity -uint256 public maxBatchDepositSize = 16; -``` - - -### TNFTInterfaceInstance - -```solidity -ITNFT public TNFTInterfaceInstance; -``` - - -### BNFTInterfaceInstance - -```solidity -IBNFT public BNFTInterfaceInstance; -``` - - -### auctionInterfaceInstance - -```solidity -IAuctionManager public auctionInterfaceInstance; -``` - - -### depositContractEth2 - -```solidity -IDepositContract public depositContractEth2; -``` - - -### nodesManagerIntefaceInstance - -```solidity -IEtherFiNodesManager public nodesManagerIntefaceInstance; -``` - - -### protocolRevenueManager - -```solidity -IProtocolRevenueManager protocolRevenueManager; -``` - - -### stakeAmount - -```solidity -uint256 public stakeAmount; -``` - - -### treasuryAddress - -```solidity -address public treasuryAddress; -``` - - -### auctionAddress - -```solidity -address public auctionAddress; -``` - - -### nodesManagerAddress - -```solidity -address public nodesManagerAddress; -``` - - -### tnftContractAddress - -```solidity -address public tnftContractAddress; -``` - - -### bnftContractAddress - -```solidity -address public bnftContractAddress; -``` - - -### bidIdToStaker - -```solidity -mapping(uint256 => address) public bidIdToStaker; -``` - - -## Functions -### constructor - -Constructor to set variables on deployment - -*Deploys NFT contracts internally to ensure ownership is set to this contract* - -*AuctionManager contract must be deployed first* - - -```solidity -constructor(address _auctionAddress); -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_auctionAddress`|`address`|the address of the auction contract for interaction| - - -### switchMode - -Switches the deposit mode of the contract - -*Used for testing purposes. WILL BE DELETED BEFORE MAINNET DEPLOYMENT* - - -```solidity -function switchMode() public; -``` - -### registerTnftContract - - -```solidity -function registerTnftContract() private returns (address); -``` - -### registerBnftContract - - -```solidity -function registerBnftContract() private returns (address); -``` - -### batchDepositWithBidIds - - -```solidity -function batchDepositWithBidIds(uint256[] calldata _candidateBidIds) - external - payable - whenNotPaused - correctStakeAmount - nonReentrant - returns (uint256[] memory); -``` - -### registerValidator - -Creates validator object, mints NFTs, sets NB variables and deposits into beacon chain - - -```solidity -function registerValidator(uint256 _validatorId, DepositData calldata _depositData) public whenNotPaused; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|id of the validator to register| -|`_depositData`|`DepositData`|data structure to hold all data needed for depositing to the beacon chain| - - -### batchRegisterValidators - -Creates validator object, mints NFTs, sets NB variables and deposits into beacon chain - - -```solidity -function batchRegisterValidators(uint256[] calldata _validatorId, DepositData[] calldata _depositData) - public - whenNotPaused; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256[]`|id of the validator to register| -|`_depositData`|`DepositData[]`|data structure to hold all data needed for depositing to the beacon chain| - - -### cancelDeposit - -Cancels a users stake - -*Only allowed to be cancelled before step 2 of the depositing process* - - -```solidity -function cancelDeposit(uint256 _validatorId) public whenNotPaused; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_validatorId`|`uint256`|the ID of the validator deposit to cancel| - - -### fetchEtherFromContract - -Allows withdrawal of funds from contract - -*Will be removed in final version* - - -```solidity -function fetchEtherFromContract(address _wallet) public onlyOwner; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_wallet`|`address`|the address to send the funds to| - - -### setEtherFiNodesManagerAddress - - -```solidity -function setEtherFiNodesManagerAddress(address _nodesManagerAddress) public onlyOwner; -``` - -### setTreasuryAddress - - -```solidity -function setTreasuryAddress(address _treasuryAddress) public onlyOwner; -``` - -### setProtocolRevenueManager - - -```solidity -function setProtocolRevenueManager(address _protocolRevenueManager) public onlyOwner; -``` - -### setMaxBatchDepositSize - - -```solidity -function setMaxBatchDepositSize(uint256 _newMaxBatchDepositSize) public onlyOwner; -``` - -### pauseContract - - -```solidity -function pauseContract() external onlyOwner; -``` - -### unPauseContract - - -```solidity -function unPauseContract() external onlyOwner; -``` - -### uncheckedInc - - -```solidity -function uncheckedInc(uint256 x) private pure returns (uint256); -``` - -### processDeposit - -Update the state of the contract now that a deposit has been made - - -```solidity -function processDeposit(uint256 _bidId) internal; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_bidId`|`uint256`|the bid that won the right to the deposit| - - -### _refundDeposit - -Refunds the depositor their staked ether for a specific stake - -*Gets called internally from cancelStakingManager or when the time runs out for calling registerValidator* - - -```solidity -function _refundDeposit(address _depositOwner, uint256 _amount) internal; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`_depositOwner`|`address`|address of the user being refunded| -|`_amount`|`uint256`|the amount to refund the depositor| - - -### correctStakeAmount - - -```solidity -modifier correctStakeAmount(); -``` - -## Events -### StakeDeposit - -```solidity -event StakeDeposit(address indexed staker, uint256 bidId, address withdrawSafe); -``` - -### DepositCancelled - -```solidity -event DepositCancelled(uint256 id); -``` - -### ValidatorRegistered - -```solidity -event ValidatorRegistered(address indexed operator, uint256 validatorId, string ipfsHashForEncryptedValidatorKey); -``` - diff --git a/docs/src/src/TNFT.sol/contract.TNFT.md b/docs/src/src/TNFT.sol/contract.TNFT.md deleted file mode 100644 index 14b9f6c8d..000000000 --- a/docs/src/src/TNFT.sol/contract.TNFT.md +++ /dev/null @@ -1,51 +0,0 @@ -# TNFT -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/TNFT.sol) - -**Inherits:** -ERC721 - - -## State Variables -### tokenIds - -```solidity -uint256 private tokenIds; -``` - - -### nftValue - -```solidity -uint256 public nftValue; -``` - - -### stakingManagerContractAddress - -```solidity -address public stakingManagerContractAddress; -``` - - -## Functions -### constructor - - -```solidity -constructor() ERC721("Transferrable NFT", "TNFT"); -``` - -### mint - - -```solidity -function mint(address _reciever, uint256 _validatorId) external onlyStakingManagerContract; -``` - -### onlyStakingManagerContract - - -```solidity -modifier onlyStakingManagerContract(); -``` - diff --git a/docs/src/src/Treasury.sol/contract.Treasury.md b/docs/src/src/Treasury.sol/contract.Treasury.md deleted file mode 100644 index 6fdd42d59..000000000 --- a/docs/src/src/Treasury.sol/contract.Treasury.md +++ /dev/null @@ -1,24 +0,0 @@ -# Treasury -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/Treasury.sol) - -**Inherits:** -[ITreasury](/src/interfaces/ITreasury.sol/interface.ITreasury.md), Ownable - - -## Functions -### withdraw - -Function allows only the owner to withdraw all the funds in the contract - - -```solidity -function withdraw(uint256 _amount) external onlyOwner; -``` - -### receive - - -```solidity -receive() external payable; -``` - diff --git a/docs/src/src/interfaces/IAuctionManager.sol/interface.IAuctionManager.md b/docs/src/src/interfaces/IAuctionManager.sol/interface.IAuctionManager.md deleted file mode 100644 index b4f5ca50b..000000000 --- a/docs/src/src/interfaces/IAuctionManager.sol/interface.IAuctionManager.md +++ /dev/null @@ -1,87 +0,0 @@ -# IAuctionManager -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/IAuctionManager.sol) - - -## Functions -### createBid - - -```solidity -function createBid(uint256 _bidSize, uint256 _bidAmount) external payable returns (uint256[] memory); -``` - -### updateSelectedBidInformation - - -```solidity -function updateSelectedBidInformation(uint256 _bidId) external; -``` - -### cancelBid - - -```solidity -function cancelBid(uint256 _bidId) external; -``` - -### getBidOwner - - -```solidity -function getBidOwner(uint256 _bidId) external view returns (address); -``` - -### reEnterAuction - - -```solidity -function reEnterAuction(uint256 _bidId) external; -``` - -### setStakingManagerContractAddress - - -```solidity -function setStakingManagerContractAddress(address _stakingManagerContractAddress) external; -``` - -### processAuctionFeeTransfer - - -```solidity -function processAuctionFeeTransfer(uint256 _validatorId) external; -``` - -### isBidActive - - -```solidity -function isBidActive(uint256 _bidId) external view returns (bool); -``` - -### numberOfActiveBids - - -```solidity -function numberOfActiveBids() external view returns (uint256); -``` - -### setProtocolRevenueManager - - -```solidity -function setProtocolRevenueManager(address _protocolRevenueManager) external; -``` - -## Structs -### Bid - -```solidity -struct Bid { - uint256 amount; - uint64 bidderPubKeyIndex; - address bidderAddress; - bool isActive; -} -``` - diff --git a/docs/src/src/interfaces/IBNFT.sol/interface.IBNFT.md b/docs/src/src/interfaces/IBNFT.sol/interface.IBNFT.md deleted file mode 100644 index 7ff6cee7f..000000000 --- a/docs/src/src/interfaces/IBNFT.sol/interface.IBNFT.md +++ /dev/null @@ -1,12 +0,0 @@ -# IBNFT -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/IBNFT.sol) - - -## Functions -### mint - - -```solidity -function mint(address _reciever, uint256 _validatorId) external; -``` - diff --git a/docs/src/src/interfaces/IDepositContract.sol/interface.IDepositContract.md b/docs/src/src/interfaces/IDepositContract.sol/interface.IDepositContract.md deleted file mode 100644 index 7052ba357..000000000 --- a/docs/src/src/interfaces/IDepositContract.sol/interface.IDepositContract.md +++ /dev/null @@ -1,71 +0,0 @@ -# IDepositContract -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/IDepositContract.sol) - -This is the Ethereum 2.0 deposit contract interface. -For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs -https://github.com/ethereum/eth2.0-specs/blob/dev/solidity_deposit_contract/deposit_contract.sol - - -## Functions -### deposit - -Submit a Phase 0 DepositData object. - - -```solidity -function deposit( - bytes calldata pubkey, - bytes calldata withdrawal_credentials, - bytes calldata signature, - bytes32 deposit_data_root -) external payable; -``` -**Parameters** - -|Name|Type|Description| -|----|----|-----------| -|`pubkey`|`bytes`|A BLS12-381 public key.| -|`withdrawal_credentials`|`bytes`|Commitment to a public key for withdrawals.| -|`signature`|`bytes`|A BLS12-381 signature.| -|`deposit_data_root`|`bytes32`|The SHA-256 hash of the SSZ-encoded DepositData object. Used as a protection against malformed input.| - - -### get_deposit_root - -Query the current deposit root hash. - - -```solidity -function get_deposit_root() external view returns (bytes32); -``` -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes32`|The deposit root hash.| - - -### get_deposit_count - -Query the current deposit count. - - -```solidity -function get_deposit_count() external view returns (bytes memory); -``` -**Returns** - -|Name|Type|Description| -|----|----|-----------| -|``|`bytes`|The deposit count encoded as a little endian 64-bit number.| - - -## Events -### DepositEvent -A processed deposit event. - - -```solidity -event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index); -``` - diff --git a/docs/src/src/interfaces/IEETH.sol/interface.IEETH.md b/docs/src/src/interfaces/IEETH.sol/interface.IEETH.md deleted file mode 100644 index d01faeaa7..000000000 --- a/docs/src/src/interfaces/IEETH.sol/interface.IEETH.md +++ /dev/null @@ -1,19 +0,0 @@ -# IEETH -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/IEETH.sol) - - -## Functions -### mint - - -```solidity -function mint(address _account, uint256 _amount) external; -``` - -### burn - - -```solidity -function burn(address _account, uint256 _amount) external; -``` - diff --git a/docs/src/src/interfaces/IEtherFiNode.sol/interface.IEtherFiNode.md b/docs/src/src/interfaces/IEtherFiNode.sol/interface.IEtherFiNode.md deleted file mode 100644 index ee797d920..000000000 --- a/docs/src/src/interfaces/IEtherFiNode.sol/interface.IEtherFiNode.md +++ /dev/null @@ -1,205 +0,0 @@ -# IEtherFiNode -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/IEtherFiNode.sol) - - -## Functions -### phase - - -```solidity -function phase() external view returns (VALIDATOR_PHASE); -``` - -### ipfsHashForEncryptedValidatorKey - - -```solidity -function ipfsHashForEncryptedValidatorKey() external view returns (string memory); -``` - -### localRevenueIndex - - -```solidity -function localRevenueIndex() external view returns (uint256); -``` - -### stakingStartTimestamp - - -```solidity -function stakingStartTimestamp() external view returns (uint32); -``` - -### exitRequestTimestamp - - -```solidity -function exitRequestTimestamp() external view returns (uint32); -``` - -### exitTimestamp - - -```solidity -function exitTimestamp() external view returns (uint32); -``` - -### vestedAuctionRewards - - -```solidity -function vestedAuctionRewards() external view returns (uint256); -``` - -### getNonExitPenalty - - -```solidity -function getNonExitPenalty(uint256 _principal, uint256 _dailyPenalty, uint32 _endTimestamp) - external - view - returns (uint256); -``` - -### calculatePayouts - - -```solidity -function calculatePayouts(uint256 _totalAmount, IEtherFiNodesManager.RewardsSplit memory _splits, uint256 _scale) - external - view - returns (uint256, uint256, uint256, uint256); -``` - -### getStakingRewardsPayouts - - -```solidity -function getStakingRewardsPayouts(IEtherFiNodesManager.RewardsSplit memory _splits, uint256 _scale) - external - view - returns (uint256, uint256, uint256, uint256); -``` - -### getProtocolRewards - - -```solidity -function getProtocolRewards(IEtherFiNodesManager.RewardsSplit memory _splits, uint256 _scale) - external - view - returns (uint256, uint256, uint256, uint256); -``` - -### getRewardsPayouts - - -```solidity -function getRewardsPayouts( - bool _stakingRewards, - bool _protocolRewards, - bool _vestedAuctionFee, - IEtherFiNodesManager.RewardsSplit memory _SRsplits, - uint256 _SRscale, - IEtherFiNodesManager.RewardsSplit memory _PRsplits, - uint256 _PRscale -) external view returns (uint256, uint256, uint256, uint256); -``` - -### getFullWithdrawalPayouts - - -```solidity -function getFullWithdrawalPayouts( - IEtherFiNodesManager.RewardsSplit memory _splits, - uint256 _scale, - uint256 _principal, - uint256 _dailyPenalty -) external view returns (uint256, uint256, uint256, uint256); -``` - -### setPhase - - -```solidity -function setPhase(VALIDATOR_PHASE _phase) external; -``` - -### setIpfsHashForEncryptedValidatorKey - - -```solidity -function setIpfsHashForEncryptedValidatorKey(string calldata _ipfs) external; -``` - -### setLocalRevenueIndex - - -```solidity -function setLocalRevenueIndex(uint256 _localRevenueIndex) external payable; -``` - -### setExitRequestTimestamp - - -```solidity -function setExitRequestTimestamp() external; -``` - -### markExited - - -```solidity -function markExited(uint32 _exitTimestamp) external; -``` - -### receiveVestedRewardsForStakers - - -```solidity -function receiveVestedRewardsForStakers() external payable; -``` - -### processVestedAuctionFeeWithdrawal - - -```solidity -function processVestedAuctionFeeWithdrawal() external; -``` - -### moveRewardsToManager - - -```solidity -function moveRewardsToManager(uint256 _amount) external; -``` - -### withdrawFunds - - -```solidity -function withdrawFunds( - address _treasury, - uint256 _treasuryAmount, - address _operator, - uint256 _operatorAmount, - address _tnftHolder, - uint256 _tnftAmount, - address _bnftHolder, - uint256 _bnftAmount -) external; -``` - -## Enums -### VALIDATOR_PHASE - -```solidity -enum VALIDATOR_PHASE { - STAKE_DEPOSITED, - LIVE, - EXITED, - CANCELLED -} -``` - diff --git a/docs/src/src/interfaces/IEtherFiNodesManager.sol/interface.IEtherFiNodesManager.md b/docs/src/src/interfaces/IEtherFiNodesManager.sol/interface.IEtherFiNodesManager.md deleted file mode 100644 index e8c03fcb1..000000000 --- a/docs/src/src/interfaces/IEtherFiNodesManager.sol/interface.IEtherFiNodesManager.md +++ /dev/null @@ -1,240 +0,0 @@ -# IEtherFiNodesManager -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/IEtherFiNodesManager.sol) - - -## Functions -### numberOfValidators - - -```solidity -function numberOfValidators() external view returns (uint256); -``` - -### etherfiNodeAddress - - -```solidity -function etherfiNodeAddress(uint256 _validatorId) external view returns (address); -``` - -### phase - - -```solidity -function phase(uint256 _validatorId) external view returns (IEtherFiNode.VALIDATOR_PHASE phase); -``` - -### ipfsHashForEncryptedValidatorKey - - -```solidity -function ipfsHashForEncryptedValidatorKey(uint256 _validatorId) external view returns (string memory); -``` - -### localRevenueIndex - - -```solidity -function localRevenueIndex(uint256 _validatorId) external returns (uint256); -``` - -### vestedAuctionRewards - - -```solidity -function vestedAuctionRewards(uint256 _validatorId) external returns (uint256); -``` - -### generateWithdrawalCredentials - - -```solidity -function generateWithdrawalCredentials(address _address) external view returns (bytes memory); -``` - -### getWithdrawalCredentials - - -```solidity -function getWithdrawalCredentials(uint256 _validatorId) external view returns (bytes memory); -``` - -### isExitRequested - - -```solidity -function isExitRequested(uint256 _validatorId) external view returns (bool); -``` - -### isExited - - -```solidity -function isExited(uint256 _validatorId) external view returns (bool); -``` - -### getNonExitPenalty - - -```solidity -function getNonExitPenalty(uint256 _validatorId, uint32 _endTimestamp) external view returns (uint256); -``` - -### getStakingRewardsPayouts - - -```solidity -function getStakingRewardsPayouts(uint256 _validatorId) external view returns (uint256, uint256, uint256, uint256); -``` - -### getRewardsPayouts - - -```solidity -function getRewardsPayouts(uint256 _validatorId, bool _stakingRewards, bool _protocolRewards, bool _vestedAuctionFee) - external - view - returns (uint256, uint256, uint256, uint256); -``` - -### getFullWithdrawalPayouts - - -```solidity -function getFullWithdrawalPayouts(uint256 _validatorId) external view returns (uint256, uint256, uint256, uint256); -``` - -### incrementNumberOfValidators - - -```solidity -function incrementNumberOfValidators(uint256 _count) external; -``` - -### createEtherfiNode - - -```solidity -function createEtherfiNode(uint256 _validatorId) external returns (address); -``` - -### registerEtherFiNode - - -```solidity -function registerEtherFiNode(uint256 _validatorId, address _address) external; -``` - -### unregisterEtherFiNode - - -```solidity -function unregisterEtherFiNode(uint256 _validatorId) external; -``` - -### setEtherFiNodePhase - - -```solidity -function setEtherFiNodePhase(uint256 _validatorId, IEtherFiNode.VALIDATOR_PHASE _phase) external; -``` - -### setEtherFiNodeIpfsHashForEncryptedValidatorKey - - -```solidity -function setEtherFiNodeIpfsHashForEncryptedValidatorKey(uint256 _validatorId, string calldata _ipfs) external; -``` - -### setEtherFiNodeLocalRevenueIndex - - -```solidity -function setEtherFiNodeLocalRevenueIndex(uint256 _validatorId, uint256 _localRevenueIndex) external payable; -``` - -### sendExitRequest - - -```solidity -function sendExitRequest(uint256 _validatorId) external; -``` - -### processNodeExit - - -```solidity -function processNodeExit(uint256[] calldata _validatorIds, uint32[] calldata _exitTimestamp) external; -``` - -### partialWithdraw - - -```solidity -function partialWithdraw(uint256 _validatorId, bool _stakingRewards, bool _protocolRewards, bool _vestedAuctionFee) - external; -``` - -### partialWithdraw - - -```solidity -function partialWithdraw( - uint256[] calldata _validatorIds, - bool _stakingRewards, - bool _protocolRewards, - bool _vestedAuctionFee -) external; -``` - -### partialWithdrawBatchGroupByOperator - - -```solidity -function partialWithdrawBatchGroupByOperator( - address _operator, - uint256[] memory _validatorIds, - bool _stakingRewards, - bool _protocolRewards, - bool _vestedAuctionFee -) external; -``` - -### fullWithdraw - - -```solidity -function fullWithdraw(uint256 _validatorId) external; -``` - -### fullWithdrawBatch - - -```solidity -function fullWithdrawBatch(uint256[] calldata _validatorIds) external; -``` - -## Structs -### RewardsSplit - -```solidity -struct RewardsSplit { - uint64 treasury; - uint64 nodeOperator; - uint64 tnft; - uint64 bnft; -} -``` - -## Enums -### ValidatorRecipientType - -```solidity -enum ValidatorRecipientType { - TNFTHOLDER, - BNFTHOLDER, - TREASURY, - OPERATOR -} -``` - diff --git a/docs/src/src/interfaces/INodeOperatorManager.sol/interface.INodeOperatorManager.md b/docs/src/src/interfaces/INodeOperatorManager.sol/interface.INodeOperatorManager.md deleted file mode 100644 index 577a13c1f..000000000 --- a/docs/src/src/interfaces/INodeOperatorManager.sol/interface.INodeOperatorManager.md +++ /dev/null @@ -1,51 +0,0 @@ -# INodeOperatorManager -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/INodeOperatorManager.sol) - - -## Functions -### registerNodeOperator - - -```solidity -function registerNodeOperator(bytes32[] calldata _merkleProof, bytes memory ipfsHash, uint64 totalKeys) external; -``` - -### fetchNextKeyIndex - - -```solidity -function fetchNextKeyIndex(address _user) external returns (uint64); -``` - -### getUserTotalKeys - - -```solidity -function getUserTotalKeys(address _user) external view returns (uint64 totalKeys); -``` - -### getNumKeysRemaining - - -```solidity -function getNumKeysRemaining(address _user) external view returns (uint64 numKeysRemaining); -``` - -### isWhitelisted - - -```solidity -function isWhitelisted(address _user) external view returns (bool whitelisted); -``` - -## Structs -### KeyData - -```solidity -struct KeyData { - uint64 totalKeys; - uint64 keysUsed; - bytes ipfsHash; -} -``` - diff --git a/docs/src/src/interfaces/IProtocolRevenueManager.sol/interface.IProtocolRevenueManager.md b/docs/src/src/interfaces/IProtocolRevenueManager.sol/interface.IProtocolRevenueManager.md deleted file mode 100644 index b0a385e51..000000000 --- a/docs/src/src/interfaces/IProtocolRevenueManager.sol/interface.IProtocolRevenueManager.md +++ /dev/null @@ -1,59 +0,0 @@ -# IProtocolRevenueManager -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/IProtocolRevenueManager.sol) - - -## Functions -### globalRevenueIndex - - -```solidity -function globalRevenueIndex() external view returns (uint256); -``` - -### auctionFeeVestingPeriodForStakersInDays - - -```solidity -function auctionFeeVestingPeriodForStakersInDays() external view returns (uint256); -``` - -### addAuctionRevenue - - -```solidity -function addAuctionRevenue(uint256 _validatorId) external payable; -``` - -### distributeAuctionRevenue - - -```solidity -function distributeAuctionRevenue(uint256 _validatorId) external returns (uint256); -``` - -### setEtherFiNodesManagerAddress - - -```solidity -function setEtherFiNodesManagerAddress(address _etherFiNodesManager) external; -``` - -### getAccruedAuctionRevenueRewards - - -```solidity -function getAccruedAuctionRevenueRewards(uint256 _validatorId) external returns (uint256); -``` - -## Structs -### AuctionRevenueSplit - -```solidity -struct AuctionRevenueSplit { - uint64 treasurySplit; - uint64 nodeOperatorSplit; - uint64 tnftHolderSplit; - uint64 bnftHolderSplit; -} -``` - diff --git a/docs/src/src/interfaces/IStakingManager.sol/interface.IStakingManager.md b/docs/src/src/interfaces/IStakingManager.sol/interface.IStakingManager.md deleted file mode 100644 index 9896b17de..000000000 --- a/docs/src/src/interfaces/IStakingManager.sol/interface.IStakingManager.md +++ /dev/null @@ -1,73 +0,0 @@ -# IStakingManager -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/IStakingManager.sol) - - -## Functions -### cancelDeposit - - -```solidity -function cancelDeposit(uint256 _validatorId) external; -``` - -### registerValidator - - -```solidity -function registerValidator(uint256 _validatorId, DepositData calldata _depositData) external; -``` - -### fetchEtherFromContract - - -```solidity -function fetchEtherFromContract(address _wallet) external; -``` - -### bidIdToStaker - - -```solidity -function bidIdToStaker(uint256 id) external view returns (address); -``` - -### stakeAmount - - -```solidity -function stakeAmount() external view returns (uint256); -``` - -### setEtherFiNodesManagerAddress - - -```solidity -function setEtherFiNodesManagerAddress(address _managerAddress) external; -``` - -### batchDepositWithBidIds - - -```solidity -function batchDepositWithBidIds(uint256[] calldata _candidateBidIds) external payable returns (uint256[] memory); -``` - -### setProtocolRevenueManager - - -```solidity -function setProtocolRevenueManager(address _protocolRevenueManager) external; -``` - -## Structs -### DepositData - -```solidity -struct DepositData { - bytes publicKey; - bytes signature; - bytes32 depositDataRoot; - string ipfsHashForEncryptedValidatorKey; -} -``` - diff --git a/docs/src/src/interfaces/ITNFT.sol/interface.ITNFT.md b/docs/src/src/interfaces/ITNFT.sol/interface.ITNFT.md deleted file mode 100644 index 61ce9f2a4..000000000 --- a/docs/src/src/interfaces/ITNFT.sol/interface.ITNFT.md +++ /dev/null @@ -1,12 +0,0 @@ -# ITNFT -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/ITNFT.sol) - - -## Functions -### mint - - -```solidity -function mint(address _reciever, uint256 _validatorId) external; -``` - diff --git a/docs/src/src/interfaces/ITreasury.sol/interface.ITreasury.md b/docs/src/src/interfaces/ITreasury.sol/interface.ITreasury.md deleted file mode 100644 index 32ad5f06a..000000000 --- a/docs/src/src/interfaces/ITreasury.sol/interface.ITreasury.md +++ /dev/null @@ -1,12 +0,0 @@ -# ITreasury -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/ITreasury.sol) - - -## Functions -### withdraw - - -```solidity -function withdraw(uint256 _amount) external; -``` - diff --git a/docs/src/src/interfaces/IWeth.sol/interface.IWETH.md b/docs/src/src/interfaces/IWeth.sol/interface.IWETH.md deleted file mode 100644 index 8b4259da1..000000000 --- a/docs/src/src/interfaces/IWeth.sol/interface.IWETH.md +++ /dev/null @@ -1,26 +0,0 @@ -# IWETH -[Git Source](https://github.com/GadzeFinance/dappContracts/blob/c722006f91e5a8b00322356d0c967de90bbae6e0/src/interfaces/IWeth.sol) - - -## Functions -### deposit - - -```solidity -function deposit() external payable; -``` - -### transfer - - -```solidity -function transfer(address to, uint256 value) external returns (bool); -``` - -### withdraw - - -```solidity -function withdraw(uint256) external; -``` - diff --git a/docs/src/src/interfaces/README.md b/docs/src/src/interfaces/README.md deleted file mode 100644 index 35a9eace6..000000000 --- a/docs/src/src/interfaces/README.md +++ /dev/null @@ -1,15 +0,0 @@ - - -# Contents -- [IAuctionManager](IAuctionManager.sol/interface.IAuctionManager.md) -- [IBNFT](IBNFT.sol/interface.IBNFT.md) -- [IDepositContract](IDepositContract.sol/interface.IDepositContract.md) -- [IEETH](IEETH.sol/interface.IEETH.md) -- [IEtherFiNode](IEtherFiNode.sol/interface.IEtherFiNode.md) -- [IEtherFiNodesManager](IEtherFiNodesManager.sol/interface.IEtherFiNodesManager.md) -- [INodeOperatorManager](INodeOperatorManager.sol/interface.INodeOperatorManager.md) -- [IProtocolRevenueManager](IProtocolRevenueManager.sol/interface.IProtocolRevenueManager.md) -- [IStakingManager](IStakingManager.sol/interface.IStakingManager.md) -- [ITNFT](ITNFT.sol/interface.ITNFT.md) -- [ITreasury](ITreasury.sol/interface.ITreasury.md) -- [IWETH](IWeth.sol/interface.IWETH.md) diff --git a/documentation/src/README.md b/documentation/src/README.md deleted file mode 100644 index 3b468fe31..000000000 --- a/documentation/src/README.md +++ /dev/null @@ -1,236 +0,0 @@ -# dappContracts - -Smart Contracts for Ether Fi dapp - -# EtherFi smart contracts setup - -## Get Started - -### Install Foundry - -```zsh -curl -L https://foundry.paradigm.xyz | bash -``` - -### Update Foundry - -```zsh -foundryup -``` - -### Install Submodules - -```zsh -git submodule update --init --recursive -``` - -### Formatter and Linter - -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. - -### Set your environment variables - -Check `.env.example` to see some of the environment variables you should have set in `.env` in order to run some of the commands. - -### Compile Project - -```zsh -forge build -``` - -### Run Project Tests - -```zsh -forge test -``` - -### Run Project Fork Tests - -```zsh -forge test --fork-url > -``` - -### Build Troubleshooting Tips - -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](https://www.rust-lang.org/tools/install) installed on your system and with it the accompanying package manager `cargo`. Once that is done, to install `svm` run the following command: - -```zsh -cargo install svm-rs -``` - -To list the available versions of solidity compiler run: - -```zsh -svm list -``` - -Make sure the version you need is in this list, or choose the closest one and install it: - -```zsh -svm install "0.7.6" -``` - -## Deployment Instructions - -### Update foundry.toml - -The foundry.toml file allows foundry to read which network it should deploy smart contracts to. It is here where you set this variable. For example (deploying to Goerli): - -```zsh -[rpc_endpoints] -goerli = "${GOERLI_RPC_URL}" - -[etherscan] -goerli = { key = "${ETHERSCAN_API_KEY}" } -``` - -The first part refers to the RPC endpoint to be used when deploying. You can get this through Alchemy or Infura. Simply create an account and create a new RPC endpoint, selecting the respective network you wish to deploy to. - -The second part relates to the etherscan API key that will be used for verifying the contracts on etherscan. If you prefer to keep your contracts unverified, this part can be skipped. To generate an API key, create an account on etherscan and select generate API key. - -### Updating env file - -Many variables used in deployment, such as the deployer private key, are advised to be kept private. An env file is a great way to achieve this. Make a copy of the .example.env file and create a new file called .env in the root directory. In this file, you will store your RPC endpoint, private key as well as etherscan api key. Fill in the required parameters in the .env to aid the deployment process. - -### Deploy Script - -The deploy script controls the actual deployment of the contracts to the specified network. The following part refers to the generation of the merkletree and merkle root: - -```zsh -Merkle merkle = new Merkle(); -bytes32[] memory data = new bytes32[](5); -data[0] = bytes32(keccak256( - abi.encodePacked(0x1c5fffDbFDE331A10Ab1e32da8c4Dff210B43145) - )); -data[1] = bytes32(keccak256( - abi.encodePacked(0x2f2806e8b288428f23707A69faA60f52BC565c17) - )); -data[2] = bytes32(keccak256( - abi.encodePacked(0x5dfb8BC4830ccF60d469D546aEC36531c97B96b5) - )); -data[3] = bytes32(keccak256( - abi.encodePacked(0x4507cfB4B077d5DBdDd520c701E30173d5b59Fad) - )); -data[4] = bytes32(keccak256( - abi.encodePacked(0xCd5EBC2dD4Cb3dc52ac66CEEcc72c838B40A5931) - )); - -bytes32 root = merkle.getRoot(data); -bytes32[] memory proofOne = merkle.getProof(data, 0); -bytes32[] memory proofTwo = merkle.getProof(data, 1); -bytes32[] memory proofThree = merkle.getProof(data, 2); -bytes32[] memory proofFour = merkle.getProof(data, 3); -bytes32[] memory proofFive = merkle.getProof(data, 4); -``` - -The above generates a bytes32 array holding five public addresses. If you want more or less, you can add and remove lines as you see fit. However it is important to update the following line accordingly: - -```zsh -bytes32[] memory data = new bytes32[](5); -``` - -Make sure the number in the ( ) corresponds to how many addresses are being whitelisted. - -The next set of code refers to the actual deployment of the contracts: - -```zsh -uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY"); -vm.startBroadcast(deployerPrivateKey); - -Treasury treasury = new Treasury(); -Auction auction = new Auction(address(treasury)); -Deposit deposit = new Deposit(address(auction)); -``` - -The first part of the above code retrieves the private key from the .env file and uses that address to deploy the contracts. The second part is the functionality of actually creating the new contracts. - -Once this is all populated, you can run the deploy function to perform the deployment to the provided network. When you ready, run the following command: - -```zsh -source .env -``` - -followed by: - -```zsh -forge script script/Deploy.s.sol:MyScript --rpc-url $GOERLI_RPC_URL --broadcast --verify -vvvv -``` - -This will run the deployment and verify the contracts on the provided network. It will print data to the terminal which will provide you with the relevant contract addresses and merkle proofs for each whitelisted address. - -### Inside your Foundry project working directory: - -Install Yarn or Node: - -```zsh -yarn or npm init -``` - -Install hardhat - -```zsh -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. - -```zsh -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. - -```zsh -forge remappings > remappings.txt -``` - -Now make the following changes to your Hardhat project. - -```zsh -yarn add hardhat-preprocessor --save-dev -``` - -```zsh -Add import "hardhat-preprocessor"; to your hardhat.config.ts file. -``` - -```zsh -Add import fs from "fs"; to your hardhat.config.ts file. -``` - -Add the following function to your hardhat.config.ts file. - -```zsh -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: - -```zsh -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", -}, -```