Class

IContract

IContract(options)

Constructor

# new IContract(options)

Contract Object Interface

Parameters:
Name Type Description
options IContract~Options

View Source models/IContract.js, line 25

Methods

# __assert()

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

View Source models/IContract.js, line 161

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

Error

# __deploy(args, options) → {Promise.<(*|undefined)>}

Deploy current contract

Parameters:
Name Type Description
args *
options IContract~TxOptions

View Source models/IContract.js, line 145

Promise.<(*|undefined)>

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

Initialize by awaiting IContract.__assert

View Source models/IContract.js, line 65

if no IContract.getAddress, Please add a Contract Address

Error
Promise.<void>

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

View Source models/IContract.js, line 79

Promise.<*>

# _loadDataFromWeb3Connection()

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

View Source models/IContract.js, line 356

# 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 296

Promise.<(*|undefined)>

# deploy(options) → {Promise.<(*|undefined)>}

Deploy IContract.params.contract and call IContract.__assert

Parameters:
Name Type Description
options IContract~TxOptions

View Source models/IContract.js, line 195

Promise.<(*|undefined)>

# getAccounts() → {Promise.<Array>}

Get user wallets from current provider

View Source models/IContract.js, line 441

Promise.<Array>

# getAddress() → {string|null}

Returns the contract address

View Source models/IContract.js, line 308

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 316

Promise.<string>

# getContract()

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 208

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

Get ETH Network

View Source models/IContract.js, line 405

Network Name (Ex : Kovan)

Promise.<string>

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

Get contract current user/sender address

View Source models/IContract.js, line 423

Promise.<string> | string

# getUserCurrentAccount() → {Promise.<string>}

Get current/selected user account in use if available, or selected signer wallet/address otherwise.

View Source models/IContract.js, line 415

Account/Wallet in use

Promise.<string>

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

Get user ETH Balance of Address connected via login()

View Source models/IContract.js, line 432

User ETH Balance

Promise.<string>

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

Get the paused state of IContract.params.contract

View Source models/IContract.js, line 237

Promise.<boolean>

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

Login with Metamask/Web3 Wallet - substitutes start()

View Source models/IContract.js, line 392

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 327

Only admin can perform this operation

Error

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

Get Owner of IContract.params.contract

View Source models/IContract.js, line 229

Promise.<string>

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

(Admins only) Pauses the Contract

View Source models/IContract.js, line 245

Promise.<(*|undefined)>

# 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 269

# 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 283

Promise.<(*|undefined)>

# 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 218

Promise.<(*|undefined)>

# start()

Start the Web3Connection

View Source models/IContract.js, line 380

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

(Admins only) Unpause Contract

View Source models/IContract.js, line 256

Promise.<(*|undefined)>

# updateParams(params)

Updates this contract's params.

Parameters:
Name Type Description
params Object

View Source models/IContract.js, line 178

# async whenNotPaused()

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

View Source models/IContract.js, line 343

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>

View Source models/IContract.js, line 4

Object

# TxOptions

Properties:
Name Type Description
call boolean
value *
callback function
from string
gasAmount number
gasFactor number
gasPrice number

View Source models/IContract.js, line 14