Skip to content

Using Remix

Overview

Remix is a popular web-based Integrated Development Environment (IDE) for building and testing smart contracts on the Waterfall network. It is an open-source tool that provides a wide range of features and tools for developers to write, compile, deploy, and test their smart contracts.

Some of the key features of Remix include:

  • A Solidity code editor with syntax highlighting, auto-completion, and error highlighting
  • A compiler that can compile Solidity code into bytecode that can be executed on the Waterfall network
  • A debugger that allows developers to step through their code line by line and inspect variables
  • A testing environment that allows developers to write and run automated tests for their smart contracts
  • A built-in file manager that allows developers to organize and manage their smart contract files
  • Integration with other popular development tools and services, such as Truffle and Hardhat.

Remix has become a popular choice among Waterfall developers because it provides a user-friendly and accessible interface for developing and testing smart contracts. It is also highly customizable and extensible, allowing developers to add their own plugins and libraries to the IDE. Additionally, it has a large and active community of developers who contribute to its ongoing development and provide support to other users.

Getting started

  1. Connect Wallet - Metamask
  2. Open Metamask and select Waterfall Network
  3. Go to the Remix Ide

Create Project

  1. Create new Blank Workspace on File explorer page
  2. Create contracts directory
  3. Create contracts file HelloWaterfall.sol
  4. Paste example contract from solidity documentation site
    // SPDX-License-Identifier: GPL-3.0
    pragma solidity ^0.8.4;
    
    contract Coin {
        // The keyword "public" makes variables
        // accessible from other contracts
        address public minter;
        mapping(address => uint) public balances;
    
        // Events allow clients to react to specific
        // contract changes you declare
        event Sent(address from, address to, uint amount);
    
        // Constructor code is only run when the contract
        // is created
        constructor() {
            minter = msg.sender;
        }
    
        // Sends an amount of newly created coins to an address
        // Can only be called by the contract creator
        function mint(address receiver, uint amount) public {
            require(msg.sender == minter);
            balances[receiver] += amount;
        }
    
        // Errors allow you to provide information about
        // why an operation failed. They are returned
        // to the caller of the function.
        error InsufficientBalance(uint requested, uint available);
    
        // Sends an amount of existing coins
        // from any caller to an address
        function send(address receiver, uint amount) public {
            if (amount > balances[msg.sender])
                revert InsufficientBalance({
                    requested: amount,
                    available: balances[msg.sender]
                });
    
            balances[msg.sender] -= amount;
            balances[receiver] += amount;
            emit Sent(msg.sender, receiver, amount);
        }
    }
    

Compile

  1. Select HelloWaterfall.sol and go to the Solidity compiler page
  2. Click on Compile HelloWaterfall.sol button

Deploy to Waterfall Network

  1. Go to the Deploy & run transactions page
  2. Select Injected Provider - MetaMask in Environment field
  3. Click on Deploy button
  4. Confirm transaction in Metamask

Testing

After the contract is deployed, you can see the address of the contract and call the methods of the contract.