This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Helper method for pricing a base currency in a quote currency (#8) * Add method for getting twap * initial implementation, seems to work * minor * minor * refactor * found bad case * use u128 * working on it * clarify * cleanup * more cleanup * pretty sure i need this * better * bad merge * no println * adding solana tx stuff * change approach a bit * this seems to work * comment * cleanup * refactor * refactor * initial implementation of mul * exponent * tests for normalize * tests for normalize * negative numbers in div * handle negative numbers * comments * stuff * cleanup * unused * minor Co-authored-by: Jayant Krishnamurthy <[email protected]> * Instruction counts and optimizations (#9) * instruction counts * reduce normalize opcount * instruction counts * tests Co-authored-by: Jayant Krishnamurthy <[email protected]> * Docs and utilities (#12) * uh oh * docs * fix error docs Co-authored-by: Jayant Krishnamurthy <[email protected]> * bump version number * bump version number * ignore more files * docs * remove mod * checked ops Co-authored-by: Jayant Krishnamurthy <[email protected]>
- Loading branch information
Showing
12 changed files
with
1,328 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ | |
debug | ||
target | ||
Cargo.lock | ||
|
||
# IntelliJ temp files | ||
.idea | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[target.bpfel-unknown-unknown.dependencies.std] | ||
features = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//! Program entrypoint | ||
|
||
#![cfg(not(feature = "no-entrypoint"))] | ||
|
||
use solana_program::{ | ||
account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, pubkey::Pubkey, | ||
}; | ||
|
||
entrypoint!(process_instruction); | ||
fn process_instruction( | ||
program_id: &Pubkey, | ||
accounts: &[AccountInfo], | ||
instruction_data: &[u8], | ||
) -> ProgramResult { | ||
crate::processor::process_instruction(program_id, accounts, instruction_data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use num_derive::FromPrimitive; | ||
use solana_program::program_error::ProgramError; | ||
use thiserror::Error; | ||
|
||
/// Errors that may be returned by Pyth. | ||
#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)] | ||
pub enum PythError { | ||
// 0 | ||
/// Invalid account data -- either insufficient data, or incorrect magic number | ||
#[error("Failed to convert account into a Pyth account")] | ||
InvalidAccountData, | ||
/// Wrong version number | ||
#[error("Incorrect version number for Pyth account")] | ||
BadVersionNumber, | ||
/// Tried reading an account with the wrong type, e.g., tried to read | ||
/// a price account as a product account. | ||
#[error("Incorrect account type")] | ||
WrongAccountType, | ||
} | ||
|
||
impl From<PythError> for ProgramError { | ||
fn from(e: PythError) -> Self { | ||
ProgramError::Custom(e as u32) | ||
} | ||
} |
Oops, something went wrong.