4
4
use futures:: { Future , FutureExt } ;
5
5
use solana_program:: {
6
6
feature:: { self , Feature } ,
7
+ program_option:: COption ,
7
8
program_pack:: Pack ,
8
9
pubkey:: Pubkey ,
9
10
system_program,
@@ -54,6 +55,9 @@ async fn test_basic() {
54
55
let ( mut banks_client, payer, recent_blockhash) = program_test ( ) . start ( ) . await ;
55
56
56
57
let feature_id_address = get_feature_id_address ( & feature_proposal. pubkey ( ) ) ;
58
+ let mint_address = get_mint_address ( & feature_proposal. pubkey ( ) ) ;
59
+ let delivery_token_address = get_delivery_token_address ( & feature_proposal. pubkey ( ) ) ;
60
+ let acceptance_token_address = get_acceptance_token_address ( & feature_proposal. pubkey ( ) ) ;
57
61
58
62
// Create a new feature proposal
59
63
let mut transaction = Transaction :: new_with_payer (
@@ -80,6 +84,38 @@ async fn test_basic() {
80
84
assert_eq ! ( feature_id_acccount. owner, system_program:: id( ) ) ;
81
85
assert_eq ! ( feature_id_acccount. data. len( ) , Feature :: size_of( ) ) ;
82
86
87
+ // Confirm mint account state
88
+ let mint = get_account :: < spl_token:: state:: Mint > ( & mut banks_client, mint_address)
89
+ . await
90
+ . unwrap ( ) ;
91
+ assert_eq ! ( mint. supply, 42 ) ;
92
+ assert_eq ! ( mint. decimals, 9 ) ;
93
+ assert ! ( mint. freeze_authority. is_none( ) ) ;
94
+ assert_eq ! ( mint. mint_authority, COption :: Some ( mint_address) ) ;
95
+
96
+ // Confirm delivery token account state
97
+ let delivery_token =
98
+ get_account :: < spl_token:: state:: Account > ( & mut banks_client, delivery_token_address)
99
+ . await
100
+ . unwrap ( ) ;
101
+ assert_eq ! ( delivery_token. amount, 42 ) ;
102
+ assert_eq ! ( delivery_token. mint, mint_address) ;
103
+ assert_eq ! ( delivery_token. owner, feature_proposal. pubkey( ) ) ;
104
+ assert ! ( delivery_token. close_authority. is_none( ) ) ;
105
+
106
+ // Confirm acceptance token account state
107
+ let acceptance_token =
108
+ get_account :: < spl_token:: state:: Account > ( & mut banks_client, acceptance_token_address)
109
+ . await
110
+ . unwrap ( ) ;
111
+ assert_eq ! ( acceptance_token. amount, 0 ) ;
112
+ assert_eq ! ( acceptance_token. mint, mint_address) ;
113
+ assert_eq ! ( acceptance_token. owner, id( ) ) ;
114
+ assert_eq ! (
115
+ acceptance_token. close_authority,
116
+ COption :: Some ( feature_proposal. pubkey( ) )
117
+ ) ;
118
+
83
119
// Tally #1: Does nothing because the acceptance criteria has not been met
84
120
let mut transaction =
85
121
Transaction :: new_with_payer ( & [ tally ( & feature_proposal. pubkey ( ) ) ] , Some ( & payer. pubkey ( ) ) ) ;
@@ -100,9 +136,6 @@ async fn test_basic() {
100
136
) ) ;
101
137
102
138
// Transfer tokens to the acceptance account
103
- let delivery_token_address = get_delivery_token_address ( & feature_proposal. pubkey ( ) ) ;
104
- let acceptance_token_address = get_acceptance_token_address ( & feature_proposal. pubkey ( ) ) ;
105
-
106
139
let mut transaction = Transaction :: new_with_payer (
107
140
& [ spl_token:: instruction:: transfer (
108
141
& spl_token:: id ( ) ,
0 commit comments