@@ -340,15 +340,11 @@ cell create_price_feed_cell_chain(tuple price_feeds) {
340340 cell custom_payload_cell = begin_cell().store_slice(custom_payload).end_cell();
341341 response = response.store_ref(price_feeds_cell).store_slice(sender_address).store_ref(custom_payload_cell);
342342
343- int num_price_feeds = price_feeds.tlen();
344-
345- ;; Calculate all fees
346- int compute_fee = get_compute_fee(WORKCHAIN, get_gas_consumed());
343+ ;; Calculate update fee
347344 int update_fee = single_update_fee * price_feeds.tlen();
348345
349- ;; Calculate total fees and remaining excess
350- int total_fees = compute_fee + update_fee;
351- int excess = msg_value - total_fees;
346+ ;; Reserve current_balance + fee
347+ raw_reserve(update_fee, RESERVE_MODE::INCREASE_BY_ORIGINAL_BALANCE);
352348
353349 ;; SECURITY: Integrators MUST validate that messages are from this Pyth contract
354350 ;; in their receive function. Otherwise, attackers could:
@@ -362,11 +358,11 @@ cell create_price_feed_cell_chain(tuple price_feeds) {
362358 send_raw_message(begin_cell()
363359 .store_uint(0x18, 6)
364360 .store_slice(target_address)
365- .store_coins(excess )
361+ .store_coins(0 )
366362 .store_uint(1, MSG_SERIALIZE_BITS)
367363 .store_ref(response.end_cell())
368364 .end_cell(),
369- 0 );
365+ SENDMODE::CARRY_ALL_BALANCE );
370366}
371367
372368;; Helper function to parse price IDs from a slice, handling cell chain traversal
0 commit comments