Guide to deploying Solidity contracts to Calix Chain using Hardhat and Foundry.
npm init -y && npm install --save-dev hardhat @nomicfoundation/hardhat-toolbox
npx hardhat init # select "Create a JavaScript project"
hardhat.config.jsrequire("@nomicfoundation/hardhat-toolbox");
require("dotenv").config();
module.exports = {
solidity: "0.8.24",
networks: {
calix: {
url: "https://calixchain.io/rpc",
chainId: 999,
accounts: [process.env.PRIVATE_KEY],
},
},
};
scripts/deploy.jsconst { ethers } = require("hardhat");
async function main() {
const [deployer] = await ethers.getSigners();
console.log("Deploying from:", deployer.address);
const Token = await ethers.getContractFactory("MyToken");
const token = await Token.deploy(ethers.parseUnits("1000000", 18));
await token.waitForDeployment();
console.log("Token deployed to:", await token.getAddress());
}
main().catch(console.error);
PRIVATE_KEY=0x... npx hardhat run scripts/deploy.js --network calix
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash && foundryup
# Create project
forge init my-project && cd my-project
# Deploy
forge create src/MyToken.sol:MyToken \
--rpc-url https://calixchain.io/rpc \
--private-key $PRIVATE_KEY \
--constructor-args 1000000000000000000000000
# Verify (if verifier is available)
forge verify-contract <ADDRESS> src/MyToken.sol:MyToken \
--rpc-url https://calixchain.io/rpc
| Transaction type | Estimated gas |
|---|---|
| CLX transfer | 21,000 |
| CLX20 transfer | ~50,000 |
| CLX20 approve | ~45,000 |
| Simple ERC-20 deploy | ~700,000 |
| DEX swap | ~150,000 |