pub type UserAction = UserAction<Address>;Expand description
User-facing trading action (placing orders, withdrawals, etc.).
Aliased Type§
#[repr(u8)]pub enum UserAction {
Show 42 variants
Deposit {
asset_id: AssetId,
amount: PositiveDecimal,
},
Withdraw {
asset_id: AssetId,
amount: PositiveDecimal,
},
DepositSpotCollateral {
asset_id: AssetId,
amount: PositiveDecimal,
},
WithdrawSpotCollateral {
asset_id: AssetId,
amount: PositiveDecimal,
},
TransferSpotCollateral {
asset_id: AssetId,
amount: PositiveDecimal,
direction: SpotCollateralTransferDirection,
sub_account_index: Option<u8>,
},
BorrowSpot {
asset_id: AssetId,
amount: PositiveDecimal,
sub_account_index: Option<u8>,
},
CreateSubAccount {
index: u8,
},
TransferToSubAccount {
asset_id: AssetId,
amount: PositiveDecimal,
sub_account_index: u8,
to_sub_account: bool,
},
DelegateUser {
delegate: Address,
name: CustomString,
},
RevokeDelegation {
delegate: Address,
},
UpdateMaxLeverage {
market_id: MarketId,
max_leverage: u16,
sub_account_index: Option<u8>,
},
ClaimReferralRewards {
asset_id: AssetId,
},
DepositIso {
market_id: MarketId,
amount: PositiveDecimal,
},
WithdrawIso {
market_id: MarketId,
amount: PositiveDecimal,
},
SetPerpLedgerTradingMode {
market_id: MarketId,
trading_mode: TradingMode,
sub_account_index: Option<u8>,
},
DelegateUserV1 {
delegate: Address,
name: CustomString,
sub_account_index: Option<u8>,
},
RevokeDelegationV1 {
delegate: Address,
sub_account_index: Option<u8>,
},
DelegateUserV2 {
delegate: Address,
name: CustomString,
sub_account_index: Option<u8>,
expires_at: Option<UnixTimestampMicros>,
flags: u32,
},
PlaceOrders {
market_id: MarketId,
orders: Vec<NewOrderArgs>,
replace: bool,
sub_account_index: Option<u8>,
},
AmendOrders {
market_id: MarketId,
orders: Vec<AmendOrderArgs>,
sub_account_index: Option<u8>,
},
CancelOrders {
market_id: MarketId,
orders: Vec<CancelOrderArgs>,
sub_account_index: Option<u8>,
},
CancelMarketOrders {
market_id: MarketId,
sub_account_index: Option<u8>,
},
CreateTriggerOrders {
market_id: MarketId,
trigger_orders: Vec<NewTriggerOrderArgs>,
sub_account_index: Option<u8>,
},
CreatePositionTpsl {
market_id: MarketId,
tpsl_pair: TpslPair,
size: Option<PositiveDecimal>,
sub_account_index: Option<u8>,
},
CancelTriggerOrders {
market_id: MarketId,
trigger_order_ids: Vec<TriggerOrderId>,
sub_account_index: Option<u8>,
},
CreateTwapOrder {
market_id: MarketId,
twap_order_args: NewTwapOrderArgs,
sub_account_index: Option<u8>,
},
CancelTwapOrder {
market_id: MarketId,
twap_id: TwapId,
sub_account_index: Option<u8>,
},
CancelAllOrders {
sub_account_index: Option<u8>,
},
DepositToPnlPool {
usdc_amount: PositiveDecimal,
},
SettleFromPnlPool {
sub_account_index: Option<u8>,
},
DepositToInsuranceFund {
usdc_amount: PositiveDecimal,
},
DepositToTreasury {
asset_id: AssetId,
amount: PositiveDecimal,
},
ClaimBorrowLendFees {},
DepositToIsoInsuranceFund {
market_id: MarketId,
amount: PositiveDecimal,
},
CreateVault {
args: CreateVaultArgs<Address>,
},
DepositToVault {
vault_address: Address,
asset_id: AssetId,
amount: PositiveDecimal,
},
QueueWithdrawal {
vault_address: Address,
shares: PositiveDecimal,
},
CancelQueuedWithdrawal {
vault_address: Address,
},
ForceWithdrawVault {
vault_address: Address,
shares: PositiveDecimal,
},
BackstopLiquidatePerpPositions {
address: Address,
positions: Option<Vec<BackstopLiquidatePerpPositionArgs>>,
sub_account_index: Option<u8>,
},
LiquidateBorrowLendLiability {
liquidatee_address: Address,
liability_asset_id: AssetId,
collateral_asset_id: AssetId,
liability_amount: PositiveDecimal,
sub_account_index: Option<u8>,
},
BackstopLiquidateIsoPerpPosition {
address: Address,
position: BackstopLiquidatePerpPositionArgs,
sub_account_index: Option<u8>,
},
}Variants§
Deposit
Deposit assets to perp margin account.
Withdraw
Withdraw assets from perp margin account.
DepositSpotCollateral
Deposit assets to spot collateral.
WithdrawSpotCollateral
Withdraw assets from spot collateral.
TransferSpotCollateral
Transfer assets between perp margin and spot collateral.
BorrowSpot
Borrow assets from spot pool.
CreateSubAccount
Create a new sub-account.
TransferToSubAccount
Transfer assets between main account and sub-account.
DelegateUser
Delegate trading permissions to another address.
RevokeDelegation
Revoke delegation from an address.
UpdateMaxLeverage
Update maximum leverage for a market.
ClaimReferralRewards
Claim your own referral rewards.
DepositIso
Deposit USDC into an isolated market / isolated margin position.
WithdrawIso
Withdraw USDC from an isolated market / isolated margin position.
SetPerpLedgerTradingMode
Set the trading mode of a perp ledger to cross or iso.
DelegateUserV1
Delegate trading permissions to another address allowing for sub accounts to be delegated.
RevokeDelegationV1
Revoke delegation from an address allowing for sub accounts to revoke delegation.
DelegateUserV2
Delegate trading permissions with optional expiry and flags
PlaceOrders
Place new orders on a market.
AmendOrders
Amend existing orders (cancel + place).
CancelOrders
Cancel specific orders.
CancelMarketOrders
Cancel all orders on a market.
CreateTriggerOrders
Create trigger orders for spot markets.
CreatePositionTpsl
Create take-profit/stop-loss for a perp position.
Fields
size: Option<PositiveDecimal>CancelTriggerOrders
Cancel trigger orders.
CreateTwapOrder
Create TWAP orders
CancelTwapOrder
Cancel a TWAP order
CancelAllOrders
Cancel all orders for perp or spot
DepositToPnlPool
Deposit USDC to the PnL pool.
Fields
usdc_amount: PositiveDecimalSettleFromPnlPool
Settle user’s PnL from the pool.
DepositToInsuranceFund
Deposit to the insurance fund.
Fields
usdc_amount: PositiveDecimalDepositToTreasury
Deposit to protocol treasury.
ClaimBorrowLendFees
Claim accumulated borrow/lend protocol fees.
DepositToIsoInsuranceFund
Deposit to the iso insurance fund.
CreateVault
Create a new vault (caller becomes the vault leader).
Fields
args: CreateVaultArgs<Address>DepositToVault
Deposit assets to a vault.
QueueWithdrawal
Queue a withdrawal from a vault.
CancelQueuedWithdrawal
Cancel a queued withdrawal.
ForceWithdrawVault
Force withdraw from a vault (bypasses queue).
BackstopLiquidatePerpPositions
Backstop liquidation for perp positions (user provides capital).
Fields
positions: Option<Vec<BackstopLiquidatePerpPositionArgs>>LiquidateBorrowLendLiability
Liquidate borrow/lend liability (user provides capital).
Fields
liability_amount: PositiveDecimal