seele-contract-core
v1.0.6
Published
This command line tool greatly simplifies the compiling and deploying process of multiple seele solidity contracts.
Downloads
11
Readme
Description
This command line tool greatly simplifies the compiling and deploying process of multiple seele solidity contracts.
Installation
# as command line tool
npm i -g seele-contract-core
# as module
npm i seele-contract-core
Usage
# initiate contract
scc init -n mycontract
# creates the following tree
# .
# ├── abi
# ├── byt.json
# ├── conf.json
# ├── deploy.json
# └── src
#
#
# 2 directories, 3 files
# copy your solidity source code files to ./src
# toggle configurations in conf.json
# only compile
scc make -c -n mycontract
# only deploy
scc make -d -n mycontract
# compile and deploy
scc make -cd -n mycontract
Or in code
const path = require('path')
const scc = require('seele-contract-core')
async function sccexample(){
const root = await process.cwd()
const dirname = 'yourContract'
const project = '.contract'
scc.init(root, dirname, project)
const dir = path.join(root, dirname, project)
const contract = scc.ContractBase(dir)
// contract.compile()
// contract.deploy()
// compile and deploy
new Promise((resolve, reject)=>{
resolve('');
})
.then((d)=>{
return contract.compile();
})
.then((d)=>{
return contract.deploy();
})
.catch((e)=>{
console.log(e);
});
}
API
In your conf.json
- compiler
- version: currently only v0.4.24 is made available
- shard: seele currently has four shards, the network used will be determined through the shard of
transactions.privateKey
andtransactions.fromAddress
pair. - transactions
- limit: gas limit of each transaction.
- depth: wait for how many blocks after transaction packaged.
- privateKey: private key used for signing transactions.
- fromAddress: address of signature private key.
- addressBook:
- To skip certain contract deployment. Ex: if I've already deployed
"SafeMath.sol"
at"0xce8b79448f41224413b6e13f5ae624b901070022"
Instead of deploying the contract with another transaction, the contract address will be reused in the next iteration of deployment."addressBook": { "SafeMath.sol": "0xce8b79448f41224413b6e13f5ae624b901070022", },
- To skip certain contract deployment. Ex: if I've already deployed
- constructors:
- If a contract happen to have a constructor to be a payable contract, the structure to use would be the following
"myContract.sol": [ [ "address[]", "uint256" ], //abi [ [ "0x627306090abab3a6e1400e9345bc60c78a8bef57", "0x4b0897b0513fdc7c541b6d9d7e929c4e5364d2db" ], "0x416e6e6965", ], //value 1000 //payable amount, 1000 fan ]