comments
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
15961ec81c
commit
27c76c7494
|
@ -2,7 +2,6 @@ use std::{sync::Arc, time::Duration};
|
||||||
|
|
||||||
use anchor_lang::{AccountDeserialize, __private::bytemuck::cast_ref};
|
use anchor_lang::{AccountDeserialize, __private::bytemuck::cast_ref};
|
||||||
|
|
||||||
use log::{info, warn};
|
|
||||||
use mango_v4::state::{EventQueue, EventType, FillEvent, OutEvent, PerpMarket};
|
use mango_v4::state::{EventQueue, EventType, FillEvent, OutEvent, PerpMarket};
|
||||||
|
|
||||||
use solana_sdk::{
|
use solana_sdk::{
|
||||||
|
@ -36,6 +35,8 @@ pub fn perform_operation(
|
||||||
|
|
||||||
let mut ams_ = vec![];
|
let mut ams_ = vec![];
|
||||||
|
|
||||||
|
// TODO: future, choose better constant of how many max events to pack
|
||||||
|
// TODO: future, choose better constant of how many max mango accounts to pack
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
let event = match event_queue.peek_front() {
|
let event = match event_queue.peek_front() {
|
||||||
None => break,
|
None => break,
|
||||||
|
@ -92,7 +93,7 @@ pub fn perform_operation(
|
||||||
.send();
|
.send();
|
||||||
match sig_result {
|
match sig_result {
|
||||||
Ok(sig) => {
|
Ok(sig) => {
|
||||||
info!(
|
log::info!(
|
||||||
"Crank: consume event for perp_market {:?} ix signature: {:?}",
|
"Crank: consume event for perp_market {:?} ix signature: {:?}",
|
||||||
format!("{: >6}", perp_market.name()),
|
format!("{: >6}", perp_market.name()),
|
||||||
sig
|
sig
|
||||||
|
@ -113,15 +114,7 @@ fn get_event_queue(
|
||||||
.rpc
|
.rpc
|
||||||
.get_account_with_commitment(&perp_market.event_queue, mango_client.commitment);
|
.get_account_with_commitment(&perp_market.event_queue, mango_client.commitment);
|
||||||
|
|
||||||
let res = match res {
|
let data = res.unwrap().value.unwrap().data;
|
||||||
Ok(x) => x,
|
|
||||||
Err(e) => {
|
|
||||||
warn!("{}", e);
|
|
||||||
return Err(Ok(()));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let data = res.value.unwrap().data;
|
|
||||||
let mut data_slice: &[u8] = &data;
|
let mut data_slice: &[u8] = &data;
|
||||||
AccountDeserialize::try_deserialize(&mut data_slice).ok()
|
AccountDeserialize::try_deserialize(&mut data_slice).ok()
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,6 +60,7 @@ pub async fn runner(
|
||||||
|
|
||||||
// TODO: enable
|
// TODO: enable
|
||||||
// ensure!(!perp_markets.is_empty());
|
// ensure!(!perp_markets.is_empty());
|
||||||
|
// atm no perp code is deployed to devnet, and no perp markets have been init
|
||||||
|
|
||||||
let handles2 = perp_markets
|
let handles2 = perp_markets
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -159,6 +159,7 @@ fn main() -> Result<(), anyhow::Error> {
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
// TODO: future: remove, just for learning purposes
|
||||||
let debugging_handle = async {
|
let debugging_handle = async {
|
||||||
let mut interval = time::interval(time::Duration::from_secs(5));
|
let mut interval = time::interval(time::Duration::from_secs(5));
|
||||||
loop {
|
loop {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use std::{sync::Arc, time::Duration};
|
use std::{sync::Arc, time::Duration};
|
||||||
|
|
||||||
use log::info;
|
|
||||||
use mango_v4::state::Bank;
|
use mango_v4::state::Bank;
|
||||||
|
|
||||||
use solana_sdk::{instruction::Instruction, pubkey::Pubkey};
|
use solana_sdk::{instruction::Instruction, pubkey::Pubkey};
|
||||||
|
@ -38,7 +37,7 @@ pub fn perform_operation(
|
||||||
.send();
|
.send();
|
||||||
match sig_result {
|
match sig_result {
|
||||||
Ok(sig) => {
|
Ok(sig) => {
|
||||||
info!(
|
log::info!(
|
||||||
"Crank: update_index for bank {:?} ix signature: {:?}",
|
"Crank: update_index for bank {:?} ix signature: {:?}",
|
||||||
format!("{: >6}", bank.name()),
|
format!("{: >6}", bank.name()),
|
||||||
sig
|
sig
|
||||||
|
|
Loading…
Reference in New Issue