forked from wormholelabs-xyz/example-messaging-executor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
59 lines (52 loc) · 2.29 KB
/
Copy pathlib.rs
File metadata and controls
59 lines (52 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! Wormhole Executor contract interface for Stellar/Soroban.
//!
//! This crate provides the public API for interacting with the Wormhole
//! Executor contract implemented by `wormhole-executors`.
#![no_std]
pub mod error;
pub use error::ExecutorError;
use soroban_sdk::{Address, Bytes, BytesN, Env, String, contractclient};
/// Public interface for the Wormhole Executor contract.
///
/// The Executor is a stateless, permissionless cross-chain delivery payment
/// rail. A `payer` submits an off-chain-signed quote (as opaque bytes)
/// alongside a delivery request, the contract validates the quote header,
/// transfers the agreed `amount` of native token from the payer to the
/// `payee`, and emits an event carrying the full quote verbatim for off-chain
/// relayers that fulfill the delivery on the destination chain.
///
/// # Quote authentication and payee binding are OFF-CHAIN
///
/// The contract parses only the 68-byte quote header (chain ids and expiry).
/// It does not verify the quote's signature, nor does it bind `payee` to the
/// payee encoded in the quote header — both are the relayer's off-chain
/// responsibility, which the verbatim-emitted quote enables.
#[contractclient(name = "ExecutorClient")]
pub trait ExecutorInterface {
/// Returns the Wormhole chain id configured at construction.
///
/// Wormhole chain ids are 16-bit; `u32` is used here only because Soroban's
/// ABI has no 16-bit value type. The value is always in `0..=u16::MAX`.
fn chain_id(env: Env) -> u32;
/// Returns the version string of the Executor implementation.
fn executor_version(env: Env) -> String;
/// Records a prepaid cross-chain delivery request.
///
/// Parses the quote header from `signed_quote_bytes`, requires the payer's
/// authorization, transfers `amount` native tokens from `payer` to
/// `payee`, and emits a `RequestForExecution` event carrying the full
/// quote bytes for off-chain relayers.
#[allow(clippy::too_many_arguments)]
fn request_execution(
env: Env,
dst_chain: u32,
dst_addr: BytesN<32>,
refund: Address,
payer: Address,
payee: Address,
amount: i128,
signed_quote_bytes: Bytes,
request: Bytes,
relay_instructions: Bytes,
) -> Result<(), ExecutorError>;
}