Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle remove hardcoded #159

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions contracts/mock_band/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ pub fn handle<S: Storage, A: Api, Q: Querier>(
return Ok(HandleResponse::default())
}
}

Err(StdError::GenericErr { msg: "Not Implemented".to_string(), backtrace: None})
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
Expand Down
11 changes: 1 addition & 10 deletions contracts/oracle/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use shade_protocol::{
band::ReferenceData,
};
use crate::{
state::{ config_w, hard_coded_w },
state::{ config_w },
query, handle,
};

Expand All @@ -31,15 +31,6 @@ pub fn init<S: Storage, A: Api, Q: Querier>(

config_w(&mut deps.storage).save(&state)?;

/* Hard-coded SILK = $1.00
*/
hard_coded_w(&mut deps.storage).save("SILK".as_bytes(), &ReferenceData {
//1$
rate: Uint128(1 * 10u128.pow(18)),
last_updated_base: 0,
last_updated_quote: 0
})?;

debug_print!("Contract was initialized by {}", env.message.sender);

Ok(InitResponse::default())
Expand Down
6 changes: 0 additions & 6 deletions contracts/oracle/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ pub fn price<S: Storage, A: Api, Q: Querier>(
return reference_data(deps, "SCRT".to_string(), "USD".to_string());
}

/*
if let Some(reference_data) = hard_coded_r(&deps.storage).may_load(&symbol.as_bytes())? {
return Ok(reference_data);
}
*/

// secret swap pair
// TODO: sienna pair
if let Some(sswap_pair) = sswap_pairs_r(&deps.storage).may_load(symbol.as_bytes())? {
Expand Down
9 changes: 0 additions & 9 deletions contracts/oracle/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use shade_protocol::{
};

pub static CONFIG_KEY: &[u8] = b"config";
pub static HARD_CODED: &[u8] = b"hard_coded";
pub static SSWAP_PAIRS: &[u8] = b"sswap_pairs";
pub static INDEX: &[u8] = b"index";

Expand All @@ -29,14 +28,6 @@ pub fn config_w<S: Storage>(storage: &mut S) -> Singleton<S, OracleConfig> {
singleton(storage, CONFIG_KEY)
}

pub fn hard_coded_r<S: Storage>(storage: &S) -> ReadonlyBucket<S, ReferenceData> {
bucket_read(HARD_CODED, storage)
}

pub fn hard_coded_w<S: Storage>(storage: &mut S) -> Bucket<S, ReferenceData> {
bucket(HARD_CODED, storage)
}

pub fn sswap_pairs_r<S: Storage>(storage: &S) -> ReadonlyBucket<S, SswapPair> {
bucket_read(SSWAP_PAIRS, storage)
}
Expand Down