Skip to content

Commit

Permalink
core: add abi::moonlight_sender
Browse files Browse the repository at this point in the history
Resolves #3341
  • Loading branch information
herr-seppia committed Jan 10, 2025
1 parent 99564c3 commit c62f484
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ impl Metadata {
pub const CHAIN_ID: &'static str = "chain_id";
/// The current block-height.
pub const BLOCK_HEIGHT: &'static str = "block_height";
/// The current moonlight sender (if any)
pub const MOONLIGHT_SENDER: &'static str = "moonlight_sender";
}

/// Enum storing the available host-queries.
Expand Down Expand Up @@ -156,6 +158,17 @@ pub(crate) mod host_queries {
meta_data(Metadata::BLOCK_HEIGHT).unwrap()
}

/// Get the moonlight sender of the ongoing tx (if any).
///
/// # Panics
/// Panics if the chain doesn't store a `Option<BlsPublicKey>`
/// `MOONLIGHT_SENDER` in the metadata.
#[must_use]
pub fn moonlight_sender() -> Option<BlsPublicKey> {
meta_data(Metadata::MOONLIGHT_SENDER)
.expect("moonlight sender metadata to be set")
}

/// Query owner of a given contract.
/// Returns none if contract is not found.
///
Expand Down

0 comments on commit c62f484

Please sign in to comment.