Now you are ready to develop & deploy smart contract on MEVerse. We have used Truffle as an example, as it is the most widely used tool.
Create Project Directory
First, create a directory to store the source code
$ mkdir meverse-test
$ cd meverse-test
Initialize Truffle
To deploy contract, initialize Truffle
$ truffle init
Write simple solidity contract
Create MEVerseGreeter.sol at meverse-test/contracts directory
$ cd contracts
$ touch MEVerseGreeter.sol
$ vi MEVerseGreeter.sol
Write following code in MEVerseGreeter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.6;
contract Mortal {
/* Define Variable owner of the type address */
address payable owner;
/* This function is executed at initialization and sets the owner of the contract */
constructor () public { owner = msg.sender; }
/* Function to recover the funds on the contract */
function kill() public payable { if (msg.sender == owner) selfdestruct(owner); }
}
contract MEVerseGreeter is Mortal {
/* Define variable greeting of the type string */
string greeting;
/* This runs when the contract is executed */
constructor (string memory _greeting) public {
greeting = _greeting;
}
/* Main function */
function greet() public view returns (string memory) {
return greeting;
}
}
Modify Migration Script
Deploy contract with hdwallet-provider. Install the library first.
$ npm install @truffle/hdwallet-provider
you can also deploy contracts written via Truffle's Dashboard, please refer to the Dashboard for more details.