Korean version: CONFIGURATION-ko.md
vvisp-config.js
is a file to set environment variables.
If there is no config file in root directory, some functions of vvisp don't work.
You can use your custom config file described as below by adding option like --configFile custom-config.js
.
You can define those properties:
-
network
: The information of network you want to connect to. You can choose one of the networks below. Default isdevelopment
. -
networks
: The detail information of networks. -platform
: The platform you want to connect with. (vvisp is supporting ethereum and klaytn) Default isethereum
.
-url
: The URL you want to connect with. Thehost
andport
below are ignored when the corresponding item is present.
-host
: The host name required to access the custom blockchain. -port
: The port number required to access the custom blockchain.
-websockets
: To connecthost
andport
to websocket, set this item totrue
.
-network_id
: The id of the network.
-gasLimit
: The gas limit to pay for transactions. Default is6721975
.
-gasPrice
: The gas price to pay for transactions. Default is10000000000
(10Gwei)` and unit is wei. In Klaytn, the gasPrice is fixed at 25ston(25000000000) and no other values are allowed. -
compilers
: The detail information of compilers.
-version
: The version of solc compiler version you want to use and it needs network communication. You can keep it empty to use solc0.5.0
.
-settings
: The settings of the compiler.
-optimizer.enabled
: If you don't want to optimize compile, set thisfalse
.
-optimizer.run
: The number of times you intend to run the code for the optimization. Default is200
.
-evmVersion
: The version of EVM to use. Default version isbyzantium
. -
from
: The detail information of account to create transactions. This can be string type private key or an object about mnemonic. Please see to the example below.
-mnemonic
: The mnemonic words of an account to make transaction.
-index
: The index of private key generated fromfrom.mnemonic
. Default is 0.
module.exports = {
network: 'development',
networks: {
development: {
platform: 'ethereum',
host: 'localhost',
port: 8545,
network_id: '*'
},
ropsten: {
url: "https://ropsten.infura.io/your_infura_api_key",
gasLimit: 123123,
gasPrice: 10000000000
}
},
compilers: {
solc: {
version: '0.5.3',
settings: {
optimizer: {
enabled: false,
runs: 200
},
evmVersion: 'byzantium'
}
}
},
from: { // or from: '0x9741fa712a6912b862c9043f8752ffae513cb01895985998c61620da5aaf2d2d'
mnemonic:
'piano garage flag neglect spare title drill basic strong aware enforce fury',
index: 0
}
};
vvisp-config.js
can be compatible with truffle-config.js
.
If you want to use generated truffle-config.js
, use as below:
module.exports = {
...require('./truffle-config.js'),
from: '0x9741fa712a6912b862c9043f8752ffae513cb01895985998c61620da5aaf2d2d'
}
You can change some of the environment variables mentioned above by using option when you run command.
`-s, --silent` // Do not print any logs.
--configFile <fileName> // Read and use your custom configuration file.
-n, --network <network> // Change the network.
-p, --platform <platform> // Change the platform.
--gasLimit <gasLimit> // Change the gasLimit.
--gasPrice <gasPrice> // Change the gasPrice.
--from <privateKey> // Change the privateKey to use.
service.vvisp.json
is a configuration file that defines a service, a bundle of smart contracts that must be managed with the same versioning scheme.
Normally, make file like below:
{
"serviceName": "Haechi", (1)
"variables" : { (2)
"varName": "constant"
},
"contracts": { (3)
"ContractKeyName1": { (4)
"path": "./contracts/Contract1.sol", (5)
"name": "Contract1" (6)
},
"ContractKeyName2": {
"path": "./contracts/Contract2.sol",
"name": "Contract2",
"constructorArguments": [ (7)
"${contracts.ContractKeyName1.address}", (8)
"${variables.varName}" (9)
],
"initialize": { (10)
"functionName": "initialize", (11)
"arguments": [ (12)
"argument1",
"argument2"
]
}
}
}
}
-
Define the name of service.
-
Set some constant variables in
service.vvisp.json
. Define a constant variable as a key-value pair. -
Define the information of contracts as the json format.
-
Define the name of the contract.
-
Set the path to the source code of this contract file.
-
Set the name of the contract you want to deploy. Default name is the name of the file.
-
If the contract has constructor arguments, write them as an array. If it does not exist, it can be left as an empty array.
-
You can refer to the address of the contract that is being deployed or deployed. Please note cyclic dependency
-
The value specified by
${variables.varName}
is replaced withconstant
by 3). -
Define the information of initializing this contract.
vvisp
calls the function after deployment. If you do not have to initialize, you can omit this. -
Write the name of the method responsible for the initialization function.
-
Write the arguments to initialize as an array. If you do not have to the arguments to initialize, you can omit this.