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 16

Methods

# async __assert()

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

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 239

Promise.<TransactionObject>

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

Get All Tokens Available for the Subscription Amount

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

Promise.<number>

# async 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 134

Promise.<TransactionObject>

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

Deploy the Staking Contract

Parameters:
Name Type Attributes Description
Object <optional>

params

params.callback function

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

Promise.<*>

# async 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 394

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

Get ERC20 Address of the Contract

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

Promise.<Address>

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

Get All Tokens Locked for the APR

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

Promise.<number>

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

Get All Subscriptions done

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

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 102

Promise.<number>

# getERC20Contract()

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

ERC20Contract|undefined

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

Get product

Parameters:
Name Type Description
params Object
product_id number

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

Promise.<StakingContract~Product>

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

Get All Available Products Ids

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

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 305

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

Get Subscriptions by Address

Parameters:
Name Type Description
params Object
address Address

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

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 54

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 406

Amount

Promise.<number>

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

Get All Tokens Held in Stake at that specific moment

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

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 259

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 340

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 7

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 177

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 284