# Smart contract limitations & edge cases

When integrating with THORChain or Mayachain, certain limitations at the smart contract and transaction level must be taken into account. Failing to do so may result in failed swaps, rejected transactions, or permanent loss of funds.&#x20;

### EVM Transaction Types

THORChain and Mayachain do not support EVM Type 4 transactions introduced in [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702), which involve account abstraction. This includes:

* All `type: 4` transactions
* Transactions from wallets based on abstracted accounts

Any transaction using this format will be rejected and **may lead to loss of funds** if funds are transferred under an unsupported transaction structure.

The following EVM transaction types are supported:

* `type: 0` (Legacy)
* `type: 2` (EIP-1559)

The `includeTx` optional argument when requesting a quote returns a legacy transaction object.

Chainflip, by contrast, does not impose restrictions on transaction types. All EVM transaction types, including Type 4, are supported when depositing on a Chainflip channel.

### Transaction Log Limit

For inbound transactions into THORChain and Mayachain, the maximum number of logs that a transaction can include is **50 logs**.

This limitation is particularly important for integrators who use smart contract wrappers to:

* Perform token swaps
* Route through aggregators
* Execute any custom logic **before** sending funds to THORChain or Mayachain

If the resulting transaction generates more than 50 logs (e.g., due to complex DeFi interactions), **THORChain will not process it**.

### THORChain, Mayachain & Smart Contract Limitations <a href="#transaction-log-limit" id="transaction-log-limit"></a>

Thorchain has strict gas limits when sending assets to smart contracts. Wallet-emitting events require gas and might break compatibility with Thorchain normal swap flow.\
By default, SwapKit API checks if the sender and recipient addresses are smart contract and will filter out `THORCHAIN`, `THORCHAIN_STREAMING`, `MAYACHAIN` and `MAYACHAIN_STREAMING` providers.\
You may use the `allowSmartContractReceiver`  after confirming with SwapKit developers that your wallet respects Thorchain gas requirements.

### XRP through THORChain limitations <a href="#transaction-log-limit" id="transaction-log-limit"></a>

Integrators should be aware of if they are not using our `includeTx` optional argument to build transactions for XRP swaps through THORChain:

* **Transaction Type**: Only `Payment` transactions are supported for both inbound and outbound transfers.
* **Address Format**: Only **classic XRP addresses** (starting with `r...`) are supported. X-addresses (which encode both address and destination tag) are **not supported** and must be decoded before use.
* **Memo Field**:
  * THORChain supports only the first entry in the `Memos[]` array.
  * Additional memos (if present) will be ignored.
  * Maximum memo length: 250 characters, any excess will be ignored.

For reliable behavior, always use classic addresses and ensure your memo data fits within the 250-character limit.


---

# Agent Instructions: 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.swapkit.dev/smart-contract-limitations-and-edge-cases.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.
