-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(target_chains/ton): soft throw instead of revert (#2413)
* soft throw instead of revert * add soft throw for parse_unique_price_feed_updates * revert test * feat: enhance documentation for Pyth Network Price Oracle contract operations
- Loading branch information
Showing
5 changed files
with
217 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
target_chains/ton/contracts/contracts/common/error_handling.fc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "op.fc"; | ||
#include "errors.fc"; | ||
#include "constants.fc"; | ||
|
||
() emit_error(int error_code, int op, slice sender_address, cell custom_payload) impure inline { | ||
;; Create error message cell with context | ||
cell msg = begin_cell() | ||
.store_uint(OP_RESPONSE_ERROR, 32) | ||
.store_uint(error_code, 32) | ||
.store_uint(op, 32) | ||
.store_ref(custom_payload) | ||
.end_cell(); | ||
|
||
;; Send error response back to sender | ||
var msg = begin_cell() | ||
.store_uint(0x18, 6) ;; nobounce | ||
.store_slice(sender_address) ;; to_addr | ||
.store_coins(0) ;; value | ||
.store_uint(1, MSG_SERIALIZE_BITS) ;; msg header | ||
.store_ref(msg) ;; error info | ||
.end_cell(); | ||
|
||
send_raw_message(msg, 64); | ||
} | ||
|
||
() emit_success(slice sender_address, cell result, cell custom_payload) impure inline { | ||
;; Create success message cell | ||
cell msg = begin_cell() | ||
.store_uint(OP_RESPONSE_SUCCESS, 32) | ||
.store_ref(result) ;; Result data | ||
.store_ref(custom_payload) ;; Original custom payload | ||
.end_cell(); | ||
|
||
;; Send success response | ||
var msg = begin_cell() | ||
.store_uint(0x18, 6) ;; nobounce | ||
.store_slice(sender_address) ;; to_addr | ||
.store_coins(0) ;; value | ||
.store_uint(1, MSG_SERIALIZE_BITS) ;; msg header | ||
.store_ref(msg) ;; success info | ||
.end_cell(); | ||
|
||
send_raw_message(msg, 64); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters