> For the complete documentation index, see [llms.txt](https://docs.maple.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.maple.finance/technical-resources/interfaces/fixed-term-loan-initializer.md).

# FixedTermLoanInitializer

## Functions

### `decodeArguments`

Decodes the initialization arguments for a MapleLoan.

```solidity
    function decodeArguments(
        bytes encodedArguments_
    )
        pure
        returns (
            address borrower_,
            address lender_,
            address feeManager_,
            address[2] assets_,
            uint256[3] termDetails_,
            uint256[3] amounts_,
            uint256[4] rates_,
            uint256[2] fees_
        );
```

#### Parameters:

| Index |         Name        |   Type  | Internal Type | Description |
| :---: | :-----------------: | :-----: | :-----------: | ----------- |
|   0   | `encodedArguments_` | `bytes` |    `bytes`    |             |

#### Return Values:

| Index |      Name      |     Type     | Internal Type | Description                                                                                                   |
| :---: | :------------: | :----------: | :-----------: | ------------------------------------------------------------------------------------------------------------- |
|   0   |   `borrower_`  |   `address`  |   `address`   | The address of the borrower.                                                                                  |
|   1   |    `lender_`   |   `address`  |   `address`   | The address of the lender.                                                                                    |
|   2   |  `feeManager_` |   `address`  |   `address`   | The address of the entity responsible for calculating fees.                                                   |
|   3   |    `assets_`   | `address[2]` |  `address[2]` | Array of asset addresses. \[0]: collateralAsset, \[1]: fundsAsset                                             |
|   4   | `termDetails_` | `uint256[3]` |  `uint256[3]` | Array of loan parameters: \[0]: gracePeriod, \[1]: paymentInterval, \[2]: payments                            |
|   5   |   `amounts_`   | `uint256[3]` |  `uint256[3]` | Requested amounts: \[0]: collateralRequired, \[1]: principalRequested, \[2]: endingPrincipal                  |
|   6   |    `rates_`    | `uint256[4]` |  `uint256[4]` | Rates parameters: \[0]: interestRate, \[1]: closingFeeRate, \[2]: lateFeeRate, \[3]: lateInterestPremiumRate, |
|   7   |     `fees_`    | `uint256[2]` |  `uint256[2]` | Array of fees: \[0]: delegateOriginationFee, \[1]: delegateServiceFee                                         |

### `encodeArguments`

Encodes the initialization arguments for a MapleLoan.

```solidity
    function encodeArguments(
        address borrower_,
        address lender_,
        address feeManager_,
        address[2] assets_,
        uint256[3] termDetails_,
        uint256[3] amounts_,
        uint256[4] rates_,
        uint256[2] fees_
    )
        pure
        returns (
            bytes encodedArguments_
        );
```

#### Parameters:

| Index |      Name      |     Type     | Internal Type | Description                                                                                                   |
| :---: | :------------: | :----------: | :-----------: | ------------------------------------------------------------------------------------------------------------- |
|   0   |   `borrower_`  |   `address`  |   `address`   | The address of the borrower.                                                                                  |
|   1   |    `lender_`   |   `address`  |   `address`   | The address of the lender.                                                                                    |
|   2   |  `feeManager_` |   `address`  |   `address`   | The address of the entity responsible for calculating fees.                                                   |
|   3   |    `assets_`   | `address[2]` |  `address[2]` | Array of asset addresses. \[0]: collateralAsset, \[1]: fundsAsset                                             |
|   4   | `termDetails_` | `uint256[3]` |  `uint256[3]` | Array of loan parameters: \[0]: gracePeriod, \[1]: paymentInterval, \[2]: payments                            |
|   5   |   `amounts_`   | `uint256[3]` |  `uint256[3]` | Requested amounts: \[0]: collateralRequired, \[1]: principalRequested, \[2]: endingPrincipal                  |
|   6   |    `rates_`    | `uint256[4]` |  `uint256[4]` | Rates parameters: \[0]: interestRate, \[1]: closingFeeRate, \[2]: lateFeeRate, \[3]: lateInterestPremiumRate, |
|   7   |     `fees_`    | `uint256[2]` |  `uint256[2]` | Array of fees: \[0]: delegateOriginationFee, \[1]: delegateServiceFee                                         |

#### Return Values:

| Index |         Name        |   Type  | Internal Type | Description |
| :---: | :-----------------: | :-----: | :-----------: | ----------- |
|   0   | `encodedArguments_` | `bytes` |    `bytes`    |             |

## Events

### `BorrowerAccepted`

```solidity
    event BorrowerAccepted(
        address borrower_
    );
```

#### Parameters:

| Index |     Name    |    Type   | Internal Type | Description |
| :---: | :---------: | :-------: | :-----------: | ----------- |
|   0   | `borrower_` | `address` |   `address`   |             |

### `CollateralPosted`

```solidity
    event CollateralPosted(
        uint256 amount_
    );
```

#### Parameters:

| Index |    Name   |    Type   | Internal Type | Description |
| :---: | :-------: | :-------: | :-----------: | ----------- |
|   0   | `amount_` | `uint256` |   `uint256`   |             |

### `CollateralRemoved`

```solidity
    event CollateralRemoved(
        uint256 amount_,
        address destination_
    );
```

#### Parameters:

| Index |      Name      |    Type   | Internal Type | Description |
| :---: | :------------: | :-------: | :-----------: | ----------- |
|   0   |    `amount_`   | `uint256` |   `uint256`   |             |
|   1   | `destination_` | `address` |   `address`   |             |

### `Funded`

```solidity
    event Funded(
        address lender_,
        uint256 amount_,
        uint256 nextPaymentDueDate_
    );
```

#### Parameters:

| Index |          Name         |    Type   | Internal Type | Description |
| :---: | :-------------------: | :-------: | :-----------: | ----------- |
|   0   |       `lender_`       | `address` |   `address`   |             |
|   1   |       `amount_`       | `uint256` |   `uint256`   |             |
|   2   | `nextPaymentDueDate_` | `uint256` |   `uint256`   |             |

### `FundsClaimed`

```solidity
    event FundsClaimed(
        uint256 amount_,
        address destination_
    );
```

#### Parameters:

| Index |      Name      |    Type   | Internal Type | Description |
| :---: | :------------: | :-------: | :-----------: | ----------- |
|   0   |    `amount_`   | `uint256` |   `uint256`   |             |
|   1   | `destination_` | `address` |   `address`   |             |

### `FundsDrawnDown`

```solidity
    event FundsDrawnDown(
        uint256 amount_,
        address destination_
    );
```

#### Parameters:

| Index |      Name      |    Type   | Internal Type | Description |
| :---: | :------------: | :-------: | :-----------: | ----------- |
|   0   |    `amount_`   | `uint256` |   `uint256`   |             |
|   1   | `destination_` | `address` |   `address`   |             |

### `FundsReturned`

```solidity
    event FundsReturned(
        uint256 amount_
    );
```

#### Parameters:

| Index |    Name   |    Type   | Internal Type | Description |
| :---: | :-------: | :-------: | :-----------: | ----------- |
|   0   | `amount_` | `uint256` |   `uint256`   |             |

### `ImpairmentRemoved`

```solidity
    event ImpairmentRemoved(
        uint256 nextPaymentDueDate_
    );
```

#### Parameters:

| Index |          Name         |    Type   | Internal Type | Description |
| :---: | :-------------------: | :-------: | :-----------: | ----------- |
|   0   | `nextPaymentDueDate_` | `uint256` |   `uint256`   |             |

### `Initialized`

```solidity
    event Initialized(
        address borrower_,
        address lender_,
        address feeManager_,
        address[2] assets_,
        uint256[3] termDetails_,
        uint256[3] amounts_,
        uint256[4] rates_,
        uint256[2] fees_
    );
```

#### Parameters:

| Index |      Name      |     Type     | Internal Type | Description |
| :---: | :------------: | :----------: | :-----------: | ----------- |
|   0   |   `borrower_`  |   `address`  |   `address`   |             |
|   1   |    `lender_`   |   `address`  |   `address`   |             |
|   2   |  `feeManager_` |   `address`  |   `address`   |             |
|   3   |    `assets_`   | `address[2]` |  `address[2]` |             |
|   4   | `termDetails_` | `uint256[3]` |  `uint256[3]` |             |
|   5   |   `amounts_`   | `uint256[3]` |  `uint256[3]` |             |
|   6   |    `rates_`    | `uint256[4]` |  `uint256[4]` |             |
|   7   |     `fees_`    | `uint256[2]` |  `uint256[2]` |             |

### `LenderAccepted`

```solidity
    event LenderAccepted(
        address lender_
    );
```

#### Parameters:

| Index |    Name   |    Type   | Internal Type | Description |
| :---: | :-------: | :-------: | :-----------: | ----------- |
|   0   | `lender_` | `address` |   `address`   |             |

### `LoanClosed`

```solidity
    event LoanClosed(
        uint256 principalPaid_,
        uint256 interestPaid_,
        uint256 feesPaid_
    );
```

#### Parameters:

| Index |       Name       |    Type   | Internal Type | Description |
| :---: | :--------------: | :-------: | :-----------: | ----------- |
|   0   | `principalPaid_` | `uint256` |   `uint256`   |             |
|   1   |  `interestPaid_` | `uint256` |   `uint256`   |             |
|   2   |    `feesPaid_`   | `uint256` |   `uint256`   |             |

### `LoanImpaired`

```solidity
    event LoanImpaired(
        uint256 nextPaymentDueDate_
    );
```

#### Parameters:

| Index |          Name         |    Type   | Internal Type | Description |
| :---: | :-------------------: | :-------: | :-----------: | ----------- |
|   0   | `nextPaymentDueDate_` | `uint256` |   `uint256`   |             |

### `NewTermsAccepted`

```solidity
    event NewTermsAccepted(
        bytes32 refinanceCommitment_,
        address refinancer_,
        uint256 deadline_,
        bytes[] calls_
    );
```

#### Parameters:

| Index |          Name          |    Type   | Internal Type | Description |
| :---: | :--------------------: | :-------: | :-----------: | ----------- |
|   0   | `refinanceCommitment_` | `bytes32` |   `bytes32`   |             |
|   1   |      `refinancer_`     | `address` |   `address`   |             |
|   2   |       `deadline_`      | `uint256` |   `uint256`   |             |
|   3   |        `calls_`        | `bytes[]` |   `bytes[]`   |             |

### `NewTermsProposed`

```solidity
    event NewTermsProposed(
        bytes32 refinanceCommitment_,
        address refinancer_,
        uint256 deadline_,
        bytes[] calls_
    );
```

#### Parameters:

| Index |          Name          |    Type   | Internal Type | Description |
| :---: | :--------------------: | :-------: | :-----------: | ----------- |
|   0   | `refinanceCommitment_` | `bytes32` |   `bytes32`   |             |
|   1   |      `refinancer_`     | `address` |   `address`   |             |
|   2   |       `deadline_`      | `uint256` |   `uint256`   |             |
|   3   |        `calls_`        | `bytes[]` |   `bytes[]`   |             |

### `NewTermsRejected`

```solidity
    event NewTermsRejected(
        bytes32 refinanceCommitment_,
        address refinancer_,
        uint256 deadline_,
        bytes[] calls_
    );
```

#### Parameters:

| Index |          Name          |    Type   | Internal Type | Description |
| :---: | :--------------------: | :-------: | :-----------: | ----------- |
|   0   | `refinanceCommitment_` | `bytes32` |   `bytes32`   |             |
|   1   |      `refinancer_`     | `address` |   `address`   |             |
|   2   |       `deadline_`      | `uint256` |   `uint256`   |             |
|   3   |        `calls_`        | `bytes[]` |   `bytes[]`   |             |

### `PaymentMade`

```solidity
    event PaymentMade(
        uint256 principalPaid_,
        uint256 interestPaid_,
        uint256 fees_
    );
```

#### Parameters:

| Index |       Name       |    Type   | Internal Type | Description |
| :---: | :--------------: | :-------: | :-----------: | ----------- |
|   0   | `principalPaid_` | `uint256` |   `uint256`   |             |
|   1   |  `interestPaid_` | `uint256` |   `uint256`   |             |
|   2   |      `fees_`     | `uint256` |   `uint256`   |             |

### `PendingBorrowerSet`

```solidity
    event PendingBorrowerSet(
        address pendingBorrower_
    );
```

#### Parameters:

| Index |        Name        |    Type   | Internal Type | Description |
| :---: | :----------------: | :-------: | :-----------: | ----------- |
|   0   | `pendingBorrower_` | `address` |   `address`   |             |

### `PendingLenderSet`

```solidity
    event PendingLenderSet(
        address pendingLender_
    );
```

#### Parameters:

| Index |       Name       |    Type   | Internal Type | Description |
| :---: | :--------------: | :-------: | :-----------: | ----------- |
|   0   | `pendingLender_` | `address` |   `address`   |             |

### `Repossessed`

```solidity
    event Repossessed(
        uint256 collateralRepossessed_,
        uint256 fundsRepossessed_,
        address destination_
    );
```

#### Parameters:

| Index |           Name           |    Type   | Internal Type | Description |
| :---: | :----------------------: | :-------: | :-----------: | ----------- |
|   0   | `collateralRepossessed_` | `uint256` |   `uint256`   |             |
|   1   |    `fundsRepossessed_`   | `uint256` |   `uint256`   |             |
|   2   |      `destination_`      | `address` |   `address`   |             |

### `Skimmed`

```solidity
    event Skimmed(
        address token_,
        uint256 amount_,
        address destination_
    );
```

#### Parameters:

| Index |      Name      |    Type   | Internal Type | Description |
| :---: | :------------: | :-------: | :-----------: | ----------- |
|   0   |    `token_`    | `address` |   `address`   |             |
|   1   |    `amount_`   | `uint256` |   `uint256`   |             |
|   2   | `destination_` | `address` |   `address`   |             |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.maple.finance/technical-resources/interfaces/fixed-term-loan-initializer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
