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

Remove the quantity type from the codebase #64

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
25 changes: 0 additions & 25 deletions Anoma/Resource/Types.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@ KindEq : Eq Kind :=
eq (a b : Kind) : Bool := anomaEncode a == anomaEncode b;
};

--- A fixed-size data type encoding the quantity of a resource.
type Quantity :=
mkQuantity@{
unQuantity : Nat;
};

instance
FromNaturalQuantityI : FromNatural Quantity := mkFromNatural mkQuantity;

instance
NaturalQuantityI : Natural Quantity :=
mkNatural@{
+ : Quantity -> Quantity -> Quantity
| (mkQuantity a) (mkQuantity b) := mkQuantity (a Natural.+ b);

* : Quantity -> Quantity -> Quantity
| (mkQuantity a) (mkQuantity b) := mkQuantity (a Natural.* b);
};

--- A fixed-size data type encoding the public commitment to the private nullifier key.
type NullifierKeyCommitment :=
mkNullifierKeyCommitment@{
Expand Down Expand Up @@ -109,12 +90,6 @@ Value-Ord : Ord Value;
deriving instance
Value-Eq : Eq Value;

deriving instance
Quantity-Ord : Ord Quantity;

deriving instance
Quantity-Eq : Eq Quantity;

--- Implements the ;FixedSize; trait for ;NullifierKeyCommitment;.
instance
NullifierKeyCommitment-FixedSize : FixedSize NullifierKeyCommitment :=
Expand Down
11 changes: 0 additions & 11 deletions Applib/Projection/TotalQuantity.juvix

This file was deleted.

1 change: 0 additions & 1 deletion Applib/Resource/Traits.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module Applib.Resource.Traits;
-- import Applib.Resource.Traits.NullifierKey open public;
-- import Applib.Resource.Traits.Originator open public;
-- import Applib.Resource.Traits.Owner open public;
import Applib.Resource.Traits.Quantity open public;
-- import Applib.Resource.Traits.Supply open public;
-- import Applib.Resource.Traits.Transferability open public;

Expand Down
20 changes: 0 additions & 20 deletions Applib/Resource/Traits/Quantity.juvix

This file was deleted.

6 changes: 2 additions & 4 deletions Applib/Transaction/Errors.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ type InsufficientElementsError :=

type InsufficientHasQuantityError :=
mkInsufficientHasQuantityError@{
limit : Quantity;
actual : Quantity;
limit : Nat;
actual : Nat;
};

type InvalidLogicError :=
Expand Down Expand Up @@ -139,13 +139,11 @@ InsufficientHasQuantityError-Show : Show InsufficientHasQuantityError :=
++str "limit : "
++str (e
|> InsufficientHasQuantityError.limit
|> Quantity.unQuantity
|> Show.show)
++str ", "
++str "actual"
++str (e
|> InsufficientHasQuantityError.actual
|> Quantity.unQuantity
|> Show.show)
++str "}"};

Expand Down
Loading