This repository has been archived by the owner on Oct 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
142 additions
and
35 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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// IMPLEMENTATION OF https://arxiv.org/pdf/1812.10844.pdf | ||
//! AT2 Money | ||
|
||
/// We define Money as a u64. This is a common choice for cryptocurrencies | ||
/// and good enough for our purposes. | ||
pub type Money = u64; |
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 |
---|---|---|
@@ -1,11 +1,21 @@ | ||
//! AT2 Op | ||
|
||
use core::hash::Hash; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::{Money, Transfer}; | ||
|
||
/// An AT2 operation | ||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] | ||
pub enum Op<A: Ord + Hash> { | ||
/// Transfer money between 2 accounts | ||
Transfer(Transfer<A>), // Split out Transfer into it's own struct to get some more type safety in Bank struct | ||
OpenAccount { owner: A, balance: Money }, | ||
/// Open a new account | ||
OpenAccount { | ||
/// Account owner | ||
owner: A, | ||
/// Account initial balance. typically 0. | ||
balance: Money, | ||
}, | ||
} |
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