A JavaScript library to execute EOSDT contracts methods.
Install the module using NPM:
$ npm install @eosdt/eosdt-js
Use service module Connector
to initiate one of functional modules. Connector
uses EOS node address and an array of private keys. Transactions would be signed with given keys and sent to blockchain through given node.
const { EosdtConnector } = require("@eosdt/eosdt-js")
const nodeAddress = "http://node-address.example.com:80"
const connector = new EosdtConnector(nodeAddress, ["private-key-1", "private-key-2"])
const eosPositions = connector.getPositions()
const eosLiquidator = connector.getLiquidator()
const pbtcPositions = connector.getBasicPositions("PBTC")
const pbtcLiquidator = connector.getLiquidator("PBTC")
const pethPositions = connector.getBasicPositions("PETH")
const pethLiquidator = connector.getLiquidator("PETH")
const governance = connector.getGovernance()
const balances = connector.getBalances()
const savings = connector.getSavingsRate()
Fore more code examples, checkout examples
folder.
This object is used as optional argument in each method that sends actions to blockchain. Use it to manage transaction and action parameters.
This object has following properties:
Property | Type | Description |
---|---|---|
[permission] | string |
Name of permission, |
[blocksBehind] | number |
Default value is |
[expireSeconds] | number |
Default value is |
- ArmContract
Module to manage EOSDT arming operations
- BalanceGetter
Module to get account's balances of EOSDT, EOS, PBTC, PETH and NUT
- BasicPositionsContract
Module to manage EOSDT positions with non-EOS collateral
- BpManager
Class for EOSDT Governance actions, related to block producers management
- EosdtConnector
A connector object, used to build classes to work with EOSDT ecosystem contracts
- GovernanceContract
A class to work with EOSDT Governance contract (
eosdtgovernc
)- LiquidatorContract
A class to work with EOSDT Liquidator contract. Creates EOS liquidator by default
- PositionsContract
Module to manage EOS-collateral positions (on contract
eosdtcntract
). It is inherited fromBasicPositionsContract
and includes all it's methods.- SavingsRateContract
A wrapper class to invoke actions of Equilibrium Savings Rate contract
- TokenSwapContract
A wrapper class to invoke actions of Equilibrium Token Swap contract
Module to manage EOSDT arming operations
Kind: global class
- ArmContract
- .armEos(accountName, amount, arm, [transactionParams]) ⇒
Promise
- .armExistingEosPosition(owner, positionId, arm, [transactionParams]) ⇒
Promise
- .dearmEosPosition(owner, positionId, debtTarget, [transactionParams]) ⇒
Promise
- .getSettings() ⇒
Promise.<object>
- .armEos(accountName, amount, arm, [transactionParams]) ⇒
Creates EOSDT position with given EOS, then sells received EOSDT to buy more EOS and add it to position. Contract would continue for 20 iterations or until given arm is reached
Kind: instance method of ArmContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
accountName | string |
name of account that sends EOS and receives position |
amount | number | string |
transferred amount of EOS |
arm | number |
arm value. With arm = 2.1 and 100 EOS user will receive position with 210 EOS |
[transactionParams] | object |
Gives EOS-EOSDT position to 'arm.eq' contract and it arms that position (see armEos
)
Kind: instance method of ArmContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
owner | string |
name of position maker account |
positionId | number |
|
arm | number |
arm value. With arm = 2.1 and 100 EOS user will receive position with 210 EOS |
[transactionParams] | object |
Reduces debt on position, selling it's collateral. Will stop, when position has LTV, equal to critical LTV + arm safety margin. Excess EOSDT would be returned to maker acc balance
Kind: instance method of ArmContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
owner | string |
name of maker account |
positionId | number |
|
debtTarget | number |
approximate desired debt amount |
[transactionParams] | object |
Kind: instance method of ArmContract
Returns: Promise.<object>
-
Positions contract settings
Module to get account's balances of EOSDT, EOS, PBTC, PETH and NUT
Kind: global class
- BalanceGetter
- new BalanceGetter(connector)
- .getEos(account) ⇒
Promise.<number>
- .getEosdt(account) ⇒
Promise.<number>
- .getNut(account) ⇒
Promise.<number>
- .getPbtc(account) ⇒
Promise.<number>
- .getPeth(account) ⇒
Promise.<number>
Creates instance of BalanceGetter
Param | Description |
---|---|
connector | EosdtConnector (see |
Kind: instance method of BalanceGetter
Returns: Promise.<number>
-
EOS balance of account
Param | Type | Description |
---|---|---|
account | string |
Account name |
Kind: instance method of BalanceGetter
Returns: Promise.<number>
-
EOSDT balance of account
Param | Type | Description |
---|---|---|
account | string |
Account name |
Kind: instance method of BalanceGetter
Returns: Promise.<number>
-
NUT balance of account
Param | Type | Description |
---|---|---|
account | string |
Account name |
Kind: instance method of BalanceGetter
Returns: Promise.<number>
-
PBTC balance of account
Param | Type | Description |
---|---|---|
account | string |
Account name |
Kind: instance method of BalanceGetter
Returns: Promise.<number>
-
PETH balance of account
Param | Type | Description |
---|---|---|
account | string |
Account name |
Module to manage EOSDT positions with non-EOS collateral
Kind: global class
- BasicPositionsContract
- new BasicPositionsContract(connector, tokenSymbol)
- .newPosition(accountName, collatAmount, eosdtAmount, [transactionParams]) ⇒
Promise
- .newEmptyPosition(maker, [transactionParams])
- .give(giverAccount, receiver, positionId, [transactionParams]) ⇒
Promise
- .addCollateral(senderName, amount, positionId, [transactionParams]) ⇒
Promise
- .deleteCollateral(senderName, amount, positionId, [transactionParams]) ⇒
Promise
- .generateDebt(senderName, amount, positionId, [transactionParams]) ⇒
Promise
- .burnbackDebt(senderName, amount, positionId, [transactionParams]) ⇒
Promise
- .addCollatAndDebt(senderName, addedCollatAmount, generatedDebtAmount, positionId, [transactionParams]) ⇒
Promise
- .pbtcDelCollatAndRedeem(senderName, amount, positionId, btcAddress, [transactionParams]) ⇒
Promise
- .marginCall(senderName, positionId, [transactionParams]) ⇒
Promise
- .del(creator, positionId, [transactionParams]) ⇒
Promise
- .paybackAndDelete(maker, debtAmount, positionId, [transactionParams]) ⇒
Promise
- .close(senderAccount, positionId, [transactionParams]) ⇒
Promise
- .getContractTokenBalance() ⇒
Promise.<number>
- .getRates() ⇒
Promise.<Array.<object>>
- .getRatesNew() ⇒
Promise.<Array.<object>>
- .getLtvRatiosTable() ⇒
Promise.<Array.<object>>
- .getPositionLtvRatio(id) ⇒
Promise.<(object|undefined)>
- .getPositionById(id) ⇒
Promise.<(object|undefined)>
- .getPositionByMaker(maker) ⇒
Promise.<(object|undefined)>
- .getAllUserPositions(maker) ⇒
Promise.<Array.<object>>
- .getAllPositions() ⇒
Promise.<Array.<object>>
- .getLatestUserPosition(accountName) ⇒
Promise.<(object|undefined)>
- .getParameters() ⇒
Promise.<object>
- .getSettings() ⇒
Promise.<object>
Creates an instance of BasicPositionsContract
Param | Type | Description |
---|---|---|
connector | EosdtConnector (see |
|
tokenSymbol | string |
"PBTC" or "PETH" |
basicPositionsContract.newPosition(accountName, collatAmount, eosdtAmount, [transactionParams]) ⇒ Promise
Creates new position, sending specified amount of collateral and issuing specified amount of EOSDT to creator.
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
accountName | string |
Creator's account name |
collatAmount | string | number |
Amount of collateral tokens to transfer to position |
eosdtAmount | string | number |
EOSDT amount to issue |
[transactionParams] | object |
Creates new position with 0 debt and collateral
Kind: instance method of BasicPositionsContract
Param | Type | Description |
---|---|---|
maker | string |
Account to create position for |
[transactionParams] | object |
Transfers position ownership to another account
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
giverAccount | string |
Account name |
receiver | string |
Account name |
positionId | number |
|
[transactionParams] | object |
Sends collateral to position to increase it's collateralization.
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
Account name |
amount | string | number |
Amount of added collateral |
positionId | number |
|
[transactionParams] | object |
basicPositionsContract.deleteCollateral(senderName, amount, positionId, [transactionParams]) ⇒ Promise
Returns collateral from position, LTV must remain above critical for this action to work
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
Account name |
amount | string | number |
|
positionId | number |
|
[transactionParams] | object |
Issues additional EOSDT if this does not bring position LTV below critical.
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
Account name |
amount | string | number |
Not more than 4 significant decimals |
positionId | number |
|
[transactionParams] | object |
Transfers EOSDT to position to burn debt. Excess debt would be refunded to user account
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
Account name |
amount | string | number |
Not more than 4 significant decimals |
positionId | number |
|
[transactionParams] | object |
basicPositionsContract.addCollatAndDebt(senderName, addedCollatAmount, generatedDebtAmount, positionId, [transactionParams]) ⇒ Promise
Transfers collateral tokens to position and generates EOSDT debt
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
Account name |
addedCollatAmount | string | number |
|
generatedDebtAmount | string | number |
|
positionId | number |
|
[transactionParams] | object |
basicPositionsContract.pbtcDelCollatAndRedeem(senderName, amount, positionId, btcAddress, [transactionParams]) ⇒ Promise
Withdraws specified amount of PBTC tokens from position and redeems that PBTCs
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
Account name |
amount | string | number |
|
positionId | number |
|
btcAddress | string |
|
[transactionParams] | object |
Called on a position with critical LTV to perform a margin call
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
Account name |
positionId | number |
|
[transactionParams] | object |
Deletes position that has 0 debt.
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
creator | string |
Account name |
positionId | number |
|
[transactionParams] | object |
basicPositionsContract.paybackAndDelete(maker, debtAmount, positionId, [transactionParams]) ⇒ Promise
Burns debt on position and deletes it. Debt must be = 0 to delete position. Excess debt would be refunded to user account
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
maker | string |
Account name |
debtAmount | string | number |
Must be > than position debt |
positionId | number |
|
[transactionParams] | object |
Used to close a position in an event of global shutdown.
Kind: instance method of BasicPositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderAccount | string |
Account name |
positionId | number |
|
[transactionParams] | object |
Kind: instance method of BasicPositionsContract
Returns: Promise.<number>
-
Contract's collateral asset balance.
Kind: instance method of BasicPositionsContract
Returns: Promise.<Array.<object>>
-
Table of current system token prices (contract 'pricefeed.eq' - table 'oraclerates'). These are valid rates, except fields 'backend_price' and 'backend_update' are missing
Kind: instance method of BasicPositionsContract
Returns: Promise.<Array.<object>>
-
Table of current system token prices (contract 'pricefeed.eq' - table 'newrates'). These are valid rates including all rates data
Kind: instance method of BasicPositionsContract
Returns: Promise.<Array.<object>>
-
Table of current LTV ratios for all positions.
Kind: instance method of BasicPositionsContract
Returns: Promise.<(object|undefined)>
-
Current LTV ratio for position by id
Param | Type | Description |
---|---|---|
id | number |
Position id |
Kind: instance method of BasicPositionsContract
Returns: Promise.<(object|undefined)>
-
A position object
Param | Type | Description |
---|---|---|
id | number |
Position id |
Kind: instance method of BasicPositionsContract
Returns: Promise.<(object|undefined)>
-
Position object - first position that belongs to maker account
Param | Type | Description |
---|---|---|
maker | string |
Account name |
Kind: instance method of BasicPositionsContract
Returns: Promise.<Array.<object>>
-
Array of all positions objects, created by the maker
Param | Type | Description |
---|---|---|
maker | string |
Account name |
Kind: instance method of BasicPositionsContract
Returns: Promise.<Array.<object>>
-
An array of all positions created on this contract
Kind: instance method of BasicPositionsContract
Returns: Promise.<(object|undefined)>
-
Position object - position of the account with maximum id value
Param | Type |
---|---|
accountName | string |
Kind: instance method of BasicPositionsContract
Returns: Promise.<object>
-
Positions contract parameters
Kind: instance method of BasicPositionsContract
Returns: Promise.<object>
-
Positions contract settings
Class for EOSDT Governance actions, related to block producers management
Kind: global class
- BpManager
- new BpManager(connector)
- .getAllBpPositions() ⇒
Promise.<Array.<object>>
- .getBpPosition() ⇒
Promise.<(object|undefined)>
- .registerBlockProducer(bpName, depositedAmount, [transactionParams]) ⇒
Promise
- .changeBlockProducerReward(bpName, rewardAmount, [transactionParams]) ⇒
Promise
- .unregisterBlockProducer(bpName, [transactionParams]) ⇒
Promise
- .depositEos(fromAccount, bpName, eosAmount, [transactionParams]) ⇒
Promise
Creates instance of BpManager
Param | Description |
---|---|
connector | EosdtConnector (see |
Kind: instance method of BpManager
Returns: Promise.<Array.<object>>
-
An array of objects, that contain information about registered block producers
Kind: instance method of BpManager
Returns: Promise.<(object|undefined)>
-
Object with information about a registered block producer
Registers a block producer in BP voting reward program via EOS transfer. Transferred EOS is added to BP reward balance
Kind: instance method of BpManager
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
bpName | string |
Account name |
depositedAmount | number |
EOS amount to transfer |
[transactionParams] | object |
Changes amount of EOS reward payed by block producer
Kind: instance method of BpManager
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
bpName | string |
Account name |
rewardAmount | number |
|
[transactionParams] | object |
Deactivates block producer
Kind: instance method of BpManager
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
bpName | string |
Account name |
[transactionParams] | object |
Deposit EOS into block producer Governance account to pay reward. Any account can deposit EOS for a block producer
Kind: instance method of BpManager
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
fromAccount | string |
Paying account name |
bpName | string |
|
eosAmount | number | string |
|
[transactionParams] | object |
A connector object, used to build classes to work with EOSDT ecosystem contracts
Kind: global class
A connector object, used to build classes to work with EOSDT ecosystem contracts
Param | Type | Description |
---|---|---|
nodeAddress | string |
URL of blockchain node, used to send transactions |
privateKeys | Array.<string> |
Array of private keys used to sign transactions |
Creates class to work with basic positions contract (non-EOS collateral)
Kind: instance method of EosdtConnector
Returns:
Instance of BasicPositionsContract
Param | Type | Description |
---|---|---|
collateralToken | string |
"PBTC" or "PETH" |
Creates a class to work with EOS-collateral positions contract (eosdtcntract
)
Kind: instance method of EosdtConnector
Creates a class to work with specified liquidator contract
Kind: instance method of EosdtConnector
Returns:
Instance of LiquidatorContract
Param | Type | Default | Description |
---|---|---|---|
[collateralToken] | string |
"EOS" |
"EOS", "PBTC" or "PETH" |
Creates a wrapper for Savings Rate contract
Kind: instance method of EosdtConnector
Returns:
Instance of SavingsRateContract
Creates a wrapper for 'arm.eq' contract
Kind: instance method of EosdtConnector
Returns:
Instance of ArmContract
Creates a wrapper for 'tokenswap.eq' contract
Kind: instance method of EosdtConnector
Returns:
Instance of TokenSwapContract
Instantiates GovernanceContract
- a wrapper to work with eosdtgovernc
Kind: instance method of EosdtConnector
Returns:
Instance of GovernanceContract
Instantiates a simple class to read blockchain balances
Kind: instance method of EosdtConnector
Returns:
Instance of BalanceGetter
A class to work with EOSDT Governance contract (eosdtgovernc
)
Kind: global class
- GovernanceContract
- new GovernanceContract(connector)
- .propose(proposal, senderName, [transactionParams]) ⇒
Promise
- .expire(proposalName, senderName, [transactionParams]) ⇒
Promise
- .applyChanges(proposalName, senderName, [transactionParams]) ⇒
Promise
- .cleanProposal(proposalName, deletedVotes, senderName, [transactionParams]) ⇒
Promise
- .stake(senderName, nutsAmount, [trxMemo], [transactionParams]) ⇒
Promise
- .unstake(nutAmount, voterName, [transactionParams]) ⇒
Promise
- .vote(proposalName, vote, voterName, voteJson, [transactionParams]) ⇒
Promise
- .unvote(proposalName, voterName, [transactionParams]) ⇒
Promise
- .voteForBlockProducers(voterName, producers, [transactionParams]) ⇒
Promise
- .stakeAndVoteForBlockProducers(voterName, nutAmount, producers, [transactionParams]) ⇒
Promise
- .getVoterInfo() ⇒
Promise.<(object|undefined)>
- .getVoterInfosTable() ⇒
Promise.<Array.<object>>
- .getVotes() ⇒
Promise.<Array.<object>>
- .getVotesForAccount() ⇒
Promise.<Array.<object>>
- .getProposals() ⇒
Promise.<Array.<object>>
- .getBpVotes() ⇒
Promise.<Array.<object>>
- .getProxyInfo() ⇒
Promise.<(object|undefined)>
- .getSettings() ⇒
Promise.<object>
- .getParameters() ⇒
Promise.<object>
Creates an instance of GovernanceContract
Param | Description |
---|---|
connector | EosdtConnector (see |
Creates a proposal
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
proposal | object |
|
proposal.proposer | string |
|
proposal.name | string |
|
proposal.title | string |
|
proposal.json | string |
|
proposal.expiresAt | Date |
|
proposal.type | number |
|
senderName | string |
|
[transactionParams] | object |
Expires an active proposal
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
proposalName | string |
|
senderName | string |
|
[transactionParams] | object |
Applies proposed changes. At least 51% of all issued NUT tokens must vote, at least 55% of votes must be for proposal
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
proposalName | string |
|
senderName | string |
|
[transactionParams] | object |
governanceContract.cleanProposal(proposalName, deletedVotes, senderName, [transactionParams]) ⇒ Promise
Removes specified amount of votes from an expired proposal. If 0 votes left, removes proposal
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
proposalName | string |
|
deletedVotes | number |
|
senderName | string |
|
[transactionParams] | object |
Sends NUT tokens to contract, staking them and allowing to vote for block producers and for proposals
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
|
nutsAmount | string | number |
|
[trxMemo] | string |
|
[transactionParams] | object |
Unstakes NUT tokens to user's balance
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
nutAmount | string | number |
|
voterName | string |
|
[transactionParams] | object |
Vote for or against a proposal
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
proposalName | string |
|
vote | number |
Vote |
voterName | string |
|
voteJson | string |
|
[transactionParams] | object |
Removes all user votes from a proposal
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
proposalName | string |
|
voterName | string |
|
[transactionParams] | object |
Votes with staked NUTs for block producers
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
voterName | string |
|
producers | Array.<string> |
|
[transactionParams] | object |
governanceContract.stakeAndVoteForBlockProducers(voterName, nutAmount, producers, [transactionParams]) ⇒ Promise
Stakes NUTs and votes for BPs in one transaction
Kind: instance method of GovernanceContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
voterName | string |
|
nutAmount | string | number |
|
producers | Array.<string> |
|
[transactionParams] | object |
Kind: instance method of GovernanceContract
Returns: Promise.<(object|undefined)>
-
Amount of NUTs staked by account in Governance contract and their unstake date
Kind: instance method of GovernanceContract
Returns: Promise.<Array.<object>>
-
Table of information on accounts that staked NUT
Kind: instance method of GovernanceContract
Returns: Promise.<Array.<object>>
-
An array with all Governance contract votes (up to 10000)
Kind: instance method of GovernanceContract
Returns: Promise.<Array.<object>>
-
All account votes
Kind: instance method of GovernanceContract
Returns: Promise.<Array.<object>>
-
An array with all Governance contract proposals (up to 10000)
Kind: instance method of GovernanceContract
Returns: Promise.<Array.<object>>
-
Array of objects, containing block producers names and amount of NUT votes for them
Kind: instance method of GovernanceContract
Returns: Promise.<(object|undefined)>
-
Voter info for eosdtbpproxy
Kind: instance method of GovernanceContract
Returns: Promise.<object>
-
Governance contract settings
Kind: instance method of GovernanceContract
Returns: Promise.<object>
-
Governance contract parameters
A class to work with EOSDT Liquidator contract. Creates EOS liquidator by default
Kind: global class
- LiquidatorContract
- new LiquidatorContract(connector)
- .marginCallAndBuyoutCollat(senderName, positionId, eosdtToTransfer, [trxMemo], [transactionParams]) ⇒
Promise
- .transferEosdt(senderName, eosdtAmount, [trxMemo], [transactionParams]) ⇒
Promise
- .transferNut(senderName, nutAmount, trxMemo, [transactionParams]) ⇒
Promise
- .getSurplusDebt() ⇒
Promise.<string>
- .getBadDebt() ⇒
Promise.<string>
- .getCollatBalance() ⇒
Promise.<string>
- .getNutCollatBalance() ⇒
Promise.<string>
- .getParameters() ⇒
Promise.<object>
- .getSettings() ⇒
Promise.<object>
Instantiates LiquidatorContract
Param | Description |
---|---|
connector | EosdtConnector (see |
liquidatorContract.marginCallAndBuyoutCollat(senderName, positionId, eosdtToTransfer, [trxMemo], [transactionParams]) ⇒ Promise
Performs margin call on a position and transfers specified amount of EOSDT to liquidator to buyout freed collateral
Kind: instance method of LiquidatorContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
|
positionId | number |
|
eosdtToTransfer | string | number |
|
[trxMemo] | string |
|
[transactionParams] | object |
Sends EOSDT to liquidator contract. Used to cancel bad debt and buyout liquidator collateral with discount
Kind: instance method of LiquidatorContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
|
eosdtAmount | string | number |
|
[trxMemo] | string |
|
[transactionParams] | object |
Sends NUT tokens to liquidator contract. Send token symbol in memo to buyout collateral
asset (liquidator parameter nut_collat_balance
). With memo "EOSDT" it is used to
buyout EOSDT (liquidator parameter surplus_debt
)
Kind: instance method of LiquidatorContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
|
nutAmount | string | number |
|
trxMemo | string |
|
[transactionParams] | object |
Kind: instance method of LiquidatorContract
Returns: Promise.<string>
-
Amount of system surplus debt
Kind: instance method of LiquidatorContract
Returns: Promise.<string>
-
Amount of system bad debt
Kind: instance method of LiquidatorContract
Returns: Promise.<string>
-
Amount of collateral on liquidator contract balance
Kind: instance method of LiquidatorContract
Returns: Promise.<string>
-
Amount of NUT collateral on liquidator
Kind: instance method of LiquidatorContract
Returns: Promise.<object>
-
Liquidator contract parameters object
Kind: instance method of LiquidatorContract
Returns: Promise.<object>
-
Liquidator contract settings object
Module to manage EOS-collateral positions (on contract eosdtcntract
). It is inherited from
BasicPositionsContract
and includes all it's methods.
Kind: global class
- PositionsContract
- new PositionsContract(connector)
- .newEmptyPositionWithRef(maker, referralId, [transactionParams])
- .getPositionById(id) ⇒
Promise.<object>
- .getPositionByMaker(maker) ⇒
Promise.<(object|undefined)>
- .getAllUserPositions(maker) ⇒
Promise.<Array.<object>>
- .getAllPositions() ⇒
Promise.<Array.<object>>
- .getLatestUserPosition() ⇒
Promise.<(object|undefined)>
- .getParameters() ⇒
Promise.<Array.<object>>
- .addReferral(senderName, nutAmount, [transactionParams]) ⇒
Promise
- .deleteReferral(senderName, referralId, [transactionParams]) ⇒
Promise
- .getReferralById(id) ⇒
Promise.<(object|undefined)>
- .getAllReferrals() ⇒
Promise.<Array.<object>>
- .getReferralByName(name) ⇒
Promise.<(object|undefined)>
- .getPositionReferral(positionId) ⇒
Promise.<(object|undefined)>
- .getPositionReferralsTable() ⇒
Promise.<Array.<object>>
- .getAllReferralPositionsIds() ⇒
Promise.<Array.<number>>
Creates an instance of PositionsContract
Param | Description |
---|---|
connector | EosdtConnector (see |
Creates position that has a referral. Position would have 0 collateral and 0 debt
Kind: instance method of PositionsContract
Param | Type | Description |
---|---|---|
maker | string |
Account to create position for |
referralId | number |
Id of a referral |
[transactionParams] | object |
Kind: instance method of PositionsContract
Returns: Promise.<object>
-
A position object
Param | Type |
---|---|
id | number |
Kind: instance method of PositionsContract
Returns: Promise.<(object|undefined)>
-
Position object - first position that belongs to maker account
Param | Type | Description |
---|---|---|
maker | string |
Account name |
Kind: instance method of PositionsContract
Returns: Promise.<Array.<object>>
-
Array of all positions objects, created by the maker
Param | Type | Description |
---|---|---|
maker | string |
Account name |
Kind: instance method of PositionsContract
Returns: Promise.<Array.<object>>
-
An array of all positions created on this contract
Kind: instance method of PositionsContract
Returns: Promise.<(object|undefined)>
-
Position object - position of the account with maximum id value
Kind: instance method of PositionsContract
Returns: Promise.<Array.<object>>
-
Positions contract parameters
Creates new referral, staking given amount of NUT tokens. Rejects when amount is less then
referral_min_stake
in positions contract settings.
Kind: instance method of PositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
|
nutAmount | string | number |
|
[transactionParams] | object |
Removes referral and unstakes that referral's NUTs
Kind: instance method of PositionsContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
|
referralId | number |
|
[transactionParams] | object |
Kind: instance method of PositionsContract
Returns: Promise.<(object|undefined)>
-
An object with information about referral
Param | Type |
---|---|
id | number |
Kind: instance method of PositionsContract
Returns: Promise.<Array.<object>>
-
Table of existing referrals
Kind: instance method of PositionsContract
Returns: Promise.<(object|undefined)>
-
An object with information about referral
Param | Type | Description |
---|---|---|
name | string |
Account name |
Kind: instance method of PositionsContract
Returns: Promise.<(object|undefined)>
-
Returns referral information object if position with given id has a referral
Param | Type |
---|---|
positionId | number |
Kind: instance method of PositionsContract
Returns: Promise.<Array.<object>>
-
An array of objects, containing positions ids and those positions referrals ids
Kind: instance method of PositionsContract
Returns: Promise.<Array.<number>>
-
An array of position objects with given referral id
A wrapper class to invoke actions of Equilibrium Savings Rate contract
Kind: global class
- SavingsRateContract
- new SavingsRateContract(connector)
- .stake(senderName, eosdtAmount, [trxMemo], [transactionParams]) ⇒
Promise
- .unstake(toAccount, eosdtAmount, [transactionParams]) ⇒
Promise
- .getAllPositions() ⇒
Promise.<Array.<object>>
- .getPositionById() ⇒
Promise.<(object|undefined)>
- .getUserPositions() ⇒
Promise.<Array.<object>>
- .getParameters() ⇒
Promise.<object>
- .getSettings() ⇒
Promise.<object>
Instantiates SavingsRateContract
Param | Description |
---|---|
connector | EosdtConnector (see |
Transfers EOSDT from user to Savings Rate contract
Kind: instance method of SavingsRateContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
|
eosdtAmount | string | number |
|
[trxMemo] | string |
|
[transactionParams] | object |
Returns EOSDT from Savings Rate contract to account balance
Kind: instance method of SavingsRateContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
toAccount | string |
|
eosdtAmount | string | number |
|
[transactionParams] | object |
Kind: instance method of SavingsRateContract
Returns: Promise.<Array.<object>>
-
An array of all positions on Savings Rate contract
Kind: instance method of SavingsRateContract
Returns: Promise.<(object|undefined)>
-
A Savings Rate position object with given id
Kind: instance method of SavingsRateContract
Returns: Promise.<Array.<object>>
-
Array of all positions objects, created by the maker
Kind: instance method of SavingsRateContract
Returns: Promise.<object>
-
Savings Rate contract parameters
Kind: instance method of SavingsRateContract
Returns: Promise.<object>
-
Savings Rate contract settings
A wrapper class to invoke actions of Equilibrium Token Swap contract
Kind: global class
- TokenSwapContract
- new TokenSwapContract(connector)
- .transferNut(senderName, nutAmount, ethereumAddress, [transactionParams]) ⇒
Promise
- .claim(toAccount, positionId, ethereumSignature, [transactionParams]) ⇒
Promise
- .getParameters() ⇒
Promise.<object>
- .getSettings() ⇒
Promise.<object>
- .getAllPositions() ⇒
Promise.<Array.<object>>
Instantiates TokenSwapContract
Param | Description |
---|---|
connector | EosdtConnector (see |
tokenSwapContract.transferNut(senderName, nutAmount, ethereumAddress, [transactionParams]) ⇒ Promise
Sends NUT tokens to TokenSwap contract. Send Ethereum address (available format with and without prefix "0x") in memo to verify Ethereum signature
Kind: instance method of TokenSwapContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
senderName | string |
|
nutAmount | string | number |
|
ethereumAddress | string |
|
[transactionParams] | object |
Returns NUT from TokenSwap contract to account balance and verifies Ethereum signature (available format with and without prefix "0x")
Kind: instance method of TokenSwapContract
Returns: Promise
-
Promise of transaction receipt
Param | Type | Description |
---|---|---|
toAccount | string |
|
positionId | number |
|
ethereumSignature | string |
|
[transactionParams] | object |
Kind: instance method of TokenSwapContract
Returns: Promise.<object>
-
TokenSwap contract parameters
Kind: instance method of TokenSwapContract
Returns: Promise.<object>
-
TokenSwap contract settings
Kind: instance method of TokenSwapContract
Returns: Promise.<Array.<object>>
-
An array of all positions created on TokenSwap contract
© 2019-2021 Equilibrium