Skip to content

Commit 48ef6c6

Browse files
update: pyth dummy contract
1 parent e5b8849 commit 48ef6c6

4 files changed

Lines changed: 10 additions & 12 deletions

File tree

contracts/dummy/src/contract.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn execute(
4949
Ok(response)
5050
}
5151
ExecuteMsg::Error { .. } => Err(ContractError::Std(StdError::generic_err("oh no!"))),
52-
ExecuteMsg::TriggerPythUpdate { price } => execute_trigger_pyth_update(deps, env, price),
52+
ExecuteMsg::TriggerPythUpdate { price, price_id } => execute_trigger_pyth_update(deps, env, price, price_id),
5353
}
5454
}
5555

contracts/dummy/src/mock_pyth_attestation.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,16 @@ pub fn execute_trigger_pyth_update(
1212
deps: DepsMut<InjectiveQueryWrapper>,
1313
env: Env,
1414
price: i64,
15+
price_id: String,
1516
) -> Result<Response<InjectiveMsgWrapper>, ContractError> {
1617
deps.api.debug("Starting trigger update");
1718
let mut response = Response::new();
1819
let pa = PriceAttestation {
1920
product_id: "MOCK_PRODUCT_ID".to_string(),
20-
// price_id: Hash::from_hex(
21-
// "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b",
22-
// )?,
23-
price_id: Hash::from_hex(
24-
"f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b",
25-
)?
26-
.to_string(),
21+
price_id: Hash::from_hex(&price_id)?.to_string(),
2722
price,
2823
conf: 500,
29-
expo: -3,
24+
expo: -8,
3025
ema_price: 1000,
3126
ema_conf: 2000,
3227
status: PythStatus::Trading,
@@ -59,7 +54,10 @@ mod tests {
5954
pub fn test_send_pyth() {
6055
let sender_addr = "inj1x2ck0ql2ngyxqtw8jteyc0tchwnwxv7npaungt";
6156

62-
let msg = ExecuteMsg::TriggerPythUpdate { price: 10000 };
57+
let msg = ExecuteMsg::TriggerPythUpdate {
58+
price: 10000,
59+
price_id: "f9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b".to_string(),
60+
};
6361
let info = message_info(&Addr::unchecked(sender_addr), &[]);
6462
let env = mock_env();
6563
let res = execute(inj_mock_deps().as_mut_deps(), env, info, msg);

contracts/dummy/src/msg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub struct InstantiateMsg {}
99
pub enum ExecuteMsg {
1010
Ping {},
1111
Error {},
12-
TriggerPythUpdate { price: i64 },
12+
TriggerPythUpdate { price: i64, price_id: String },
1313
}
1414

1515
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[toolchain]
2-
channel = "1.87.0"
2+
channel = "1.81.0"
33
components = [ "rustfmt" ]
44
profile = "minimal"
55
targets = [ "wasm32-unknown-unknown" ]

0 commit comments

Comments
 (0)