Last active
May 30, 2022 11:58
-
-
Save pcaversaccio/84727c7dd2efa145a50cd2a1615f54df to your computer and use it in GitHub Desktop.
How to deploy a smart contract on Hedera using Hardhat.
This file contains 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: MIT | |
pragma solidity ^0.8.4; | |
contract LookupContract { | |
mapping(string => uint256) public myDirectory; | |
constructor(string memory _name, uint256 _mobileNumber) { | |
myDirectory[_name] = _mobileNumber; | |
} | |
function setMobileNumber(string memory _name, uint256 _mobileNumber) | |
public | |
{ | |
myDirectory[_name] = _mobileNumber; | |
} | |
function getMobileNumber(string memory _name) | |
public | |
view | |
returns (uint256) | |
{ | |
return myDirectory[_name]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this template
..env
file store your Hedera testnet account ID and private key:Create your contract in the
contracts/
directory. For this tutorial, we will use the aboveLookupContract
.Now, create a file called
index.ts
in the root directory with the following content:The output will look like the following:
0.0.34940384
.