-
Notifications
You must be signed in to change notification settings - Fork 88
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
feat: add PoolFees RtApi & AccruedFees event #1728
Conversation
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.
Clean and straignforward!
Just a minor question and NIT
runtime/altair/src/lib.rs
Outdated
@@ -2241,6 +2241,15 @@ impl_runtime_apis! { | |||
} | |||
} | |||
|
|||
// PoolFeesApi | |||
impl runtime_common::apis::PoolFeesApi<Block, PoolId, PoolFeeId, AccountId, Balance, Rate> for Runtime { | |||
fn list_fees(pool_id: PoolId) -> Option<Vec<(cfg_traits::fee::PoolFeeBucket, Vec<cfg_types::pools::PoolFee<AccountId, PoolFeeId, cfg_types::pools::PoolFeeAmounts<Balance, Rate>>>)>> { |
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.
NIT. This type is very long. Could maybe get_pool_fees()
return a type which simplifies this?
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.
Since clippy is complaining, I should do that yes. I dislike introducing types specifically for runtime API responses because these have to be typed manually in the JS side.
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.
Oh, I didn't know that. And with tuples, they do not need to specify any type?
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.
Maybe you can get the best of both worlds with a type alias?
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.
In JS, tuples are just arrays. So you have to specify them as tuples still. WDYT about 731aaa1?
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.
Perfect!
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.
LGTM
Description
Accrued
event for fixed fees when they are updated (either manually during NAV update or during epochclosing)
list_fees
which simulates a PoolFees update and returns the list of pool fees divided by the bucketRuntime API
Apps needs to add type decorations for the new
PoolFeesApi
similar to the existing ones.Checklist: