GeneralMagicio / GeneralMagicio/dappnode-mev-smoothing-pool

Add option to subscribe multiple validators at once

Open
#83 1 comment 1 reaction 1 assignee Claimed by @mateodaza View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Context:
* Currently validators can only be subscribed one by one. Meaning that someone with 50, would need to send 50 different txs, which implies: click Subscribe button, sign tx, wait, repeat. Not the best UX.

Feture:
* Add new button with `Subscribe All` that allows to subscribe all validators that are in `notsubscribed` or `untracked` state.

Tasks:
- [x] Update the abi to the latest. Latest can be found [here](https://github.com/dappnode/mev-sp-oracle/blob/main/contract/abi.abi). Its important to have this latest abi because it adds the `subscribeValidators` function.
- [x] Create new button named `Subscribe All`. No opinion where it should be placed.
- [x] When `Subscribe All` button is clicked, get all validators belonging to the connected wallet `/memory/validators/0x_wallet` (note that this is already being done) and **filter** all validators so that we get the ones in `notsubscribed` or `untracked` state. This is very important as it wouldn't make sense to subscribe an already subscribed validator. Then, get their `validator_index` eg: `validator_index(es)=5, 10, 40, 60`.
- [ ] Call the function `subscribeValidators` with said indexes and payable amount equal to `collateral_in_wei` * `length(indexes)`. As a reminder `collateral_in_wei` is already used by the contract and can be fetched from `:7300/config`

Note: `subscribeValidators` function is very similar to `subscribeValidator` with the only difference that it takes an array of validators, and that the collateral amount has to be x times the amount of validators, where x is the amount of validators one wants to subscribe.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.