Skip to content

Instantly share code, notes, and snippets.

View strange-dv's full-sized avatar

andrii strange-dv

  • Ukraine
View GitHub Profile
@strange-dv
strange-dv / comp_multi.rs
Created January 12, 2025 17:52 — forked from kepler-5/comp_multi.rs
Python comprehension proc macro that handles multiple nested for-if-clauses, flattening nested structure
// Python comprehension proc macro that handles multiple nested for-if-clauses, flattening nested structure.
// Example:
//
// let vec_of_vecs = vec![vec![1, 2, 3], vec![4, 5, 6]];
//
// let result = comp![x for vec in vec_of_vecs for x in vec].collect::<Vec<_>>();
// assert_eq!(result, [1, 2, 3, 4, 5, 6]);
//
use proc_macro2::TokenStream as TokenStream2;

When I tried to call the sign_print_trade method using CPI, I got the following error:

  logs: [
    'Program 5Vhsk4PT6MDMrGSsQoQGEHfakkntEYydRYTs14T1PooL invoke [1]',
    'Program log: Instruction: Settle',
    'Program FUfpR31LmcP1VSbz5zDaM7nxnH55iBHkpwusgrnhaFjL invoke [2]',
    'Program log: Instruction: InitializePrintTrade',
    'Program 11111111111111111111111111111111 invoke [3]',
    'Program 11111111111111111111111111111111 success',
    'Program FUfpR31LmcP1VSbz5zDaM7nxnH55iBHkpwusgrnhaFjL consumed 14389 of 177160 compute units',