Created
March 4, 2021 11:14
-
-
Save sorinmircea/d40d95d8af72b69c52424b7f3438114a to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.7.4+commit.3f05b770.js&optimize=false&runs=200&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| REMIX EXAMPLE PROJECT | |
| Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer. | |
| It contains 3 directories: | |
| 1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name. | |
| 2. 'scripts': Holds two scripts to deploy a contract. It is explained below. | |
| 3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity. | |
| SCRIPTS | |
| The 'scripts' folder contains example async/await scripts for deploying the 'Storage' contract. | |
| For the deployment of any other contract, 'contractName' and 'constructorArgs' should be updated (along with other code if required). | |
| Scripts have full access to the web3.js and ethers.js libraries. | |
| To run a script, right click on file name in the file explorer and click 'Run'. Remember, Solidity file must already be compiled. | |
| Output from script will appear in remix terminal. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //SPDX-License-Identifier: UNLICENSED | |
| pragma solidity ^0.7.4; | |
| contract Incrementer { | |
| uint256 public number; | |
| constructor(uint256 _initialNumber) { | |
| number = _initialNumber; | |
| } | |
| function increment(uint256 _value) public { | |
| number = number + _value; | |
| } | |
| function reset() public { | |
| number = 0; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pragma solidity ^0.7.0; | |
| import 'https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0-solc-0.7/contracts/token/ERC20/ERC20.sol'; | |
| // This ERC-20 contract mints the specified amount of tokens to the contract creator. | |
| contract MyToken is ERC20 { | |
| constructor(uint256 initialSupply) ERC20("MyToken", "MYTOK") { | |
| _mint(msg.sender, initialSupply); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment