|
27 | 27 | },
|
28 | 28 | };
|
29 | 29 |
|
30 |
| -pub static CONFIG_KEY: &[u8] = b"config"; |
| 30 | +pub static DEPRECATED_CONFIG_KEY: &[u8] = b"config"; |
| 31 | +pub static CONFIG_KEY: &[u8] = b"config_v1"; |
31 | 32 | pub static PRICE_FEED_KEY: &[u8] = b"price_feed";
|
32 | 33 |
|
33 | 34 | /// 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> {
|
78 | 79 | pub fn price_feed_read_bucket(storage: &dyn Storage) -> ReadonlyBucket<PriceFeed> {
|
79 | 80 | bucket_read(storage, PRICE_FEED_KEY)
|
80 | 81 | }
|
| 82 | + |
| 83 | + |
| 84 | +// this code is only added to facilititate migration |
| 85 | +// once migrated this code can be removed |
| 86 | +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] |
| 87 | +pub struct DepreceatedConfigInfo { |
| 88 | + pub owner: Addr, |
| 89 | + pub wormhole_contract: Addr, |
| 90 | + pub data_sources: HashSet<PythDataSource>, |
| 91 | + pub governance_source: PythDataSource, |
| 92 | + // Index for preventing replay attacks on governance data source transfers. |
| 93 | + // This index increases every time the governance data source is changed, which prevents old |
| 94 | + // transfer request VAAs from being replayed. |
| 95 | + pub governance_source_index: u32, |
| 96 | + // The wormhole sequence number for governance messages. This value is increased every time the |
| 97 | + // a governance instruction is executed. |
| 98 | + // |
| 99 | + // This field differs from the one above in that it is generated by wormhole and applicable to all |
| 100 | + // governance messages, whereas the one above is generated by Pyth and only applicable to governance |
| 101 | + // source transfers. |
| 102 | + pub governance_sequence_number: u64, |
| 103 | + // Warning: This id needs to agree with the wormhole chain id. |
| 104 | + // We should read this directly from wormhole, but their contract doesn't expose it. |
| 105 | + pub chain_id: u16, |
| 106 | + pub valid_time_period: Duration, |
| 107 | + |
| 108 | + // The fee to pay, denominated in fee_denom (typically, the chain's native token) |
| 109 | + pub fee: Coin, |
| 110 | +} |
| 111 | + |
| 112 | +pub fn deprecated_config(storage: &mut dyn Storage) -> Singleton<DepreceatedConfigInfo> { |
| 113 | + singleton(storage, DEPRECATED_CONFIG_KEY) |
| 114 | +} |
| 115 | + |
| 116 | +pub fn deprecated_config_read(storage: &dyn Storage) -> ReadonlySingleton<DepreceatedConfigInfo> { |
| 117 | + singleton_read(storage, DEPRECATED_CONFIG_KEY) |
| 118 | +} |
0 commit comments