Deploying to TAC EVM
Learn how to deploy your Solidity smart contracts to TAC EVM
This guide will walk you through the process of deploying your Solidity smart contracts to the TAC EVM Layer using Foundry. By the end, you’ll have successfully deployed a contract that can interact with the TON ecosystem through the TON Adapter.
TAC provides a standard EVM environment, allowing you to use modern tools like Foundry for smart contract development and deployment.
Prerequisites
Before you begin, make sure you have the following:
- An Ethereum wallet with private key
- Basic familiarity with Solidity and smart contract development
- Some TAC tokens for gas fees (available from the testnet faucet for testing)
Step 1: Install Foundry
If you haven’t already installed Foundry, start by setting it up on your system.
Install Foundry
After the installation script completes, run:
Verify installation
You should see version information for forge, cast, and anvil.
Step 2: Create a New Foundry Project
Initialize a new Foundry project
This creates a new Foundry project with a basic structure.
Explore the project structure
Foundry creates several directories:
src/
: Directory for your smart contractstest/
: Directory for your testsscript/
: Directory for deployment scriptslib/
: Directory for dependenciesfoundry.toml
: Foundry configuration file
Step 3: Write a Smart Contract
Let’s create a simple smart contract to deploy to TAC.
Create a contract file
Replace the content of src/Counter.sol
with our SimpleStorage contract:
Create a deployment script
Create a new file in the script
directory:
Add the following code to script/DeploySimpleStorage.s.sol
:
Step 4: Configure Foundry for TAC
Create a .env file for your private key
Add your private key to the .env file:
Never commit your .env file to version control. Add it to your .gitignore file.
Update foundry.toml
Update the foundry.toml
file to include the TAC network configurations:
Step 5: Get Testnet TAC Tokens
Before deploying to the testnet, you’ll need some TAC tokens to pay for gas fees.
Add TAC Testnet to your wallet
Add the TAC testnet to your MetaMask or other Ethereum wallet with the following details:
- Network Name: TAC Turin Testnet
- RPC URL: https://turin.rpc.tac.build
- Chain ID: 2390
- Currency Symbol: TAC
Get testnet tokens from the faucet
Visit the TAC Testnet Faucet and follow these steps:
- Connect your wallet
- Enter your wallet address
- Submit the request
- Wait for the tokens to arrive in your wallet
Step 6: Compile the Contract
Compile the contracts
You should see output indicating successful compilation.
Step 7: Deploy the Contract to TAC Testnet
Now, let’s deploy the contract to the TAC testnet.
Load environment variables
Deploy the contract
If you encounter issues with verification, you can deploy without it:
You should see output with the deployment transaction and contract address.
Verify the deployment
You can verify your deployment by checking the TAC Turin Explorer:
- Visit TAC Turin Explorer
- Search for your contract address
- Confirm the contract details and transaction history
Step 8: Make Your Contract Accessible from TON
To make your contract accessible from TON wallets, you’ll need to create a proxy contract. This is covered in detail in the Build a Proxy Contract guide, but here’s a brief overview:
Create a proxy contract
Create a proxy contract that connects to your SimpleStorage contract and handles cross-chain messages from TON.
Deploy the proxy contract
Deploy the proxy contract to the TAC EVM Layer using the same Foundry workflow.
Connect with frontend
Use the TAC SDK to connect your frontend application to the proxy contract, enabling TON wallet interactions.
Next Steps
Congratulations! You’ve successfully deployed a smart contract to the TAC EVM Layer using Foundry. Now you can:
Was this page helpful?