[Pools] Refactors and runtime apis for DelegateStake (#4537)
## Runtime Apis Introduces the following runtime apis to facilitate dapps and wallets in integrating with the `DelegateStake` functionalities of the pools (related: https://github.com/paritytech/polkadot-sdk/pull/3905). These apis are meant to support pool and member migration, as well as lazy application of pending slashes of pool members. ```rust fn pool_pending_slash(pool_id: PoolId) -> Balance; fn member_pending_slash(member: AccountId) -> Balance; fn pool_needs_delegate_migration(pool_id: PoolId) -> bool; fn member_needs_delegate_migration(member: AccountId) -> bool; ``` ## Refactors - Introduces newtypes for `Agent`, `Delegator`, `Pool` and `[Pool]Member`. And refactors `StakeAdapter` and `DelegationInterface` to accept the above types. This will help make these apis typesafe against using wrong account type. - Fixing `DelegationInterface` apis to return optional (instead of default value if key does not exist). - Rename struct `Agent` that wraps `AgentLedger` to `AgentOuterLedger` which is clearer (naming wise) and different from the newtype `Agent`. - Cleaning up new Pool events (related to `Delegation` feature of pool). --------- Signed-off-by: Matteo Muraca <[email protected]> Signed-off-by: Alexandru Gheorghe <[email protected]> Signed-off-by: Andrei Sandu <[email protected]> Signed-off-by: Adrian Catangiu <[email protected]> Signed-off-by: Alexandru Vasile <[email protected]> Signed-off-by: Oliver Tale-Yazdi <[email protected]> Signed-off-by: divdeploy <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: hongkuang <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: gemini132 <[email protected]> Co-authored-by: Matteo Muraca <[email protected]> Co-authored-by: Liam Aharon <[email protected]> Co-authored-by: Kian Paimani <[email protected]> Co-authored-by: Alexandru Gheorghe <[email protected]> Co-authored-by: Alessandro Siniscalchi <[email protected]> Co-authored-by: Andrei Sandu <[email protected]> Co-authored-by: Ross Bulat <[email protected]> Co-authored-by: Serban Iorga <[email protected]> Co-authored-by: s0me0ne-unkn0wn <[email protected]> Co-authored-by: Sam Johnson <[email protected]> Co-authored-by: Adrian Catangiu <[email protected]> Co-authored-by: Javier Viola <[email protected]> Co-authored-by: Alexandru Vasile <[email protected]> Co-authored-by: Niklas Adolfsson <[email protected]> Co-authored-by: Dastan <[email protected]> Co-authored-by: Clara van Staden <[email protected]> Co-authored-by: Ron <[email protected]> Co-authored-by: Vincent Geddes <[email protected]> Co-authored-by: Svyatoslav Nikolsky <[email protected]> Co-authored-by: Michal Kucharczyk <[email protected]> Co-authored-by: Dino Pačandi <[email protected]> Co-authored-by: Andrei Eres <[email protected]> Co-authored-by: Alin Dima <[email protected]> Co-authored-by: Andrei Sandu <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Branislav Kontur <[email protected]> Co-authored-by: Sebastian Kunert <[email protected]> Co-authored-by: gupnik <[email protected]> Co-authored-by: Vladimir Istyufeev <[email protected]> Co-authored-by: Lulu <[email protected]> Co-authored-by: Juan Girini <[email protected]> Co-authored-by: Francisco Aguirre <[email protected]> Co-authored-by: Dónal Murray <[email protected]> Co-authored-by: Shawn Tabrizi <[email protected]> Co-authored-by: Kutsal Kaan Bilgin <[email protected]> Co-authored-by: Ermal Kaleci <[email protected]> Co-authored-by: ordian <[email protected]> Co-authored-by: divdeploy <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sergej Sakac <[email protected]> Co-authored-by: Squirrel <[email protected]> Co-authored-by: HongKuang <[email protected]> Co-authored-by: Tsvetomir Dimitrov <[email protected]> Co-authored-by: Egor_P <[email protected]> Co-authored-by: Aaro Altonen <[email protected]> Co-authored-by: Dmitry Markin <[email protected]> Co-authored-by: Alexandru Vasile <[email protected]> Co-authored-by: Léa Narzis <[email protected]> Co-authored-by: Gonçalo Pestana <[email protected]> Co-authored-by: georgepisaltu <[email protected]> Co-authored-by: command-bot <> Co-authored-by: PG Herveou <[email protected]> Co-authored-by: jimwfs <[email protected]> Co-authored-by: jimwfs <[email protected]> Co-authored-by: polka.dom <[email protected]>
Please register or sign in to comment