mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-07-25 23:23:11 +00:00
add serialize/deserialize impls
This commit is contained in:
+30
-30
@@ -7,7 +7,7 @@ use amm_core::{
|
||||
compute_pool_pda, compute_vault_pda, compute_vault_pda_seed,
|
||||
};
|
||||
use nssa_core::{
|
||||
account::{Account, AccountId, AccountWithMetadata, Data, Nonce},
|
||||
account::{Account, AccountId, AccountWithMetadata, Data},
|
||||
program::{ChainedCall, ProgramId},
|
||||
};
|
||||
use token_core::{TokenDefinition, TokenHolding};
|
||||
@@ -415,7 +415,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_a_definition_id(),
|
||||
balance: BalanceForTests::user_token_a_balance(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::user_token_a_id(),
|
||||
@@ -431,7 +431,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_b_definition_id(),
|
||||
balance: BalanceForTests::user_token_b_balance(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::user_token_b_id(),
|
||||
@@ -447,7 +447,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_a_definition_id(),
|
||||
balance: BalanceForTests::vault_a_reserve_init(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::vault_a_id(),
|
||||
@@ -463,7 +463,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_b_definition_id(),
|
||||
balance: BalanceForTests::vault_b_reserve_init(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::vault_b_id(),
|
||||
@@ -479,7 +479,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_a_definition_id(),
|
||||
balance: BalanceForTests::vault_a_reserve_high(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::vault_a_id(),
|
||||
@@ -495,7 +495,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_b_definition_id(),
|
||||
balance: BalanceForTests::vault_b_reserve_high(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::vault_b_id(),
|
||||
@@ -511,7 +511,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_a_definition_id(),
|
||||
balance: BalanceForTests::vault_a_reserve_low(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::vault_a_id(),
|
||||
@@ -527,7 +527,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_b_definition_id(),
|
||||
balance: BalanceForTests::vault_b_reserve_low(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::vault_b_id(),
|
||||
@@ -543,7 +543,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_a_definition_id(),
|
||||
balance: 0,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::vault_a_id(),
|
||||
@@ -559,7 +559,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_b_definition_id(),
|
||||
balance: 0,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::vault_b_id(),
|
||||
@@ -576,7 +576,7 @@ impl AccountForTests {
|
||||
total_supply: BalanceForTests::lp_supply_init(),
|
||||
metadata_id: None,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::token_lp_definition_id(),
|
||||
@@ -593,7 +593,7 @@ impl AccountForTests {
|
||||
total_supply: BalanceForTests::lp_supply_init(),
|
||||
metadata_id: None,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::vault_a_id(),
|
||||
@@ -609,7 +609,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_lp_definition_id(),
|
||||
balance: 0,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::user_token_lp_id(),
|
||||
@@ -625,7 +625,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_lp_definition_id(),
|
||||
balance: BalanceForTests::user_token_lp_balance(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::user_token_lp_id(),
|
||||
@@ -649,7 +649,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -673,7 +673,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -697,7 +697,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -721,7 +721,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -745,7 +745,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -769,7 +769,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -793,7 +793,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -817,7 +817,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -841,7 +841,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -865,7 +865,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -889,7 +889,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: false,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -913,7 +913,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: false,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: AccountId::new([4; 32]),
|
||||
@@ -929,7 +929,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_a_definition_id(),
|
||||
balance: BalanceForTests::vault_a_reserve_init(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: AccountId::new([4; 32]),
|
||||
@@ -945,7 +945,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::token_b_definition_id(),
|
||||
balance: BalanceForTests::vault_b_reserve_init(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: AccountId::new([4; 32]),
|
||||
@@ -969,7 +969,7 @@ impl AccountForTests {
|
||||
fees: 0u128,
|
||||
active: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
|
||||
+26
-26
@@ -1,6 +1,6 @@
|
||||
#![cfg(test)]
|
||||
|
||||
use nssa_core::account::{Account, AccountId, AccountWithMetadata, Data, Nonce};
|
||||
use nssa_core::account::{Account, AccountId, AccountWithMetadata, Data};
|
||||
use token_core::{
|
||||
MetadataStandard, NewTokenDefinition, NewTokenMetadata, TokenDefinition, TokenHolding,
|
||||
};
|
||||
@@ -32,7 +32,7 @@ impl AccountForTests {
|
||||
total_supply: BalanceForTests::init_supply(),
|
||||
metadata_id: None,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -49,7 +49,7 @@ impl AccountForTests {
|
||||
total_supply: BalanceForTests::init_supply(),
|
||||
metadata_id: None,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: false,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -65,7 +65,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id_diff(),
|
||||
balance: BalanceForTests::holding_balance(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -81,7 +81,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::holding_balance(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -97,7 +97,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::holding_balance(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: false,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -113,7 +113,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::init_supply(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: false,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -130,7 +130,7 @@ impl AccountForTests {
|
||||
total_supply: BalanceForTests::init_supply_burned(),
|
||||
metadata_id: None,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -146,7 +146,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::holding_balance_burned(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: false,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -170,7 +170,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::mint_success(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: false,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -186,7 +186,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::holding_balance_mint(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -203,7 +203,7 @@ impl AccountForTests {
|
||||
total_supply: BalanceForTests::init_supply_mint(),
|
||||
metadata_id: None,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -219,7 +219,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::mint_overflow(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -236,7 +236,7 @@ impl AccountForTests {
|
||||
printable_supply: BalanceForTests::printable_copies(),
|
||||
metadata_id: AccountId::new([0; 32]),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -260,7 +260,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::init_supply(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -277,7 +277,7 @@ impl AccountForTests {
|
||||
total_supply: BalanceForTests::init_supply(),
|
||||
metadata_id: None,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::pool_definition_id(),
|
||||
@@ -293,7 +293,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::init_supply(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -309,7 +309,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::init_supply(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id_2(),
|
||||
@@ -325,7 +325,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::recipient_post_transfer(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id_2(),
|
||||
@@ -341,7 +341,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
balance: BalanceForTests::sender_post_transfer(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -357,7 +357,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
print_balance: BalanceForTests::printable_copies(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -373,7 +373,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
print_balance: 1,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -389,7 +389,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
print_balance: BalanceForTests::printable_copies() - 1,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -405,7 +405,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
owned: true,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: false,
|
||||
account_id: IdForTests::holding_id(),
|
||||
@@ -421,7 +421,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
print_balance: BalanceForTests::printable_copies(),
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id_2(),
|
||||
@@ -437,7 +437,7 @@ impl AccountForTests {
|
||||
definition_id: IdForTests::pool_definition_id(),
|
||||
print_balance: 0,
|
||||
}),
|
||||
nonce: Nonce(0),
|
||||
nonce: 0u128.into(),
|
||||
},
|
||||
is_authorized: true,
|
||||
account_id: IdForTests::holding_id(),
|
||||
|
||||
Reference in New Issue
Block a user