@@ -38,17 +38,6 @@ static bool valid_funding_account( SolAccountInfo *ka )
38
38
ka -> is_writable ;
39
39
}
40
40
41
- static bool valid_signable_account ( SolParameters * prm ,
42
- SolAccountInfo * ka ,
43
- uint64_t min_dlen )
44
- {
45
- return ka -> is_signer &&
46
- ka -> is_writable &&
47
- SolPubkey_same ( ka -> owner , prm -> program_id ) &&
48
- ka -> data_len >= min_dlen &&
49
- is_rent_exempt ( * ka -> lamports , ka -> data_len );
50
- }
51
-
52
41
static bool valid_writable_account ( SolParameters * prm ,
53
42
SolAccountInfo * ka ,
54
43
uint64_t min_dlen )
@@ -59,54 +48,6 @@ static bool valid_writable_account( SolParameters *prm,
59
48
is_rent_exempt ( * ka -> lamports , ka -> data_len );
60
49
}
61
50
62
- static uint64_t init_price ( SolParameters * prm , SolAccountInfo * ka )
63
- {
64
- // Validate command parameters
65
- cmd_init_price_t * cptr = (cmd_init_price_t * )prm -> data ;
66
- if ( prm -> data_len != sizeof ( cmd_init_price_t ) ||
67
- cptr -> expo_ > PC_MAX_NUM_DECIMALS ||
68
- cptr -> expo_ < - PC_MAX_NUM_DECIMALS ) {
69
- return ERROR_INVALID_ARGUMENT ;
70
- }
71
-
72
- // Account (1) is the price account to (re)initialize
73
- // Verify that these are signed, writable accounts with correct ownership
74
- // and size
75
- if ( prm -> ka_num != 2 ||
76
- !valid_funding_account ( & ka [0 ] ) ||
77
- !valid_signable_account ( prm , & ka [1 ], sizeof ( pc_price_t ) )) {
78
- return ERROR_INVALID_ARGUMENT ;
79
- }
80
-
81
- // Verify that the price account is initialized
82
- pc_price_t * sptr = (pc_price_t * )ka [1 ].data ;
83
- if ( sptr -> magic_ != PC_MAGIC ||
84
- sptr -> ver_ != cptr -> ver_ ||
85
- sptr -> type_ != PC_ACCTYPE_PRICE ||
86
- sptr -> ptype_ != cptr -> ptype_ ) {
87
- return ERROR_INVALID_ARGUMENT ;
88
- }
89
-
90
- // (re)initialize price exponent and clear-down all quotes
91
- sptr -> expo_ = cptr -> expo_ ;
92
- sptr -> last_slot_ = 0UL ;
93
- sptr -> valid_slot_ = 0UL ;
94
- sptr -> agg_ .pub_slot_ = 0UL ;
95
- sptr -> prev_slot_ = 0UL ;
96
- sptr -> prev_price_ = 0L ;
97
- sptr -> prev_conf_ = 0L ;
98
- sptr -> prev_timestamp_ = 0L ;
99
- sol_memset ( & sptr -> twap_ , 0 , sizeof ( pc_ema_t ) );
100
- sol_memset ( & sptr -> twac_ , 0 , sizeof ( pc_ema_t ) );
101
- sol_memset ( & sptr -> agg_ , 0 , sizeof ( pc_price_info_t ) );
102
- for (unsigned i = 0 ; i != sptr -> num_ ; ++ i ) {
103
- pc_price_comp_t * iptr = & sptr -> comp_ [i ];
104
- sol_memset ( & iptr -> agg_ , 0 , sizeof ( pc_price_info_t ) );
105
- sol_memset ( & iptr -> latest_ , 0 , sizeof ( pc_price_info_t ) );
106
- }
107
- return SUCCESS ;
108
- }
109
-
110
51
static uint64_t upd_price ( SolParameters * prm , SolAccountInfo * ka )
111
52
{
112
53
// Validate command parameters
@@ -212,7 +153,7 @@ static uint64_t dispatch( SolParameters *prm, SolAccountInfo *ka )
212
153
case e_cmd_add_price : return ERROR_INVALID_ARGUMENT ;
213
154
case e_cmd_add_publisher : return ERROR_INVALID_ARGUMENT ;
214
155
case e_cmd_del_publisher : return ERROR_INVALID_ARGUMENT ;
215
- case e_cmd_init_price : return init_price ( prm , ka ) ;
156
+ case e_cmd_init_price : return ERROR_INVALID_ARGUMENT ;
216
157
case e_cmd_init_test : return ERROR_INVALID_ARGUMENT ;
217
158
case e_cmd_upd_test : return ERROR_INVALID_ARGUMENT ;
218
159
case e_cmd_set_min_pub : return ERROR_INVALID_ARGUMENT ;
0 commit comments