Class

StakingContract

StakingContract(options)

Constructor

# new StakingContract(options)

Staking Contract Object

Parameters:
Name Type Description
options StakingContract~Options

View Source models/Staking/StakingContract.js, line 17

Methods

# async __assert()

View Source models/Staking/StakingContract.js, line 437

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

Error

# approveERC20Transfer() → {Promise.<TransactionObject>}

Approve ERC20 Allowance for Transfer for Subscribe Product

View Source models/Staking/StakingContract.js, line 243

Promise.<TransactionObject>

# async availableTokens() → {Promise.<number>}

Get All Tokens Available for the Subscription Amount

View Source models/Staking/StakingContract.js, line 77

Promise.<number>

# createProduct(params) → {Promise.<TransactionObject>}

Creates a product

Parameters:
Name Type Description
params Object
startDate Date
endDate Date
totalMaxAmount Integer
individualMinimumAmount Integer
individualMaxAmount Integer
APR Integer
lockedUntilFinalization Boolean

View Source models/Staking/StakingContract.js, line 138

Promise.<TransactionObject>

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

Deploy the Staking Contract

Parameters:
Name Type Description
options IContract~TxOptions

View Source models/Staking/StakingContract.js, line 465

Promise.<*>

# depositAPRTokensByAdmin(params, amount)

Transfer Tokens by the Admin to ensure APR Amount

Parameters:
Name Type Description
params Object
amount number
amount Promise.<number>

View Source models/Staking/StakingContract.js, line 397

# erc20() → {Promise.<Address>}

Get ERC20 Address of the Contract

View Source models/Staking/StakingContract.js, line 45

Promise.<Address>

# async futureLockedTokens() → {Promise.<number>}

Get All Tokens Locked for the APR

View Source models/Staking/StakingContract.js, line 65

Promise.<number>

# getAllSubscriptions() → {Promise.<Array.<Subscription>>}

Get All Subscriptions done

View Source models/Staking/StakingContract.js, line 369

subscriptions

Promise.<Array.<Subscription>>

# getAPRAmount(params) → {Promise.<number>}

Get APR Amount based on amount of timestamp, amount and APR of that product

Parameters:
Name Type Description
params Object
APR Integer
startDate Date
endDate Date
amount Integer

Token Amount

View Source models/Staking/StakingContract.js, line 107

Promise.<number>

# getERC20Contract()

View Source models/Staking/StakingContract.js, line 487

ERC20Contract|undefined

# getERC721Contract()

View Source models/Staking/StakingContract.js, line 493

ERC721Collectibles|undefined

# getProduct(params) → {Promise.<StakingContract~Product>}

Get product

Parameters:
Name Type Description
params Object
product_id number

View Source models/Staking/StakingContract.js, line 204

Promise.<StakingContract~Product>

# getProducts() → {Promise.<Array.<number>>}

Get All Available Products Ids

View Source models/Staking/StakingContract.js, line 176

ids

Promise.<Array.<number>>

# getSubscription(params) → {Promise.<StakingContract~ProductSubscription>}

Get Subscription from product

Parameters:
Name Type Description
params Object
subscription_id number
product_id number

View Source models/Staking/StakingContract.js, line 309

# getSubscriptionsByAddress(params) → {Promise.<Array.<number>>}

Get Subscriptions by Address

Parameters:
Name Type Description
params Object
address Address

View Source models/Staking/StakingContract.js, line 356

subscriptions_ids

Promise.<Array.<number>>

# getTokenAmount(params) → {Promise.<number>}

Get Token Amount of ERC20 Address

Parameters:
Name Type Description
params Object
address Address

View Source models/Staking/StakingContract.js, line 59

Promise.<number>

# getTotalNeededTokensForAPRbyAdmin() → {Promise.<number>}

Get Total Amount of tokens needed to be deposited by Admin to ensure APR for all available Products

View Source models/Staking/StakingContract.js, line 409

Amount

Promise.<number>

# async heldTokens() → {Promise.<number>}

Get All Tokens Held in Stake at that specific moment

View Source models/Staking/StakingContract.js, line 89

Promise.<number>

# subscribeProduct(params) → {Promise.<boolean>}

Subscribe to a product Staking

Parameters:
Name Type Description
params Object
product_id number
amount number

View Source models/Staking/StakingContract.js, line 263

Has to Approve Token Transfer First, use the 'approve' Call

Error

Success

Promise.<boolean>

# withdrawSubscription(params) → {Promise.<TransactionObject>}

Withdraw Subscription to a product Staking

Parameters:
Name Type Description
params Object
subscription_id number
product_id number

View Source models/Staking/StakingContract.js, line 343

Promise.<TransactionObject>

Type Definitions

Object

# Options

Properties:
Name Type Attributes Default Description
tokenAddress string
test Boolean
localtest Boolean

ganache local blockchain

web3Connection Web3Connection <optional>
Web3Connection

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

contractAddress string <optional>

View Source models/Staking/StakingContract.js, line 8

Object

# Product

Properties:
Name Type Description
createdAt Date
startDate Date
endDate Date
lockedUntilFinalization boolean
APR number
currentAmount number
individualMinimumAmount number
individualMaxAmount number
totalMaxAmount number
subscriptionIds Array.<number>
subscribers Array.<Address>
_id number

View Source models/Staking/StakingContract.js, line 181

Object

# ProductSubscription

Properties:
Name Type Description
amount number
APR number
withdrawAmount number
productId number
_id number
subscriberAddress Address
startDate Date
endDate Date
finalized boolean

View Source models/Staking/StakingContract.js, line 288