Skip to content

Latest commit

 

History

History
120 lines (92 loc) · 3.09 KB

README.md

File metadata and controls

120 lines (92 loc) · 3.09 KB
Stellar

Introduction

This repository contains the implementation of Velo Protocol version 2, which includes

  • Smart contract
  • Golang implementations
    • Go SDK (vclient)
    • Go CLI (gvel)

Getting Started with Smart Contract

Project Structure

├── contracts          - solidity smart contract code stays here
├── migrations         - migration script
├── test               - smart contract test
├── truffle-config.js  - config truffle env and behaviour here
├── package.json
├── yarn.lock
...
└── go (Golang implementations)

See Golang implementations here

Installation

To install DRSv2, you need to install NodeJs 10.16.3, Truffle and Ganache first.

  1. You can use the command below to install Truffle.
$ yarn global add truffle
  1. Clone this repository in your machine, go to folder DRSv2, then use yarn install to install all dependencies:
$ yarn install
  1. Run Ganache

  2. After that you can run the command below to deploy Velo Protocol smart contracts to your local network

$ yarn run reset
  1. Now you can interact with the smart contract via truffle console
  2. Modify the migration script in ./migrations to control the how the smart contract should be setup.

Script usage

Deployment

1. Deploy locally, suit when developing on local machine
$ yarn run reset
2. Deploy to dev environment (required variables from .env configured properly, Env File section)
$ yarn run reset:dev

Running test

1. Test a single file, suit when focusing on a single file
$ yarn run test test/path/to/file.js
or
$ yarn run test test/path/to/file.sol
2. Test only js files
$ yarn run test:js
3. Test only sol files
$ yarn run test:sol
4. Test all files
$ yarn run test:all
5. Test all files and generate a coverage report
$ yarn run test:cov

Utils

Create Smart Contract .bin and .abi

After smart contract compilation, it yields ABI in .json format. Golang's abigen tool requires ABI in .bin and .abi to generate Go smart contract function. (see more in Go abigen section)

# compile your smart contract before proceed (yarn run reset)
$ yarn run abi:extract

Env File

Please copy .env.example and rename it to .env, config its value properly

DEV_SCC_HOST - the rpc url to the Ethereum based chain
DEV_SCC_PK - the private key of the smart contract deployer account (the account must own some ETH balance)
USD_VELO_PK, THB_VELO_PK, SGD_VELO_PK - the private key of the VOracle Module deployer account of each currency pair, this
key can be the same as DEV_SCC_PK for testing purpose