Smart Wallet

The source code can be found at SmartWallet.sol



function executeCall(
    address target,
    bytes calldata callData

(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.


function executeMarketOrder(
    IAmm _asset,
    SignedDecimal.signedDecimal memory _orderSize,
    Decimal.decimal memory _collateral,
    Decimal.decimal memory _leverage,
    Decimal.decimal memory _slippage

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.


function executeClosePosition(
    IAmm _asset,
    Decimal.decimal memory _slippage

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


function pauseWallet()
function unpauseWallet()

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 updated