pyth-crosschain/target_chains/sui/contracts/sources/data_source.move

78 lines
2.1 KiB
Plaintext
Raw Normal View History

module pyth::data_source {
use sui::dynamic_field::{Self};
use sui::object::{UID};
use sui::tx_context::{TxContext};
use pyth::set::{Self};
use wormhole::external_address::ExternalAddress;
[sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783) * state getters and setters, change Move.toml dependency to sui/integration_v2 * finish state.move * add new line to pyth * use deployer cap pattern for state module * sui pyth * update price feeds, dynamic object fields, Sui object PriceInfoObject * register price info object with pyth state after creation * sui governance * some newlines * error codes * update and comment * unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades) * updates * test_get_update_fee test passes * fix test_get_update_fee and test_update_price_feeds_corrupt_vaa * test_update_price_feeds_invalid_data_source * test_create_and_update_price_feeds * test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure * test_update_cache * update * test_update_cache_old_update * update_price_feeds_if_fresh * comment * contract upgrades start * contract upgradeability * update clock stuff * edits * use clone of sui/integration_v2 for stability * make contract_upgrade::execute a public(friend) fun, remove clock arg * E_INCORRECT_IDENTIFIER_LENGTH * comment and edit * add a single comment * upgradeability fixes, other fixes * update, migrate, state, pyth, setup, version_control * upgradeability, governance, LatestOnly * - state init_version, init_package_info - governance and contract ugpradeability stuff * make several functions public(friend), and friend the right modules in data_source.move * add comment * fix bug in from_u8, so that value <= TRANSFER_FEE * rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES * set_last_executed_governance_sequence * set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001 * update README * Update README.md * Update README.md * delete comments * Update README.md * Update README.md * change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence. * state::set_last_executed_governance_sequence * rename error * add newline to setup.move * delete space * Update README.md * mark test module as well as some imports #[test_only] so sui move build works * scripts for Pyth contract testing and deployment remove required_version.move, as it is no longer being used for access control make init_and_share_state a public(friend) function * add build to Makefile * init pyth ts script * sui deploy and testing scripts * contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update * init_pyth.ts, registry.ts, create_price_feed.ts * create price feeds * deploy script and Move.toml * some contract updates to compile with WH branch sui/mainnet deployment script updates * update README * update readme * rename TS scripts, edit readme * add rev for wormhole dependency, edit README * edit create_price_feed script * - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier - add test for price_info::get * contract updates * script edits * contract upgrade in version_control.move and fix pyth_create_price_feed.ts * add get_price_info_object_id function to pyth::state * tests and build pass * update scripts * Pyth mainnet deploy, create all price feeds script * clean up script imports * add mainnet addresses to readme * correct Pyth Mainnet addresses * create price feeds on mainnet * use git dependency in Move.toml * edits * delete required contracts * get price info object ids * get price info object IDs * add json file containing price feed id to price info object id * comment * clean up scripts folder and imports * more script clean up (comments) * script updates * pre-commit run --all-files
2023-06-19 20:05:33 -07:00
friend pyth::state;
friend pyth::set_data_sources;
friend pyth::pyth;
friend pyth::set_governance_data_source;
friend pyth::governance;
[sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783) * state getters and setters, change Move.toml dependency to sui/integration_v2 * finish state.move * add new line to pyth * use deployer cap pattern for state module * sui pyth * update price feeds, dynamic object fields, Sui object PriceInfoObject * register price info object with pyth state after creation * sui governance * some newlines * error codes * update and comment * unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades) * updates * test_get_update_fee test passes * fix test_get_update_fee and test_update_price_feeds_corrupt_vaa * test_update_price_feeds_invalid_data_source * test_create_and_update_price_feeds * test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure * test_update_cache * update * test_update_cache_old_update * update_price_feeds_if_fresh * comment * contract upgrades start * contract upgradeability * update clock stuff * edits * use clone of sui/integration_v2 for stability * make contract_upgrade::execute a public(friend) fun, remove clock arg * E_INCORRECT_IDENTIFIER_LENGTH * comment and edit * add a single comment * upgradeability fixes, other fixes * update, migrate, state, pyth, setup, version_control * upgradeability, governance, LatestOnly * - state init_version, init_package_info - governance and contract ugpradeability stuff * make several functions public(friend), and friend the right modules in data_source.move * add comment * fix bug in from_u8, so that value <= TRANSFER_FEE * rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES * set_last_executed_governance_sequence * set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001 * update README * Update README.md * Update README.md * delete comments * Update README.md * Update README.md * change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence. * state::set_last_executed_governance_sequence * rename error * add newline to setup.move * delete space * Update README.md * mark test module as well as some imports #[test_only] so sui move build works * scripts for Pyth contract testing and deployment remove required_version.move, as it is no longer being used for access control make init_and_share_state a public(friend) function * add build to Makefile * init pyth ts script * sui deploy and testing scripts * contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update * init_pyth.ts, registry.ts, create_price_feed.ts * create price feeds * deploy script and Move.toml * some contract updates to compile with WH branch sui/mainnet deployment script updates * update README * update readme * rename TS scripts, edit readme * add rev for wormhole dependency, edit README * edit create_price_feed script * - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier - add test for price_info::get * contract updates * script edits * contract upgrade in version_control.move and fix pyth_create_price_feed.ts * add get_price_info_object_id function to pyth::state * tests and build pass * update scripts * Pyth mainnet deploy, create all price feeds script * clean up script imports * add mainnet addresses to readme * correct Pyth Mainnet addresses * create price feeds on mainnet * use git dependency in Move.toml * edits * delete required contracts * get price info object ids * get price info object IDs * add json file containing price feed id to price info object id * comment * clean up scripts folder and imports * more script clean up (comments) * script updates * pre-commit run --all-files
2023-06-19 20:05:33 -07:00
#[test_only]
friend pyth::pyth_tests;
#[test_only]
friend pyth::set_data_sources_tests;
[sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783) * state getters and setters, change Move.toml dependency to sui/integration_v2 * finish state.move * add new line to pyth * use deployer cap pattern for state module * sui pyth * update price feeds, dynamic object fields, Sui object PriceInfoObject * register price info object with pyth state after creation * sui governance * some newlines * error codes * update and comment * unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades) * updates * test_get_update_fee test passes * fix test_get_update_fee and test_update_price_feeds_corrupt_vaa * test_update_price_feeds_invalid_data_source * test_create_and_update_price_feeds * test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure * test_update_cache * update * test_update_cache_old_update * update_price_feeds_if_fresh * comment * contract upgrades start * contract upgradeability * update clock stuff * edits * use clone of sui/integration_v2 for stability * make contract_upgrade::execute a public(friend) fun, remove clock arg * E_INCORRECT_IDENTIFIER_LENGTH * comment and edit * add a single comment * upgradeability fixes, other fixes * update, migrate, state, pyth, setup, version_control * upgradeability, governance, LatestOnly * - state init_version, init_package_info - governance and contract ugpradeability stuff * make several functions public(friend), and friend the right modules in data_source.move * add comment * fix bug in from_u8, so that value <= TRANSFER_FEE * rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES * set_last_executed_governance_sequence * set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001 * update README * Update README.md * Update README.md * delete comments * Update README.md * Update README.md * change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence. * state::set_last_executed_governance_sequence * rename error * add newline to setup.move * delete space * Update README.md * mark test module as well as some imports #[test_only] so sui move build works * scripts for Pyth contract testing and deployment remove required_version.move, as it is no longer being used for access control make init_and_share_state a public(friend) function * add build to Makefile * init pyth ts script * sui deploy and testing scripts * contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update * init_pyth.ts, registry.ts, create_price_feed.ts * create price feeds * deploy script and Move.toml * some contract updates to compile with WH branch sui/mainnet deployment script updates * update README * update readme * rename TS scripts, edit readme * add rev for wormhole dependency, edit README * edit create_price_feed script * - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier - add test for price_info::get * contract updates * script edits * contract upgrade in version_control.move and fix pyth_create_price_feed.ts * add get_price_info_object_id function to pyth::state * tests and build pass * update scripts * Pyth mainnet deploy, create all price feeds script * clean up script imports * add mainnet addresses to readme * correct Pyth Mainnet addresses * create price feeds on mainnet * use git dependency in Move.toml * edits * delete required contracts * get price info object ids * get price info object IDs * add json file containing price feed id to price info object id * comment * clean up scripts folder and imports * more script clean up (comments) * script updates * pre-commit run --all-files
2023-06-19 20:05:33 -07:00
const KEY: vector<u8> = b"data_sources";
const E_DATA_SOURCE_REGISTRY_ALREADY_EXISTS: u64 = 0;
const E_DATA_SOURCE_ALREADY_REGISTERED: u64 = 1;
struct DataSource has copy, drop, store {
emitter_chain: u64,
emitter_address: ExternalAddress,
}
[sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783) * state getters and setters, change Move.toml dependency to sui/integration_v2 * finish state.move * add new line to pyth * use deployer cap pattern for state module * sui pyth * update price feeds, dynamic object fields, Sui object PriceInfoObject * register price info object with pyth state after creation * sui governance * some newlines * error codes * update and comment * unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades) * updates * test_get_update_fee test passes * fix test_get_update_fee and test_update_price_feeds_corrupt_vaa * test_update_price_feeds_invalid_data_source * test_create_and_update_price_feeds * test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure * test_update_cache * update * test_update_cache_old_update * update_price_feeds_if_fresh * comment * contract upgrades start * contract upgradeability * update clock stuff * edits * use clone of sui/integration_v2 for stability * make contract_upgrade::execute a public(friend) fun, remove clock arg * E_INCORRECT_IDENTIFIER_LENGTH * comment and edit * add a single comment * upgradeability fixes, other fixes * update, migrate, state, pyth, setup, version_control * upgradeability, governance, LatestOnly * - state init_version, init_package_info - governance and contract ugpradeability stuff * make several functions public(friend), and friend the right modules in data_source.move * add comment * fix bug in from_u8, so that value <= TRANSFER_FEE * rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES * set_last_executed_governance_sequence * set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001 * update README * Update README.md * Update README.md * delete comments * Update README.md * Update README.md * change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence. * state::set_last_executed_governance_sequence * rename error * add newline to setup.move * delete space * Update README.md * mark test module as well as some imports #[test_only] so sui move build works * scripts for Pyth contract testing and deployment remove required_version.move, as it is no longer being used for access control make init_and_share_state a public(friend) function * add build to Makefile * init pyth ts script * sui deploy and testing scripts * contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update * init_pyth.ts, registry.ts, create_price_feed.ts * create price feeds * deploy script and Move.toml * some contract updates to compile with WH branch sui/mainnet deployment script updates * update README * update readme * rename TS scripts, edit readme * add rev for wormhole dependency, edit README * edit create_price_feed script * - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier - add test for price_info::get * contract updates * script edits * contract upgrade in version_control.move and fix pyth_create_price_feed.ts * add get_price_info_object_id function to pyth::state * tests and build pass * update scripts * Pyth mainnet deploy, create all price feeds script * clean up script imports * add mainnet addresses to readme * correct Pyth Mainnet addresses * create price feeds on mainnet * use git dependency in Move.toml * edits * delete required contracts * get price info object ids * get price info object IDs * add json file containing price feed id to price info object id * comment * clean up scripts folder and imports * more script clean up (comments) * script updates * pre-commit run --all-files
2023-06-19 20:05:33 -07:00
public(friend) fun new_data_source_registry(parent_id: &mut UID, ctx: &mut TxContext) {
assert!(
!dynamic_field::exists_(parent_id, KEY),
E_DATA_SOURCE_REGISTRY_ALREADY_EXISTS // TODO - add custom error type
);
dynamic_field::add(
parent_id,
KEY,
set::new<DataSource>(ctx)
)
}
[sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783) * state getters and setters, change Move.toml dependency to sui/integration_v2 * finish state.move * add new line to pyth * use deployer cap pattern for state module * sui pyth * update price feeds, dynamic object fields, Sui object PriceInfoObject * register price info object with pyth state after creation * sui governance * some newlines * error codes * update and comment * unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades) * updates * test_get_update_fee test passes * fix test_get_update_fee and test_update_price_feeds_corrupt_vaa * test_update_price_feeds_invalid_data_source * test_create_and_update_price_feeds * test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure * test_update_cache * update * test_update_cache_old_update * update_price_feeds_if_fresh * comment * contract upgrades start * contract upgradeability * update clock stuff * edits * use clone of sui/integration_v2 for stability * make contract_upgrade::execute a public(friend) fun, remove clock arg * E_INCORRECT_IDENTIFIER_LENGTH * comment and edit * add a single comment * upgradeability fixes, other fixes * update, migrate, state, pyth, setup, version_control * upgradeability, governance, LatestOnly * - state init_version, init_package_info - governance and contract ugpradeability stuff * make several functions public(friend), and friend the right modules in data_source.move * add comment * fix bug in from_u8, so that value <= TRANSFER_FEE * rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES * set_last_executed_governance_sequence * set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001 * update README * Update README.md * Update README.md * delete comments * Update README.md * Update README.md * change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence. * state::set_last_executed_governance_sequence * rename error * add newline to setup.move * delete space * Update README.md * mark test module as well as some imports #[test_only] so sui move build works * scripts for Pyth contract testing and deployment remove required_version.move, as it is no longer being used for access control make init_and_share_state a public(friend) function * add build to Makefile * init pyth ts script * sui deploy and testing scripts * contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update * init_pyth.ts, registry.ts, create_price_feed.ts * create price feeds * deploy script and Move.toml * some contract updates to compile with WH branch sui/mainnet deployment script updates * update README * update readme * rename TS scripts, edit readme * add rev for wormhole dependency, edit README * edit create_price_feed script * - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier - add test for price_info::get * contract updates * script edits * contract upgrade in version_control.move and fix pyth_create_price_feed.ts * add get_price_info_object_id function to pyth::state * tests and build pass * update scripts * Pyth mainnet deploy, create all price feeds script * clean up script imports * add mainnet addresses to readme * correct Pyth Mainnet addresses * create price feeds on mainnet * use git dependency in Move.toml * edits * delete required contracts * get price info object ids * get price info object IDs * add json file containing price feed id to price info object id * comment * clean up scripts folder and imports * more script clean up (comments) * script updates * pre-commit run --all-files
2023-06-19 20:05:33 -07:00
public(friend) fun add(parent_id: &mut UID, data_source: DataSource) {
assert!(
!contains(parent_id, data_source),
E_DATA_SOURCE_ALREADY_REGISTERED
);
set::add(
dynamic_field::borrow_mut(parent_id, KEY),
data_source
)
}
[sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783) * state getters and setters, change Move.toml dependency to sui/integration_v2 * finish state.move * add new line to pyth * use deployer cap pattern for state module * sui pyth * update price feeds, dynamic object fields, Sui object PriceInfoObject * register price info object with pyth state after creation * sui governance * some newlines * error codes * update and comment * unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades) * updates * test_get_update_fee test passes * fix test_get_update_fee and test_update_price_feeds_corrupt_vaa * test_update_price_feeds_invalid_data_source * test_create_and_update_price_feeds * test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure * test_update_cache * update * test_update_cache_old_update * update_price_feeds_if_fresh * comment * contract upgrades start * contract upgradeability * update clock stuff * edits * use clone of sui/integration_v2 for stability * make contract_upgrade::execute a public(friend) fun, remove clock arg * E_INCORRECT_IDENTIFIER_LENGTH * comment and edit * add a single comment * upgradeability fixes, other fixes * update, migrate, state, pyth, setup, version_control * upgradeability, governance, LatestOnly * - state init_version, init_package_info - governance and contract ugpradeability stuff * make several functions public(friend), and friend the right modules in data_source.move * add comment * fix bug in from_u8, so that value <= TRANSFER_FEE * rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES * set_last_executed_governance_sequence * set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001 * update README * Update README.md * Update README.md * delete comments * Update README.md * Update README.md * change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence. * state::set_last_executed_governance_sequence * rename error * add newline to setup.move * delete space * Update README.md * mark test module as well as some imports #[test_only] so sui move build works * scripts for Pyth contract testing and deployment remove required_version.move, as it is no longer being used for access control make init_and_share_state a public(friend) function * add build to Makefile * init pyth ts script * sui deploy and testing scripts * contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update * init_pyth.ts, registry.ts, create_price_feed.ts * create price feeds * deploy script and Move.toml * some contract updates to compile with WH branch sui/mainnet deployment script updates * update README * update readme * rename TS scripts, edit readme * add rev for wormhole dependency, edit README * edit create_price_feed script * - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier - add test for price_info::get * contract updates * script edits * contract upgrade in version_control.move and fix pyth_create_price_feed.ts * add get_price_info_object_id function to pyth::state * tests and build pass * update scripts * Pyth mainnet deploy, create all price feeds script * clean up script imports * add mainnet addresses to readme * correct Pyth Mainnet addresses * create price feeds on mainnet * use git dependency in Move.toml * edits * delete required contracts * get price info object ids * get price info object IDs * add json file containing price feed id to price info object id * comment * clean up scripts folder and imports * more script clean up (comments) * script updates * pre-commit run --all-files
2023-06-19 20:05:33 -07:00
public(friend) fun empty(parent_id: &mut UID){
set::empty<DataSource>(
dynamic_field::borrow_mut(parent_id, KEY)
)
}
public fun contains(parent_id: &UID, data_source: DataSource): bool {
let ref = dynamic_field::borrow(parent_id, KEY);
set::contains<DataSource>(ref, data_source)
}
[sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783) * state getters and setters, change Move.toml dependency to sui/integration_v2 * finish state.move * add new line to pyth * use deployer cap pattern for state module * sui pyth * update price feeds, dynamic object fields, Sui object PriceInfoObject * register price info object with pyth state after creation * sui governance * some newlines * error codes * update and comment * unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades) * updates * test_get_update_fee test passes * fix test_get_update_fee and test_update_price_feeds_corrupt_vaa * test_update_price_feeds_invalid_data_source * test_create_and_update_price_feeds * test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure * test_update_cache * update * test_update_cache_old_update * update_price_feeds_if_fresh * comment * contract upgrades start * contract upgradeability * update clock stuff * edits * use clone of sui/integration_v2 for stability * make contract_upgrade::execute a public(friend) fun, remove clock arg * E_INCORRECT_IDENTIFIER_LENGTH * comment and edit * add a single comment * upgradeability fixes, other fixes * update, migrate, state, pyth, setup, version_control * upgradeability, governance, LatestOnly * - state init_version, init_package_info - governance and contract ugpradeability stuff * make several functions public(friend), and friend the right modules in data_source.move * add comment * fix bug in from_u8, so that value <= TRANSFER_FEE * rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES * set_last_executed_governance_sequence * set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001 * update README * Update README.md * Update README.md * delete comments * Update README.md * Update README.md * change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence. * state::set_last_executed_governance_sequence * rename error * add newline to setup.move * delete space * Update README.md * mark test module as well as some imports #[test_only] so sui move build works * scripts for Pyth contract testing and deployment remove required_version.move, as it is no longer being used for access control make init_and_share_state a public(friend) function * add build to Makefile * init pyth ts script * sui deploy and testing scripts * contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update * init_pyth.ts, registry.ts, create_price_feed.ts * create price feeds * deploy script and Move.toml * some contract updates to compile with WH branch sui/mainnet deployment script updates * update README * update readme * rename TS scripts, edit readme * add rev for wormhole dependency, edit README * edit create_price_feed script * - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier - add test for price_info::get * contract updates * script edits * contract upgrade in version_control.move and fix pyth_create_price_feed.ts * add get_price_info_object_id function to pyth::state * tests and build pass * update scripts * Pyth mainnet deploy, create all price feeds script * clean up script imports * add mainnet addresses to readme * correct Pyth Mainnet addresses * create price feeds on mainnet * use git dependency in Move.toml * edits * delete required contracts * get price info object ids * get price info object IDs * add json file containing price feed id to price info object id * comment * clean up scripts folder and imports * more script clean up (comments) * script updates * pre-commit run --all-files
2023-06-19 20:05:33 -07:00
public(friend) fun new(emitter_chain: u64, emitter_address: ExternalAddress): DataSource {
DataSource {
emitter_chain,
emitter_address,
}
}
[sui 8/x] - finalize contracts, deploy scripts, address audit feedback (#783) * state getters and setters, change Move.toml dependency to sui/integration_v2 * finish state.move * add new line to pyth * use deployer cap pattern for state module * sui pyth * update price feeds, dynamic object fields, Sui object PriceInfoObject * register price info object with pyth state after creation * sui governance * some newlines * error codes * update and comment * unit tests for pyth.move, add UpgradeCap to Pyth State (will be used for contract upgrades) * updates * test_get_update_fee test passes * fix test_get_update_fee and test_update_price_feeds_corrupt_vaa * test_update_price_feeds_invalid_data_source * test_create_and_update_price_feeds * test_create_and_update_price_feeds_success and test_create_and_update_price_feeds_price_info_object_not_found_failure * test_update_cache * update * test_update_cache_old_update * update_price_feeds_if_fresh * comment * contract upgrades start * contract upgradeability * update clock stuff * edits * use clone of sui/integration_v2 for stability * make contract_upgrade::execute a public(friend) fun, remove clock arg * E_INCORRECT_IDENTIFIER_LENGTH * comment and edit * add a single comment * upgradeability fixes, other fixes * update, migrate, state, pyth, setup, version_control * upgradeability, governance, LatestOnly * - state init_version, init_package_info - governance and contract ugpradeability stuff * make several functions public(friend), and friend the right modules in data_source.move * add comment * fix bug in from_u8, so that value <= TRANSFER_FEE * rename error message to E_MUST_USE_CONTRACT_UPGRADE_MODULE_TO_DO_UPGRADES * set_last_executed_governance_sequence * set pyth governance_module to 0000000000000000000000000000000000000000000000000000000000000001 * update README * Update README.md * Update README.md * delete comments * Update README.md * Update README.md * change Wormhole dependency to branch sui/mainnet, which has the latest update that includes VAA sequence number in DecreeReceipt do proper checking of sequence number when executing governance instructions, allow set_governance_data_source to update the sequence number to some initial_sequence. * state::set_last_executed_governance_sequence * rename error * add newline to setup.move * delete space * Update README.md * mark test module as well as some imports #[test_only] so sui move build works * scripts for Pyth contract testing and deployment remove required_version.move, as it is no longer being used for access control make init_and_share_state a public(friend) function * add build to Makefile * init pyth ts script * sui deploy and testing scripts * contract fixes, set_fee_recipient governance action, emit price update event only if fresh price update * init_pyth.ts, registry.ts, create_price_feed.ts * create price feeds * deploy script and Move.toml * some contract updates to compile with WH branch sui/mainnet deployment script updates * update README * update readme * rename TS scripts, edit readme * add rev for wormhole dependency, edit README * edit create_price_feed script * - add price_info::get function for getting PriceInfoObject ID from PriceIdentifier - add test for price_info::get * contract updates * script edits * contract upgrade in version_control.move and fix pyth_create_price_feed.ts * add get_price_info_object_id function to pyth::state * tests and build pass * update scripts * Pyth mainnet deploy, create all price feeds script * clean up script imports * add mainnet addresses to readme * correct Pyth Mainnet addresses * create price feeds on mainnet * use git dependency in Move.toml * edits * delete required contracts * get price info object ids * get price info object IDs * add json file containing price feed id to price info object id * comment * clean up scripts folder and imports * more script clean up (comments) * script updates * pre-commit run --all-files
2023-06-19 20:05:33 -07:00
public fun emitter_chain(data_source: &DataSource): u64{
data_source.emitter_chain
}
public fun emitter_address(data_source: &DataSource): ExternalAddress{
data_source.emitter_address
}
}