Использование Remix - Ethereum IDE

Introduction

This guide walks through the process of creating and deploying a Solidity-based smart contract to a Edgeware dev node using the Remix IDE. Remix is one of the commonly used development environments for smart contracts on Ethereum. Given Edgeware’s Ethereum compatibility features, Remix can be used directly with a Edgeware node.

This guide assumes that you have a running local Edgeware node running in --dev mode, and that you have a MetaMask installation configured to use this local node. You can find instructions for running a local Edgeware EVM node and to configure MetaMask for Edgeware.

Interacting With Edgeware Using Remix

Open Remix and click on the New File

Name your file, in our case we've named it ERC20.sol - yes, that famous token standard

Now add code. Here we are using simple ERC-20 contract based on the current Open Zeppelin ERC-20 template. It creates MyFirstToken with symbol HEDGE and mints the entirety of the initial supply to the creator of the contract.

pragma solidity ^0.6.0;

import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.1.0/contracts/token/ERC20/ERC20.sol';

// This ERC-20 contract mints the specified amount of tokens to the contract creator.
contract MyFirstToken is ERC20 {
  constructor(uint256 initialSupply) ERC20("MyFirstToken", "HEDGE") public {
    _mint(msg.sender, initialSupply);
  }
}

On the left sidebar, you will click on Solidity compiler and Compile ERC20.sol

Solidity Compiler >>> Compile Contract

Now click to the Deploy & Run Transactions on the left in the sidebar and open Metamask to check if is our account connected. If it's connected you can skip to next steps

Select our account, in this case it's Edgeware Dev and click connect if you don't see that option click on Not connected a new window will pop up.

You will now head to deploy contract. Just before that, make sure you've set set ENVIRONMENT to Injected Web3 and Account that we've imported. Hint, it should have some Eth. To the input next deploy input initialSupply, in our case it's 21M. Since this contract uses the default of 18 decimals, the value you will put there is 21000000000000000000000000

You will hit confirm!

Remix-MM-confirm

You will see your contract has been successfully deployed.

Remix-deployed-contract

You can see your contract deployment details, that has been successfully deployed on Edgeware EVM

You can now click to call functions like decimals, name, symbol, totalSupply

What's next?

You can copy your contracts address and add it to Metamask to play out! Have fun, stay safe!

Reach us for more engagement

Glad you've made it through! 🥰 We are eager to guide your more on your exploration through Edgeware Ethereum combability feature. We are keen to hear your experience and suggestions you may have for us.. You can feel free to chat with us in the Edgeware's channels like Discord, Element and Telegram, we can help you out with issues you may have or project you may want to be funded through our Treasury program. Don't hesitate to share your feedback on our channels, there is always space to improve! 🙌