Your First Proxy Contract
Let’s start with the absolute minimum proxy contract that can handle TON->TAC transaction:Understanding the Structure
Required Imports
TacProxyV1: The base contract that handles all cross-chain communicationTacHeaderV1: Data structure containing information about the TON user
Inheritance
TacProxyV1 to receive cross-chain calls.
Constructor Parameter
crossChainLayer address is TAC’s infrastructure contract that will call your functions. You get this address from TAC documentation or contract addresses page.
Function Signature (Critical!)
bytes calldata tacHeader- Encoded TacHeaderV1 containing TON user informationbytes calldata arguments- Your custom ABI-encoded parametersexternal- Must be externally callable_onlyCrossChainLayer- Security modifier that ensures only CrossChainLayer can call this function (required only for TON->TAC and TON->TAC->TON types)
Step-by-Step Walkthrough
Step 1: Decode the Header
header.tvmCaller- TON user’s address. Important! It is always base64 mainnet bounceable format and starts with “EQ” (like “EQAbc123…”)header.operationId- Unique ID for this operationheader.timestamp- When the TON transaction happened
Step 2: Decode Your Parameters
arguments contain whatever data the TON user sent. You decide what format this should be - it could be:
- A single string:
abi.decode(arguments, (string)) - Multiple values:
abi.decode(arguments, (uint256, address, bool)) - A struct:
abi.decode(arguments, (MyCustomStruct))
Step 3: Execute Your Logic
- Store data in state variables
- Call other contracts
- Perform calculations
- Transfer tokens
Sending Responses Back to TON
You may also want to send arbitrary tokens back to the TON user after an EVM execution (TON->TAC->TON transaction type). Learn how in the more advanced example.Deployment
Deploy your basic proxy just like any other contract. You can also usedeploy from @tonappchain/evm-ccl as helper:
What’s Next?
Feeling ready for more complex patterns?Upgradeable Proxy Example
Learn when and how to build contracts that can be upgraded over time