|
@@ -27,7 +27,8 @@ use {
|
|
|
},
|
|
},
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-pub static CONFIG_KEY: &[u8] = b"config";
|
|
|
|
|
|
|
+pub static DEPRECATED_CONFIG_KEY: &[u8] = b"config";
|
|
|
|
|
+pub static CONFIG_KEY: &[u8] = b"config_v1";
|
|
|
pub static PRICE_FEED_KEY: &[u8] = b"price_feed";
|
|
pub static PRICE_FEED_KEY: &[u8] = b"price_feed";
|
|
|
|
|
|
|
|
/// A `PythDataSource` identifies a specific contract (given by its Wormhole `emitter`) on
|
|
/// A `PythDataSource` identifies a specific contract (given by its Wormhole `emitter`) on
|
|
@@ -78,3 +79,40 @@ pub fn price_feed_bucket(storage: &mut dyn Storage) -> Bucket<PriceFeed> {
|
|
|
pub fn price_feed_read_bucket(storage: &dyn Storage) -> ReadonlyBucket<PriceFeed> {
|
|
pub fn price_feed_read_bucket(storage: &dyn Storage) -> ReadonlyBucket<PriceFeed> {
|
|
|
bucket_read(storage, PRICE_FEED_KEY)
|
|
bucket_read(storage, PRICE_FEED_KEY)
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// this code is only added to facilititate migration
|
|
|
|
|
+// once migrated this code can be removed
|
|
|
|
|
+#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
|
|
|
|
|
+pub struct DepreceatedConfigInfo {
|
|
|
|
|
+ pub owner: Addr,
|
|
|
|
|
+ pub wormhole_contract: Addr,
|
|
|
|
|
+ pub data_sources: HashSet<PythDataSource>,
|
|
|
|
|
+ pub governance_source: PythDataSource,
|
|
|
|
|
+ // Index for preventing replay attacks on governance data source transfers.
|
|
|
|
|
+ // This index increases every time the governance data source is changed, which prevents old
|
|
|
|
|
+ // transfer request VAAs from being replayed.
|
|
|
|
|
+ pub governance_source_index: u32,
|
|
|
|
|
+ // The wormhole sequence number for governance messages. This value is increased every time the
|
|
|
|
|
+ // a governance instruction is executed.
|
|
|
|
|
+ //
|
|
|
|
|
+ // This field differs from the one above in that it is generated by wormhole and applicable to all
|
|
|
|
|
+ // governance messages, whereas the one above is generated by Pyth and only applicable to governance
|
|
|
|
|
+ // source transfers.
|
|
|
|
|
+ pub governance_sequence_number: u64,
|
|
|
|
|
+ // Warning: This id needs to agree with the wormhole chain id.
|
|
|
|
|
+ // We should read this directly from wormhole, but their contract doesn't expose it.
|
|
|
|
|
+ pub chain_id: u16,
|
|
|
|
|
+ pub valid_time_period: Duration,
|
|
|
|
|
+
|
|
|
|
|
+ // The fee to pay, denominated in fee_denom (typically, the chain's native token)
|
|
|
|
|
+ pub fee: Coin,
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+pub fn deprecated_config(storage: &mut dyn Storage) -> Singleton<DepreceatedConfigInfo> {
|
|
|
|
|
+ singleton(storage, DEPRECATED_CONFIG_KEY)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+pub fn deprecated_config_read(storage: &dyn Storage) -> ReadonlySingleton<DepreceatedConfigInfo> {
|
|
|
|
|
+ singleton_read(storage, DEPRECATED_CONFIG_KEY)
|
|
|
|
|
+}
|