mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-07 15:53:14 +00:00
add docstrings. Remove unused method
This commit is contained in:
parent
686eb787c9
commit
068bfa0ec5
@ -20,6 +20,10 @@ pub struct ChainedCall {
|
|||||||
pub pre_states: Vec<AccountWithMetadata>,
|
pub pre_states: Vec<AccountWithMetadata>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Represents the final state of an `Account` after a program execution.
|
||||||
|
/// A post state may optionally request that the executing program
|
||||||
|
/// becomes the owner of the account (a “claim”). This is used to signal
|
||||||
|
/// that the program intends to take ownership of the account.
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(any(feature = "host", test), derive(Debug, PartialEq, Eq))]
|
#[cfg_attr(any(feature = "host", test), derive(Debug, PartialEq, Eq))]
|
||||||
pub struct AccountPostState {
|
pub struct AccountPostState {
|
||||||
@ -28,6 +32,8 @@ pub struct AccountPostState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AccountPostState {
|
impl AccountPostState {
|
||||||
|
/// Creates a post state without a claim request.
|
||||||
|
/// The executing program is not requesting ownership of the account.
|
||||||
pub fn new(account: Account) -> Self {
|
pub fn new(account: Account) -> Self {
|
||||||
Self {
|
Self {
|
||||||
account,
|
account,
|
||||||
@ -35,6 +41,9 @@ impl AccountPostState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a post state that requests ownership of the account.
|
||||||
|
/// This indicates that the executing program intends to claim the
|
||||||
|
/// account as its own and is allowed to mutate it.
|
||||||
pub fn new_claimed(account: Account) -> Self {
|
pub fn new_claimed(account: Account) -> Self {
|
||||||
Self {
|
Self {
|
||||||
account,
|
account,
|
||||||
@ -42,18 +51,13 @@ impl AccountPostState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns `true` if this post state requests that the account
|
||||||
|
/// be claimed (owned) by the executing program.
|
||||||
pub fn requires_claim(&self) -> bool {
|
pub fn requires_claim(&self) -> bool {
|
||||||
self.claim
|
self.claim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AccountPostState {
|
|
||||||
pub fn with_claim_request(mut self) -> Self {
|
|
||||||
self.claim = true;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone)]
|
#[derive(Serialize, Deserialize, Clone)]
|
||||||
#[cfg_attr(any(feature = "host", test), derive(Debug, PartialEq, Eq))]
|
#[cfg_attr(any(feature = "host", test), derive(Debug, PartialEq, Eq))]
|
||||||
pub struct ProgramOutput {
|
pub struct ProgramOutput {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user