forked from 0LNetworkCommunity/libra-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ol specific Move resource bindings
- Loading branch information
1 parent
9a5a4c2
commit 4ba3415
Showing
10 changed files
with
280 additions
and
77 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
use crate::version_five::{ | ||
language_storage_v5::StructTagV5, move_resource_v5::MoveResourceV5, | ||
move_resource_v5::MoveStructTypeV5, | ||
}; | ||
use anyhow::Result; | ||
use move_core_types::{ident_str, identifier::IdentStr}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::{language_storage_v5::CORE_CODE_ADDRESS, legacy_address_v5::LegacyAddressV5}; | ||
|
||
/// Struct that represents a AutoPay resource | ||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct AncestryResource { | ||
/// | ||
pub tree: Vec<LegacyAddressV5>, | ||
} | ||
|
||
impl MoveStructTypeV5 for AncestryResource { | ||
const MODULE_NAME: &'static IdentStr = ident_str!("Ancestry"); | ||
const STRUCT_NAME: &'static IdentStr = ident_str!("Ancestry"); | ||
} | ||
impl MoveResourceV5 for AncestryResource {} | ||
|
||
impl AncestryResource { | ||
/// | ||
pub fn struct_tag() -> StructTagV5 { | ||
StructTagV5 { | ||
address: CORE_CODE_ADDRESS, | ||
module: AncestryResource::module_identifier(), | ||
name: AncestryResource::struct_identifier(), | ||
type_params: vec![], | ||
} | ||
} | ||
|
||
/// | ||
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self> { | ||
bcs::from_bytes(bytes).map_err(Into::into) | ||
} | ||
} |
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,38 @@ | ||
|
||
use crate::version_five::{language_storage_v5::StructTagV5, move_resource_v5::MoveStructTypeV5}; | ||
use anyhow::Result; | ||
use move_core_types::{ident_str, identifier::IdentStr}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::language_storage_v5::CORE_CODE_ADDRESS; | ||
|
||
/// Struct that represents a CurrencyInfo resource | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct CumulativeDepositResource { | ||
/// | ||
pub value: u64, | ||
/// | ||
pub index: u64, | ||
} | ||
|
||
impl MoveStructTypeV5 for CumulativeDepositResource { | ||
const MODULE_NAME: &'static IdentStr = ident_str!("DiemAccount"); | ||
const STRUCT_NAME: &'static IdentStr = ident_str!("CumulativeDeposits"); | ||
} | ||
|
||
impl CumulativeDepositResource { | ||
/// | ||
pub fn struct_tag() -> StructTagV5 { | ||
StructTagV5 { | ||
address: CORE_CODE_ADDRESS, | ||
module: CumulativeDepositResource::module_identifier(), | ||
name: CumulativeDepositResource::struct_identifier(), | ||
type_params: vec![], | ||
} | ||
} | ||
|
||
/// | ||
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self> { | ||
bcs::from_bytes(bytes).map_err(Into::into) | ||
} | ||
} |
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,41 @@ | ||
use crate::version_five::{language_storage_v5::StructTagV5, move_resource_v5::MoveStructTypeV5}; | ||
use anyhow::Result; | ||
use move_core_types::{ident_str, identifier::IdentStr}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::{language_storage_v5::CORE_CODE_ADDRESS, legacy_address_v5::LegacyAddressV5}; | ||
|
||
/// Struct that represents a CurrencyInfo resource | ||
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct ReceiptsResource { | ||
/// | ||
pub destination: Vec<LegacyAddressV5>, | ||
/// | ||
pub cumulative: Vec<u64>, | ||
/// | ||
pub last_payment_timestamp: Vec<u64>, | ||
/// | ||
pub last_payment_value: Vec<u64>, | ||
} | ||
|
||
impl MoveStructTypeV5 for ReceiptsResource { | ||
const MODULE_NAME: &'static IdentStr = ident_str!("Receipts"); | ||
const STRUCT_NAME: &'static IdentStr = ident_str!("UserReceipts"); | ||
} | ||
|
||
impl ReceiptsResource { | ||
/// | ||
pub fn struct_tag() -> StructTagV5 { | ||
StructTagV5 { | ||
address: CORE_CODE_ADDRESS, | ||
module: ReceiptsResource::module_identifier(), | ||
name: ReceiptsResource::struct_identifier(), | ||
type_params: vec![], | ||
} | ||
} | ||
|
||
/// | ||
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self> { | ||
bcs::from_bytes(bytes).map_err(Into::into) | ||
} | ||
} |
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,47 @@ | ||
use crate::version_five::{language_storage_v5::StructTagV5, move_resource_v5::MoveStructTypeV5}; | ||
use anyhow::Result; | ||
use move_core_types::{ident_str, identifier::IdentStr}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::{language_storage_v5::CORE_CODE_ADDRESS, move_resource_v5::MoveResourceV5}; | ||
/// Struct that represents a CurrencyInfo resource | ||
#[derive(Debug, Serialize, Deserialize)] | ||
pub struct TowerStateResource { | ||
/// | ||
pub previous_proof_hash: Vec<u8>, | ||
/// user's latest verified_tower_height | ||
pub verified_tower_height: u64, | ||
/// | ||
pub latest_epoch_mining: u64, | ||
/// | ||
pub count_proofs_in_epoch: u64, | ||
/// | ||
pub epochs_validating_and_mining: u64, | ||
/// | ||
pub contiguous_epochs_validating_and_mining: u64, | ||
/// | ||
pub epochs_since_last_account_creation: u64, | ||
} | ||
|
||
impl MoveStructTypeV5 for TowerStateResource { | ||
const MODULE_NAME: &'static IdentStr = ident_str!("TowerState"); | ||
const STRUCT_NAME: &'static IdentStr = ident_str!("TowerProofHistory"); | ||
} | ||
impl MoveResourceV5 for TowerStateResource {} | ||
|
||
impl TowerStateResource { | ||
/// | ||
pub fn struct_tag() -> StructTagV5 { | ||
StructTagV5 { | ||
address: CORE_CODE_ADDRESS, | ||
module: TowerStateResource::module_identifier(), | ||
name: TowerStateResource::struct_identifier(), | ||
type_params: vec![], | ||
} | ||
} | ||
|
||
/// | ||
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self> { | ||
bcs::from_bytes(bytes).map_err(Into::into) | ||
} | ||
} |
Oops, something went wrong.