๐ŸŒ
Atleta Network
English
English
  • ๐Ÿ‘‹Welcome
    • Introduction
      • What is Atleta?
      • Considerations
  • โ›“๏ธAtleta L1
    • Performance
    • Consensus
      • NPoS
        • BABE
        • GRANDPA
    • Staking
      • Validators
        • Process
        • Configuration
      • Nominators
        • Nominator Pools
      • Rewards
        • Slashing Mechanism
          • Misbehavior Cases
    • $ATLA
      • Tokenomics
    • Interoperability
      • Parachains
      • XCM+
    • Governance
      • Gov Specifications
        • Gov (Without Staking)
      • Treasury
    • Virtual Machine
    • Looking Ahead
  • ๐ŸงชTestnet
    • Olympia information
  • ๐Ÿ‘จโ€๐Ÿ’ปDEVs
    • Build - โš™ - Testent
      • Building on Atleta Olympia
        • EVM Compatibility
        • Atleta Olympia Contracts
        • Fees
      • Smart Contract Development
        • ATIP
        • ATS
        • Tech Stack
      • Deploy Your EVM App
        • Deploy on Atleta Olympia
        • Hardhat
        • Foundry
        • REMIX
        • Ethersยทjs
        • Web3ยทjs
      • Tools
        • Node providers
        • Block Explorers
      • Source code
  • โš™๏ธNODE
    • Run a validator node
    • Run an archive node
  • ๐Ÿ’ฑGrants
    • Atleta Grants Program
      • Ecosystem Grants
        • Application & Requirements
        • Payments
      • ๐ŸšงRPGF
      • ๐ŸšงHackathons
  • ๐Ÿ“’Guides
    • Testnet "How-To's"
      • โ€œConnect to Olympia Testnetโ€
      • "Claim $ATLA via Faucet"
      • โ€œStake Testnet $ATLA tokensโ€
      • โ€œGovernance on Olympia Testnetโ€
      • โ€œTrade on the DEX โ€
      • โ€œUse Atleta Olympia Leaderboardโ€
  • โ“FAQs
    • F.A.Q.'s
  • โ„น๏ธResources
    • ๐Ÿ˜„Social Channels
      • Twitter / X
      • Medium
      • Discord
      • Youtube
      • Instagram
      • Telegram
    • ๐ŸŒWebsite (Atleta)
    • ๐Ÿ“„BCSports Docs
    • ๐Ÿ“–Atleta Terminology
Powered by GitBook
On this page
  1. DEVs
  2. Build - โš™ - Testent
  3. Deploy Your EVM App

Foundry

Deploying Smart Contracts using Forge in Foundry

PreviousHardhatNextREMIX

Last updated 10 months ago

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 Atleta Olympia's Ethereum API, enabling the use of Foundry to deploy smart contracts into the Atleta Olympia network.

Getting Started with Foundry

  1. Install Foundry

    • Linux or MacOS

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

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

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

    cd src
    touch MyToken.sol
  4. 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.0
    pragma solidity ^0.8.17;
    
    contract HelloWorld {
        string public greet = "Hello World!";
    }
  5. Install OpenZeppelin contracts as a dependency

    forge install OpenZeppelin/openzeppelin-contracts
  6. Compile contract

    forge build

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 Atleta Olympia chain's RPC URL while running the forge create command:

    forge create --rpc-url "https://testnet-rpc.atleta.network" //Insert your RPC URL here
    --constructor-args 100 \
    --private-key YOUR_PRIVATE_KEY \
    src/MyToken.sol:MyToken

Deploying your Smart Contract

๐Ÿ‘จโ€๐Ÿ’ป
โ€‹
โ€‹
โ€‹