File tree 10 files changed +55
-16
lines changed
auction-house/program/src
candy-machine/program/src/processor/collection
fixed-price-sale/program/src/processor
hydra/program/src/utils/validation
10 files changed +55
-16
lines changed Original file line number Diff line number Diff line change @@ -380,8 +380,7 @@ pub fn pay_creator_fees<'a>(
380
380
is_native : bool ,
381
381
) -> Result < u64 > {
382
382
let data = & metadata_info. data . borrow_mut ( ) ;
383
- if metadata_info. data_is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8
384
- {
383
+ if data. is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
385
384
return Err ( AuctionHouseError :: MetadataDoesntExist . into ( ) ) ;
386
385
}
387
386
let metadata = Metadata :: deserialize ( & mut data. as_ref ( ) ) ?;
Original file line number Diff line number Diff line change @@ -33,9 +33,7 @@ pub fn handle_remove_collection(ctx: Context<RemoveCollection>) -> Result<()> {
33
33
candy_machine. assert_not_minted ( error ! ( CandyError :: NoChangingCollectionDuringMint ) ) ?;
34
34
35
35
let data = & ctx. accounts . metadata . data . borrow_mut ( ) ;
36
- if ctx. accounts . metadata . data_is_empty ( )
37
- || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8
38
- {
36
+ if data. is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
39
37
return Err ( CandyError :: InvalidMetadataAccount . into ( ) ) ;
40
38
}
41
39
let metadata = Metadata :: deserialize ( & mut data. as_ref ( ) ) ?;
Original file line number Diff line number Diff line change @@ -41,9 +41,7 @@ pub struct SetCollection<'info> {
41
41
pub fn handle_set_collection ( ctx : Context < SetCollection > ) -> Result < ( ) > {
42
42
let mint = ctx. accounts . mint . to_account_info ( ) ;
43
43
let data = & ctx. accounts . metadata . data . borrow_mut ( ) ;
44
- if ctx. accounts . metadata . data_is_empty ( )
45
- || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8
46
- {
44
+ if data. is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
47
45
return Err ( CandyError :: InvalidMetadataAccount . into ( ) ) ;
48
46
}
49
47
let metadata = Metadata :: deserialize ( & mut data. as_ref ( ) ) ?;
Original file line number Diff line number Diff line change @@ -374,7 +374,7 @@ impl<'info> Buy<'info> {
374
374
) ?;
375
375
376
376
let data = & metadata. data . borrow_mut ( ) ;
377
- if metadata . data_is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
377
+ if data . is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
378
378
return Err ( ErrorCode :: InvalidMetadataAccount . into ( ) ) ;
379
379
}
380
380
let metadata_data = Metadata :: deserialize ( & mut data. as_ref ( ) ) ?;
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ impl<'info> ClaimResource<'info> {
70
70
71
71
// Update primary sale flag
72
72
let data = & metadata. data . borrow_mut ( ) ;
73
- if metadata . data_is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
73
+ if data . is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
74
74
return Err ( ErrorCode :: InvalidMetadataAccount . into ( ) ) ;
75
75
}
76
76
let metadata_state = mpl_token_metadata:: state:: Metadata :: deserialize ( & mut data. as_ref ( ) ) ?;
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ impl<'info> InitSellingResource<'info> {
46
46
) ?;
47
47
48
48
let data = & metadata. data . borrow_mut ( ) ;
49
- if metadata . data_is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
49
+ if data . is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
50
50
return Err ( ErrorCode :: InvalidMetadataAccount . into ( ) ) ;
51
51
}
52
52
let metadata = mpl_token_metadata:: state:: Metadata :: deserialize ( & mut data. as_ref ( ) ) ?;
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ impl<'info> SavePrimaryMetadataCreators<'info> {
11
11
let admin = & self . admin ;
12
12
let secondary_metadata_creators = & mut self . primary_metadata_creators ;
13
13
let data = & metadata. data . borrow_mut ( ) ;
14
- if metadata . data_is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
14
+ if data . is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
15
15
return Err ( ErrorCode :: InvalidMetadataAccount . into ( ) ) ;
16
16
}
17
17
let metadata_state = mpl_token_metadata:: state:: Metadata :: deserialize ( & mut data. as_ref ( ) ) ?;
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ impl<'info> Withdraw<'info> {
60
60
61
61
// Obtain right creators according to sale type
62
62
let data = & metadata. data . borrow_mut ( ) ;
63
- if metadata . data_is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
63
+ if data . is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
64
64
return Err ( ErrorCode :: InvalidMetadataAccount . into ( ) ) ;
65
65
}
66
66
let metadata = mpl_token_metadata:: state:: Metadata :: deserialize ( & mut data. as_ref ( ) ) ?;
Original file line number Diff line number Diff line change @@ -118,9 +118,7 @@ pub fn assert_valid_metadata(
118
118
mint : & AccountInfo ,
119
119
) -> Result < Metadata > {
120
120
let data = & metadata_account. data . borrow_mut ( ) ;
121
- if metadata_account. data_is_empty ( )
122
- || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8
123
- {
121
+ if data. is_empty ( ) || data[ 0 ] != mpl_token_metadata:: state:: Key :: MetadataV1 as u8 {
124
122
return Err ( HydraError :: InvalidMetadata . into ( ) ) ;
125
123
}
126
124
let meta = mpl_token_metadata:: state:: Metadata :: deserialize ( & mut data. as_ref ( ) ) ?;
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ function exists_in_list() {
4
+ LIST=$1
5
+ DELIMITER=$2
6
+ VALUE=$3
7
+ echo $LIST | tr " $DELIMITER " ' \n' | grep -F -q -x " $VALUE "
8
+ }
9
+
10
+ input=$1
11
+
12
+ programs=" auction-house auctioneer candy-machine fixed-price-sale gumdrop hydra token-entangler"
13
+
14
+ mkdir -p test-programs
15
+
16
+ if exists_in_list " $programs " " " $input ; then
17
+ echo " testing $input "
18
+ cd $input /program
19
+ cargo test-bpf --bpf-out-dir ../../test-programs/
20
+ cd ../../
21
+
22
+ elif [[ $input = " all" ]]
23
+ then
24
+ echo " testing all programs"
25
+ for program in ${programs} ; do
26
+ echo " testing $program "
27
+ cd $program /program
28
+ cargo test-bpf --bpf-out-dir ../../test-programs/
29
+ cd ../../
30
+ done
31
+ # echo "building testing-utils"
32
+ # cd core/rust/testing-utils
33
+ # cargo build-bpf --bpf-out-dir ../../../test-programs/
34
+ # cd ../../../
35
+ elif [[ $input = " token-auth-rules" ]]
36
+ then
37
+ solana program dump -u https://api.mainnet-beta.solana.com auth9SigNpDKz4sJJ1DfCTuZrZNSAgh9sFD3rboVmgg ./test-programs/mpl_token_auth_rules.so
38
+ elif [[ $input = " rooster" ]]
39
+ then
40
+ solana program dump -u https://api.mainnet-beta.solana.com Roostrnex2Z9Y2XZC49sFAdZARP8E4iFpEnZC5QJWdz ./test-programs/rooster.so
41
+ else
42
+ echo " Invalid program name: $input "
43
+ exit 1
44
+ fi
45
+
46
+
You can’t perform that action at this time.
0 commit comments