# new StakingContract(options)
Staking Contract Object
Parameters:
Name | Type | Description |
---|---|---|
options |
StakingContract~Options
|
Methods
# async __assert()
Contract is not deployed, first deploy it and provide a contract address
Error
# approveERC20Transfer() → {Promise.<TransactionObject>}
Approve ERC20 Allowance for Transfer for Subscribe Product
Promise.<TransactionObject>
# async availableTokens() → {Promise.<number>}
Get All Tokens Available for the Subscription Amount
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
|
Promise.<TransactionObject>
# deploy(options) → {Promise.<*>}
Deploy the Staking Contract
Parameters:
Name | Type | Description |
---|---|---|
options |
IContract~TxOptions
|
Promise.<*>
# depositAPRTokensByAdmin(params, amount)
Transfer Tokens by the Admin to ensure APR Amount
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
amount |
number
|
|
amount |
Promise.<number>
|
# async futureLockedTokens() → {Promise.<number>}
Get All Tokens Locked for the APR
Promise.<number>
# getAllSubscriptions() → {Promise.<Array.<Subscription>>}
Get All Subscriptions done
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 |
Promise.<number>
# getERC20Contract()
ERC20Contract|undefined
# getERC721Contract()
ERC721Collectibles|undefined
# getProduct(params) → {Promise.<StakingContract~Product>}
Get product
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
product_id |
number
|
Promise.<StakingContract~Product>
# getProducts() → {Promise.<Array.<number>>}
Get All Available Products Ids
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
|
Promise.<StakingContract~ProductSubscription>
# getSubscriptionsByAddress(params) → {Promise.<Array.<number>>}
Get Subscriptions by Address
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
address |
Address
|
subscriptions_ids
Promise.<Array.<number>>
# getTokenAmount(params) → {Promise.<number>}
Get Token Amount of ERC20 Address
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
address |
Address
|
Promise.<number>
# getTotalNeededTokensForAPRbyAdmin() → {Promise.<number>}
Get Total Amount of tokens needed to be deposited by Admin to ensure APR for all available Products
Amount
Promise.<number>
# async heldTokens() → {Promise.<number>}
Get All Tokens Held in Stake at that specific moment
Promise.<number>
# subscribeProduct(params) → {Promise.<boolean>}
Subscribe to a product Staking
Parameters:
Name | Type | Description |
---|---|---|
params |
Object
|
|
product_id |
number
|
|
amount |
number
|
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
|
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> |
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
|
Object
# ProductSubscription
Properties:
Name | Type | Description |
---|---|---|
amount |
number
|
|
APR |
number
|
|
withdrawAmount |
number
|
|
productId |
number
|
|
_id |
number
|
|
subscriberAddress |
Address
|
|
startDate |
Date
|
|
endDate |
Date
|
|
finalized |
boolean
|