Began adding chain logic
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
9188221ce4
commit
e0dc8c845a
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -1,5 +1,9 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "currency"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "farm"
|
||||
version = "0.1.0"
|
||||
|
@ -1,6 +1,7 @@
|
||||
[workspace]
|
||||
|
||||
members = [
|
||||
"currency",
|
||||
"farm",
|
||||
"node",
|
||||
"plot",
|
||||
|
9
currency/Cargo.toml
Normal file
9
currency/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "currency"
|
||||
version = "0.1.0"
|
||||
authors = ["Jake Hillion <jake@hillion.co.uk>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
33
currency/src/lib.rs
Normal file
33
currency/src/lib.rs
Normal file
@ -0,0 +1,33 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
type Hash = [u8; 64];
|
||||
type Signature = [u8; 64];
|
||||
type Address = [u8; 32];
|
||||
|
||||
type ChainHeight = u64;
|
||||
type ChainSize = u64;
|
||||
type Cost = u128;
|
||||
type ChainIndex = u64;
|
||||
|
||||
pub struct BeaconEntry {
|
||||
pub prev: Hash,
|
||||
pub height: ChainHeight,
|
||||
}
|
||||
|
||||
pub struct ShardEntry {
|
||||
pub prev: Hash,
|
||||
pub height: ChainHeight,
|
||||
|
||||
pub transactions: Vec<Transaction>,
|
||||
}
|
||||
|
||||
pub struct Transaction {
|
||||
pub address: Address,
|
||||
pub signature: Signature,
|
||||
}
|
||||
|
||||
impl Transaction {
|
||||
fn get_cost(transaction: &Transaction, sizes: HashMap<ChainIndex, ChainSize>) -> Cost {
|
||||
todo!()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user