Deployer

Deployer

Deployer class. Handles all functionality with using web3 and compiled material to deploy!

Constructor

new Deployer(_web3, _compiledopt, _accountsopt, _logSettingopt, options)

Source:

Instantiate a Deployer object.

NOTE: This is not inteded to be called by the user; if you are looking to create a Deployer from web3, please use "static async build" instead!

Parameters:
Name Type Attributes Default Description
_web3 web3_instance

Initizalized web3 instance, with provider set

_compiled object <optional>
null

solc compilation output

_accounts Array.<string> <optional>
null

Array of accounts

_logSetting Logger.state.ENUM <optional>
Logger.state.NORMAL

Logger state for deployer to use when running methods.

options object

User options

Methods

(async, static) build(_web3, _compiledopt, _logSettingopt, options) → {Deployer}

Source:

Construct a Deployer object. The intended point of entry.

Parameters:
Name Type Attributes Default Description
_web3 web3_instance

Initizalized web3 instance, with provider set

_compiled JSON <optional>
null

solc compilation output. Required for using async deploy() function!

_logSetting Logger.state.ENUM <optional>
Logger.state.NORMAL

Logger state f or deployer to use when running methods.

options object

User options

Returns:

deployer - a new Deployer object instantiated using the provided parameters.

Type
Deployer

(async) deploy(name, argsopt, senderopt, compiledopt) → {web3.eth.Contract}

Source:

Deploy a contract by name, by parsing the object's (if not provided) compiled material. Returns the contract deployed as a web3.eth.Contract object (as provided by web3).

Parameters:
Name Type Attributes Default Description
name string

Name of the contract (e.g. Calculator.sol, ERC20.sol)

args array <optional>
[]

Constructor arguments for the contract

sender object <optional>
{ from: this.accounts[0] }

The send object to be passed along in deployment. By default, it is passed an object declaring the 1st account as the sender.

compiled JSON <optional>
this.compiled

solc compilation output.

Returns:
  • Contract web3 object of the deployed contract.
Type
web3.eth.Contract

(async) deployContract(contract, args, sendOptions) → {web3.eth.Contract}

Source:

Deploy a contract object [defined internally; see return val of DeployUtil.extractContract].

Parameters:
Name Type Description
contract object

Contract object [constructed internally, NOT web3]

args array

Constructor arguments for the contract

sendOptions object

The send object to be passed along in deployment.

Returns:
  • Contract web3 object of the deployed contract.
Type
web3.eth.Contract