-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement all queries on State that are required for the Coeus node.
- also introduced the name Bundle for an array of operations that are signed separately in a transaction - also fixed metadata in packages
- Loading branch information
1 parent
0f38f59
commit 3b9a0e5
Showing
35 changed files
with
354 additions
and
218 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "iop-coeus-core-ffi" | ||
version = "0.0.6" | ||
authors = ["IoP Ventures LLC <info@iop-ventures.com>", "Rache Bartmoss <[email protected]>", "wigy <[email protected]>"] | ||
authors = ["IOP Ventures LLC <dev@iop-ventures.com>", "Rache Bartmoss <[email protected]>", "wigy <[email protected]>"] | ||
edition = "2018" | ||
license = "LGPL-3.0-or-later" | ||
|
||
|
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,7 +1,7 @@ | ||
{ | ||
"name": "@internet-of-people/coeus-core-wasm", | ||
"collaborators": [ | ||
"IoP Ventures LLC <info@iop-ventures.com>", | ||
"IOP Ventures LLC <dev@iop-ventures.com>", | ||
"Rache Bartmoss <[email protected]>", | ||
"wigy <[email protected]>" | ||
], | ||
|
@@ -19,4 +19,4 @@ | |
"module": "browser/iop_coeus_core_wasm.js", | ||
"types": "iop_coeus_core_wasm.d.ts", | ||
"sideEffects": "false" | ||
} | ||
} |
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,7 +1,7 @@ | ||
[package] | ||
name = "iop-coeus-core-wasm" | ||
version = "0.0.6" | ||
authors = ["IoP Ventures LLC <info@iop-ventures.com>", "Rache Bartmoss <[email protected]>", "wigy <[email protected]>"] | ||
authors = ["IOP Ventures LLC <dev@iop-ventures.com>", "Rache Bartmoss <[email protected]>", "wigy <[email protected]>"] | ||
edition = "2018" | ||
license = "LGPL-3.0-or-later" | ||
|
||
|
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
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,7 +1,7 @@ | ||
[package] | ||
name = "iop-coeus-core" | ||
version = "0.0.6" | ||
authors = ["IoP Ventures LLC <info@iop-ventures.com>", "Rache Bartmoss <[email protected]>", "wigy <[email protected]>"] | ||
authors = ["IOP Ventures LLC <dev@iop-ventures.com>", "Rache Bartmoss <[email protected]>", "wigy <[email protected]>"] | ||
edition = "2018" | ||
license = "LGPL-3.0-or-later" | ||
|
||
|
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,32 @@ | ||
use super::*; | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct CoeusAsset { | ||
pub bundles: Vec<SignedBundle>, | ||
} | ||
|
||
// TODO work out ecosystem for pricing model | ||
impl CoeusAsset { | ||
const FEE_BYTES_OFFSET: u64 = 0; | ||
//const FLAKES_PER_BYTES: u64 = 3000; | ||
|
||
pub fn fee(&self) -> u64 { | ||
let price = | ||
self.bundles.iter().fold(Price::fee(Self::FEE_BYTES_OFFSET), |mut price, bundle| { | ||
price += bundle.get_price(); | ||
price | ||
}); | ||
price.fee | ||
} | ||
|
||
pub fn to_bytes(&self) -> Result<Vec<u8>> { | ||
let json_val = serde_json::to_value(self)?; | ||
let json_str = canonical_json(&json_val)?; | ||
Ok(json_str.into_bytes()) | ||
} | ||
|
||
pub fn from_bytes(bytes: &[u8]) -> Result<Self> { | ||
Ok(serde_json::from_slice(bytes)?) | ||
} | ||
} |
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
Oops, something went wrong.