-
Notifications
You must be signed in to change notification settings - Fork 2
Release/v0.1.0 #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Parent:
Consolidate v0.1.1
Merged
Release/v0.1.0 #46
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
506ac6a
chore: modify README
mtabasco 6100015
chore: add forge docs, reorganize folders
mtabasco 7f2e070
docs: slashing & withdrawal mechanics
mtabasco 7ab4f27
chore: optimizations
mtabasco ea59077
chore: stage deployment
mtabasco f462573
chore: add deployment params to script output
mtabasco 3dfca65
doc: update guides naming
mtabasco f540a72
chore: deploy hoodi prod
mtabasco 96778dd
doc: generations guide
mtabasco f3ae784
docs: update README
mtabasco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,80 +61,22 @@ __`❍ forge test`__ | |
|
|
||
| | ||
|
|
||
| ## 🔨 _Slashing Mechanism_ | ||
| ## 🔨 _Slashing & Withdrawals Mechanisms_ | ||
|
|
||
| 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: | ||
| [Slashing & Withdrawals](./guides/slashing_and_withdrawals.md) | ||
|
|
||
| **1)** The bApp is a compliant smart contract; | ||
| ## :gear: _Feature Activation_ | ||
|
|
||
| **2)** The bApp is a non-compliant smart contract or an EOA. | ||
|
|
||
| ### 🧠 Compliant BApp | ||
|
|
||
| If the bApp is a compliant contract implementing the required interface `IBasedApp`, | ||
|
|
||
| The slash function of the bApp is called: `(success, receiver, exit) = IBasedApp(bApp).slash(...)` | ||
|
|
||
| * `data` parameter is forwarded and may act as a proof or auxiliary input. | ||
|
|
||
| * The bApp decides: | ||
|
|
||
| * Who receives the slashed funds by setting the `receiver` fund, it can burn by setting the receiver as `address(0)`; | ||
|
|
||
| * Whether to exit the strategy or adjust obligations; | ||
|
|
||
| * If `exit == true`, the strategy is exited and the obligation value is set to 0; | ||
|
|
||
| * Otherwise, obligations are adjusted proportionally based on remaining balances, the new obligated amount is set to the previous one less the slashed amount; | ||
|
|
||
| * Funds are credited to the receiver in the slashing fund. | ||
|
|
||
| ### 🔐 Non-compliant bApp (EOA or Non-compliant Contract) | ||
|
|
||
| If the bApp is an EOA or does not comply with the required interface: | ||
|
|
||
| * Only the bApp itself can invoke slashing; | ||
|
|
||
| * The receiver of slashed funds is forcibly set to the bApp itself; | ||
|
|
||
| * The strategy is always exited (no obligation adjustment); | ||
|
|
||
| * Funds are added to the bApp’s slashing fund. | ||
|
|
||
| ### ⏳ Post Slashing | ||
|
|
||
| ⚠️ 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. | ||
|
|
||
| This acts as a safeguard to prevent immediate re-entry and encourages more deliberate strategy participation. | ||
|
|
||
| ### 💸 Slashing Fund | ||
|
|
||
| Slashed tokens are not immediately transferred. They are deposited into an internal slashing fund. | ||
|
|
||
| The `receiver` (set during slashing) can later withdraw them using: | ||
|
|
||
| ``` | ||
| function withdrawSlashingFund(address token, uint256 amount) external | ||
| function withdrawETHSlashingFund(uint256 amount) external | ||
| ``` | ||
|
|
||
| These functions verify balances and authorize the caller to retrieve their accumulated slashed tokens. | ||
|
|
||
| | ||
|
|
||
| ## :gear: _Feature activation_ | ||
|
|
||
| [Feature activation](./specs/feature_activation.md) | ||
| [Feature Activation](./guides/feature_activation.md) | ||
|
|
||
| ## :page_facing_up: _Whitepaper_ | ||
|
|
||
| [Whitepaper](https://ssv.network/wp-content/uploads/2025/01/SSV2.0-Based-Applications-Protocol-1.pdf) | ||
|
|
||
| | ||
|
|
||
| ## :books: _More Resources_ | ||
|
|
||
| [Based Apps Onboarding Guide](./doc/bAppOnBoarding.md) | ||
| [Based Apps Onboarding Guide](./guides/bAppOnBoarding.md) | ||
|
|
||
| | ||
|
|
||
|
|
@@ -164,13 +106,12 @@ __`❍ updateModules`__: specifying the correct module id and the new module add | |
|
|
||
| __`❍ upgradeToAndCall`__: specifying the new implementation address. The data field can be left empty in this case. | ||
|
|
||
| There is also the `UpgradeProxy.s.sol` script file that can be run easily from the CLI. | ||
|
|
||
| ### Public Testnet Holesky | ||
| ### Public Testnet Hoodi | ||
|
|
||
| | Name | Proxy | Implementation | Notes | | ||
| | -------- | -------- | -------- | -------- | | ||
| | [`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) | | ||
| | [`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) | | ||
|
|
||
| | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| book/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| table { | ||
| margin: 0 auto; | ||
| border-collapse: collapse; | ||
| width: 100%; | ||
| } | ||
|
|
||
| table td:first-child { | ||
| width: 15%; | ||
| } | ||
|
|
||
| table td:nth-child(2) { | ||
| width: 25%; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [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/ssvlabs/based-applications" | ||
|
|
||
| [output.html.fold] | ||
| enable = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| 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,"(?<!\\$)\\b"));var s={className:"number", | ||
| begin:a,relevance:0},n={ | ||
| keyword:"assembly let function if switch case default for leave break continue u256 jump jumpi stop return revert selfdestruct invalid", | ||
| built_in:"add sub mul div sdiv mod smod exp not lt gt slt sgt eq iszero and or xor byte shl shr sar addmod mulmod signextend keccak256 pc pop dup1 dup2 dup3 dup4 dup5 dup6 dup7 dup8 dup9 dup10 dup11 dup12 dup13 dup14 dup15 dup16 swap1 swap2 swap3 swap4 swap5 swap6 swap7 swap8 swap9 swap10 swap11 swap12 swap13 swap14 swap15 swap16 mload mstore mstore8 sload sstore msize gas address balance selfbalance caller callvalue calldataload calldatasize calldatacopy codesize codecopy extcodesize extcodecopy returndatasize returndatacopy extcodehash create create2 call callcode delegatecall staticcall log0 log1 log2 log3 log4 chainid origin gasprice basefee blockhash coinbase timestamp number difficulty gaslimit", | ||
| literal:"true false"},i={className:"string", | ||
| begin:/\bhex'(([0-9a-fA-F]{2}_?)*[0-9a-fA-F]{2})?'/},t={className:"string", | ||
| begin:/\bhex"(([0-9a-fA-F]{2}_?)*[0-9a-fA-F]{2})?"/};function r(e){ | ||
| return e.inherit(e.APOS_STRING_MODE,{begin:/(\bunicode)?'/})}function l(e){ | ||
| return e.inherit(e.QUOTE_STRING_MODE,{begin:/(\bunicode)?"/})}var o={ | ||
| SOL_ASSEMBLY_KEYWORDS:n,baseAssembly:e=>{ | ||
| 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()?"(?<!\\$)\\b":"\\b")+"(gas|value|salt)(?=:)"};function x(e,a){return{ | ||
| begin:(E()?"(?<!\\$)\\b":"\\b")+e+"\\.\\s*",end:/[^A-Za-z0-9$_\.]/, | ||
| excludeBegin:!1,excludeEnd:!0,lexemes:C,keywords:{built_in:e+" "+a}, | ||
| contains:[f],relevance:10}}var h=c(e),v=e.inherit(h,{ | ||
| contains:h.contains.concat([{begin:/\./,end:/[^A-Za-z0-9$.]/,excludeBegin:!0, | ||
| excludeEnd:!0,keywords:{built_in:"slot offset length address selector"}, | ||
| relevance:2},{begin:/_/,end:/[^A-Za-z0-9$.]/,excludeBegin:!0,excludeEnd:!0, | ||
| keywords:{built_in:"slot offset"},relevance:2}])});return{aliases:["sol"], | ||
| keywords:p,lexemes:C, | ||
| contains:[a,s,_,m,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,w,O,{ | ||
| className:"function",lexemes:C, | ||
| beginKeywords:"function modifier event constructor fallback receive error", | ||
| end:/[{;]/,excludeEnd:!0, | ||
| contains:[y,N,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:/%/ | ||
| },x("msg","gas value data sender sig"),x("block","blockhash coinbase difficulty gaslimit basefee number timestamp chainid"),x("tx","gasprice origin"),x("abi","decode encode encodePacked encodeWithSelector encodeWithSignature encodeCall"),x("bytes","concat"),f,{ | ||
| className:"class",lexemes:C,beginKeywords:"contract interface library",end:"{", | ||
| excludeEnd:!0,illegal:/[:"\[\]]/,contains:[{beginKeywords:"is",lexemes:C | ||
| },y,N,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{lexemes:C, | ||
| beginKeywords:"struct enum",end:"{",excludeEnd:!0,illegal:/[:"\[\]]/, | ||
| contains:[y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{ | ||
| beginKeywords:"import",end:";",lexemes:C,keywords:"import from as", | ||
| contains:[y,a,s,_,m,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,O]},{ | ||
| beginKeywords:"using",end:";",lexemes:C,keywords:"using for", | ||
| contains:[y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,O]},{className:"meta", | ||
| beginKeywords:"pragma",end:";",lexemes:C,keywords:{ | ||
| keyword:"pragma solidity experimental abicoder", | ||
| built_in:"ABIEncoderV2 SMTChecker v1 v2"}, | ||
| contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.inherit(a,{ | ||
| className:"meta-string"}),e.inherit(s,{className:"meta-string"})]},{ | ||
| beginKeywords:"assembly",end:/\b\B/, | ||
| contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.inherit(v,{begin:"{", | ||
| end:"}",endsParent:!0,contains:v.contains.concat([e.inherit(v,{begin:"{", | ||
| end:"}",contains:v.contains.concat(["self"])})])})]}],illegal:/#/}}})()); | ||
|
|
||
| // Ugly hack to reload HLJS | ||
| hljs.initHighlightingOnLoad(); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we will update the entry with the addresses of the deployed contracts on stage and prod