|  | 
| 2 | 2 | 
 | 
| 3 | 3 | :construction: CAUTION: This repo is currently under **heavy development!** :construction: | 
| 4 | 4 | 
 | 
|  | 5 | +We strongly advise you to work with **releases tags**. Please, check what version the SSVBasedApp.sol is using by calling `getVersion()`. | 
|  | 6 | + | 
|  | 7 | +  | 
|  | 8 | + | 
| 5 | 9 | [](https://github.com/ssvlabs/based-applications/actions/workflows/tests.yml) | 
| 6 | 10 | [](https://www.gnu.org/licenses/gpl-3.0.html) | 
| 7 | 11 | 
 | 
| @@ -61,94 +65,58 @@ __`❍ forge test`__ | 
| 61 | 65 | 
 | 
| 62 | 66 |   | 
| 63 | 67 | 
 | 
| 64 |  | -## 🔨 _Slashing Mechanism_ | 
| 65 |  | - | 
| 66 |  | -The `slash` function allows for the reduction of a strategy’s token balance under specific conditions, either as a penalty or to enforce protocol-defined behavior. Slashing can happen in two distinct modes, depending on whether: | 
| 67 |  | - | 
| 68 |  | -**1)** The bApp is a compliant smart contract; | 
| 69 |  | - | 
| 70 |  | -**2)** The bApp is a non-compliant smart contract or an EOA. | 
| 71 |  | - | 
| 72 |  | -### 🧠 Compliant BApp | 
| 73 |  | - | 
| 74 |  | -If the bApp is a compliant contract implementing the required interface `IBasedApp`, | 
| 75 |  | - | 
| 76 |  | -The slash function of the bApp is called: `(success, receiver, exit) = IBasedApp(bApp).slash(...)` | 
| 77 |  | - | 
| 78 |  | -*	`data` parameter is forwarded and may act as a proof or auxiliary input. | 
| 79 |  | - | 
| 80 |  | -*	The bApp decides: | 
| 81 |  | - | 
| 82 |  | -    *	Who receives the slashed funds by setting the `receiver` fund, it can burn by setting the receiver as `address(0)`; | 
| 83 |  | - | 
| 84 |  | -    *	Whether to exit the strategy or adjust obligations; | 
| 85 |  | - | 
| 86 |  | -    *	If `exit == true`, the strategy is exited and the obligation value is set to 0; | 
| 87 |  | - | 
| 88 |  | -    *	Otherwise, obligations are adjusted proportionally based on remaining balances, the new obligated amount is set to the previous one less the slashed amount; | 
| 89 |  | - | 
| 90 |  | -    *	Funds are credited to the receiver in the slashing fund. | 
|  | 68 | +## 🔨 _Slashing & Withdrawals Mechanisms_ | 
| 91 | 69 | 
 | 
| 92 |  | -### 🔐 Non-compliant bApp (EOA or Non-compliant Contract) | 
|  | 70 | +[Slashing & Withdrawals](./guides/slashing-and-withdrawals.md) | 
| 93 | 71 | 
 | 
| 94 |  | -If the bApp is an EOA or does not comply with the required interface: | 
|  | 72 | +[Generation pattern](./guides/generations.md) | 
| 95 | 73 | 
 | 
| 96 |  | -*	Only the bApp itself can invoke slashing; | 
|  | 74 | +## :gear: _Feature Activation_ | 
| 97 | 75 | 
 | 
| 98 |  | -*	The receiver of slashed funds is forcibly set to the bApp itself; | 
|  | 76 | +[Feature Activation](./guides/feature-activation.md) | 
| 99 | 77 | 
 | 
| 100 |  | -*	The strategy is always exited (no obligation adjustment); | 
|  | 78 | +## :page_facing_up: _Whitepaper_ | 
| 101 | 79 | 
 | 
| 102 |  | -*	Funds are added to the bApp’s slashing fund. | 
|  | 80 | +[Whitepaper](https://ssv.network/wp-content/uploads/2025/01/SSV2.0-Based-Applications-Protocol-1.pdf) | 
| 103 | 81 | 
 | 
| 104 |  | -### ⏳ Post Slashing | 
| 105 | 82 | 
 | 
| 106 |  | -⚠️ Important: After an obligation has been exited, it can be updated again to a value greater than 0, but only after a 14-day obligation timelock. | 
|  | 83 | +## :books: _More Resources_ | 
| 107 | 84 | 
 | 
| 108 |  | -This acts as a safeguard to prevent immediate re-entry and encourages more deliberate strategy participation. | 
|  | 85 | +[Based Apps Onboarding Guide](./guides/bApp-onboarding.md)  | 
| 109 | 86 | 
 | 
| 110 |  | -### 💸 Slashing Fund | 
| 111 | 87 | 
 | 
| 112 |  | -Slashed tokens are not immediately transferred. They are deposited into an internal slashing fund. | 
|  | 88 | +## :rocket: _Deployments_ | 
| 113 | 89 | 
 | 
| 114 |  | -The `receiver` (set during slashing) can later withdraw them using: | 
|  | 90 | +### How to Deploy | 
| 115 | 91 | 
 | 
| 116 |  | -``` | 
| 117 |  | -function withdrawSlashingFund(address token, uint256 amount) external | 
| 118 |  | -function withdrawETHSlashingFund(uint256 amount) external | 
| 119 |  | -``` | 
|  | 92 | +**2)** Set the environment variables in the `.env` file. | 
| 120 | 93 | 
 | 
| 121 |  | -These functions verify balances and authorize the caller to retrieve their accumulated slashed tokens. | 
|  | 94 | +**1)** Run the deployment script `DeployAllHoodi.s.sol` defined in `script/`: | 
| 122 | 95 | 
 | 
| 123 |  | -  | 
|  | 96 | +__`❍ npm run deploy:hoodi-stage`__: verification is done automatically. | 
| 124 | 97 | 
 | 
| 125 |  | -## :page_facing_up: _Whitepaper_ | 
|  | 98 | +### How to Update Module Contracts | 
| 126 | 99 | 
 | 
| 127 |  | -[Whitepaper](https://ssv.network/wp-content/uploads/2025/01/SSV2.0-Based-Applications-Protocol-1.pdf) | 
|  | 100 | +It is possible to update each one of the three modules: `StrategyManager`, `BasedAppsManager` and `ProtocolManager`. | 
| 128 | 101 | 
 | 
| 129 |  | -  | 
| 130 |  | - | 
| 131 |  | -## :books: _More Resources_ | 
|  | 102 | +It is possible to update multiple modules at the same time.  | 
| 132 | 103 | 
 | 
| 133 |  | -[Based Apps Onboarding Guide](./doc/bAppOnBoarding.md)  | 
|  | 104 | +**1)** Go on the Proxy Contract on Etherscan, under "Write as Proxy" call the function: | 
| 134 | 105 | 
 | 
| 135 |  | -  | 
|  | 106 | +__`❍ updateModules`__: specifying the correct module id and the new module address. | 
| 136 | 107 | 
 | 
| 137 |  | -## :rocket: _Deployments_ | 
| 138 |  | - | 
| 139 |  | -### How to Deploy | 
|  | 108 | +### How to Upgrade the Implementation Contract  | 
| 140 | 109 | 
 | 
| 141 |  | -**1)** Run the deployment script defined in `scripts/`: | 
|  | 110 | +**1)** Go on the Proxy Contract on Etherscan, under "Write as Proxy" call the function: | 
| 142 | 111 | 
 | 
| 143 |  | -__`❍ npm run deploy:holesky`__: verification is done automatically. | 
|  | 112 | +__`❍ upgradeToAndCall`__: specifying the new implementation address. The data field can be left empty in this case. | 
| 144 | 113 | 
 | 
| 145 |  | -__`❍ npm run deploy:hoodi`__: verification needs to be done manually for now. | 
| 146 | 114 | 
 | 
| 147 |  | -### Public Testnet | 
|  | 115 | +### Public Testnet Hoodi | 
| 148 | 116 | 
 | 
| 149 | 117 | | Name | Proxy | Implementation | Notes | | 
| 150 | 118 | | -------- | -------- | -------- | -------- |  | 
| 151 |  | -| [`BasedApplications`](https://github.com/ssvlabs/based-applications/blob/main/src/BasedAppManager.sol) | [`0x1Bd6ceB98Daf7FfEB590236b720F81b65213836A`](https://holesky.etherscan.io/address/0x1Bd6ceB98Daf7FfEB590236b720F81b65213836A) | [`0x9a09A49870353867b0ce9901B44E84C32B2A47AC`](https://holesky.etherscan.io/address/0x9a09A49870353867b0ce9901B44E84C32B2A47AC) | Proxy: [`[email protected]`](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v5.1.0/contracts/proxy/utils/UUPSUpgradeable.sol) | | 
|  | 119 | +| [`SSVBasedApps`](https://github.com/ssvlabs/based-applications/blob/main/src/BasedAppManager.sol) | [`<pending>`](https://holesky.etherscan.io/address/0x1Bd6ceB98Daf7FfEB590236b720F81b65213836A) | [`<pending>`](https://holesky.etherscan.io/address/0x9a09A49870353867b0ce9901B44E84C32B2A47AC) | Proxy: [`[email protected]`](https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v5.1.0/contracts/proxy/utils/UUPSUpgradeable.sol) | | 
| 152 | 120 | 
 | 
| 153 | 121 |   | 
| 154 | 122 | 
 | 
|  | 
0 commit comments