Sanko Mainnet Docs
  • Sanko
    • What is Sanko?
    • Sanko Overview
      • AnyTrust and the Data Availability Committee
      • Keysets
      • Data Availability Certificates​
      • Data Posting Mechanisms
      • Data Availability Servers​
      • Sequencer-Committee Interaction
    • Official Links
  • Sanko Mainnet
    • Connect to Sanko Mainnet
    • Bridge to Sanko
    • Native DEXs
      • Sankoswap
      • Camelot Exchange
        • Camelot V2
        • Camelot V3
          • Concentrated Liquidity
          • Customizable Tickspacing
          • Directional & Dynamic Volatility Fees
    • Sudoswap
      • Sudoswap Overview
        • Bonding Curves
        • Royalties
        • Settings
        • Property Checking
        • ERC1155 NFTs
      • User Guide
        • Creating a Liquidity Pool
        • Managing Existing Pools
        • Creating an Auction
        • Managing Collections
    • SankoTools
      • Terminal Elements
        • Research Elements
        • Chaindata Elements
        • Market Data Elements
        • NFT Elements
        • Chart Elements
        • Liquidity Elements
        • Portfolio Elements
        • Utility Elements
    • Run a Sanko node
  • $DMT
    • The Dream Machine Token (DMT)
    • What is $DMT?
      • How to Purchase $DMT on Arbitrum
      • How to Purchase $DMT on Ethereum
    • The Dream Machine
    • Tokenomics
  • Build on Sanko
    • Connect to Sanko Testnet
    • Deploy on Sanko Testnet
      • Foundry
      • Hardhat
      • Remix
    • Testnet Info + Faucet
    • Testnet Bridge
    • Testnet Block Explorer
    • Pyth Entropy (RNG)
  • miscellaneous
    • Sanko Terms of Use
    • Sanko Privacy Policy
    • FAQ
    • Notice
Powered by GitBook
On this page
  • What is Foundry?
  • Get Started with Foundry
  • Deploying Smart Contracts
  1. Build on Sanko
  2. Deploy on Sanko Testnet

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
  2. Create a project

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

    cd srctouch 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.0pragma 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 Smart Contracts

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://sanko-arb-sepolia.rpc.caldera.xyz/http"--constructor-args 100 \--private-key YOUR_PRIVATE_KEY \src/MyToken.sol:MyToken 
PreviousDeploy on Sanko TestnetNextHardhat

Last updated 1 year ago