-
Notifications
You must be signed in to change notification settings - Fork 302
feature(target_chains/ton): add upgrade standard #1939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
target_chains/ton/contracts/contracts/common/governance_actions.fc
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| const int OP_UPDATE_GUARDIAN_SET = 1; | ||
| const int OP_UPDATE_PRICE_FEEDS = 2; | ||
| const int OP_EXECUTE_GOVERNANCE_ACTION = 3; | ||
| const int OP_UPGRADE_CONTRACT = 4; |
This file contains hidden or 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 hidden or 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
78 changes: 78 additions & 0 deletions
78
target_chains/ton/contracts/contracts/tests/PythTestUpgraded.fc
This file contains hidden or 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,78 @@ | ||
| {- | ||
| This test contract is an upgraded version of PythTest.fc. This is used to test the upgrade functionality of the Pyth contract. | ||
| -} | ||
|
|
||
| #include "../imports/stdlib.fc"; | ||
| #include "../Pyth.fc"; | ||
| #include "../Wormhole.fc"; | ||
| #include "../common/op.fc"; | ||
|
|
||
| () recv_internal(int balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { | ||
| if (in_msg_body.slice_empty?()) { | ||
| return (); | ||
| } | ||
|
|
||
| int op = in_msg_body~load_uint(32); | ||
| cell data = in_msg_body~load_ref(); | ||
| slice data_slice = data.begin_parse(); | ||
| if (op == OP_UPDATE_GUARDIAN_SET) { | ||
| update_guardian_set(data_slice); | ||
| } elseif (op == OP_UPDATE_PRICE_FEEDS) { | ||
| update_price_feeds(msg_value, data_slice); | ||
| } elseif (op == OP_EXECUTE_GOVERNANCE_ACTION) { | ||
| execute_governance_action(data_slice); | ||
| } elseif (op == OP_UPGRADE_CONTRACT) { | ||
| execute_upgrade_contract(data); | ||
| } else { | ||
| throw(0xffff); ;; Throw exception for unknown op | ||
| } | ||
| } | ||
|
|
||
| (int, int, int, int) test_get_price_unsafe(int price_feed_id) method_id { | ||
| return get_price_unsafe(price_feed_id); | ||
| } | ||
|
|
||
| (int, int, int, int) test_get_price_no_older_than(int time_period, int price_feed_id) method_id { | ||
| return get_price_no_older_than(time_period, price_feed_id); | ||
| } | ||
|
|
||
| (int, int, int, int) test_get_ema_price_unsafe(int price_feed_id) method_id { | ||
| return get_ema_price_unsafe(price_feed_id); | ||
| } | ||
|
|
||
| (int, int, int, int) test_get_ema_price_no_older_than(int time_period, int price_feed_id) method_id { | ||
| return get_ema_price_no_older_than(time_period, price_feed_id); | ||
| } | ||
|
|
||
| (int) test_get_update_fee(slice in_msg_body) method_id { | ||
| return get_update_fee(in_msg_body); | ||
| } | ||
|
|
||
| (int) test_get_single_update_fee() method_id { | ||
| return get_single_update_fee(); | ||
| } | ||
|
|
||
| (int) test_get_chain_id() method_id { | ||
| return get_chain_id(); | ||
| } | ||
|
|
||
| (int) test_get_last_executed_governance_sequence() method_id { | ||
| return get_last_executed_governance_sequence(); | ||
| } | ||
|
|
||
| (int) test_get_governance_data_source_index() method_id { | ||
| return get_governance_data_source_index(); | ||
| } | ||
|
|
||
| (cell) test_get_governance_data_source() method_id { | ||
| return get_governance_data_source(); | ||
| } | ||
|
|
||
| (int) test_get_is_valid_data_source(cell data_source) method_id { | ||
| return get_is_valid_data_source(data_source); | ||
| } | ||
|
|
||
| ;; Add a new function to demonstrate the upgrade | ||
| (int) test_new_function() method_id { | ||
| return 1; | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.