Apex Docs
Search…
Smart Wallet
The source code can be found at SmartWallet.sol

Functions

executeCall

1
function executeCall(
2
address target,
3
bytes calldata callData
4
)
Copied!
(Advanced) This function allows smart wallets to execute functions by interacting with other smart contracts. For example, you can interact with the USDC contract in order to transfer funds from your smart wallet to another account.
    target the smart contract address - please note, only whitelisted contracts are permitted
    callData the input data for a function call as defined by the ABI specification
Please note: Executing incorrect data can have irreversible consequences. Please be certain that you know what you are doing.

executeMarketOrder

1
function executeMarketOrder(
2
IAmm _asset,
3
SignedDecimal.signedDecimal memory _orderSize,
4
Decimal.decimal memory _collateral,
5
Decimal.decimal memory _leverage,
6
Decimal.decimal memory _slippage
7
)
Copied!
This function executes a market order by interact with the perpetual ClearingHouse.
    _orderSize represents the size of the position you wish to trade. A positive number represents BUY/LONG whilst a negative number signifies a SELL/SHORT.
    _collateral the amount of margin that will be used for this order.
    _leverage the maximum amount of leverage that can be used. The transaction will revert if the target leverage is greater than this number.
    _slippage the minimum/maximum number of tokens that the user will accept otherwise the transaction will revert.

executeClosePosition

1
function executeClosePosition(
2
IAmm _asset,
3
Decimal.decimal memory _slippage
4
)
Copied!
This function will close the users entire position for a specific asset.
    _slippage the minimum amount of USDC that the user will accept otherwise the transaction will revert

Pause

1
function pauseWallet()
2
function unpauseWallet()
Copied!
A user may choose to freeze their wallet. If their smart wallet is frozen, it will not be possible for them to execute orders. It is still possible for the user to create additional advanced orders - but it will not be possible to execute these orders until the user unfreezes their wallet.
Last modified 5mo ago