solana/token_bridge: check balance and truncation

Change-Id: I59837374067350885b70f4b090ac4ba7a1e37d3e
This commit is contained in:
Reisen 2021-09-07 14:27:36 +00:00 committed by David Paryente
parent c1c1bb26bf
commit 4865275d95
1 changed files with 14 additions and 1 deletions

View File

@ -43,7 +43,7 @@ use solitaire::{
processors::seeded::Seeded, processors::seeded::Seeded,
AccountState, AccountState,
}; };
use spl_token::state::Mint; use spl_token::state::{Account, Mint};
use std::{ use std::{
convert::TryInto, convert::TryInto,
io::{ io::{
@ -794,6 +794,19 @@ fn test_transfer_in_wrapped_preexisting(context: &mut Context) {
payer, payer,
) )
.unwrap(); .unwrap();
let account_data = Account::unpack(
&client
.get_account_with_commitment(&external_token_account.pubkey(), CommitmentConfig::processed())
.unwrap()
.value
.unwrap()
.data,
)
.unwrap();
// Check truncation for external asset shrinks by the correct amount.
assert_eq!(1000, account_data.amount);
} }
fn test_transfer_wrapped_preexisting(context: &mut Context) { fn test_transfer_wrapped_preexisting(context: &mut Context) {