-
Notifications
You must be signed in to change notification settings - Fork 25
/
oracle.rs
56 lines (46 loc) · 1.11 KB
/
oracle.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::Uint128;
use crate::ownable::{OwnableMsg, OwnableQueryMsg};
#[cw_serde]
pub struct InstantiateMsg {
pub owner: String,
}
#[cw_serde]
pub struct RemoteGasDataConfig {
pub remote_domain: u32,
pub token_exchange_rate: Uint128,
pub gas_price: Uint128,
}
#[cw_serde]
pub enum ExecuteMsg {
// ownership
Ownership(OwnableMsg),
// gas data
SetRemoteGasDataConfigs { configs: Vec<RemoteGasDataConfig> },
SetRemoteGasData { config: RemoteGasDataConfig },
}
#[cw_serde]
#[derive(QueryResponses)]
#[query_responses(nested)]
pub enum QueryMsg {
// overrides
Ownable(OwnableQueryMsg),
// base
Oracle(IgpGasOracleQueryMsg),
}
#[cw_serde]
#[derive(QueryResponses)]
pub enum IgpGasOracleQueryMsg {
#[returns(GetExchangeRateAndGasPriceResponse)]
GetExchangeRateAndGasPrice { dest_domain: u32 },
}
impl IgpGasOracleQueryMsg {
pub fn wrap(self) -> QueryMsg {
QueryMsg::Oracle(self)
}
}
#[cw_serde]
pub struct GetExchangeRateAndGasPriceResponse {
pub gas_price: Uint128,
pub exchange_rate: Uint128,
}