> For the complete documentation index, see [llms.txt](https://docs-sdk.crypto-chief.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-sdk.crypto-chief.com/processing/python/guides/contract-calls.md).

# Contract calls (EVM / TRON)

Call EVM, TRON, and Solana contracts in Python without hand-encoding calldata.

Most real-world transactions are smart-contract calls. You never encode the `data` field by hand: give the SDK a typed description and get back a signed reservation.

{% hint style="warning" %}
Contract-type transactions (`sign_evm_call`, `erc20_transfer`, `sign_tron_call`, `sign_anchor_call` — every helper in this guide signs `type=contract`) are covered by the same [execute-time pre-flight](/processing/python/guides/sign-execute.md): a wallet without enough native coin for gas gets `PREFLIGHT_FAILED` instead of an on-chain revert or a silent gas burn. On TRON, the call is additionally simulated, so a reverting call (including an insufficient token balance) is rejected as `simulation_reverted` before any fee is spent.
{% endhint %}

## EVM — by Solidity signature

{% hint style="danger" %}
This snippet shows the **encoder**, not a complete swap. Two things have to be true before a swap like this succeeds on chain:

* **An allowance.** Uniswap's router moves your input token with `transferFrom`, so it needs an ERC-20 `approve(address,uint256)` on that token first, confirmed before the swap is signed — the nonce comes from chain state. Without it the swap reverts and burns the gas.
* **A slippage floor.** `amountOutMin` of `0` accepts whatever the pool returns, which on a public mempool hands the trade to the first sandwich bot that sees it. Pass a real minimum, in the output token's base units.
  {% endhint %}

```python
import time
from cryptochief import Chain, EvmCallRequest, human_to_base

amount_in = human_to_base("0.01", 18)
deadline = int(time.time()) + 600

signed = await client.transactions.sign_evm_call(EvmCallRequest(
    network=Chain.ETH_MAINNET,
    from_address="0xYourWallet...",
    contract="0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",  # Uniswap V2 router
    method="swapExactTokensForTokens(uint256,uint256,address[],address,uint256)",
    args=[amount_in, 0, [token_in, token_out], "0xYou...", deadline],
    url_callback="https://your.app/webhooks/transaction",
))
```

The encoder supports `uint/int<M>`, `address`, `bool`, `bytes`, `bytes<N>`, `string`, and fixed/dynamic arrays of those. Argument values accept `int`, decimal/hex strings, `bytes`, and lists.

## ERC-20 / TRC-20 transfer (one-liner)

```python
from cryptochief import Erc20TransferRequest, human_to_base

amount = human_to_base("12.5", 6)  # USDT has 6 decimals

await client.transactions.erc20_transfer(Erc20TransferRequest(
    network=Chain.ETH_MAINNET,
    from_address="0xYourWallet...",
    token_contract="0xdAC17F958D2ee523a2206206994597C13D831ec7",
    recipient="0xRecipient...",
    amount=amount,
))
```

## TRON — same encoder, base58 addresses

`sign_tron_call` (an alias of `sign_evm_call`) accepts both base58 (`T...`) and `0x41`-prefixed hex addresses:

```python
await client.transactions.sign_tron_call(EvmCallRequest(
    network=Chain.TRON_MAINNET,
    from_address="TYourWallet...",
    contract="TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",  # USDT TRC-20
    method="transfer(address,uint256)",
    args=["TRecipient...", amount],
))
```

## Solana — Anchor program

```python
from cryptochief import (
    AnchorCallRequest, SolanaAccount, borsh_u64, borsh_string,
)

signed = await client.transactions.sign_anchor_call(AnchorCallRequest(
    network=Chain.SOLANA_MAINNET,
    from_address="YourWallet...",
    program="YourProgramId...",
    method="initialize",
    args=[borsh_u64(1_000_000), borsh_string("hello")],
    accounts=[SolanaAccount(pubkey="YourWallet...", is_signer=True, is_writable=True)],
))
```

For TON contracts, see [TON transfers](/processing/python/guides/ton.md).
