# Account Methods

## Trading

### batchBalanceAction

Similar to [batchBalanceAndTradeAction](#batchbalanceandtradeaction) except the encoded BalanceAction only allows deposits, withdraws and minting / redeeming of nTokens. No trades are executed.

```
function batchBalanceAction(
  address account,
  BalanceAction[] calldata actions
) external payable;
```

### batchBalanceAndTradeAction

Described in depth in [Batch Trades](https://docs.notional.finance/developer-documentation/how-to/lend-and-borrow-fcash/batch-trades).

```
function batchBalanceAndTradeAction(
  address account,
  BalanceActionWithTrades[] calldata actions
) external payable;
```

### batchLend

Described in depth in [Batch Trades](https://docs.notional.finance/developer-documentation/how-to/lend-and-borrow-fcash/batch-trades).

```
function batchLend(address account, BatchLend[] calldata actions) externa
```

### depositAssetToken

Deposits some amount of asset tokens (i.e. cTokens or aTokens) for `currencyId` into `account`. Will transfer tokens from `msg.sender`, allowing anyone to add collateral to an account.

{% hint style="info" %}
Depositing tokens is not the same as lending at fixed rates! Deposits will earn money market variable interest rates.
{% endhint %}

```
function depositAssetToken(
    address account,
    uint16 currencyId,
    uint256 amountExternalPrecision
) external returns (uint256);
```

### depositUnderlyingToken

Deposits some amount of underlying tokens (i.e. DAI or USDC) for `currencyId` into `account`. Will transfer tokens from `msg.sender`, allowing anyone to add collateral to an account. The deposited tokens will always be used to mint asset tokens on behalf of the account.

{% hint style="info" %}
Depositing tokens is not the same as lending at fixed rates! Deposits will earn money market variable interest rates.
{% endhint %}

```
function depositUnderlyingToken(
    address account,
    uint16 currencyId,
    uint256 amountExternalPrecision
) external payable returns (uint256);
```

### withdraw

Withdraws cash from the account of `msg.sender`. `amountInternalPrecision` is the amount of cash balance an account is holding, can be viewed by calling `getAccountBalance(currencyId)` on Notional. Set `redeemToUnderlying` to true if the `msg.sender` should receive underlying tokens instead of asset tokens.&#x20;

```
function withdraw(
    uint16 currencyId,
    uint88 amountInternalPrecision,
    bool redeemToUnderlying
) external returns (uint256);
```

### nTokenRedeem

Redeems `tokensToRedeem` balance of nTokens manually for redeemer. If `sellTokenAssets` is set to true then will attempt to sell residual fCash balances back to cash and leave the cash in the account's cash balance. If `acceptResidualAssets` is set to true, any fCash that was unable to be sold to cash will be left in the redeemer's portfolio. If acceptResidualAssets is false, then will revert if there are any fCash assets that are left unsold.

```
function nTokenRedeem(
    address redeemer,
    uint16 currencyId,
    uint96 tokensToRedeem_,
    bool sellTokenAssets,
    bool acceptResidualAssets
) external returns (int256);
```

## Miscellaneous

### enableBitmapCurrency

```
function enableBitmapCurrency(uint16 currencyId) external;
```

### settleAccount

Settles matured fCash positions on an account. Calling this method is normally not required since settlement will occur automatically whenever required inside other methods.

```
function settleAccount(address account) external;
```

### batchBalanceAndTradeActionWithCallback

Similar to [batchBalanceAndTradeAction](#batchbalanceandtradeaction) except can only be called by whitelisted contracts. The whitelisted contract will receive a callback prior to the free collateral check which allows the contract to perform some arbitrary execution (i.e. trade tokens on a DEX before re-depositing to Notional).

```
function batchBalanceAndTradeActionWithCallback(
    address account,
    BalanceActionWithTrades[] calldata actions,
    bytes calldata callbackData
) external payable;
```
