Skip to content

Commit 62801bd

Browse files
committed
Add new function for avoiding anchor
1 parent 3185977 commit 62801bd

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

programs/whirlpool/src/state/oracle.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,18 @@ impl<'info> OracleAccessor<'info> {
361361
})
362362
}
363363

364+
pub fn new_from_whirlpool_key(
365+
whirlpool: Pubkey,
366+
oracle_account_info: AccountInfo<'info>,
367+
) -> Result<Self> {
368+
let oracle_account_initialized =
369+
Self::is_oracle_account_initialized(&oracle_account_info, whirlpool)?;
370+
Ok(Self {
371+
oracle_account_info,
372+
oracle_account_initialized,
373+
})
374+
}
375+
364376
pub fn is_trade_enabled(&self, current_timestamp: u64) -> Result<bool> {
365377
if !self.oracle_account_initialized {
366378
return Ok(true);

0 commit comments

Comments
 (0)