File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -11,4 +11,5 @@ typedef unsigned int uint32_t;
11
11
typedef signed long int int64_t ;
12
12
typedef unsigned long int uint64_t ;
13
13
14
- #include "../../c/src/oracle/oracle.h"
14
+ #include "../../c/src/oracle/oracle.h"
15
+ #include "price_t_offsets.h"
Original file line number Diff line number Diff line change
1
+ //The constants below are used by the rust oracle to efficiently access members in price_t
2
+ //price_t is a big struct, attemting to deserialize all of it directly in borsh causes stack
3
+ //issues on Solana. It is also more efficient to only access the members we need
4
+ #include "../../c/src/oracle/oracle.h"
5
+ #include <stddef.h>
6
+ const size_t PRICE_T_EXPO_OFFSET = offsetof(struct pc_price , expo_ );
7
+ const size_t PRICE_T_TIMESTAMP_OFFSET = offsetof(struct pc_price , timestamp_ );
8
+ const size_t PRICE_T_AGGREGATE_OFFSET = offsetof(struct pc_price , agg_ );
9
+ const size_t PRICE_T_AGGREGATE_CONF_OFFSET = offsetof(struct pc_price , agg_ ) + offsetof(struct pc_price_info , conf_ );
10
+ const size_t PRICE_T_AGGREGATE_PRICE_OFFSET = offsetof(struct pc_price , agg_ ) + offsetof(struct pc_price_info , price_ );
11
+ const size_t PRICE_T_AGGREGATE_STATUS_OFFSET = offsetof(struct pc_price , agg_ ) + offsetof(struct pc_price_info , status_ );
12
+ const size_t PRICE_T_PREV_TIMESTAMP_OFFSET = offsetof(struct pc_price , prev_timestamp_ );
13
+ const size_t PRICE_T_PREV_CONF_OFFSET = offsetof(struct pc_price , prev_conf_ );
14
+ const size_t PRICE_T_PREV_AGGREGATE_OFFSET = offsetof(struct pc_price , prev_price_ );
You can’t perform that action at this time.
0 commit comments