ALIENX
  • ALIENX CHAIN
  • White Paper
    • πŸ’‘Welcome to ALIENX
    • πŸ”οΈALIENX Introduction
      • What is ALIENX?
      • Why ALIENX
    • πŸ”¨ALIENX Protocol
      • Inside ALIENX
      • Gas Fees
      • Fraud Proofs
    • πŸ›ΈGetting Start (AlienX Mainnet)
      • Add AlienX Chain to MetaMask
      • Bridge Assets to AlienX
    • πŸš€Getting Start (HAL Testnet)
      • Add Hal Chain to MetaMask
      • Bridge Assets to Hal
      • Receive Faucet Funds
    • πŸͺ™Tokenomics
    • πŸ—ΊοΈRoadmap
    • πŸ›οΈBackers and ECO Partners
  • ALIENX Activities
    • πŸ‘»ALIENX Explorer Pass
    • πŸ•Social Airdrop
    • 🦠AI Node Sale
    • β˜„οΈStaking Season
  • ALIENX Mainnet
    • 🏭ALIENX Mainnet Quest
    • πŸŽͺALIENX Park
    • ☎️Mainnet Voyage Q&A
    • πŸͺ‡AIX Launch Announcement
      • AIX TGE Timeline
      • AIX Token Address
      • Who can claim $AIX?
      • How to Claim your $AIX?
  • ALIENX HAL Testnet
    • β›ΊHAL Testnet Quest
    • πŸ“©Apply to join HAL Testnet
  • Developer
    • πŸ•ΉοΈDeploy contract on AlienX mainnet
      • Foundry
      • Hardhat
      • Remix
    • πŸ’»Deploy contract on Hal Testnet
      • Foundry
      • Hardhat
      • Remix
  • Support
    • πŸ”—Official Links
    • πŸ“FAQ
      • Node Sale
      • Node Pre-Book
      • Social Airdrop
      • AEP Drop
  • $AIX Airdrop
    • 🎁$AIX Airdrop
Powered by GitBook
On this page
  • What is Foundry?
  • Get Started with Foundry
  • Deploying Your Smart Contract
  1. Developer
  2. Deploy contract on AlienX mainnet

Foundry

What is Foundry?

Foundry is a toolset for Ethereum development written in Rust that assists developers in managing dependencies, compiling projects, running tests, deploying contracts, and interacting with blockchains through the command line interface.Additionally, Foundry can directly communicate with Caldera's Ethereum API, enabling the use of Foundry to deploy smart contracts into the Caldera network.

Get Started with Foundry

  1. Install Foundry

  • Linux or MaxOS

curl -L https://foundry.paradigm.xyz | bashfoundryup
  • Windows

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | shcargo install --git https://github.com/foundry-rs/foundry foundry-cli anvil --bins --locked
  1. Create a project

forge init foundry
  1. Navigate to the Source in the project and create your smart contract

cd srctouch MyToken.sol
  1. Input your smart contract or use the sample contract below.

// SPDX-License-Identifier: MIT// compiler version must be greater than or equal to 0.8.17 and less than 0.9.0pragma solidity ^0.8.17; contract HelloWorld {    string public greet = "Hello World!";}
  1. Install OpenZeppelin contracts as a dependency

forge install OpenZeppelin/openzeppelin-contracts
  1. Compile contract

forge build

Deploying Your Smart Contract

Deploying a contract with Forge is a simple process that can be done with a single command. However, it requires an RPC endpoint, a private key that has funds, and any arguments for the constructor of the contract. For example, the MyToken.sol contract requires an initial supply of tokens to be specified in its constructor, so the command to deploy it on a network will include the argument of 100.To deploy the MyToken.sol contract, use the command that corresponds to the Caldera chain's RPC URL while running the forge create command:

forge create --rpc-url "https://rpc.alienxchain.io/http"--constructor-args 100 \--private-key YOUR_PRIVATE_KEY \src/MyToken.sol:MyToken 
PreviousDeploy contract on AlienX mainnetNextHardhat

Last updated 11 months ago

πŸ•ΉοΈ