-
Notifications
You must be signed in to change notification settings - Fork 71
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 fee handling for automation price #436
Conversation
c9050e0
to
550ce0f
Compare
b846c99
to
1395048
Compare
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 re-compiled with this PR but found tasks are not being scheduled after Shibuya’s polkadotXcm.send.
@v9n could you test the code with our demo to see what’s wrong? /~https://github.com/OAK-Foundation/automation-price-demo
@@ -407,13 +444,14 @@ fn test_shift_tasks_movement_through_price_changes() { | |||
Box::new(NATIVE_LOCATION.into()), | |||
Box::new(AssetPayment { | |||
asset_location: MultiLocation::new(0, Here).into(), | |||
amount: 10000000000000 | |||
amount: 10 |
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.
Is 10 too small for testing purpose? 10 * 10^10 units would make more sense?
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.
@v9n, follow up on this comment.
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 no more comments on this PR. @imstar15 could you also examine the XCM related code?
164e12a
to
f81a7a8
Compare
This PR is ready to review again. The issue with failure to schedule job is because we send an invalid XCM v3 location and |
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. I left a few comments.
pallets/automation-price/src/lib.rs
Outdated
#[cfg(not(feature = "dev-queue"))] | ||
ensure_root(origin)?; | ||
// #[cfg(not(feature = "dev-queue"))] | ||
// ensure_root(origin)?; |
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.
Do we need to turn on this #[cfg(not(feature = "dev-queue"))]
?
@@ -756,12 +765,9 @@ pub mod pallet { | |||
}; | |||
|
|||
Self::validate_and_schedule_task(task)?; | |||
// TODO withdraw fee | |||
//T::FeeHandler::withdraw_fee(&who, fee).map_err(|_| Error::<T>::InsufficientBalance)?; |
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.
Without this line, is the fee actually withdrawn?
cdc9cc0
to
369b795
Compare
Now that we have weight, attempt to handle fee properly.
We charged fee only once when schedule the job succesfully. Because this isn't recurring tasks, we only need to charge once.