-
Notifications
You must be signed in to change notification settings - Fork 2
bApp Onboarding Guide #6
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
Conversation
bapp_onboarding.md
Outdated
| ```go | ||
| Risk map[Token]map[Strategy]float64 | ||
| ``` | ||
| 4. **Compute Risk-Aware Weights**: With this information, it can compute the weight of a participant for a certain token by |
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.
I still think there could be a function on the contract to compute the weight, so some apps could use this data on-chain...
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.
The model described is a proposal by us, not a must. So, a bApp can actually define any weight model it wants. But I see no issue with adding the default one as a function. I think this is more of a product decision
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.
I see.
@liorrutenberg @mtabasco @GalRogozinski ? Any opinion on this?
bapp_onboarding.md
Outdated
|
|
||
| where $c_{\text{token}}$ is a normalization constant defined as | ||
|
|
||
| $$c_{\text{token}} = \left( \sum_{\text{strategy}} \frac{ObligatedBalance[\text{token}][\text{strategy}]}{TotalBAppBalance[\text{token}]} e^{-\beta_{\text{token}} \times max(1, Risk[\text{token}][\text{strategy}])} \right)^{-1}$$ |
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.
I have not reviewed the math
Co-authored-by: Riccardo Persiani <[email protected]>
Co-authored-by: Riccardo Persiani <[email protected]>
Co-authored-by: Riccardo Persiani <[email protected]>
Co-authored-by: Riccardo Persiani <[email protected]>
Co-authored-by: Riccardo Persiani <[email protected]>
Co-authored-by: Riccardo Persiani <[email protected]>
Co-authored-by: Riccardo Persiani <[email protected]>
|
@MatheusFranco99 lets move it to a docs folder or examples |
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.
Just a reminder that we need to add the actual contract address once we have it deployed
bapp_onboarding.md
Outdated
| for strategy in strategies do | ||
|
|
||
| # Check if strategy participates in the bApp | ||
| if !api.HasStrategyOptedInToBApp(strategy, bApp) then |
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.
api hints that we have some SDK in place.
Maybe whoever is writing the SDK can put actual runnable code here that uses the abi
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.
Thanks @MatheusFranco99 !
I added some ideas/suggestions.
|
@liorrutenberg |
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.
Still waiting for a link to the deployed contract on etherscan...
Wonder if we can have runnable code snippets
|
|
||
| Once the bApp is registered, strategies can join it and allocate capital to secure it. | ||
|
|
||
| ### 2.1 Opting in |
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.
I think we are missing how to register operators (accounts) and create strategy
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.
I thought it was a guide mainly for the bApp to register itself and understand how others join.
If strategies registering is really necessary, I can add it
Wdyt @liorrutenberg ?
doc/bapp_onboarding.md
Outdated
| ) | ||
| ``` | ||
| - `tokens`: List of tokens to obligate to the bApp. | ||
| - `obligationPercentages`: The proportion of each token's balance to commit to the bApp. |
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.
The encoding format of the obligation percentages is not clear.
We decided on 5000 representing 50.00% right?
It needs to be clear
Maybe @mtabasco or @riccardo-ssvlabs can provide an example of a cli-command that will show examples of how to create the transactions. This will make sure will use proper encoding when creating the txs.
I think clef allows using json as tx data, so maybe a json would be a good idea?
But the contract guys probably know what is the best way to give such examples
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.
Well-spotted.
Because it's a uint32, we could have had far better precision than 2 decimals
But I think that's the current encoding, yes.
I'll add this mention to the encoding
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.
I think one simple way to send transactions using a cli-command is with Foundry's cast.
# install foundry
curl -L https://foundry.paradigm.xyz | bash
cast send <CONTRACT_ADDRESS> "optInToBApp(uint256,address,address[],uint32[],bytes)" \
<STRATEGY_ID> <BAPP_ADDRESS> \
'["0xTokenAddress1","0xTokenAddress2"]' '[1000,2000]' "0xDataParam" \
--private-key <YOUR_PRIVATE_KEY> --rpc-url <RPC_URL>
You can use --keystore param to access key store instead of passing raw private key to the cli command.
doc/bapp_onboarding.md
Outdated
| $$W^{\text{final}}_{\text{strategy}} = c_{\text{final}} \times \frac{1}{\frac{2/3}{W_{\text{strategy, A}}} + \frac{1/3}{W_{\text{strategy, B}}}}$$ | ||
|
|
||
| where $c_{\text{final}}$ is a normalization constant computed as | ||
|
|
||
| $$c_{\text{final}} = \left( \sum_{\text{strategy}} \frac{1}{\frac{2/3}{W_{\text{strategy, A}}} + \frac{1/3}{W_{\text{strategy, B}}}} \right)^{-1}$$ | ||
|
|
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.
still doesn't render well on github
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.
It renders locally. I'll try a change
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.
Well done @MatheusFranco99 !
bapp_onboarding.md
Outdated
|
|
||
| 1. **Define core attributes**: | ||
| - `bApp`: a unique 20-byte EVM address that uniquely identifies the bApp. | ||
| - `tokens`: A list of ERC-20 tokens to be used in the bApp's security mechanism. For the native ETH token, use the special address [`0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`](https://github.com/ssvlabs/based-applications/blob/92a5d3d276148604e3fc087c1c121f78b136a741/src/BasedAppManager.sol#L62). |
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.
Suggestion: substitute the links with a specific commit with links with main. E.g.:
https://github.com/ssvlabs/based-applications/blob/main/src/BasedAppManager.sol
Lines links may be broken at first, but when the contract stabilizes, people would not be weirded out by visiting a contract's commit page that is months old.
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.
Actually, it was requested to change the links to the ones from etherscan
Overview
This PR adds an onboarding guide for bApp builders