Class

IContract

IContract(options)

Constructor

# new IContract(options)

Contract Object Interface

Parameters:
Name Type Description
options IContract~Options

View Source models/IContract.js, line 15

Methods

# __assert()

Asserts and uses IContract.params.contract with IContract.params.abi

View Source models/IContract.js, line 170

Contract is not deployed, first deploy it and provide a contract address

Error

# __deploy(params, callback) → {Promise.<(*|undefined)>}

Deploy current contract

Parameters:
Name Type Description
params *
callback function

View Source models/IContract.js, line 156

Promise.<(*|undefined)>

# __init__() → {Promise.<void>}

Initialize by awaiting IContract.__assert

View Source models/IContract.js, line 60

if no IContract.getAddress, Please add a Contract Address

Error
Promise.<void>

# __metamaskCall() → {Promise.<*>}

View Source models/IContract.js, line 88

Promise.<*>

# __sendTx() → {Promise.<*>}

View Source models/IContract.js, line 116

Promise.<*>

# _loadDataFromWeb3Connection()

Load data from Web3Connection object, Called at start when testing or at login on MAINNET

View Source models/IContract.js, line 344

# async changeTokenAddress(params) → {Promise.<(*|undefined)>}

Change token address of IContract.params.contract

Parameters:
Name Type Description
params Object
newTokenAddress Address

View Source models/IContract.js, line 284

Promise.<(*|undefined)>

# deploy(params, callback) → {Promise.<(*|undefined)>}

Deploy IContract.params.contract and call IContract.__assert

Parameters:
Name Type Description
params Object
callback function

View Source models/IContract.js, line 187

Promise.<(*|undefined)>

# getAddress() → {string|null}

Returns the contract address

View Source models/IContract.js, line 296

Contract address

string | null

# async getBalance() → {Promise.<string>}

Get the Ether balance for the current IContract#getAddress using fromWei util of IContract#web3

View Source models/IContract.js, line 304

Promise.<string>

# async getETHNetwork() → {Promise.<string>}

Get ETH Network

View Source models/IContract.js, line 389

Network Name (Ex : Kovan)

Promise.<string>

# async getUserAddress() → {Promise.<string>|string}

Get contract current user/sender address

View Source models/IContract.js, line 397

Promise.<string> | string

# async getUserETHBalance() → {Promise.<string>}

Get user ETH Balance of Address connected via login()

View Source models/IContract.js, line 406

User ETH Balance

Promise.<string>

# getWeb3Contract()

Get Web3 Contract to interact directly with the web3 library functions like events (https://web3js.readthedocs.io/en/v1.2.11/web3-eth-contract.html?highlight=events#contract-events)

View Source models/IContract.js, line 200

# async isPaused() → {Promise.<boolean>}

Get the paused state of IContract.params.contract

View Source models/IContract.js, line 228

Promise.<boolean>

# async login() → {Promise.<Boolean>}

Login with Metamask/Web3 Wallet - substitutes start()

View Source models/IContract.js, line 378

True is login was successful

Promise.<Boolean>

# async onlyOwner()

Verify that current user/sender is admin, throws an error otherwise

View Source models/IContract.js, line 315

Only admin can perform this operation

Error

# async owner() → {Promise.<string>}

Get Owner of IContract.params.contract

View Source models/IContract.js, line 220

Promise.<string>

# async pauseContract() → {Promise.<(*|undefined)>}

(Admins only) Pauses the Contract

View Source models/IContract.js, line 236

Promise.<(*|undefined)>

# async removeOtherERC20Tokens(params)

Remove Tokens from other ERC20 Address (in case of accident)

Parameters:
Name Type Description
params Object
tokenAddress Address
toAddress Address

View Source models/IContract.js, line 258

# async safeGuardAllTokens(params) → {Promise.<(*|undefined)>}

(Admins only) Safeguards all tokens from IContract.params.contract

Parameters:
Name Type Description
params Object
toAddress Address

View Source models/IContract.js, line 272

Promise.<(*|undefined)>

# async setNewOwner(params) → {Promise.<(*|undefined)>}

Set new owner of IContract.params.contract

Parameters:
Name Type Description
params Object
address Address

View Source models/IContract.js, line 210

Promise.<(*|undefined)>

# async start()

Start the Web3Connection

View Source models/IContract.js, line 368

# async unpauseContract() → {Promise.<(*|undefined)>}

(Admins only) Unpause Contract

View Source models/IContract.js, line 246

Promise.<(*|undefined)>

# async whenNotPaused()

Verify that contract is not paused before sending a transaction, throws an error otherwise

View Source models/IContract.js, line 331

Contract is paused

Error

Type Definitions

Object

# Options

Properties:
Name Type Attributes Default Description
test boolean
localtest boolean

ganache local blockchain

abi ABI
tokenAddress string
web3Connection Web3Connection <optional>
Web3Connection

created from params: 'test', 'localtest' and optional 'web3Connection' string and 'privateKey'

contractAddress string <optional>
useLastBlockGasPriceWhenMetaSend number <optional>

View Source models/IContract.js, line 4