Skip to content
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
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hylo-fix"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
description = "Fixed-point number types with Solana Anchor support"
authors = ["0xPlish <plish@hylo.so>", "Curtis McEnroe <programble@gmail.com>"]
Expand All @@ -23,4 +23,5 @@ muldiv = "1.0.1"
num-traits = "0.2.17"
paste = "1.0.14"
quote = "1.0.36"
serde = { version = "1.0.224", features = ["derive"] }
typenum = { version = "1.17.0", features = ["i128"] }
3 changes: 2 additions & 1 deletion src/fix_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ use crate::Fix;
use anchor_lang::error::ErrorCode::InvalidNumericConversion;
use anchor_lang::prelude::{borsh, AnchorDeserialize, AnchorSerialize, InitSpace, Result};
use paste::paste;
use serde::{Deserialize, Serialize};

macro_rules! impl_fix_value {
($sign:ident, $bits:expr) => {
paste! {
/// A value-space `Fix` where base is always 10 and bits are a concrete type.
/// Intended for serialized storage in Solana accounts where generics won't work.
#[derive(PartialEq, Eq, Copy, Clone, Debug, AnchorSerialize, AnchorDeserialize, InitSpace)]
#[derive(PartialEq, Eq, Copy, Clone, Debug, Serialize, Deserialize, AnchorSerialize, AnchorDeserialize, InitSpace)]
pub struct [<$sign FixValue $bits>] {
pub bits: [<$sign:lower $bits>],
pub exp: i8,
Expand Down