0.0.5-Beta • Published 3 years ago
io.dltlabs.unify v0.0.5-Beta
Follow below steps to setup unify command line interface
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
------------------------------------------------
Invoke the contract method
------------------------------------------------
Options:
--version Show version number [boolean]
--help Show help [boolean]
-d, --deployed Invoke the deployed smart contract
-m, --method Method Name to be invoked from deployed smart contract
-p, --params Multiple arguments to contract method as an array.
-a, --address contract address [string]
------------------------------------------------
unify ruffle search
------------------------------------------------
Search the account activity in last 25 blocks.
Options:
--version Show version number [boolean]
--help Show help [boolean]
-a, --account Search the account activity in last 25 blocks. [string]
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 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.
--------------------------------------------------------------------HelloWorld.sol----------------------------------------------------------------------------
// 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;
}
}
------------------------------------------------------------------------------------------------------------------------------------------------
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/)
7. Invoke the contract method from CLI
------------------------------------------------
unify ruffle invoke -d HelloWorld.json -m update -p '["puru"]' - a 0x28CbD506d22B28434815b5A3Dd4F99f17f542946
------------------------------------------------
8. Search account activity with last 25 blocks:
------------------------------------------------
unify ruffle search -a 0x3ec180429a49f45adf252D22c9c5316e13b3c0b0
------------------------------------------------
------------------------------------------------ ------------------------------------------------ ------------------------------------------------
Set up environment
Create and initialize HelloWorld project
ruffle-config.json
Compile Solidity contract
Deploy Solidity Contract
0.0.3-Beta
3 years ago
0.0.4-Beta
3 years ago
0.0.5-Beta
3 years ago
0.0.2-Beta
3 years ago
0.0.1-Beta
3 years ago