1.0.2-Beta • Published 3 years ago

sample.u v1.0.2-Beta

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Follow below steps to setup unify command line interface

From npm registry

```npm install @dltlabs-tbd/dl-unify-cli```

From build

  1. Git clone the repo

    git clone git@bitbucket.org:dltgeth/dl-unify-cli.git

  2. Install it globally

    npm install -g .

Usage

unify ruffle init

Creates and Initialize the project.

Options:
      --version  Show version number                                   [boolean]
      --help     Show help                                             [boolean]
  -n, --name     Creates and Initialize the project with the name passed as an
                 option
unify ruffle compile

Compiles the contract/s in the project.

Options:
      --version  Show version number                                   [boolean]
      --help     Show help                                             [boolean]
  -f, --file     Compiles the contract/s in the project with contract file name
                 passed as an option
unify ruffle deploy

Deploys the contract to the <dltestnet> network.

Options:
      --version   Show version number                                  [boolean]
      --help      Show help                                            [boolean]
  -c, --contract  Deploys the contract to the <dltestnet> network. Contract

Example of more complex contract deployment

    unify ruffle deploy -c VotingCore.json:VotingRegistry

Here VotingCore.json is compile json which contains VotingRegistry as one of the imported contracts.


Steps for compiling and deploying HelloWorld on DL Unify Gateway with DL Unify CLI:

  1. Install DL Unify CLI from NPM registry or download and install it from the link below:

https://dltlabsglobal.sharepoint.com/:u:/r/sites/Tool-BNOOrchestrator/Shared%20Documents/dl-unify-cli/io.dltlabs.unify-1.0.0-Beta.tgz?csf=1&web=1&e=0bTiqz

    1.  Install the package by runing below command in your shell/cmd.

        npm install -g io.dltlabs.unify-1.0.0-Beta.tgz

    2.   Create and initialize HelloWorld project

        unify ruffle init --name HelloWorld

    3.  Copy HelloWorld.sol file to contract folder created by previous 
    command.
    <<File Starts Below >>
        // SPDX-License-Identifier: UNLICENSED

        pragma solidity >=0.5.0 <=0.8.7;

        // Specifies the version of Solidity, using semantic versioning.
        // Learn more: https://solidity.readthedocs.io/en/v0.5.10/layout-of-source-files.html#pragma

        // Defines a contract named `HelloWorld`.
        // A contract is a collection of functions and data (its state). Once deployed, a contract resides at a specific address on the Ethereum blockchain. Learn more: https://solidity.readthedocs.io/en/v0.5.10/structure-of-a-contract.html
        contract HelloWorld {

        // Declares a state variable `message` of type `string`.
        // State variables are variables whose values are permanently stored in contract storage. The keyword `public` makes variables accessible from outside a contract and creates a function that other contracts or clients can call to access the value.
        string public message;

        // Similar to many class-based object-oriented languages, a constructor is a special function that is only executed upon contract creation.
        // Constructors are used to initialize the contract's data. Learn more:https://solidity.readthedocs.io/en/v0.5.10/contracts.html#constructors
        constructor(string memory initMessage) {
        
            // Accepts a string argument `initMessage` and sets the value into the contract's `message` storage variable).
            message = initMessage;
        }

        // A public function that accepts a string argument and updates the `message` storage variable.
        function update(string memory newMessage) public {
            message = newMessage;
        }
    }
        <<File Ends Above >>

    4.  Compile HelloWorld Solidity Contract

         unify ruffle compile --file HelloWorld.sol

    5. Deploy the contract to DL Unify GATEWAY.

        unify ruffle deploy -c  HelloWorld.sol

    6. Verify the contract is deployed successfully @ [DLTESTNET Explorer](https://market-bcexplorer.devdlt.com/)