Skip to content
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

Add pool accounts view_function #6408

Draft
wants to merge 2 commits into
base: aj/view-functions
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions substrate/frame/nomination-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4072,3 +4072,13 @@ impl<T: Config> sp_staking::OnStakingUpdate<T::AccountId, BalanceOf<T>> for Pall
}
}
}

#[pallet::view_functions]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried to trigger this from anywhere now?

I can provide some pointers on how to do it manually:

  • The kitchensink runtime should have a new runtime API that will expose this.
  • You can manually hash the name and signature of this function (as per the view fn PR) to get the QueryId
  • You can use any of our developer consoles that can trigger a runtime API to call into the runtime API, and give the right query

impl<T: Config> Pallet<T> {
/// Provide bonded account and reward account for nomination pool.
pub fn pool_accounts(pool_id: PoolId) -> (T::AccountId, T::AccountId) {
let bonded_account = Self::generate_bonded_account(pool_id);
let reward_account = Self::generate_reward_account(pool_id);
(bonded_account, reward_account)
}
}
Loading