@@ -64,6 +64,7 @@ pub fn instantiate(
64
64
credit_agency : Contract :: new ( & info. sender . clone ( ) , & msg. credit_agency_code_hash ) . into ( ) ,
65
65
reserve_factor : msg. reserve_factor ,
66
66
borrow_limit_ratio : msg. borrow_limit_ratio ,
67
+ oracle : msg. oracle . into ( )
67
68
} ;
68
69
CONFIG . save ( deps. storage , & cfg) ?;
69
70
VIEWING_KEY . save ( deps. storage , & msg. viewing_key ) ?;
@@ -262,6 +263,7 @@ mod query {
262
263
use shade_protocol:: {
263
264
c_std:: { ContractInfo , Decimal , Deps , Uint128 } ,
264
265
utils:: asset:: Contract ,
266
+ contract_interfaces:: oracles,
265
267
} ;
266
268
267
269
use lend_token:: msg:: { BalanceResponse , QueryMsg as TokenQueryMsg , TokenInfoResponse } ;
@@ -433,26 +435,27 @@ mod query {
433
435
pub fn price_market_local_per_common ( deps : Deps ) -> Result < PriceRate , ContractError > {
434
436
todo ! ( ) ;
435
437
436
- // let config = CONFIG.load(deps.storage)?;
437
- // // If tokens are the same, just return 1:1.
438
- // if config.common_token == config.market_token {
439
- // Ok(PriceRate {
440
- // sell_denom: config.market_token.clone(),
441
- // buy_denom: config.common_token,
442
- // rate_sell_per_buy: Decimal::one(),
443
- // })
444
- // } else {
445
- // let price_response: TwapResponse = OracleQueryMsg::Twap {
446
- // offer: config.market_token.clone().into(),
447
- // ask: config.common_token.clone().into(),
448
- // }
449
- // .query(&deps.querier, config.price_oracle.clone())?;
450
- // Ok(PriceRate {
451
- // sell_denom: config.market_token,
452
- // buy_denom: config.common_token,
453
- // rate_sell_per_buy: price_response.a_per_b,
454
- // })
455
- // }
438
+ let config = CONFIG . load ( deps. storage ) ?;
439
+ // If tokens are the same, just return 1:1.
440
+ if config. common_token == config. market_token {
441
+ Ok ( PriceRate {
442
+ sell_denom : config. market_token . clone ( ) ,
443
+ buy_denom : config. common_token ,
444
+ rate_sell_per_buy : Decimal :: one ( ) ,
445
+ } )
446
+ } else {
447
+ todo ! ( ) ;
448
+ // let price_response: TwapResponse = OracleQueryMsg::Twap {
449
+ // offer: config.market_token.clone().into(),
450
+ // ask: config.common_token.clone().into(),
451
+ // }
452
+ // .query(&deps.querier, config.price_oracle.clone())?;
453
+ Ok ( PriceRate {
454
+ sell_denom : config. market_token ,
455
+ buy_denom : config. common_token ,
456
+ rate_sell_per_buy : Decimal :: one ( ) /*price_response.a_per_b,*/
457
+ } )
458
+ }
456
459
}
457
460
458
461
// /// Handler for `QueryMsg::CreditLine`
0 commit comments