Contents
Preparations
- Installed the MetaMask and created a account.
- Added the Goerli testnet in MetaMask.
- Obtained the Goerli’s ETH.
- Free https://goerlifaucet.com/ (Need to complete the registration first)
Remix IDE
![Smart Contracts With Remix IDE 1 remix.ethereum.org](https://saludpcb.com/wp-content/uploads/2023/02/Remix-IDE-scaled.jpg)
Quickly Create a Smart Contracts Via Remix IDE
❖ First connect to remix.ethereum.org website. ❖ Create an empty workspace.
![Smart Contracts With Remix IDE 2 remix.ethereum.org](https://saludpcb.com/wp-content/uploads/2023/02/Create-an-empty-workspace-1-1024x562.jpg)
❖ Create a New File "HelloWorld.sol"(.prettierrc.json can delete it).
![Smart Contracts With Remix IDE 3 remix.ethereum.org](https://saludpcb.com/wp-content/uploads/2023/02/Create-a-New-File-22-HelloWorld.sol-22-1024x562.jpg)
❖ Enter the following code in "HelloWorld.sol" file.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract HelloWorldToken is ERC20, Ownable {
constructor() ERC20("HelloWorldToken", "HWTK") {
_mint(msg.sender, 1000 * 10 ** decimals());
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}
![Smart Contracts With Remix IDE 4 er20 code 1](https://saludpcb.com/wp-content/uploads/2023/02/er20_code-1-1024x562.jpg)
❖ Compile "HelloWorld.sol". ❖ After the compilation is complete, you will get a ✅.
![Smart Contracts With Remix IDE 5 remix.ethereum.org](https://saludpcb.com/wp-content/uploads/2023/02/Compile-HelloWorld.sol_-1024x562.jpg)
![Smart Contracts With Remix IDE 6 remix.ethereum.org](https://saludpcb.com/wp-content/uploads/2023/02/After-the-compilation-is-complete-1024x565.jpg)
Deploy & Run Transaction
❖ Login MetaMask and select Goerli test network.
![Smart Contracts With Remix IDE 7 metamask](https://saludpcb.com/wp-content/uploads/2023/02/Login-to-your-MetaMask-and-select-Goerli-testnet-610x1024.jpg)
❖ Select Deploy & Run Transaction in Remix IDE. ❖ Select Injected Provider - MetaMask in ENVPONMENT.
![Smart Contracts With Remix IDE 8 deploy](https://saludpcb.com/wp-content/uploads/2023/02/Deploy-Run-Transaction-1024x562.jpg)
❖ Deploy and Confirm (will pop up a MetaMask Notification window).
![Smart Contracts With Remix IDE 9 deploy](https://saludpcb.com/wp-content/uploads/2023/02/Deploy-and-Confirm-1024x580.jpg)
❖ When you finish Deploy, you will see the contract information in the Deployed Contracts field. ❖ When you want to import tokens, you need to copy the token contract address of HelloWorld first.
![Smart Contracts With Remix IDE 10 deploy](https://saludpcb.com/wp-content/uploads/2023/02/import_tokens-1024x558.jpg)
❖ Paste the copied HelloWorld's contract address into the Token contract address field and select "Add custom token" and "Import tokens".
![Smart Contracts With Remix IDE 11 tokens](https://saludpcb.com/wp-content/uploads/2023/02/截圖-2023-02-01-下午10.56.23-612x1024.png)
![Smart Contracts With Remix IDE 12 tokens](https://saludpcb.com/wp-content/uploads/2023/02/import_hwtk_tokens-606x1024.jpg)
❖ Completing HWTK's Smart Contracts.
![Smart Contracts With Remix IDE 13 tokens](https://saludpcb.com/wp-content/uploads/2023/02/Completing-HWTKs-Smart-Contracts-620x1024.jpg)