1. Install vvisp
$ npm install -g @haechi-labs/vvisp
#or if you use yarn
$ yarn global add @haechi-labs/vvisp
Use version >= v2.1.0
2. Initialize your directory
$ vvisp init my-project --klaytn
$ cd my-project
$ npm install #or yarn install
3. Make your Contracts at contracts/
Now, you can use gen-script
, compile
and flatten
commands.
4. Set vvisp-config.js
file
Please set environment variables in vvisp-config.js
file.
Example
const MNEMONIC = 'YOUR_MNEMONIC';
module.exports = {
networks: {
development: {
platform: 'klaytn',
url: 'URL_TO_KLAYTN_NODE',
gasLimit: 10000000, // increase if you need
}
},
compilers: {
solc: {
version: '0.4.24',
settings: {
optimizer: {
enabled: true,
runs: 200
},
evmVersion: 'byzantium'
}
}
},
from: { // or from: 'YOUR_PRIVATE_KEY'
mnemonic: MNEMONIC,
index: 0
},
};
See more information at here for more information about vvisp-config.js
.
Now you can use deploy-contract
command.
5. Set service.vvisp.json
file
Please set information about your DApp service in service.vvisp.json
.
Example
{
"serviceName": "Haechi",
"variables" : {
"exampleVarName": 123
},
"contracts": {
"ContractKeyName1": {
"path": "./contracts/Contract1.sol",
"name": "Contract1",
"constructorArguments": [
"${contracts.ContractKeyName1.address}",
"${variables.exampleVarName}"
],
"initialize": {
"functionName": "initialize",
"arguments": ["argument1", "argument2"]
}
},
"ContractKeyName2": {
"path": "./contracts/Contract2.sol",
"name": "Contract2",
"initialize": {
"functionName": "initialize",
"arguments": ["argument1", "argument2"]
}
}
}
}
See more information at here for more information about service.vvisp.json
.
Now you can use deploy-service
command.
- Write
service.vvisp.json
file. - Make
from
variable invvisp-config.js
. See more details at here. - Run
vvisp deploy-service
at root directory. It will act like this demo. - Wait for deploying the sample app.
Then,
state.vvisp.json
will be generated. This file is necessary to upgrade your service
Add contract property at service.vvisp.json#contracts
like:
"contracts": {
...
"NewContract": {
"path": "./contracts/NewContract.sol",
"name": "NewContract"
}
}
Then, run vvisp deploy-service
.
It will act like this demo.
See more details about
vvisp deploy-service
at here
If the service is already deployed and has state.vvisp.json
(necessary), you can operate your contracts with vvisp console
.
First, make apis of contracts which are written in state.vvisp.json
.
$ vvisp gen-script
Then run vvisp console
and operate functions of your contracts.
See more details about
vvisp console
at here
- Create your own contracts in
contracts/
directory.
- We support use truffle framework.
- Create test files in
test/
directory. - Run
npm run test
to test all test files intest/
directory ornpm run test <fileName>
to test specific file.
Please see here for details.
- General Contact: hello@haechi.io
- Medium