Skip to content

Commit

Permalink
Merge pull request #193 from CMTA/add-cli-workflow
Browse files Browse the repository at this point in the history
Add cli workflow + nvm file for Node.JS
  • Loading branch information
rya-sge committed Jun 7, 2023
2 parents 380d63c + ff50356 commit b069da0
Show file tree
Hide file tree
Showing 6 changed files with 3,815 additions and 7,060 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Truffle CI

on:
push:
branches: [dev, master, main]
pull_request:
branches: [dev, master, main]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup NodeJS 16
uses: actions/setup-node@v3
with:
node-version: 16.17.0

- name: Show NodeJS version
run: npm --version

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Install Project Dependencies
run: npm install

- name: Run Truffle Test
run: npx truffle test
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16.17.0
10 changes: 9 additions & 1 deletion doc/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The toolchain includes the following components, where the versions
are the latest ones that we tested:

- npm 8.19.2
- Truffle 5.8.3
- Truffle 5.9.3
- Solidity 0.8.17 (via solc-js)
- Node 16.17.0
- Web3.js 1.9.0
Expand All @@ -18,12 +18,20 @@ Although present in the dependencies, Hardhat is not included in the toolchain s

## Installation

- Clone the repository

Clone the git repository, with the option `--recurse-submodules` to fetch the submodules:

`git clone git@github.com:CMTA/CMTAT.git --recurse-submodules`

- Node.js version

We recommend to install the [Node Version Manager `nvm`](https://github.com/nvm-sh/nvm) to manage multiple versions of Node.js on your machine. You can then, for example, install the version 16.17.0 of Node.js with the following command: `nvm install 16.17.0`

The file [.nvmrc](../.nvmrc) at the root of the project set the Node.js version. `nvm use`will automatically use this version if no version is supplied on the command line.

- node modules

To install the node modules required by CMTAT, run the following command at the root of the project:

`npm install`
Expand Down
30 changes: 30 additions & 0 deletions migrations/1_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require('dotenv').config()

const CMTAT_PROXY = artifacts.require("CMTAT_PROXY")
const { deployProxy } = require("@openzeppelin/truffle-upgrades")
const { Address } = require("ethereumjs-util")

module.exports = async function (deployer, _network, account) {
const admin = process.env.ADMIN_ADDRESS ? process.env.ADMIN_ADDRESS : account[0]
const flag = 0
const ZERO_ADDRESS = Address.zero().toString()
const proxyContract = await deployProxy(
CMTAT_PROXY,
[
admin,
"Test CMTA Token",
"TCMTAT",
"TCMTAT_ISIN",
"https://cmta.ch",
ZERO_ADDRESS,
"TCMTAT_info",
flag,
],
{
deployer,
constructorArgs: [ZERO_ADDRESS]
}
);
await CMTAT_PROXY.deployed()
console.log("Proxy deployed at: ", proxyContract.address)
}
Loading

0 comments on commit b069da0

Please sign in to comment.