pub enum KernelAction {
Show 17 variants
BeginAllocating {
op_id: u64,
plan: Vec<AllocationPlanEntry>,
now_ns: TimestampNs,
},
Deposit {
owner: Address,
receiver: Address,
assets_in: u128,
min_shares_out: u128,
now_ns: TimestampNs,
},
AtomicWithdraw {
owner: Address,
receiver: Address,
operator: Address,
amount: u128,
kind: AtomicPayoutKind,
now_ns: TimestampNs,
},
RequestWithdraw {
owner: Address,
receiver: Address,
shares: u128,
min_assets_out: u128,
now_ns: TimestampNs,
},
ExecuteWithdraw {
now_ns: TimestampNs,
},
BeginRefreshing {
op_id: u64,
plan: Vec<TargetId>,
now_ns: TimestampNs,
},
FinishAllocating {
op_id: u64,
now_ns: TimestampNs,
},
SyncExternalAssets {
new_external_assets: u128,
op_id: u64,
now_ns: TimestampNs,
},
RebalanceWithdraw {
op_id: u64,
amount: u128,
now_ns: TimestampNs,
},
FinishRefreshing {
op_id: u64,
now_ns: TimestampNs,
},
AbortRefreshing {
op_id: u64,
},
SettlePayout {
op_id: u64,
outcome: PayoutOutcome,
},
AbortAllocating {
op_id: u64,
restore_idle: u128,
},
AbortWithdrawing {
op_id: u64,
refund_shares: u128,
},
RefreshFees {
now_ns: TimestampNs,
},
Pause {
paused: bool,
},
EmergencyReset,
}Expand description
Kernel actions supported by the dispatcher.
These actions drive the vault state machine. Each action validates preconditions, updates state, and returns effects to be executed by the chain-specific runtime.
Variants§
BeginAllocating
Begin allocating idle assets to external markets according to a plan.
Transition: Idle -> Allocating
Deposit
Deposit assets into the vault and mint shares to the receiver.
AtomicWithdraw
RequestWithdraw
Request a withdrawal by escrowing shares in the queue.
ExecuteWithdraw
Execute the next pending withdrawal from the queue.
Transition: Idle -> Withdrawing
Fields
now_ns: TimestampNsBeginRefreshing
Begin refreshing external market balances.
Transition: Idle -> Refreshing
FinishAllocating
Complete an allocation operation.
Transition: Allocating -> Idle or Withdrawing
SyncExternalAssets
Sync external asset balances during an active operation.
RebalanceWithdraw
FinishRefreshing
Complete a refresh operation.
Transition: Refreshing -> Idle
AbortRefreshing
Abort a refresh operation (e.g., on external call failure).
Transition: Refreshing -> Idle
SettlePayout
Settle a payout after asset transfer attempt.
Transition: Payout -> Idle
AbortAllocating
Abort an allocation operation (e.g., on external call failure).
Transition: Allocating -> Idle
AbortWithdrawing
Abort a withdrawal operation (e.g., on external call failure).
Transition: Withdrawing -> Idle
RefreshFees
Refresh fee calculations and mint fee shares.
Fields
now_ns: TimestampNsPause
Emit a pause-state update for executor-owned pause configuration.
EmergencyReset
Emergency reset: force the vault back to Idle from any non-Idle state.
Unlike the regular abort actions, this does not require op_id matching. For Withdrawing/Payout states, escrowed shares are refunded to the owner and the queue head is dequeued.
Authorization (Owner-only, timelock-gated) must be enforced by the executor.
Implementations§
Source§impl KernelAction
impl KernelAction
pub fn begin_allocating( op_id: u64, plan: Vec<AllocationPlanEntry>, now_ns: TimestampNs, ) -> Self
pub fn deposit( owner: Address, receiver: Address, assets_in: u128, min_shares_out: u128, now_ns: TimestampNs, ) -> Self
pub fn atomic_withdraw( owner: Address, receiver: Address, operator: Address, assets_out: u128, now_ns: TimestampNs, ) -> Self
pub fn atomic_redeem( owner: Address, receiver: Address, operator: Address, shares: u128, now_ns: TimestampNs, ) -> Self
pub fn request_withdraw( owner: Address, receiver: Address, shares: u128, min_assets_out: u128, now_ns: TimestampNs, ) -> Self
pub fn execute_withdraw(now_ns: TimestampNs) -> Self
pub fn begin_refreshing( op_id: u64, plan: Vec<TargetId>, now_ns: TimestampNs, ) -> Self
pub fn finish_allocating(op_id: u64, now_ns: TimestampNs) -> Self
pub fn sync_external_assets( new_external_assets: u128, op_id: u64, now_ns: TimestampNs, ) -> Self
pub fn rebalance_withdraw(op_id: u64, amount: u128, now_ns: TimestampNs) -> Self
pub fn finish_refreshing(op_id: u64, now_ns: TimestampNs) -> Self
pub fn abort_refreshing(op_id: u64) -> Self
pub fn settle_payout(op_id: u64, outcome: PayoutOutcome) -> Self
pub fn abort_allocating(op_id: u64, restore_idle: u128) -> Self
pub fn abort_withdrawing(op_id: u64, refund_shares: u128) -> Self
pub fn refresh_fees(now_ns: TimestampNs) -> Self
pub fn pause(paused: bool) -> Self
pub const fn emergency_reset() -> Self
pub const fn op_id(&self) -> Option<u64>
pub const fn timestamp_ns(&self) -> Option<TimestampNs>
Trait Implementations§
Source§impl BorshDeserialize for KernelAction
impl BorshDeserialize for KernelAction
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for KernelAction
impl BorshSerialize for KernelAction
Source§impl Clone for KernelAction
impl Clone for KernelAction
Source§fn clone(&self) -> KernelAction
fn clone(&self) -> KernelAction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more