# new IContract(options)
Contract Object Interface
Parameters:
Name | Type | Description |
---|---|---|
options |
IContract~Options
|
Methods
# __assert()
Asserts and uses IContract.params.contract with IContract.params.abi
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
|
Promise.<(*|undefined)>
# __init__() → {Promise.<void>}
Initialize by awaiting IContract.__assert
if no IContract.getAddress, Please add a Contract Address
Error
Promise.<void>
# _loadDataFromWeb3Connection()
Load data from Web3Connection object, Called at start when testing or at login on MAINNET
# changeTokenAddress(params) → {Promise.<(*|undefined)>}
Change token address of IContract.params.contract
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
newTokenAddress |
Address
|
Promise.<(*|undefined)>
# deploy(options) → {Promise.<(*|undefined)>}
Deploy IContract.params.contract and call IContract.__assert
Parameters:
Name | Type | Description |
---|---|---|
options |
IContract~TxOptions
|
Promise.<(*|undefined)>
# async getBalance() → {Promise.<string>}
Get the Ether balance for the current IContract#getAddress using fromWei
util of IContract#web3
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)
# getUserAddress() → {Promise.<string>|string}
Get contract current user/sender address
Promise.<string>
|
string
# getUserCurrentAccount() → {Promise.<string>}
Get current/selected user account in use if available, or selected signer wallet/address otherwise.
Account/Wallet in use
Promise.<string>
# getUserETHBalance() → {Promise.<string>}
Get user ETH Balance of Address connected via login()
User ETH Balance
Promise.<string>
# isPaused() → {Promise.<boolean>}
Get the paused state of IContract.params.contract
Promise.<boolean>
# async login() → {Promise.<Boolean>}
Login with Metamask/Web3 Wallet - substitutes start()
True is login was successful
Promise.<Boolean>
# async onlyOwner()
Verify that current user/sender is admin, throws an error otherwise
Only admin can perform this operation
Error
# pauseContract() → {Promise.<(*|undefined)>}
(Admins only) Pauses the Contract
Promise.<(*|undefined)>
# removeOtherERC20Tokens(params)
Remove Tokens from other ERC20 Address (in case of accident)
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
tokenAddress |
Address
|
|
toAddress |
Address
|
# safeGuardAllTokens(params) → {Promise.<(*|undefined)>}
(Admins only) Safeguards all tokens from IContract.params.contract
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
toAddress |
Address
|
Promise.<(*|undefined)>
# setNewOwner(params) → {Promise.<(*|undefined)>}
Set new owner of IContract.params.contract
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
address |
Address
|
Promise.<(*|undefined)>
# unpauseContract() → {Promise.<(*|undefined)>}
(Admins only) Unpause Contract
Promise.<(*|undefined)>
# updateParams(params)
Updates this contract's params.
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
# async whenNotPaused()
Verify that contract is not paused before sending a transaction, throws an error otherwise
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> |
Object
# TxOptions
Properties:
Name | Type | Description |
---|---|---|
call |
boolean
|
|
value |
*
|
|
callback |
function
|
|
from |
string
|
|
gasAmount |
number
|
|
gasFactor |
number
|
|
gasPrice |
number
|