-
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
Automation price poc #420
Automation price poc #420
Conversation
98fce28
to
5e56b96
Compare
assets2: Vec<AssetName>, | ||
prices: Vec<AssetPrice>, | ||
submitted_at: Vec<u128>, | ||
rounds: Vec<u128>, |
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.
Please add comments to explain the purpose of this function and its parameters.
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.
Hi @imstar15
I had added the parameter document. On the PR link I also added encoded call data so one can click and decode
cf31683
to
df4e8d8
Compare
57a851a
to
e4986d4
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.
The existing code looks well organized so far.
@@ -260,8 +363,7 @@ pub mod pallet { | |||
LiquidityRestrictions, | |||
/// Too Many Assets Created | |||
AssetLimitReached, | |||
/// Direction Not Supported | |||
DirectionNotSupported, | |||
BadVersion, |
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.
Other error code are self-explanatory but this BadVersion
needs some comments.
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.
comment is added
d0cbc1c
to
58c07c0
Compare
An un-optimization pallet to enable an oracle price feed, price update, task scheduling based on price and task triggering based on asset price compartion with target price The weight is hardcode, document is still lack off and data structure is still being finalized.
ef4c861
to
aaa6260
Compare
Please give a final round of review. There are still many optimization we can do but we would like to merge this, have it run with the xcm-demo-price app and iterate. Pending items I will need to address next is keep track in this issue: #434 |
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.
No major changes from my last review, so I believe that this is good enough to merge. I left one more minor comment though.
@@ -417,7 +416,7 @@ fn test_shift_tasks_movement_through_price_changes() { | |||
|
|||
let task_ids = get_task_ids_from_events(); | |||
let task_id1 = task_ids.get(task_ids.len().wrapping_sub(3)).unwrap(); | |||
let task_id2 = task_ids.get(task_ids.len().wrapping_sub(2)).unwrap(); | |||
let _task_id2 = task_ids.get(task_ids.len().wrapping_sub(2)).unwrap(); |
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.
Should the format of these task_id
variable names be consistent?
I need pr no |
What I want is that “hash of the first commit that was ever made to the main oak GitHub repo”, help me with that please if possible but I am not sure if I know the pr no. It must be very first.
Thank you Regards
Sent from Yahoo Mail for iPhone
On Monday, March 18, 2024, 8:07 PM, Lalsha40 ***@***.***> wrote:
I need pr no
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Automation pallet that trigger tasks based on price. Currently price is updated externally. More docs will come when this form into a runable state to explain the detail.
We organized the data structure into this tree:
Initialize asset
We can repeat this for many assets per that chain/exchange.
Example call 1
This example, we Initialize a pair for (DOT, USDT) on astar chain, artswap exchange. and also authorized "ALICE" wallet to update this asset price. In practice, "ALICE" should be updated to the wallet address of the oracle provider.
local polkadotjs decoded link
Example call 2
This example, we Initialize a pair for (KSM, USDC) on moonbeam chain, uniswap exchange. and also authorized "BOB" wallet to update this asset price
local polkadotjs decode link
Now we can inspect storage
Update price
Price can be update at the same time. It has these below argument
Example we can update the price of 3 pairs
all the array obviously need to have the same length so we can construct the pair.
Example encoded call hash
Here we will update prices of 2 assets in a single extrinsic
polkadotjs decode link
now we can inspect the storage
Task Schedule
Very similar to automation time.
- gt
- lt
In this example task will be trigger when the TUR/USDC price is >= 60000000(note the decimal of the asset pair)
Example call
This is a task that is trigger when KSM/USDT is worth 5.5USDT
polkadotjs decode link
Chain Storage
These can be used to evaluate the storage
For task insertion, it's stored in: