dvml

command module
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 4 Imported by: 0

README

DERO Virtual Machine Light

ABOUT DVM Light

DVM Light is a standalone version of Dero Stargate Testnet Virtual Machine designed for accelerate the development of Smart Contract on the DERO Network in an offline environement. ( See more: https://git.dero.io/DeroProject/dvm_doc )

Installation From Source
  1. Install Golang, minimum Golang 1.10.3 required.
  2. Run the command go get git.dero.io/b9ron/dvml
  3. Add some dvm-basic file in the dvml folder.
  4. Finally run or compile with: go run dvml.go or go build
Usage

Linux:

./dvml --help

Windows:

dvml.exe --help
Requirment
  1. Each dvm-basic file need a mandatory function Initialize() Uint64 that return a Uint64 0 .
  2. Only public function will be executed (the first letter must be an Upper Case)
  3. Before using LOAD(data) instruction, data need to be initialized in Initialize() function with STORE(data,value) instruction.

String value

10 STORE(name, "Alice")

Uint64 value

10 STORE(balance, 0)

Minimalistic Initialize function

Function Initialize() Uint64
20 RETURN 0
End Function
Examples for lottery.bas

For the signature: Function TuneLotteryParameters(input Uint64, lotteryeveryXdeposit Uint64, lotterygiveback Uint64) Uint64

(dvml) run TuneLotteryParameters 10000 5 8800

For the signature: Function TransferOwnership(newowner String) Uint64

(dvml) run TransferOwnership dEToNFYEXufYzcs64qnfocZ48nvmbxbKR1x2MZBqbrHn5dULSfRRdN3d4EsbwKLGeHE5k3Vrh77BWFufe2gBcrDF57PqDCaJoc

Changelog

0.0.8:

  • Update in the commands
  • Update to Stargate rc2 DVM
  • New command burn will deposit Token and Dero on the SC.
  • New command reset set smart contract and the Dvml with initial value.
  • Fix on the SEND_DERO_TO_ADDRESS allow to sendback to the owner and updates balances correctly (Never sendback more Dero than what is in the SC balance)
  • Adding of a Live Debugger. (Allow breakpoints, runing step by step, display local variables and more...)
    • br or break Display the list of all breakpoint enabled.
    • br InitX 50 Enable a breakpoint in the function InitX at the line 50.
    • br InitX 50 0 Disable the breakpoint in the function InitX at the line 50.
    • Use r or run command to run the function where you add breackpoints.
  • When launching the dvml the flag -mainnet allow to generate dero address instead of deto address for the generated account.

** KNOWN BUG : SEND_DERO_TO_ADDRESS will not work properly if used multiple times. **

0.0.7:

  • New entry ExpectedStates (SC states) in the JSON test file allow to check the SC states modified with STORE(key) DVM function. (see the examples folder)
  • New command generate file will generate a JSON test file_generated.json based on the current SC loaded. (Only ExpectedResult (function output) are generated)
  • New command balance will show the SC balance and current user balance.
  • Fix on the SEND_DERO_TO_ADDRESS allow to sendback to the owner the correct ammount of Dero without crash.
  • Update to MIT Licence

0.0.6b:

  • Colors are disabled by default due to windows cmd has an issue diplaying AINSI characters, you have to use the flag -colors to enable the color mode.
  • New way to launch dvml using sc et test flags.

0.0.6:

  • You can check stored state in Dero SC.
  • You can launch the test script without using the menu, just by running dvml file.bas file.json
  • Fix golang imports

0.0.5:

  • Add the support of the Unit Testing for Dero Smart Contracts with the command tests file that load a JSON file with unit tests parameters. (see the examples folder)
  • Each time you launch the dvml a new SCID BLID and TXID will be generated (They are seeds for the RANDOM() function).
  • Every seconds the BLID and the BLOCKHEIGHT will be incremented to simulate a DeroDag with 1 second time block.

0.0.4:

  • You can use the instruction SEND_DERO_TO_ADDRESS in smart contract without crashing the DVML, but you need to send some DEROs to the smart contract using a function with an a argument named value and an amount in uint64.

0.0.3:

  • help display Help and Usage information.
  • account display 10 generated accounts (0 to 9), with the command account 9 you can select the account number 9. (usefuf for the DVM SIGNER() instruction.)
  • signer or whoami display the current address of the SIGNER().
  • storage show the data stored with the DVM STORE() instruction.

** KNOWN BUG : SEND_DERO_TO_ADDRESS doesn't work yet! **

0.0.2:

  • You can execute multiple functions without losing the context with the command run.
  • You can list the fonctions inside the SC with their arguments using the command list.
  • A prompt has been added ( press q or quit for exit.)

0.0.1:

  • Only one function at the time
  • Initial release

Donations

DERO:
dERoNFYEXufYzcs64qnfocZ48nvmbxbKR1x2MZBqbrHn5dULSfRRdN3d4EsbwKLGeHE5k3Vrh77BWFufe2gBcrDF57PqDCaJoc

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL