From c62771a0bb67b0e59dcd4ca04147f50ed98e1caa Mon Sep 17 00:00:00 2001 From: Zhao TengHu Date: Thu, 26 Nov 2020 19:55:16 +1000 Subject: [PATCH 01/20] Remove test file --- test/comptroller.test.js | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 test/comptroller.test.js diff --git a/test/comptroller.test.js b/test/comptroller.test.js deleted file mode 100644 index e87436e..0000000 --- a/test/comptroller.test.js +++ /dev/null @@ -1,35 +0,0 @@ -const BigNumber = require('bignumber.js'); -const Venus = require('.'); -const provider = 'http://3.10.133.254:8575'; -const privateKey = '0x04fd4490c7fe1e857557bdf12b1132315a718c115dfef5d8ae41045a174e5215'; -// const venus = new Venus(provider); -const venus = new Venus(provider, { privateKey, network: 'ropsten' }); - -const Web3 = require('web3'); -const web3 = new Web3(provider); - -(async function () { - - const block = await venus._provider.provider.getBlockNumber(); - console.log('block', block); - - const gasPrice = new BigNumber(await web3.eth.getGasPrice()).times(1.5).dp(0, 2).toNumber(); - let preDefinedGasValue = new BigNumber(500000).dp(0, 2).toNumber(); - let nonce = await web3.eth.getTransactionCount('0x58E312B1b0A16dF7F3D103cAB7BE438de301e534'); - // const gasLimit = new BigNumber(preDefinedGasValue).multipliedBy(new BigNumber(gasPrice)).dp(0, 2).toNumber(); - const gasLimit = new BigNumber(150000).dp(0, 2).toNumber(); - - const options = { - gasPrice: `0x${gasPrice.toString(16)}`, - gas: `0x${preDefinedGasValue.toString(16)}`, - value: '0x00', - nonce: `0x${nonce.toString(16)}`, - // chainId, - // from: options.from, - gasLimit: `0x${gasLimit.toString(16)}`, - } - console.log('options object', options); - const trx = await venus.enterMarkets(Venus.SXP, options); // Use [] for multiple - console.log('Ethers.js transaction object', trx); - -})().catch(console.error); From b73596d701b164d023695f809cea6e8e3eaceda7 Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Fri, 27 Nov 2020 22:04:57 +0200 Subject: [PATCH 02/20] Updated ctoken --- src/cToken.ts | 50 ++++++++++++++++++++++++------------------------ src/constants.ts | 1 + 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/cToken.ts b/src/cToken.ts index 6916c6e..9006f3a 100644 --- a/src/cToken.ts +++ b/src/cToken.ts @@ -14,7 +14,7 @@ import { BigNumber } from '@ethersproject/bignumber/lib/bignumber'; import { CallOptions, TrxResponse } from './types'; /** - * Supplies the user's Ethereum asset to the Venus Protocol. + * Supplies the user's Binance Smart Chain asset to the Venus Protocol. * * @param {string} asset A string of the asset to supply. * @param {number | string | BigNumber} amount A string, number, or BigNumber @@ -22,7 +22,7 @@ import { CallOptions, TrxResponse } from './types'; * the `options` parameter to indicate if this value is scaled up (so there * are no decimals) or in its natural scale. * @param {boolean} noApprove Explicitly prevent this method from attempting an - * ERC-20 `approve` transaction prior to sending the `mint` transaction. + * BEP-20 `approve` transaction prior to sending the `mint` transaction. * @param {CallOptions} [options] Call options and Ethers.js overrides for the * transaction. A passed `gasLimit` will be used in both the `approve` (if * not supressed) and `mint` transactions. @@ -33,15 +33,15 @@ import { CallOptions, TrxResponse } from './types'; * @example * * ``` - * const compound = new Venus(window.ethereum); + * const venus = new Venus(window.ethereum); * * // Ethers.js overrides are an optional 3rd parameter for `supply` * // const trxOptions = { gasLimit: 250000, mantissa: false }; * * (async function() { * - * console.log('Supplying ETH to the Venus Protocol...'); - * const trx = await compound.supply(Venus.ETH, 1); + * console.log('Supplying SXP to the Venus Protocol...'); + * const trx = await venus.supply(Venus.SXP, 1); * console.log('Ethers.js transaction object', trx); * * })().catch(console.error); @@ -127,14 +127,14 @@ export async function supply( } /** - * Redeems the user's Ethereum asset from the Venus Protocol. + * Redeems the user's Binance Smart Chain asset from the Venus Protocol. * - * @param {string} asset A string of the asset to redeem, or its cToken name. + * @param {string} asset A string of the asset to redeem, or its vToken name. * @param {number | string | BigNumber} amount A string, number, or BigNumber * object of the amount of an asset to redeem. Use the `mantissa` boolean in * the `options` parameter to indicate if this value is scaled up (so there * are no decimals) or in its natural scale. This can be an amount of - * cTokens or underlying asset (use the `asset` parameter to specify). + * vTokens or underlying asset (use the `asset` parameter to specify). * @param {CallOptions} [options] Call options and Ethers.js overrides for the * transaction. * @@ -144,12 +144,12 @@ export async function supply( * @example * * ``` - * const compound = new Venus(window.ethereum); + * const venus = new Venus(window.ethereum); * * (async function() { * - * console.log('Redeeming ETH...'); - * const trx = await compound.redeem(Venus.ETH, 1); // also accepts cToken args + * console.log('Redeeming SXP...'); + * const trx = await venus.redeem(Venus.SXP, 1); // also accepts vToken args * console.log('Ethers.js transaction object', trx); * * })().catch(console.error); @@ -204,9 +204,9 @@ export async function redeem( } /** - * Borrows an Ethereum asset from the Venus Protocol for the user. The user's - * address must first have supplied collateral and entered a corresponding - * market. + * Borrows an Binance Smart Chain asset from the Venus Protocol for the user. + * The user's address must first have supplied collateral and entered a + * corresponding market. * * @param {string} asset A string of the asset to borrow (must be a supported * underlying asset). @@ -223,15 +223,15 @@ export async function redeem( * @example * * ``` - * const compound = new Venus(window.ethereum); + * const venus = new Venus(window.ethereum); * * (async function() { * - * const daiScaledUp = '32000000000000000000'; + * const sxpScaledUp = '32000000000000000000'; * const trxOptions = { mantissa: true }; * - * console.log('Borrowing 32 Dai...'); - * const trx = await compound.borrow(Venus.DAI, daiScaledUp, trxOptions); + * console.log('Borrowing 32 SXP...'); + * const trx = await venus.borrow(Venus.SXP, sxpScaledUp, trxOptions); * * console.log('Ethers.js transaction object', trx); * @@ -279,8 +279,8 @@ export async function borrow( } /** - * Repays a borrowed Ethereum asset for the user or on behalf of another - * Ethereum address. + * Repays a borrowed Binance Smart Chain asset for the user or on behalf of + * another Binance Smart Chain address. * * @param {string} asset A string of the asset that was borrowed (must be a * supported underlying asset). @@ -288,8 +288,8 @@ export async function borrow( * object of the amount of an asset to borrow. Use the `mantissa` boolean in * the `options` parameter to indicate if this value is scaled up (so there * are no decimals) or in its natural scale. - * @param {string | null} [borrower] The Ethereum address of the borrower to - * repay an open borrow for. Set this to `null` if the user is repaying + * @param {string | null} [borrower] The Binance Smart Chain address of the borrower + * to repay an open borrow for. Set this to `null` if the user is repaying * their own borrow. * @param {boolean} noApprove Explicitly prevent this method from attempting an * ERC-20 `approve` transaction prior to sending the subsequent repayment @@ -304,13 +304,13 @@ export async function borrow( * @example * * ``` - * const compound = new Venus(window.ethereum); + * const venus = new Venus(window.ethereum); * * (async function() { * - * console.log('Repaying Dai borrow...'); + * console.log('Repaying SXP borrow...'); * const address = null; // set this to any address to repayBorrowBehalf - * const trx = await compound.repayBorrow(Venus.DAI, 32, address); + * const trx = await venus.repayBorrow(Venus.SXP, 32, address); * * console.log('Ethers.js transaction object', trx); * diff --git a/src/constants.ts b/src/constants.ts index 4b2230e..1214b11 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -40,6 +40,7 @@ export const constants = { 'USDC': 'USDC', 'USDT': 'USDT', 'SXP': 'SXP', + 'BNB': 'BNB', }; export const address = { From 5d657dc324fd37f23ef479d5aafb2dbdda494a1f Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Sat, 28 Nov 2020 21:01:38 +0200 Subject: [PATCH 03/20] Updated comp comments and functions --- src/comp.ts | 62 ++++++++++++++++++++++++------------------------ src/constants.ts | 6 ++--- src/index.ts | 8 +++---- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/comp.ts b/src/comp.ts index 0bfbaf6..9ca4750 100644 --- a/src/comp.ts +++ b/src/comp.ts @@ -51,32 +51,32 @@ function toChecksumAddress(_address) { } /** - * Get the balance of COMP tokens held by an address. + * Get the balance of XVS tokens held by an address. * - * @param {string} _address The address in which to find the COMP balance. + * @param {string} _address The address in which to find the XVS balance. * @param {Provider | string} [_provider] An Ethers.js provider or valid network * name string. * - * @returns {string} Returns a string of the numeric balance of COMP. The value + * @returns {string} Returns a string of the numeric balance of XVS. The value * is scaled up by 18 decimal places. * * @example * * ``` * (async function () { - * const bal = await Compound.comp.getCompBalance('0x2775b1c75658Be0F640272CCb8c72ac986009e38'); + * const bal = await Venus.xvs.getXVSBalance('0x2775b1c75658Be0F640272CCb8c72ac986009e38'); * console.log('Balance', bal); * })().catch(console.error); * ``` */ -export async function getCompBalance( +export async function getXVSBalance( _address: string, _provider : Provider | string='mainnet' ) : Promise { const provider = await eth._createProvider({ provider: _provider }); const net = await eth.getProviderNetwork(provider); - const errorPrefix = 'Compound [getCompBalance] | '; + const errorPrefix = 'Venus [getXVSBalance] | '; if (typeof _address !== 'string') { throw Error(errorPrefix + 'Argument `_address` must be a string.'); @@ -100,32 +100,32 @@ export async function getCompBalance( } /** - * Get the amount of COMP tokens accrued but not yet claimed by an address. + * Get the amount of XVS tokens accrued but not yet claimed by an address. * - * @param {string} _address The address in which to find the COMP accrued. + * @param {string} _address The address in which to find the XVS accrued. * @param {Provider | string} [_provider] An Ethers.js provider or valid network * name string. * - * @returns {string} Returns a string of the numeric accruement of COMP. The + * @returns {string} Returns a string of the numeric accruement of XVS. The * value is scaled up by 18 decimal places. * * @example * * ``` * (async function () { - * const acc = await Compound.comp.getCompAccrued('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5'); + * const acc = await Venus.xvs.getXVSAccrued('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5'); * console.log('Accrued', acc); * })().catch(console.error); * ``` */ -export async function getCompAccrued( +export async function getXVSAccrued( _address: string, _provider : Provider | string='mainnet' ) : Promise { const provider = await eth._createProvider({ provider: _provider }); const net = await eth.getProviderNetwork(provider); - const errorPrefix = 'Compound [getCompAccrued] | '; + const errorPrefix = 'Venus [getXVSAccrued] | '; if (typeof _address !== 'string') { throw Error(errorPrefix + 'Argument `_address` must be a string.'); @@ -146,12 +146,12 @@ export async function getCompAccrued( abi: abi.CompoundLens, }; - const result = await eth.read(lensAddress, 'getCompBalanceMetadataExt', parameters, trxOptions); + const result = await eth.read(lensAddress, 'getXVSBalanceMetadataExt', parameters, trxOptions); return result.allocated.toString(); } /** - * Create a transaction to claim accrued COMP tokens for the user. + * Create a transaction to claim accrued XVS tokens for the user. * * @param {CallOptions} [options] Options to set for a transaction and Ethers.js * method overrides. @@ -162,18 +162,18 @@ export async function getCompAccrued( * @example * * ``` - * const compound = new Compound(window.ethereum); + * const venus = new Venus(window.ethereum); * * (async function() { * - * console.log('Claiming COMP...'); - * const trx = await compound.claimComp(); + * console.log('Claiming Venus...'); + * const trx = await venus.claimVenus(); * console.log('Ethers.js transaction object', trx); * * })().catch(console.error); * ``` */ -export async function claimComp( +export async function claimVenus( options: CallOptions = {} ) : Promise { await netId(this); @@ -187,18 +187,18 @@ export async function claimComp( abi: abi.Comptroller, }; const parameters = [ userAddress ]; - const method = 'claimComp(address)'; + const method = 'claimVenus(address)'; return eth.trx(comptrollerAddress, method, parameters, trxOptions); } catch(e) { - const errorPrefix = 'Compound [claimComp] | '; + const errorPrefix = 'Venus [claimVenus] | '; e.message = errorPrefix + e.message; return e; } } /** - * Create a transaction to delegate Compound Governance voting rights to an + * Create a transaction to delegate Venus Governance voting rights to an * address. * * @param {string} _address The address in which to delegate voting rights to. @@ -213,10 +213,10 @@ export async function claimComp( * @example * * ``` - * const compound = new Compound(window.ethereum); + * const venus = new Venus(window.ethereum); * * (async function() { - * const delegateTx = await compound.delegate('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'); + * const delegateTx = await venus.delegate('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'); * console.log('Ethers.js transaction object', delegateTx); * })().catch(console.error); * ``` @@ -227,7 +227,7 @@ export async function delegate( ) : Promise { await netId(this); - const errorPrefix = 'Compound [delegate] | '; + const errorPrefix = 'Venus [delegate] | '; if (typeof _address !== 'string') { throw Error(errorPrefix + 'Argument `_address` must be a string.'); @@ -252,11 +252,11 @@ export async function delegate( } /** - * Delegate voting rights in Compound Governance using an EIP-712 signature. + * Delegate voting rights in Venus Governance using an EIP-712 signature. * * @param {string} _address The address to delegate the user's voting rights to. * @param {number} nonce The contract state required to match the signature. - * This can be retrieved from the COMP contract's public nonces mapping. + * This can be retrieved from the XVS contract's public nonces mapping. * @param {number} expiry The time at which to expire the signature. A block * timestamp as seconds since the unix epoch. * @param {object} signature An object that contains the v, r, and, s values of @@ -272,10 +272,10 @@ export async function delegate( * @example * * ``` - * const compound = new Compound(window.ethereum); + * const venus = new Venus(window.ethereum); * * (async function() { - * const delegateTx = await compound.delegateBySig( + * const delegateTx = await venus.delegateBySig( * '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A', * 42, * 9999999999, @@ -342,7 +342,7 @@ export async function delegateBySig( } /** - * Create a delegate signature for Compound Governance using EIP-712. The + * Create a delegate signature for Venus Governance using EIP-712. The * signature can be created without burning gas. Anyone can post it to the * blockchain using the `delegateBySig` method, which does have gas costs. * @@ -357,11 +357,11 @@ export async function delegateBySig( * @example * * ``` - * const compound = new Compound(window.ethereum); + * const venus = new Venus(window.ethereum); * * (async () => { * - * const delegateSignature = await compound.createDelegateSignature('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'); + * const delegateSignature = await venus.createDelegateSignature('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'); * console.log('delegateSignature', delegateSignature); * * })().catch(console.error); diff --git a/src/constants.ts b/src/constants.ts index 1214b11..b883ce3 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -154,11 +154,11 @@ export const address = { "ropsten": { "PriceFeed": "0xBEf4E076A995c784be6094a432b9CA99b7431A3f", "Maximillion": "0xE0a38ab2951B6525C33f20D5E637Ab24DFEF9bcB", - "CompoundLens": "0xB272C5C22850CcEB72C6D45DFBDbDE0D9433b036", + "CompoundLens": "0x40e42Ad74AA4c61B577387821e845a8892E65002", "GovernorAlpha": "0x93ACbA9ecaCeC21BFA09b0C4650Be3596713d747", "Comptroller": "0x94d1820b2D1c7c7452A163983Dc888CEC546b77D", "Reservoir": "0x4Aebe384D31e9309BEDf8552232C07591e0cA56F", - "COMP": "0x1fe16de955718cfab7a44605458ab023838c2793", + "COMP": "0xB9e0E753630434d7863528cc73CB7AC638a7c8ff", "cBAT": "0x9E95c0b2412cE50C37a121622308e7a6177F819D", "cDAI": "0xdb5Ed4605C11822811a39F94314fDb8F0fb59A2C", "cETH": "0xBe839b6D93E3eA47eFFcCA1F27841C917a8794f3", @@ -202,7 +202,7 @@ export const abi = { GovernorAlpha: [{"inputs":[{"internalType":"address","name":"timelock_","type":"address"},{"internalType":"address","name":"comp_","type":"address"},{"internalType":"address","name":"guardian_","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor","signature":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"ProposalCanceled","type":"event","signature":"0x789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"proposer","type":"address"},{"indexed":false,"internalType":"address[]","name":"targets","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"},{"indexed":false,"internalType":"string[]","name":"signatures","type":"string[]"},{"indexed":false,"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"},{"indexed":false,"internalType":"string","name":"description","type":"string"}],"name":"ProposalCreated","type":"event","signature":"0x7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e0"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"}],"name":"ProposalExecuted","type":"event","signature":"0x712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"eta","type":"uint256"}],"name":"ProposalQueued","type":"event","signature":"0x9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"voter","type":"address"},{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"support","type":"bool"},{"indexed":false,"internalType":"uint256","name":"votes","type":"uint256"}],"name":"VoteCast","type":"event","signature":"0x877856338e13f63d0c36822ff0ef736b80934cd90574a3a5bc9262c39d217c46"},{"constant":true,"inputs":[],"name":"BALLOT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xdeaaa7cc"},{"constant":true,"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x20606b70"},{"constant":false,"inputs":[],"name":"__abdicate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x760fbc13"},{"constant":false,"inputs":[],"name":"__acceptAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xb9a61961"},{"constant":false,"inputs":[{"internalType":"address","name":"newPendingAdmin","type":"address"},{"internalType":"uint256","name":"eta","type":"uint256"}],"name":"__executeSetTimelockPendingAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x21f43e42"},{"constant":false,"inputs":[{"internalType":"address","name":"newPendingAdmin","type":"address"},{"internalType":"uint256","name":"eta","type":"uint256"}],"name":"__queueSetTimelockPendingAdmin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x91500671"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"cancel","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x40e58ee5"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"}],"name":"castVote","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x15373e3d"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"castVoteBySig","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0x4634c61f"},{"constant":true,"inputs":[],"name":"comp","outputs":[{"internalType":"contract CompInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x109d0af8"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"execute","outputs":[],"payable":true,"stateMutability":"payable","type":"function","signature":"0xfe0d94c1"},{"constant":true,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"getActions","outputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x328dd982"},{"constant":true,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"voter","type":"address"}],"name":"getReceipt","outputs":[{"components":[{"internalType":"bool","name":"hasVoted","type":"bool"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint96","name":"votes","type":"uint96"}],"internalType":"struct GovernorAlpha.Receipt","name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xe23a9a52"},{"constant":true,"inputs":[],"name":"guardian","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x452a9320"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"latestProposalIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x17977c61"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x06fdde03"},{"constant":true,"inputs":[],"name":"proposalCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xda35c664"},{"constant":true,"inputs":[],"name":"proposalMaxOperations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function","signature":"0x7bdbe4d0"},{"constant":true,"inputs":[],"name":"proposalThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function","signature":"0xb58131b0"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proposals","outputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposer","type":"address"},{"internalType":"uint256","name":"eta","type":"uint256"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"forVotes","type":"uint256"},{"internalType":"uint256","name":"againstVotes","type":"uint256"},{"internalType":"bool","name":"canceled","type":"bool"},{"internalType":"bool","name":"executed","type":"bool"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x013cf08b"},{"constant":false,"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"internalType":"string","name":"description","type":"string"}],"name":"propose","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xda95691a"},{"constant":false,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"queue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function","signature":"0xddf0b009"},{"constant":true,"inputs":[],"name":"quorumVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function","signature":"0x24bc1a64"},{"constant":true,"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"state","outputs":[{"internalType":"enum GovernorAlpha.ProposalState","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function","signature":"0x3e4f49e6"},{"constant":true,"inputs":[],"name":"timelock","outputs":[{"internalType":"contract TimelockInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function","signature":"0xd33219b4"},{"constant":true,"inputs":[],"name":"votingDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function","signature":"0x3932abb1"},{"constant":true,"inputs":[],"name":"votingPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function","signature":"0x02a251a3"}], Comptroller: [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"action","type":"string"},{"indexed":false,"internalType":"bool","name":"pauseState","type":"bool"}],"name":"ActionPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"string","name":"action","type":"string"},{"indexed":false,"internalType":"bool","name":"pauseState","type":"bool"}],"name":"ActionPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"venusDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"venusBorrowIndex","type":"uint256"}],"name":"DistributedBorrowerVenus","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":true,"internalType":"address","name":"supplier","type":"address"},{"indexed":false,"internalType":"uint256","name":"venusDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"venusSupplyIndex","type":"uint256"}],"name":"DistributedSupplierVenus","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"error","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"info","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"detail","type":"uint256"}],"name":"Failure","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"MarketEntered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"MarketExited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"}],"name":"MarketListed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"bool","name":"isVenus","type":"bool"}],"name":"MarketVenus","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCloseFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCloseFactorMantissa","type":"uint256"}],"name":"NewCloseFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldCollateralFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCollateralFactorMantissa","type":"uint256"}],"name":"NewCollateralFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldLiquidationIncentiveMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newLiquidationIncentiveMantissa","type":"uint256"}],"name":"NewLiquidationIncentive","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxAssets","type":"uint256"}],"name":"NewMaxAssets","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPauseGuardian","type":"address"},{"indexed":false,"internalType":"address","name":"newPauseGuardian","type":"address"}],"name":"NewPauseGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract PriceOracle","name":"oldPriceOracle","type":"address"},{"indexed":false,"internalType":"contract PriceOracle","name":"newPriceOracle","type":"address"}],"name":"NewPriceOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VAIControllerInterface","name":"oldVAIController","type":"address"},{"indexed":false,"internalType":"contract VAIControllerInterface","name":"newVAIController","type":"address"}],"name":"NewVAIController","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldVAIMintRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newVAIMintRate","type":"uint256"}],"name":"NewVAIMintRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldVenusRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newVenusRate","type":"uint256"}],"name":"NewVenusRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"VenusSpeedUpdated","type":"event"},{"constant":false,"inputs":[{"internalType":"address[]","name":"vTokens","type":"address[]"}],"name":"_addVenusMarkets","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract Unitroller","name":"unitroller","type":"address"}],"name":"_become","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"_borrowGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"}],"name":"_dropVenusMarket","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"_mintGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"_setBorrowPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newCloseFactorMantissa","type":"uint256"}],"name":"_setCloseFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"},{"internalType":"uint256","name":"newCollateralFactorMantissa","type":"uint256"}],"name":"_setCollateralFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newLiquidationIncentiveMantissa","type":"uint256"}],"name":"_setLiquidationIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newMaxAssets","type":"uint256"}],"name":"_setMaxAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"_setMintPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newPauseGuardian","type":"address"}],"name":"_setPauseGuardian","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract PriceOracle","name":"newOracle","type":"address"}],"name":"_setPriceOracle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"_setSeizePaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"_setTransferPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VAIControllerInterface","name":"vaiController_","type":"address"}],"name":"_setVAIController","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newVAIMintRate","type":"uint256"}],"name":"_setVAIMintRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"venusRate_","type":"uint256"}],"name":"_setVenusRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"}],"name":"_supportMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"accountAssets","outputs":[{"internalType":"contract VToken","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allMarkets","outputs":[{"internalType":"contract VToken","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"borrowGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrowVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"contract VToken","name":"vToken","type":"address"}],"name":"checkMembership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"contract VToken[]","name":"vTokens","type":"address[]"}],"name":"claimVenus","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"claimVenus","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"holders","type":"address[]"},{"internalType":"contract VToken[]","name":"vTokens","type":"address[]"},{"internalType":"bool","name":"borrowers","type":"bool"},{"internalType":"bool","name":"suppliers","type":"bool"}],"name":"claimVenus","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"closeFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptrollerImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"vTokens","type":"address[]"}],"name":"enterMarkets","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenAddress","type":"address"}],"name":"exitMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAllMarkets","outputs":[{"internalType":"contract VToken[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAssetsIn","outputs":[{"internalType":"contract VToken[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"vTokenModify","type":"address"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"getHypotheticalAccountLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"getMintableVAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getVAIMintRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getXVSAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isComptroller","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"liquidateBorrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"liquidateBorrowVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"}],"name":"liquidateCalculateSeizeTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"liquidationIncentiveMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"markets","outputs":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"},{"internalType":"bool","name":"isVenus","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"mintAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"mintVAIAmount","type":"uint256"}],"name":"mintVAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"actualMintAmount","type":"uint256"},{"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"mintVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"mintedVAIOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintedVAIs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"oracle","outputs":[{"internalType":"contract PriceOracle","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pauseGuardian","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingComptrollerImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"redeemer","type":"address"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeemAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"redeemer","type":"address"},{"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeemVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"refreshVenusSpeeds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"repayBorrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"},{"internalType":"uint256","name":"borrowerIndex","type":"uint256"}],"name":"repayBorrowVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"repayVAIAmount","type":"uint256"}],"name":"repayVAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seizeAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"seizeGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seizeVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMintedVAIOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"transferTokens","type":"uint256"}],"name":"transferAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"transferGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"transferTokens","type":"uint256"}],"name":"transferVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"vaiController","outputs":[{"internalType":"contract VAIControllerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vaiMintRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"venusAccrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"venusBorrowState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"block","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"venusBorrowerIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"venusClaimThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"venusInitialIndex","outputs":[{"internalType":"uint224","name":"","type":"uint224"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"venusRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"venusSpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"venusSupplierIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"venusSupplyState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"block","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"}], PriceFeed: ["function price(string symbol) returns (uint256)"], - CompoundLens: [{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"},{"internalType":"address payable","name":"account","type":"address"}],"name":"cTokenBalances","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"balanceOf","type":"uint256"},{"internalType":"uint256","name":"borrowBalanceCurrent","type":"uint256"},{"internalType":"uint256","name":"balanceOfUnderlying","type":"uint256"},{"internalType":"uint256","name":"tokenBalance","type":"uint256"},{"internalType":"uint256","name":"tokenAllowance","type":"uint256"}],"internalType":"struct CompoundLens.CTokenBalances","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"},{"internalType":"address payable","name":"account","type":"address"}],"name":"cTokenBalancesAll","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"balanceOf","type":"uint256"},{"internalType":"uint256","name":"borrowBalanceCurrent","type":"uint256"},{"internalType":"uint256","name":"balanceOfUnderlying","type":"uint256"},{"internalType":"uint256","name":"tokenBalance","type":"uint256"},{"internalType":"uint256","name":"tokenAllowance","type":"uint256"}],"internalType":"struct CompoundLens.CTokenBalances[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"}],"name":"cTokenMetadata","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"exchangeRateCurrent","type":"uint256"},{"internalType":"uint256","name":"supplyRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"borrowRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"reserveFactorMantissa","type":"uint256"},{"internalType":"uint256","name":"totalBorrows","type":"uint256"},{"internalType":"uint256","name":"totalReserves","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"totalCash","type":"uint256"},{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"},{"internalType":"address","name":"underlyingAssetAddress","type":"address"},{"internalType":"uint256","name":"cTokenDecimals","type":"uint256"},{"internalType":"uint256","name":"underlyingDecimals","type":"uint256"}],"internalType":"struct CompoundLens.CTokenMetadata","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"}],"name":"cTokenMetadataAll","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"exchangeRateCurrent","type":"uint256"},{"internalType":"uint256","name":"supplyRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"borrowRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"reserveFactorMantissa","type":"uint256"},{"internalType":"uint256","name":"totalBorrows","type":"uint256"},{"internalType":"uint256","name":"totalReserves","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"totalCash","type":"uint256"},{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"},{"internalType":"address","name":"underlyingAssetAddress","type":"address"},{"internalType":"uint256","name":"cTokenDecimals","type":"uint256"},{"internalType":"uint256","name":"underlyingDecimals","type":"uint256"}],"internalType":"struct CompoundLens.CTokenMetadata[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"}],"name":"cTokenUnderlyingPrice","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"underlyingPrice","type":"uint256"}],"internalType":"struct CompoundLens.CTokenUnderlyingPrice","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"}],"name":"cTokenUnderlyingPriceAll","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"underlyingPrice","type":"uint256"}],"internalType":"struct CompoundLens.CTokenUnderlyingPrice[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerLensInterface","name":"comptroller","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getAccountLimits","outputs":[{"components":[{"internalType":"contract CToken[]","name":"markets","type":"address[]"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"shortfall","type":"uint256"}],"internalType":"struct CompoundLens.AccountLimits","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"contract Comp","name":"comp","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getCompBalanceMetadata","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"},{"internalType":"address","name":"delegate","type":"address"}],"internalType":"struct CompoundLens.CompBalanceMetadata","name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract Comp","name":"comp","type":"address"},{"internalType":"contract ComptrollerLensInterface","name":"comptroller","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getCompBalanceMetadataExt","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"allocated","type":"uint256"}],"internalType":"struct CompoundLens.CompBalanceMetadataExt","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"contract Comp","name":"comp","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint32[]","name":"blockNumbers","type":"uint32[]"}],"name":"getCompVotes","outputs":[{"components":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"}],"internalType":"struct CompoundLens.CompVotes[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract GovernorAlpha","name":"governor","type":"address"},{"internalType":"uint256[]","name":"proposalIds","type":"uint256[]"}],"name":"getGovProposals","outputs":[{"components":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"proposer","type":"address"},{"internalType":"uint256","name":"eta","type":"uint256"},{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"forVotes","type":"uint256"},{"internalType":"uint256","name":"againstVotes","type":"uint256"},{"internalType":"bool","name":"canceled","type":"bool"},{"internalType":"bool","name":"executed","type":"bool"}],"internalType":"struct CompoundLens.GovProposal[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract GovernorAlpha","name":"governor","type":"address"},{"internalType":"address","name":"voter","type":"address"},{"internalType":"uint256[]","name":"proposalIds","type":"uint256[]"}],"name":"getGovReceipts","outputs":[{"components":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"hasVoted","type":"bool"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint96","name":"votes","type":"uint96"}],"internalType":"struct CompoundLens.GovReceipt[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"}], + CompoundLens: [{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"},{"internalType":"address payable","name":"account","type":"address"}],"name":"cTokenBalances","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"balanceOf","type":"uint256"},{"internalType":"uint256","name":"borrowBalanceCurrent","type":"uint256"},{"internalType":"uint256","name":"balanceOfUnderlying","type":"uint256"},{"internalType":"uint256","name":"tokenBalance","type":"uint256"},{"internalType":"uint256","name":"tokenAllowance","type":"uint256"}],"internalType":"struct CompoundLens.CTokenBalances","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"},{"internalType":"address payable","name":"account","type":"address"}],"name":"cTokenBalancesAll","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"balanceOf","type":"uint256"},{"internalType":"uint256","name":"borrowBalanceCurrent","type":"uint256"},{"internalType":"uint256","name":"balanceOfUnderlying","type":"uint256"},{"internalType":"uint256","name":"tokenBalance","type":"uint256"},{"internalType":"uint256","name":"tokenAllowance","type":"uint256"}],"internalType":"struct CompoundLens.CTokenBalances[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"}],"name":"cTokenMetadata","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"exchangeRateCurrent","type":"uint256"},{"internalType":"uint256","name":"supplyRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"borrowRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"reserveFactorMantissa","type":"uint256"},{"internalType":"uint256","name":"totalBorrows","type":"uint256"},{"internalType":"uint256","name":"totalReserves","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"totalCash","type":"uint256"},{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"},{"internalType":"address","name":"underlyingAssetAddress","type":"address"},{"internalType":"uint256","name":"cTokenDecimals","type":"uint256"},{"internalType":"uint256","name":"underlyingDecimals","type":"uint256"}],"internalType":"struct CompoundLens.CTokenMetadata","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"}],"name":"cTokenMetadataAll","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"exchangeRateCurrent","type":"uint256"},{"internalType":"uint256","name":"supplyRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"borrowRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"reserveFactorMantissa","type":"uint256"},{"internalType":"uint256","name":"totalBorrows","type":"uint256"},{"internalType":"uint256","name":"totalReserves","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"totalCash","type":"uint256"},{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"},{"internalType":"address","name":"underlyingAssetAddress","type":"address"},{"internalType":"uint256","name":"cTokenDecimals","type":"uint256"},{"internalType":"uint256","name":"underlyingDecimals","type":"uint256"}],"internalType":"struct CompoundLens.CTokenMetadata[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"}],"name":"cTokenUnderlyingPrice","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"underlyingPrice","type":"uint256"}],"internalType":"struct CompoundLens.CTokenUnderlyingPrice","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"}],"name":"cTokenUnderlyingPriceAll","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"underlyingPrice","type":"uint256"}],"internalType":"struct CompoundLens.CTokenUnderlyingPrice[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerLensInterface","name":"comptroller","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getAccountLimits","outputs":[{"components":[{"internalType":"contract CToken[]","name":"markets","type":"address[]"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"shortfall","type":"uint256"}],"internalType":"struct CompoundLens.AccountLimits","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"contract Comp","name":"comp","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getCompBalanceMetadata","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"},{"internalType":"address","name":"delegate","type":"address"}],"internalType":"struct CompoundLens.CompBalanceMetadata","name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract Comp","name":"comp","type":"address"},{"internalType":"contract ComptrollerLensInterface","name":"comptroller","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getXVSBalanceMetadataExt","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"allocated","type":"uint256"}],"internalType":"struct CompoundLens.CompBalanceMetadataExt","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"contract Comp","name":"comp","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint32[]","name":"blockNumbers","type":"uint32[]"}],"name":"getCompVotes","outputs":[{"components":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"}],"internalType":"struct CompoundLens.CompVotes[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract GovernorAlpha","name":"governor","type":"address"},{"internalType":"uint256[]","name":"proposalIds","type":"uint256[]"}],"name":"getGovProposals","outputs":[{"components":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"proposer","type":"address"},{"internalType":"uint256","name":"eta","type":"uint256"},{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"forVotes","type":"uint256"},{"internalType":"uint256","name":"againstVotes","type":"uint256"},{"internalType":"bool","name":"canceled","type":"bool"},{"internalType":"bool","name":"executed","type":"bool"}],"internalType":"struct CompoundLens.GovProposal[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract GovernorAlpha","name":"governor","type":"address"},{"internalType":"address","name":"voter","type":"address"},{"internalType":"uint256[]","name":"proposalIds","type":"uint256[]"}],"name":"getGovReceipts","outputs":[{"components":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"hasVoted","type":"bool"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint96","name":"votes","type":"uint96"}],"internalType":"struct CompoundLens.GovReceipt[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"}], }; export const cTokens = [ diff --git a/src/index.ts b/src/index.ts index 3c79ee8..e90f86a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -65,7 +65,7 @@ const Venus = function( ...cToken, ...priceFeed, ...gov, - claimComp: comp.claimComp, + claimVenus: comp.claimVenus, delegate: comp.delegate, delegateBySig: comp.delegateBySig, createDelegateSignature: comp.createDelegateSignature, @@ -86,9 +86,9 @@ Venus.api = api; Venus.util = util; Venus._ethers = ethers; Venus.decimals = decimals; -Venus.comp = { - getCompBalance: comp.getCompBalance, - getCompAccrued: comp.getCompAccrued, +Venus.xvs = { + getXVSBalance: comp.getXVSBalance, + getXVSAccrued: comp.getXVSAccrued, }; Object.assign(Venus, constants); From ada51c2cc683015ff0897c4b38a95ef8ff5f8a59 Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Sat, 28 Nov 2020 22:14:25 +0200 Subject: [PATCH 04/20] Updated XVS with VENUS --- src/comp.ts | 30 +++++++++++++++--------------- src/index.ts | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/comp.ts b/src/comp.ts index 9ca4750..ad78b6e 100644 --- a/src/comp.ts +++ b/src/comp.ts @@ -51,32 +51,32 @@ function toChecksumAddress(_address) { } /** - * Get the balance of XVS tokens held by an address. + * Get the balance of VENUS tokens held by an address. * - * @param {string} _address The address in which to find the XVS balance. + * @param {string} _address The address in which to find the VENUS balance. * @param {Provider | string} [_provider] An Ethers.js provider or valid network * name string. * - * @returns {string} Returns a string of the numeric balance of XVS. The value + * @returns {string} Returns a string of the numeric balance of VENUS. The value * is scaled up by 18 decimal places. * * @example * * ``` * (async function () { - * const bal = await Venus.xvs.getXVSBalance('0x2775b1c75658Be0F640272CCb8c72ac986009e38'); + * const bal = await Venus.venus.getVenusBalance('0x2775b1c75658Be0F640272CCb8c72ac986009e38'); * console.log('Balance', bal); * })().catch(console.error); * ``` */ -export async function getXVSBalance( +export async function getVenusBalance( _address: string, _provider : Provider | string='mainnet' ) : Promise { const provider = await eth._createProvider({ provider: _provider }); const net = await eth.getProviderNetwork(provider); - const errorPrefix = 'Venus [getXVSBalance] | '; + const errorPrefix = 'Venus [getVenusBalance] | '; if (typeof _address !== 'string') { throw Error(errorPrefix + 'Argument `_address` must be a string.'); @@ -100,32 +100,32 @@ export async function getXVSBalance( } /** - * Get the amount of XVS tokens accrued but not yet claimed by an address. + * Get the amount of VENUS tokens accrued but not yet claimed by an address. * - * @param {string} _address The address in which to find the XVS accrued. + * @param {string} _address The address in which to find the VENUS accrued. * @param {Provider | string} [_provider] An Ethers.js provider or valid network * name string. * - * @returns {string} Returns a string of the numeric accruement of XVS. The + * @returns {string} Returns a string of the numeric accruement of VENUS. The * value is scaled up by 18 decimal places. * * @example * * ``` * (async function () { - * const acc = await Venus.xvs.getXVSAccrued('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5'); + * const acc = await Venus.venus.getVenusAccrued('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5'); * console.log('Accrued', acc); * })().catch(console.error); * ``` */ -export async function getXVSAccrued( +export async function getVenusAccrued( _address: string, _provider : Provider | string='mainnet' ) : Promise { const provider = await eth._createProvider({ provider: _provider }); const net = await eth.getProviderNetwork(provider); - const errorPrefix = 'Venus [getXVSAccrued] | '; + const errorPrefix = 'Venus [getVenusAccrued] | '; if (typeof _address !== 'string') { throw Error(errorPrefix + 'Argument `_address` must be a string.'); @@ -151,7 +151,7 @@ export async function getXVSAccrued( } /** - * Create a transaction to claim accrued XVS tokens for the user. + * Create a transaction to claim accrued VENUS tokens for the user. * * @param {CallOptions} [options] Options to set for a transaction and Ethers.js * method overrides. @@ -256,7 +256,7 @@ export async function delegate( * * @param {string} _address The address to delegate the user's voting rights to. * @param {number} nonce The contract state required to match the signature. - * This can be retrieved from the XVS contract's public nonces mapping. + * This can be retrieved from the VENUS contract's public nonces mapping. * @param {number} expiry The time at which to expire the signature. A block * timestamp as seconds since the unix epoch. * @param {object} signature An object that contains the v, r, and, s values of @@ -298,7 +298,7 @@ export async function delegateBySig( ) : Promise { await netId(this); - const errorPrefix = 'Compound [delegateBySig] | '; + const errorPrefix = 'Venus [delegateBySig] | '; if (typeof _address !== 'string') { throw Error(errorPrefix + 'Argument `_address` must be a string.'); diff --git a/src/index.ts b/src/index.ts index e90f86a..89c59c8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -86,9 +86,9 @@ Venus.api = api; Venus.util = util; Venus._ethers = ethers; Venus.decimals = decimals; -Venus.xvs = { - getXVSBalance: comp.getXVSBalance, - getXVSAccrued: comp.getXVSAccrued, +Venus.venus = { + getVenusBalance: comp.getVenusBalance, + getVenusAccrued: comp.getVenusAccrued, }; Object.assign(Venus, constants); From d38bf0bbba1bddca797e431b7fa935b035a11a95 Mon Sep 17 00:00:00 2001 From: Zhao TengHu Date: Sun, 29 Nov 2020 06:52:08 +1000 Subject: [PATCH 05/20] Update docs --- README.md | 78 ++++++++-------- docs/assets/js/search.json | 2 +- docs/globals.html | 9 +- docs/index.html | 92 +++++++++--------- docs/modules/_api_.html | 113 +++++++++++++++------- docs/modules/_comp_.html | 124 ++++++++++++------------- docs/modules/_comptroller_.html | 36 +++---- docs/modules/_constants_.html | 6 +- docs/modules/_ctoken_.html | 100 +++++++++++--------- docs/modules/_eip712_.html | 6 +- docs/modules/_eth_.html | 44 ++++----- docs/modules/_gov_.html | 50 +++++----- docs/modules/_helpers_.html | 6 +- docs/modules/_index_.html | 40 ++++---- docs/modules/_pricefeed_.html | 12 +-- docs/modules/_types_index_.html | 96 +++++++++++++++++++ docs/modules/_util_.html | 24 ++--- examples/nodejs/borrow.js | 18 ++-- examples/nodejs/eth_call.js | 8 +- examples/nodejs/eth_sendTransaction.js | 12 +-- examples/nodejs/getAddress.js | 10 +- examples/nodejs/getPrice.js | 16 ++-- examples/nodejs/redeem.js | 12 +-- examples/nodejs/repayBorrow.js | 18 ++-- examples/nodejs/supply.js | 10 +- examples/web/index.html | 88 +++++++++--------- scripts/compound-docs.js | 4 +- src/helpers.ts | 6 +- typedoc.json | 2 +- 29 files changed, 600 insertions(+), 442 deletions(-) create mode 100644 docs/modules/_types_index_.html diff --git a/README.md b/README.md index c1c7bec..4d96bf3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Compound.js +# Venus.js -A JavaScript SDK for Ethereum and the Compound Protocol. Wraps around [Ethers.js](https://github.com/ethers-io/ethers.js/). Works in the **web browser** and **Node.js**. +A JavaScript SDK for Ethereum and the Venus Protocol. Wraps around [Ethers.js](https://github.com/ethers-io/ethers.js/). Works in the **web browser** and **Node.js**. -[Compound.js Documentation](https://compound.finance/docs/compound-js) +[Venus.js Documentation](https://compound.finance/docs/compound-js) This SDK is in **open beta**, and is constantly under development. **USE AT YOUR OWN RISK**. @@ -13,12 +13,12 @@ JSON RPC based Ethereum **read** and **write**. ### Read ```js -const Compound = require('@compound-finance/compound-js'); // in Node.js -const cUsdtAddress = Compound.util.getAddress(Compound.cUSDT); +const Venus = require('@compound-finance/compound-js'); // in Node.js +const cUsdtAddress = Venus.util.getAddress(Venus.cUSDT); (async function() { - let supplyRatePerBlock = await Compound.eth.read( + let supplyRatePerBlock = await Venus.eth.read( cUsdtAddress, 'function supplyRatePerBlock() returns (uint)', [], // [optional] parameters @@ -37,35 +37,35 @@ const toAddress = '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'; (async function() { - const trx = await Compound.eth.trx( + const trx = await Venus.eth.trx( toAddress, 'function send() external payable', [], { - value: Compound._ethers.utils.parseEther('1.0'), // 1 ETH + value: Venus._ethers.utils.parseEther('1.0'), // 1 ETH provider: window.ethereum, // in a web browser } ); - const toAddressEthBalance = await Compound.eth.getBalance(toAddress); + const toAddressEthBalance = await Venus.eth.getBalance(toAddress); })().catch(console.error); ``` -## Compound Protocol +## Venus Protocol -Simple methods for using the Compound protocol. +Simple methods for using the Venus protocol. ```js -const compound = new Compound(window.ethereum); // in a web browser +const compound = new Venus(window.ethereum); // in a web browser // Ethers.js overrides are an optional 3rd parameter for `supply` // const trxOptions = { gasLimit: 250000, mantissa: false }; (async function() { - console.log('Supplying ETH to the Compound protocol...'); - const trx = await compound.supply(Compound.ETH, 1); + console.log('Supplying ETH to the Venus protocol...'); + const trx = await compound.supply(Venus.ETH, 1); console.log('Ethers.js transaction object', trx); })().catch(console.error); @@ -79,7 +79,7 @@ Web Browser ``` @@ -90,11 +90,11 @@ npm install @compound-finance/compound-js ``` ```js -const Compound = require('@compound-finance/compound-js'); +const Venus = require('@compound-finance/compound-js'); // or, when using ES6 -import Compound from '@compound-finance/compound-js'; +import Venus from '@compound-finance/compound-js'; ``` ## More Code Examples @@ -109,21 +109,21 @@ import Compound from '@compound-finance/compound-js'; The following are valid Ethereum providers for initialization of the SDK. ```js -var compound = new Compound(window.ethereum); // web browser +var compound = new Venus(window.ethereum); // web browser -var compound = new Compound('http://127.0.0.1:8545'); // HTTP provider +var compound = new Venus('http://127.0.0.1:8545'); // HTTP provider -var compound = new Compound(); // Uses Ethers.js fallback mainnet (for testing only) +var compound = new Venus(); // Uses Ethers.js fallback mainnet (for testing only) -var compound = new Compound('ropsten'); // Uses Ethers.js fallback (for testing only) +var compound = new Venus('ropsten'); // Uses Ethers.js fallback (for testing only) // Init with private key (server side) -var compound = new Compound('https://mainnet.infura.io/v3/_your_project_id_', { +var compound = new Venus('https://mainnet.infura.io/v3/_your_project_id_', { privateKey: '0x_your_private_key_', // preferably with environment variable }); // Init with HD mnemonic (server side) -var compound = new Compound('mainnet' { +var compound = new Venus('mainnet' { mnemonic: 'clutch captain shoe...', // preferably with environment variable }); ``` @@ -133,10 +133,10 @@ var compound = new Compound('mainnet' { Names of contracts, their addresses, ABIs, token decimals, and more can be found in `/src/constants.ts`. Addresses, for all networks, can be easily fetched using the `getAddress` function, combined with contract name constants. ```js -console.log(Compound.DAI, Compound.ETH, Compound.cETH); +console.log(Venus.DAI, Venus.ETH, Venus.cETH); // DAI, ETH, cETH -const cUsdtAddress = Compound.util.getAddress(Compound.cUSDT); +const cUsdtAddress = Venus.util.getAddress(Venus.cUSDT); // Mainnet cUSDT address. Second parameter can be a network like 'ropsten'. ``` @@ -146,10 +146,10 @@ Parameters of number values can be plain numbers or their scaled up mantissa val ```js // 1 Dai -await compound.borrow(Compound.DAI, '1000000000000000000', { mantissa: true }); +await compound.borrow(Venus.DAI, '1000000000000000000', { mantissa: true }); // `mantissa` defaults to false if it is not specified or if an options object is not passed -await compound.borrow(Compound.DAI, 1, { mantissa: false }); +await compound.borrow(Venus.DAI, 1, { mantissa: false }); ``` ## Transaction Options @@ -163,25 +163,25 @@ const trxOptions = { provider, // JSON RPC string, Web3 object, or Ethers.js fallback network (string) network, // Ethers.js fallback network provider, "provider" has precedence over "network" from, // Address that the Ethereum transaction is send from - gasPrice, // Ethers.js override `Compound._ethers.utils.parseUnits('10.0', 'gwei')` + gasPrice, // Ethers.js override `Venus._ethers.utils.parseUnits('10.0', 'gwei')` gasLimit, // Ethers.js override - see https://docs.ethers.io/ethers.js/v5-beta/api-contract.html#overrides value, // Number or string data, // Number or string chainId, // Number nonce, // Number - privateKey, // String, meant to be used with `Compound.eth.trx` (server side) - mnemonic, // String, meant to be used with `Compound.eth.trx` (server side) + privateKey, // String, meant to be used with `Venus.eth.trx` (server side) + mnemonic, // String, meant to be used with `Venus.eth.trx` (server side) }; ``` ## API -The [Compound API](https://compound.finance/docs/api) is accessible from Compound.js. The corresponding services are defined in the `api` namespace on the class. +The [Venus API](https://compound.finance/docs/api) is accessible from Venus.js. The corresponding services are defined in the `api` namespace on the class. -- `Compound.api.account` -- `Compound.api.cToken` -- `Compound.api.marketHistory` -- `Compound.api.governance` +- `Venus.api.account` +- `Venus.api.cToken` +- `Venus.api.marketHistory` +- `Venus.api.governance` The governance method requires a second parameter (string) for the corresponding endpoint shown in the [documentation](https://compound.finance/docs/api#GovernanceService). @@ -193,7 +193,7 @@ Here is an example for using the `account` endpoint. The `network` parameter in ```js const main = async () => { - const account = await Compound.api.account({ + const account = await Venus.api.account({ "addresses": "0xB61C5971d9c0472befceFfbE662555B78284c307", "network": "ropsten" }); @@ -202,7 +202,7 @@ const main = async () => { if (Object.isExtensible(account) && account.accounts) { account.accounts.forEach((acc) => { acc.tokens.forEach((tok) => { - if (tok.symbol === Compound.cDAI) { + if (tok.symbol === Venus.cDAI) { daiBorrowBalance = +tok.borrow_balance_underlying.value; } }); @@ -236,8 +236,8 @@ npm run build ### Node.js Build ```js // Local build (do `npm install` first) -const Compound = require('./dist/nodejs/index.js'); +const Venus = require('./dist/nodejs/index.js'); // Public NPM build -const Compound = require('@compound-finance/compound-js'); +const Venus = require('@compound-finance/compound-js'); ``` diff --git a/docs/assets/js/search.json b/docs/assets/js/search.json index a0491bb..1de0512 100644 --- a/docs/assets/js/search.json +++ b/docs/assets/js/search.json @@ -1 +1 @@ -{"kinds":{"1":"Module","64":"Function"},"rows":[{"id":0,"kind":1,"name":"\"EIP712\"","url":"modules/_eip712_.html","classes":"tsd-kind-module"},{"id":1,"kind":1,"name":"\"constants\"","url":"modules/_constants_.html","classes":"tsd-kind-module"},{"id":2,"kind":1,"name":"\"util\"","url":"modules/_util_.html","classes":"tsd-kind-module"},{"id":3,"kind":64,"name":"getAddress","url":"modules/_util_.html#getaddress","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":4,"kind":64,"name":"getAbi","url":"modules/_util_.html#getabi","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":5,"kind":64,"name":"getNetNameWithChainId","url":"modules/_util_.html#getnetnamewithchainid","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":6,"kind":1,"name":"\"api\"","url":"modules/_api_.html","classes":"tsd-kind-module"},{"id":7,"kind":64,"name":"account","url":"modules/_api_.html#account","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":8,"kind":64,"name":"cToken","url":"modules/_api_.html#ctoken","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":9,"kind":64,"name":"marketHistory","url":"modules/_api_.html#markethistory","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":10,"kind":64,"name":"governance","url":"modules/_api_.html#governance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":11,"kind":1,"name":"\"eth\"","url":"modules/_eth_.html","classes":"tsd-kind-module"},{"id":12,"kind":64,"name":"read","url":"modules/_eth_.html#read","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":13,"kind":64,"name":"trx","url":"modules/_eth_.html#trx","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":14,"kind":64,"name":"getBalance","url":"modules/_eth_.html#getbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":15,"kind":1,"name":"\"helpers\"","url":"modules/_helpers_.html","classes":"tsd-kind-module"},{"id":16,"kind":1,"name":"\"cToken\"","url":"modules/_ctoken_.html","classes":"tsd-kind-module"},{"id":17,"kind":64,"name":"supply","url":"modules/_ctoken_.html#supply","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":18,"kind":64,"name":"redeem","url":"modules/_ctoken_.html#redeem","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":19,"kind":64,"name":"borrow","url":"modules/_ctoken_.html#borrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":20,"kind":64,"name":"repayBorrow","url":"modules/_ctoken_.html#repayborrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":21,"kind":1,"name":"\"comp\"","url":"modules/_comp_.html","classes":"tsd-kind-module"},{"id":22,"kind":64,"name":"toChecksumAddress","url":"modules/_comp_.html#tochecksumaddress","classes":"tsd-kind-function tsd-parent-kind-module tsd-is-not-exported","parent":"\"comp\""},{"id":23,"kind":64,"name":"getCompBalance","url":"modules/_comp_.html#getcompbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":24,"kind":64,"name":"getCompAccrued","url":"modules/_comp_.html#getcompaccrued","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":25,"kind":64,"name":"claimComp","url":"modules/_comp_.html#claimcomp","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":26,"kind":64,"name":"delegate","url":"modules/_comp_.html#delegate","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":27,"kind":64,"name":"delegateBySig","url":"modules/_comp_.html#delegatebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":28,"kind":64,"name":"createDelegateSignature","url":"modules/_comp_.html#createdelegatesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":29,"kind":1,"name":"\"comptroller\"","url":"modules/_comptroller_.html","classes":"tsd-kind-module"},{"id":30,"kind":64,"name":"enterMarkets","url":"modules/_comptroller_.html#entermarkets","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":31,"kind":64,"name":"exitMarket","url":"modules/_comptroller_.html#exitmarket","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":32,"kind":1,"name":"\"gov\"","url":"modules/_gov_.html","classes":"tsd-kind-module"},{"id":33,"kind":64,"name":"castVote","url":"modules/_gov_.html#castvote","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":34,"kind":64,"name":"castVoteBySig","url":"modules/_gov_.html#castvotebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":35,"kind":64,"name":"createVoteSignature","url":"modules/_gov_.html#createvotesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":36,"kind":1,"name":"\"priceFeed\"","url":"modules/_pricefeed_.html","classes":"tsd-kind-module"},{"id":37,"kind":64,"name":"getPrice","url":"modules/_pricefeed_.html#getprice","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"priceFeed\""},{"id":38,"kind":1,"name":"\"index\"","url":"modules/_index_.html","classes":"tsd-kind-module"},{"id":39,"kind":64,"name":"Compound","url":"modules/_index_.html#compound","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"index\""}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,33.081]],["parent/0",[]],["name/1",[1,33.081]],["parent/1",[]],["name/2",[2,22.095]],["parent/2",[]],["name/3",[3,33.081]],["parent/3",[2,1.88]],["name/4",[4,33.081]],["parent/4",[2,1.88]],["name/5",[5,33.081]],["parent/5",[2,1.88]],["name/6",[6,20.088]],["parent/6",[]],["name/7",[7,33.081]],["parent/7",[6,1.709]],["name/8",[8,18.418]],["parent/8",[6,1.709]],["name/9",[9,33.081]],["parent/9",[6,1.709]],["name/10",[10,33.081]],["parent/10",[6,1.709]],["name/11",[11,22.095]],["parent/11",[]],["name/12",[12,33.081]],["parent/12",[11,1.88]],["name/13",[13,33.081]],["parent/13",[11,1.88]],["name/14",[14,33.081]],["parent/14",[11,1.88]],["name/15",[15,33.081]],["parent/15",[]],["name/16",[8,18.418]],["parent/16",[]],["name/17",[16,33.081]],["parent/17",[8,1.567]],["name/18",[17,33.081]],["parent/18",[8,1.567]],["name/19",[18,33.081]],["parent/19",[8,1.567]],["name/20",[19,33.081]],["parent/20",[8,1.567]],["name/21",[20,15.735]],["parent/21",[]],["name/22",[21,33.081]],["parent/22",[20,1.339]],["name/23",[22,33.081]],["parent/23",[20,1.339]],["name/24",[23,33.081]],["parent/24",[20,1.339]],["name/25",[24,33.081]],["parent/25",[20,1.339]],["name/26",[25,33.081]],["parent/26",[20,1.339]],["name/27",[26,33.081]],["parent/27",[20,1.339]],["name/28",[27,33.081]],["parent/28",[20,1.339]],["name/29",[28,24.608]],["parent/29",[]],["name/30",[29,33.081]],["parent/30",[28,2.094]],["name/31",[30,33.081]],["parent/31",[28,2.094]],["name/32",[31,22.095]],["parent/32",[]],["name/33",[32,33.081]],["parent/33",[31,1.88]],["name/34",[33,33.081]],["parent/34",[31,1.88]],["name/35",[34,33.081]],["parent/35",[31,1.88]],["name/36",[35,27.973]],["parent/36",[]],["name/37",[36,33.081]],["parent/37",[35,2.38]],["name/38",[37,27.973]],["parent/38",[]],["name/39",[38,33.081]],["parent/39",[37,2.38]]],"invertedIndex":[["account",{"_index":7,"name":{"7":{}},"parent":{}}],["api",{"_index":6,"name":{"6":{}},"parent":{"7":{},"8":{},"9":{},"10":{}}}],["borrow",{"_index":18,"name":{"19":{}},"parent":{}}],["castvote",{"_index":32,"name":{"33":{}},"parent":{}}],["castvotebysig",{"_index":33,"name":{"34":{}},"parent":{}}],["claimcomp",{"_index":24,"name":{"25":{}},"parent":{}}],["comp",{"_index":20,"name":{"21":{}},"parent":{"22":{},"23":{},"24":{},"25":{},"26":{},"27":{},"28":{}}}],["compound",{"_index":38,"name":{"39":{}},"parent":{}}],["comptroller",{"_index":28,"name":{"29":{}},"parent":{"30":{},"31":{}}}],["constants",{"_index":1,"name":{"1":{}},"parent":{}}],["createdelegatesignature",{"_index":27,"name":{"28":{}},"parent":{}}],["createvotesignature",{"_index":34,"name":{"35":{}},"parent":{}}],["ctoken",{"_index":8,"name":{"8":{},"16":{}},"parent":{"17":{},"18":{},"19":{},"20":{}}}],["delegate",{"_index":25,"name":{"26":{}},"parent":{}}],["delegatebysig",{"_index":26,"name":{"27":{}},"parent":{}}],["eip712",{"_index":0,"name":{"0":{}},"parent":{}}],["entermarkets",{"_index":29,"name":{"30":{}},"parent":{}}],["eth",{"_index":11,"name":{"11":{}},"parent":{"12":{},"13":{},"14":{}}}],["exitmarket",{"_index":30,"name":{"31":{}},"parent":{}}],["getabi",{"_index":4,"name":{"4":{}},"parent":{}}],["getaddress",{"_index":3,"name":{"3":{}},"parent":{}}],["getbalance",{"_index":14,"name":{"14":{}},"parent":{}}],["getcompaccrued",{"_index":23,"name":{"24":{}},"parent":{}}],["getcompbalance",{"_index":22,"name":{"23":{}},"parent":{}}],["getnetnamewithchainid",{"_index":5,"name":{"5":{}},"parent":{}}],["getprice",{"_index":36,"name":{"37":{}},"parent":{}}],["gov",{"_index":31,"name":{"32":{}},"parent":{"33":{},"34":{},"35":{}}}],["governance",{"_index":10,"name":{"10":{}},"parent":{}}],["helpers",{"_index":15,"name":{"15":{}},"parent":{}}],["index",{"_index":37,"name":{"38":{}},"parent":{"39":{}}}],["markethistory",{"_index":9,"name":{"9":{}},"parent":{}}],["pricefeed",{"_index":35,"name":{"36":{}},"parent":{"37":{}}}],["read",{"_index":12,"name":{"12":{}},"parent":{}}],["redeem",{"_index":17,"name":{"18":{}},"parent":{}}],["repayborrow",{"_index":19,"name":{"20":{}},"parent":{}}],["supply",{"_index":16,"name":{"17":{}},"parent":{}}],["tochecksumaddress",{"_index":21,"name":{"22":{}},"parent":{}}],["trx",{"_index":13,"name":{"13":{}},"parent":{}}],["util",{"_index":2,"name":{"2":{}},"parent":{"3":{},"4":{},"5":{}}}]],"pipeline":[]}} \ No newline at end of file +{"kinds":{"1":"Module","64":"Function"},"rows":[{"id":0,"kind":1,"name":"\"types/index\"","url":"modules/_types_index_.html","classes":"tsd-kind-module"},{"id":1,"kind":1,"name":"\"EIP712\"","url":"modules/_eip712_.html","classes":"tsd-kind-module"},{"id":2,"kind":1,"name":"\"constants\"","url":"modules/_constants_.html","classes":"tsd-kind-module"},{"id":3,"kind":1,"name":"\"util\"","url":"modules/_util_.html","classes":"tsd-kind-module"},{"id":4,"kind":64,"name":"getAddress","url":"modules/_util_.html#getaddress","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":5,"kind":64,"name":"getAbi","url":"modules/_util_.html#getabi","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":6,"kind":64,"name":"getNetNameWithChainId","url":"modules/_util_.html#getnetnamewithchainid","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":7,"kind":1,"name":"\"api\"","url":"modules/_api_.html","classes":"tsd-kind-module"},{"id":8,"kind":64,"name":"account","url":"modules/_api_.html#account","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":9,"kind":64,"name":"cToken","url":"modules/_api_.html#ctoken","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":10,"kind":64,"name":"vToken","url":"modules/_api_.html#vtoken","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":11,"kind":64,"name":"marketHistory","url":"modules/_api_.html#markethistory","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":12,"kind":64,"name":"governance","url":"modules/_api_.html#governance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":13,"kind":1,"name":"\"eth\"","url":"modules/_eth_.html","classes":"tsd-kind-module"},{"id":14,"kind":64,"name":"read","url":"modules/_eth_.html#read","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":15,"kind":64,"name":"trx","url":"modules/_eth_.html#trx","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":16,"kind":64,"name":"getBalance","url":"modules/_eth_.html#getbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":17,"kind":1,"name":"\"helpers\"","url":"modules/_helpers_.html","classes":"tsd-kind-module"},{"id":18,"kind":1,"name":"\"cToken\"","url":"modules/_ctoken_.html","classes":"tsd-kind-module"},{"id":19,"kind":64,"name":"supply","url":"modules/_ctoken_.html#supply","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":20,"kind":64,"name":"redeem","url":"modules/_ctoken_.html#redeem","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":21,"kind":64,"name":"borrow","url":"modules/_ctoken_.html#borrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":22,"kind":64,"name":"repayBorrow","url":"modules/_ctoken_.html#repayborrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":23,"kind":1,"name":"\"comp\"","url":"modules/_comp_.html","classes":"tsd-kind-module"},{"id":24,"kind":64,"name":"toChecksumAddress","url":"modules/_comp_.html#tochecksumaddress","classes":"tsd-kind-function tsd-parent-kind-module tsd-is-not-exported","parent":"\"comp\""},{"id":25,"kind":64,"name":"getVenusBalance","url":"modules/_comp_.html#getvenusbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":26,"kind":64,"name":"getVenusAccrued","url":"modules/_comp_.html#getvenusaccrued","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":27,"kind":64,"name":"claimVenus","url":"modules/_comp_.html#claimvenus","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":28,"kind":64,"name":"delegate","url":"modules/_comp_.html#delegate","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":29,"kind":64,"name":"delegateBySig","url":"modules/_comp_.html#delegatebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":30,"kind":64,"name":"createDelegateSignature","url":"modules/_comp_.html#createdelegatesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":31,"kind":1,"name":"\"comptroller\"","url":"modules/_comptroller_.html","classes":"tsd-kind-module"},{"id":32,"kind":64,"name":"enterMarkets","url":"modules/_comptroller_.html#entermarkets","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":33,"kind":64,"name":"exitMarket","url":"modules/_comptroller_.html#exitmarket","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":34,"kind":1,"name":"\"gov\"","url":"modules/_gov_.html","classes":"tsd-kind-module"},{"id":35,"kind":64,"name":"castVote","url":"modules/_gov_.html#castvote","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":36,"kind":64,"name":"castVoteBySig","url":"modules/_gov_.html#castvotebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":37,"kind":64,"name":"createVoteSignature","url":"modules/_gov_.html#createvotesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":38,"kind":1,"name":"\"priceFeed\"","url":"modules/_pricefeed_.html","classes":"tsd-kind-module"},{"id":39,"kind":64,"name":"getPrice","url":"modules/_pricefeed_.html#getprice","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"priceFeed\""},{"id":40,"kind":1,"name":"\"index\"","url":"modules/_index_.html","classes":"tsd-kind-module"},{"id":41,"kind":64,"name":"Venus","url":"modules/_index_.html#venus","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"index\""}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,33.557]],["parent/0",[]],["name/1",[1,33.557]],["parent/1",[]],["name/2",[2,33.557]],["parent/2",[]],["name/3",[3,22.571]],["parent/3",[]],["name/4",[4,33.557]],["parent/4",[3,1.907]],["name/5",[5,33.557]],["parent/5",[3,1.907]],["name/6",[6,33.557]],["parent/6",[3,1.907]],["name/7",[7,18.894]],["parent/7",[]],["name/8",[8,33.557]],["parent/8",[7,1.597]],["name/9",[9,18.894]],["parent/9",[7,1.597]],["name/10",[10,33.557]],["parent/10",[7,1.597]],["name/11",[11,33.557]],["parent/11",[7,1.597]],["name/12",[12,33.557]],["parent/12",[7,1.597]],["name/13",[13,22.571]],["parent/13",[]],["name/14",[14,33.557]],["parent/14",[13,1.907]],["name/15",[15,33.557]],["parent/15",[13,1.907]],["name/16",[16,33.557]],["parent/16",[13,1.907]],["name/17",[17,33.557]],["parent/17",[]],["name/18",[9,18.894]],["parent/18",[]],["name/19",[18,33.557]],["parent/19",[9,1.597]],["name/20",[19,33.557]],["parent/20",[9,1.597]],["name/21",[20,33.557]],["parent/21",[9,1.597]],["name/22",[21,33.557]],["parent/22",[9,1.597]],["name/23",[22,16.211]],["parent/23",[]],["name/24",[23,33.557]],["parent/24",[22,1.37]],["name/25",[24,33.557]],["parent/25",[22,1.37]],["name/26",[25,33.557]],["parent/26",[22,1.37]],["name/27",[26,33.557]],["parent/27",[22,1.37]],["name/28",[27,33.557]],["parent/28",[22,1.37]],["name/29",[28,33.557]],["parent/29",[22,1.37]],["name/30",[29,33.557]],["parent/30",[22,1.37]],["name/31",[30,25.084]],["parent/31",[]],["name/32",[31,33.557]],["parent/32",[30,2.12]],["name/33",[32,33.557]],["parent/33",[30,2.12]],["name/34",[33,22.571]],["parent/34",[]],["name/35",[34,33.557]],["parent/35",[33,1.907]],["name/36",[35,33.557]],["parent/36",[33,1.907]],["name/37",[36,33.557]],["parent/37",[33,1.907]],["name/38",[37,28.449]],["parent/38",[]],["name/39",[38,33.557]],["parent/39",[37,2.404]],["name/40",[39,28.449]],["parent/40",[]],["name/41",[40,33.557]],["parent/41",[39,2.404]]],"invertedIndex":[["account",{"_index":8,"name":{"8":{}},"parent":{}}],["api",{"_index":7,"name":{"7":{}},"parent":{"8":{},"9":{},"10":{},"11":{},"12":{}}}],["borrow",{"_index":20,"name":{"21":{}},"parent":{}}],["castvote",{"_index":34,"name":{"35":{}},"parent":{}}],["castvotebysig",{"_index":35,"name":{"36":{}},"parent":{}}],["claimvenus",{"_index":26,"name":{"27":{}},"parent":{}}],["comp",{"_index":22,"name":{"23":{}},"parent":{"24":{},"25":{},"26":{},"27":{},"28":{},"29":{},"30":{}}}],["comptroller",{"_index":30,"name":{"31":{}},"parent":{"32":{},"33":{}}}],["constants",{"_index":2,"name":{"2":{}},"parent":{}}],["createdelegatesignature",{"_index":29,"name":{"30":{}},"parent":{}}],["createvotesignature",{"_index":36,"name":{"37":{}},"parent":{}}],["ctoken",{"_index":9,"name":{"9":{},"18":{}},"parent":{"19":{},"20":{},"21":{},"22":{}}}],["delegate",{"_index":27,"name":{"28":{}},"parent":{}}],["delegatebysig",{"_index":28,"name":{"29":{}},"parent":{}}],["eip712",{"_index":1,"name":{"1":{}},"parent":{}}],["entermarkets",{"_index":31,"name":{"32":{}},"parent":{}}],["eth",{"_index":13,"name":{"13":{}},"parent":{"14":{},"15":{},"16":{}}}],["exitmarket",{"_index":32,"name":{"33":{}},"parent":{}}],["getabi",{"_index":5,"name":{"5":{}},"parent":{}}],["getaddress",{"_index":4,"name":{"4":{}},"parent":{}}],["getbalance",{"_index":16,"name":{"16":{}},"parent":{}}],["getnetnamewithchainid",{"_index":6,"name":{"6":{}},"parent":{}}],["getprice",{"_index":38,"name":{"39":{}},"parent":{}}],["getvenusaccrued",{"_index":25,"name":{"26":{}},"parent":{}}],["getvenusbalance",{"_index":24,"name":{"25":{}},"parent":{}}],["gov",{"_index":33,"name":{"34":{}},"parent":{"35":{},"36":{},"37":{}}}],["governance",{"_index":12,"name":{"12":{}},"parent":{}}],["helpers",{"_index":17,"name":{"17":{}},"parent":{}}],["index",{"_index":39,"name":{"40":{}},"parent":{"41":{}}}],["markethistory",{"_index":11,"name":{"11":{}},"parent":{}}],["pricefeed",{"_index":37,"name":{"38":{}},"parent":{"39":{}}}],["read",{"_index":14,"name":{"14":{}},"parent":{}}],["redeem",{"_index":19,"name":{"20":{}},"parent":{}}],["repayborrow",{"_index":21,"name":{"22":{}},"parent":{}}],["supply",{"_index":18,"name":{"19":{}},"parent":{}}],["tochecksumaddress",{"_index":23,"name":{"24":{}},"parent":{}}],["trx",{"_index":15,"name":{"15":{}},"parent":{}}],["types/index",{"_index":0,"name":{"0":{}},"parent":{}}],["util",{"_index":3,"name":{"3":{}},"parent":{"4":{},"5":{},"6":{}}}],["venus",{"_index":40,"name":{"41":{}},"parent":{}}],["vtoken",{"_index":10,"name":{"10":{}},"parent":{}}]],"pipeline":[]}} \ No newline at end of file diff --git a/docs/globals.html b/docs/globals.html index 34fb0fb..d735c3c 100644 --- a/docs/globals.html +++ b/docs/globals.html @@ -3,8 +3,8 @@ - Compound.js - v0.1.2 - + Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1
    @@ -54,7 +54,7 @@ Globals -

    Compound.js - v0.1.2

    +

    Venus.js - v0.0.1

    @@ -79,6 +79,7 @@

    Modules

  • "helpers"
  • "index"
  • "priceFeed"
  • +
  • "types/index"
  • "util"
  • diff --git a/docs/index.html b/docs/index.html index e55031d..5fcc8b1 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,8 +3,8 @@ - Compound.js - v0.1.2 - + Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1
    @@ -54,7 +54,7 @@ Globals -

    Compound.js - v0.1.2

    +

    Venus.js - v0.0.1

    @@ -62,11 +62,11 @@

    Compound.js - v0.1.2

    - -

    Compound.js

    +
    +

    Venus.js

    -

    A JavaScript SDK for Ethereum and the Compound Protocol. Wraps around Ethers.js. Works in the web browser and Node.js.

    -

    Compound.js Documentation

    +

    A JavaScript SDK for Ethereum and the Venus Protocol. Wraps around Ethers.js. Works in the web browser and Node.js.

    +

    Venus.js Documentation

    This SDK is in open beta, and is constantly under development. USE AT YOUR OWN RISK.

    Ethereum Read & Write

    @@ -75,12 +75,12 @@

    Ethereum Read & Write

    Read

    -
    const Compound = require('@compound-finance/compound-js'); // in Node.js
    -const cUsdtAddress = Compound.util.getAddress(Compound.cUSDT);
    +				
    const Venus = require('@compound-finance/compound-js'); // in Node.js
    +const cUsdtAddress = Venus.util.getAddress(Venus.cUSDT);
     
     (async function() {
     
    -  let supplyRatePerBlock = await Compound.eth.read(
    +  let supplyRatePerBlock = await Venus.eth.read(
         cUsdtAddress,
         'function supplyRatePerBlock() returns (uint)',
         [], // [optional] parameters
    @@ -97,32 +97,32 @@ 

    Write

    (async function() { - const trx = await Compound.eth.trx( + const trx = await Venus.eth.trx( toAddress, 'function send() external payable', [], { - value: Compound._ethers.utils.parseEther('1.0'), // 1 ETH + value: Venus._ethers.utils.parseEther('1.0'), // 1 ETH provider: window.ethereum, // in a web browser } ); - const toAddressEthBalance = await Compound.eth.getBalance(toAddress); + const toAddressEthBalance = await Venus.eth.getBalance(toAddress); })().catch(console.error);
    - -

    Compound Protocol

    +
    +

    Venus Protocol

    -

    Simple methods for using the Compound protocol.

    -
    const compound = new Compound(window.ethereum); // in a web browser
    +				

    Simple methods for using the Venus protocol.

    +
    const compound = new Venus(window.ethereum); // in a web browser
     
     // Ethers.js overrides are an optional 3rd parameter for `supply`
     // const trxOptions = { gasLimit: 250000, mantissa: false };
     
     (async function() {
     
    -  console.log('Supplying ETH to the Compound protocol...');
    -  const trx = await compound.supply(Compound.ETH, 1);
    +  console.log('Supplying ETH to the Venus protocol...');
    +  const trx = await compound.supply(Venus.ETH, 1);
       console.log('Ethers.js transaction object', trx);
     
     })().catch(console.error);
    @@ -133,11 +133,15 @@

    Install / Import

    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@compound-finance/compound-js@latest/dist/browser/compound.min.js"></script>
     
     <script type="text/javascript">
    -  window.Compound; // or `Compound`
    +  window.Venus; // or `Venus`
     </script>

    Node.js

    npm install @compound-finance/compound-js
    -
    const Compound = require('@compound-finance/compound-js');
    +
    const Venus = require('@compound-finance/compound-js');
    +
    +// or, when using ES6
    +
    +import Venus from '@compound-finance/compound-js';

    More Code Examples

    @@ -150,41 +154,41 @@

    More Code Examples

    Instance Creation

    The following are valid Ethereum providers for initialization of the SDK.

    -
    var compound = new Compound(window.ethereum); // web browser
    +				
    var compound = new Venus(window.ethereum); // web browser
     
    -var compound = new Compound('http://127.0.0.1:8545'); // HTTP provider
    +var compound = new Venus('http://127.0.0.1:8545'); // HTTP provider
     
    -var compound = new Compound(); // Uses Ethers.js fallback mainnet (for testing only)
    +var compound = new Venus(); // Uses Ethers.js fallback mainnet (for testing only)
     
    -var compound = new Compound('ropsten'); // Uses Ethers.js fallback (for testing only)
    +var compound = new Venus('ropsten'); // Uses Ethers.js fallback (for testing only)
     
     // Init with private key (server side)
    -var compound = new Compound('https://mainnet.infura.io/v3/_your_project_id_', {
    +var compound = new Venus('https://mainnet.infura.io/v3/_your_project_id_', {
       privateKey: '0x_your_private_key_', // preferably with environment variable
     });
     
     // Init with HD mnemonic (server side)
    -var compound = new Compound('mainnet' {
    +var compound = new Venus('mainnet' {
       mnemonic: 'clutch captain shoe...', // preferably with environment variable
     });

    Constants and Contract Addresses

    Names of contracts, their addresses, ABIs, token decimals, and more can be found in /src/constants.ts. Addresses, for all networks, can be easily fetched using the getAddress function, combined with contract name constants.

    -
    console.log(Compound.DAI, Compound.ETH, Compound.cETH);
    +				
    console.log(Venus.DAI, Venus.ETH, Venus.cETH);
     // DAI, ETH, cETH
     
    -const cUsdtAddress = Compound.util.getAddress(Compound.cUSDT);
    +const cUsdtAddress = Venus.util.getAddress(Venus.cUSDT);
     // Mainnet cUSDT address. Second parameter can be a network like 'ropsten'.

    Mantissas

    Parameters of number values can be plain numbers or their scaled up mantissa values. There is a transaction option boolean to tell the SDK what the developer is passing.

    // 1 Dai
    -await compound.borrow(Compound.DAI, '1000000000000000000', { mantissa: true });
    +await compound.borrow(Venus.DAI, '1000000000000000000', { mantissa: true });
     
     // `mantissa` defaults to false if it is not specified or if an options object is not passed
    -await compound.borrow(Compound.DAI, 1, { mantissa: false });
    +await compound.borrow(Venus.DAI, 1, { mantissa: false });

    Transaction Options

    @@ -196,24 +200,24 @@

    Transaction Options

    provider, // JSON RPC string, Web3 object, or Ethers.js fallback network (string) network, // Ethers.js fallback network provider, "provider" has precedence over "network" from, // Address that the Ethereum transaction is send from - gasPrice, // Ethers.js override `Compound_ethers.utils.parseUnits('10.0', 'gwei')` + gasPrice, // Ethers.js override `Venus._ethers.utils.parseUnits('10.0', 'gwei')` gasLimit, // Ethers.js override - see https://docs.ethers.io/ethers.js/v5-beta/api-contract.html#overrides value, // Number or string data, // Number or string chainId, // Number nonce, // Number - privateKey, // String, meant to be used with `Compound.eth.trx` (server side) - mnemonic, // String, meant to be used with `Compound.eth.trx` (server side) + privateKey, // String, meant to be used with `Venus.eth.trx` (server side) + mnemonic, // String, meant to be used with `Venus.eth.trx` (server side) };

    API

    -

    The Compound API is accessible from Compound.js. The corresponding services are defined in the api namespace on the class.

    +

    The Venus API is accessible from Venus.js. The corresponding services are defined in the api namespace on the class.

      -
    • Compound.api.account
    • -
    • Compound.api.cToken
    • -
    • Compound.api.marketHistory
    • -
    • Compound.api.governance
    • +
    • Venus.api.account
    • +
    • Venus.api.cToken
    • +
    • Venus.api.marketHistory
    • +
    • Venus.api.governance

    The governance method requires a second parameter (string) for the corresponding endpoint shown in the documentation.

      @@ -223,7 +227,7 @@

      API

    Here is an example for using the account endpoint. The network parameter in the request body is optional and defaults to mainnet.

    const main = async () => {
    -  const account = await Compound.api.account({
    +  const account = await Venus.api.account({
         "addresses": "0xB61C5971d9c0472befceFfbE662555B78284c307",
         "network": "ropsten"
       });
    @@ -232,7 +236,7 @@ 

    API

    if (Object.isExtensible(account) && account.accounts) { account.accounts.forEach((acc) => { acc.tokens.forEach((tok) => { - if (tok.symbol === Compound.cDAI) { + if (tok.symbol === Venus.cDAI) { daiBorrowBalance = +tok.borrow_balance_underlying.value; } }); @@ -262,10 +266,10 @@

    Web Browser Build

    Node.js Build

    // Local build (do `npm install` first)
    -const Compound = require('./dist/nodejs/index.js');
    +const Venus = require('./dist/nodejs/index.js');
     
     // Public NPM build
    -const Compound = require('@compound-finance/compound-js');
    +const Venus = require('@compound-finance/compound-js');
    @@ -75,6 +75,7 @@

    Functions

  • cToken
  • governance
  • marketHistory
  • +
  • vToken
  • @@ -86,25 +87,25 @@

    Functions

    account

      -
    • account(options: object): Promise<unknown>
    • +
    • account(options: AccountServiceRequest): Promise<APIResponse>
    • Makes a request to the AccountService API. The Account API retrieves information for various accounts which have interacted with the protocol. - For more details, see the Compound API documentation.

      + For more details, see the Venus API documentation.

      example
      (async function() {
      -  const account = await Compound.api.account({
      +  const account = await Venus.api.account({
           "addresses": "0xB61C5971d9c0472befceFfbE662555B78284c307",
           "network": "ropsten"
         });
      @@ -113,7 +114,7 @@ 

      account

      if (Object.isExtensible(account) && account.accounts) { account.accounts.forEach((acc) => { acc.tokens.forEach((tok) => { - if (tok.symbol === Compound.cDAI) { + if (tok.symbol === Venus.cDAI) { daiBorrowBalance = +tok.borrow_balance_underlying.value; } }); @@ -128,13 +129,13 @@

      account

      Parameters

      • -
        options: object
        +
        options: AccountServiceRequest

        A JavaScript object of API request parameters.

      -

      Returns Promise<unknown>

      +

      Returns Promise<APIResponse>

      Returns the HTTP response body or error.

    @@ -143,26 +144,26 @@

    Returns Promise

    cToken

      -
    • cToken(options: object): Promise<unknown>
    • +
    • cToken(options: CTokenServiceRequest): Promise<APIResponse>
    • -

      Makes a request to the CTokenService API. The cToken API retrieves - information about cToken contract interaction. For more details, see the - Compound API documentation.

      +

      Makes a request to the CTokenService API. The vToken API retrieves + information about vToken contract interaction. For more details, see the + Venus API documentation.

      example
      (async function() {
      -  const cDaiData = await Compound.api.cToken({
      -    "addresses": Compound.util.getAddress(Compound.cDAI)
      +  const cDaiData = await Venus.api.cToken({
      +    "addresses": Venus.util.getAddress(Venus.cDAI)
         });
       
         console.log('cDaiData', cDaiData); // JavaScript Object
      @@ -173,13 +174,13 @@ 

      cToken

      Parameters

      • -
        options: object
        +
        options: CTokenServiceRequest

        A JavaScript object of API request parameters.

      -

      Returns Promise<unknown>

      +

      Returns Promise<APIResponse>

      Returns the HTTP response body or error.

    @@ -188,25 +189,25 @@

    Returns Promise

    governance

      -
    • governance(options: object, endpoint: string): Promise<unknown>
    • +
    • governance(options: GovernanceServiceRequest, endpoint: string): Promise<APIResponse>
    • Makes a request to the GovernanceService API. The Governance Service includes three endpoints to retrieve information about COMP accounts. For more - details, see the Compound API documentation.

      + details, see the Venus API documentation.

      example
      (async function() {
      -  const proposal = await Compound.api.governance(
      +  const proposal = await Venus.api.governance(
           { "proposal_ids": [ 20 ] }, 'proposals'
         );
       
      @@ -218,7 +219,7 @@ 

      governance

      Parameters

      • -
        options: object
        +
        options: GovernanceServiceRequest

        A JavaScript object of API request parameters.

        @@ -232,7 +233,7 @@
        endpoint: string
    -

    Returns Promise<unknown>

    +

    Returns Promise<APIResponse>

    Returns the HTTP response body or error.

    @@ -241,26 +242,26 @@

    Returns Promise

    marketHistory

      -
    • marketHistory(options: object): Promise<unknown>
    • +
    • marketHistory(options: MarketHistoryServiceRequest): Promise<APIResponse>
    • Makes a request to the MarketHistoryService API. The market history service - retrieves information about a market. For more details, see the Compound + retrieves information about a market. For more details, see the Venus API documentation.

      example
      (async function() {
      -  const cUsdcMarketData = await Compound.api.marketHistory({
      -    "asset": Compound.util.getAddress(Compound.cUSDC),
      +  const cUsdcMarketData = await Venus.api.marketHistory({
      +    "asset": Venus.util.getAddress(Venus.cUSDC),
           "min_block_timestamp": 1559339900,
           "max_block_timestamp": 1598320674,
           "num_buckets": 10,
      @@ -274,13 +275,58 @@ 

      marketHistory

      Parameters

      • -
        options: object
        +
        options: MarketHistoryServiceRequest

        A JavaScript object of API request parameters.

      -

      Returns Promise<unknown>

      +

      Returns Promise<APIResponse>

      +

      Returns the HTTP response body or error.

      +
    • +
    + +
    + +

    vToken

    +
      +
    • vToken(options: CTokenServiceRequest): Promise<APIResponse>
    • +
    +
      +
    • + +
      +
      +

      Makes a request to the CTokenService API. The vToken API retrieves + information about vToken contract interaction. For more details, see the + Venus API documentation.

      +
      +
      +
      example
      +
      (async function() {
      +  const cDaiData = await Venus.api.vToken({
      +    "addresses": Venus.util.getAddress(Venus.cDAI)
      +  });
      +
      +  console.log('cDaiData', cDaiData); // JavaScript Object
      +})().catch(console.error);
      +
      +
      +
      +

      Parameters

      +
        +
      • +
        options: CTokenServiceRequest
        +
        +

        A JavaScript object of API request parameters.

        +
        +
      • +
      +

      Returns Promise<APIResponse>

      Returns the HTTP response body or error.

    @@ -336,6 +382,9 @@

    Returns Promise marketHistory +
  • + vToken +
  • diff --git a/docs/modules/_comp_.html b/docs/modules/_comp_.html index 5ed205f..b1f8544 100644 --- a/docs/modules/_comp_.html +++ b/docs/modules/_comp_.html @@ -3,8 +3,8 @@ - "comp" | Compound.js - v0.1.2 - + "comp" | Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1
    @@ -71,12 +71,12 @@

    Index

    Functions

    @@ -86,30 +86,30 @@

    Functions

    Functions

    - -

    claimComp

    + +

    claimVenus

      -
    • claimComp(options?: any): Promise<any>
    • +
    • claimVenus(options?: CallOptions): Promise<TrxResponse>
    • -

      Create a transaction to claim accrued COMP tokens for the user.

      +

      Create a transaction to claim accrued VENUS tokens for the user.

      example
      -
      const compound = new Compound(window.ethereum);
      +									
      const venus = new Venus(window.ethereum);
       
       (async function() {
       
      -  console.log('Claiming COMP...');
      -  const trx = await compound.claimComp();
      +  console.log('Claiming Venus...');
      +  const trx = await venus.claimVenus();
         console.log('Ethers.js transaction object', trx);
       
       })().catch(console.error);
      @@ -119,10 +119,10 @@

      claimComp

      Parameters

      • -
        Default value options: any = {}
        +
        Default value options: CallOptions = {}
      -

      Returns Promise<any>

      +

      Returns Promise<TrxResponse>

      Returns an Ethers.js transaction object of the vote transaction.

    • @@ -132,28 +132,28 @@

      Returns Promise

      createDelegateSignature

        -
      • createDelegateSignature(delegatee: string, expiry?: number): Promise<any>
      • +
      • createDelegateSignature(delegatee: string, expiry?: number): Promise<Signature>
      • -

        Create a delegate signature for Compound Governance using EIP-712. The +

        Create a delegate signature for Venus Governance using EIP-712. The signature can be created without burning gas. Anyone can post it to the blockchain using the delegateBySig method, which does have gas costs.

        example
        -
        const compound = new Compound(window.ethereum);
        +									
        const venus = new Venus(window.ethereum);
         
         (async () => {
         
        -  const delegateSignature = await compound.createDelegateSignature('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A');
        +  const delegateSignature = await venus.createDelegateSignature('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A');
           console.log('delegateSignature', delegateSignature);
         
         })().catch(console.error);
        @@ -173,7 +173,7 @@
        delegatee: string
        Default value expiry: number = 10000000000
      -

      Returns Promise<any>

      +

      Returns Promise<Signature>

      Returns an object that contains the v, r, and s components of an Ethereum signature as hexadecimal strings.

      @@ -183,26 +183,26 @@

      Returns Promise

      delegate

        -
      • delegate(_address: string, options?: any): Promise<any>
      • +
      • delegate(_address: string, options?: CallOptions): Promise<TrxResponse>
      • -

        Create a transaction to delegate Compound Governance voting rights to an +

        Create a transaction to delegate Venus Governance voting rights to an address.

        example
        -
        const compound = new Compound(window.ethereum);
        +									
        const venus = new Venus(window.ethereum);
         
         (async function() {
        -  const delegateTx = await compound.delegate('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A');
        +  const delegateTx = await venus.delegate('0xa0df350d2637096571F7A701CBc1C5fdE30dF76A');
           console.log('Ethers.js transaction object', delegateTx);
         })().catch(console.error);
        @@ -217,10 +217,10 @@
        _address: string
      • -
        Default value options: any = {}
        +
        Default value options: CallOptions = {}
      -

      Returns Promise<any>

      +

      Returns Promise<TrxResponse>

      Returns an Ethers.js transaction object of the vote transaction.

      @@ -230,25 +230,25 @@

      Returns Promise

      delegateBySig

        -
      • delegateBySig(_address: string, nonce: number, expiry: number, signature?: any, options?: any): Promise<any>
      • +
      • delegateBySig(_address: string, nonce: number, expiry: number, signature?: Signature, options?: CallOptions): Promise<TrxResponse>
      • -

        Delegate voting rights in Compound Governance using an EIP-712 signature.

        +

        Delegate voting rights in Venus Governance using an EIP-712 signature.

        example
        -
        const compound = new Compound(window.ethereum);
        +									
        const venus = new Venus(window.ethereum);
         
         (async function() {
        -  const delegateTx = await compound.delegateBySig(
        +  const delegateTx = await venus.delegateBySig(
             '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A',
             42,
             9999999999,
        @@ -275,7 +275,7 @@ 
        _address: string
        nonce: number

        The contract state required to match the signature. - This can be retrieved from the COMP contract's public nonces mapping.

        + This can be retrieved from the VENUS contract's public nonces mapping.

      • @@ -286,43 +286,43 @@
        expiry: number

  • -
    Default value signature: any = {}
    +
    Default value signature: Signature = { v: '', r: '', s: '' }

    An object that contains the v, r, and, s values of an EIP-712 signature.

  • -
    Default value options: any = {}
    +
    Default value options: CallOptions = {}
  • -

    Returns Promise<any>

    +

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the vote transaction.

    - -

    getCompAccrued

    + +

    getVenusAccrued

      -
    • getCompAccrued(_address: string, _provider?: string): Promise<any>
    • +
    • getVenusAccrued(_address: string, _provider?: Provider | string): Promise<string>
    • -

      Get the amount of COMP tokens accrued but not yet claimed by an address.

      +

      Get the amount of VENUS tokens accrued but not yet claimed by an address.

      example
      (async function () {
      -  const acc = await Compound.comp.getCompAccrued('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
      +  const acc = await Venus.venus.getVenusAccrued('0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5');
         console.log('Accrued', acc);
       })().catch(console.error);
      @@ -333,40 +333,40 @@

      Parameters

    • _address: string
      -

      The address in which to find the COMP accrued.

      +

      The address in which to find the VENUS accrued.

    • -
      Default value _provider: string = "mainnet"
      +
      Default value _provider: Provider | string = "mainnet"
    -

    Returns Promise<any>

    -

    Returns a string of the numeric accruement of COMP. The +

    Returns Promise<string>

    +

    Returns a string of the numeric accruement of VENUS. The value is scaled up by 18 decimal places.

    - -

    getCompBalance

    + +

    getVenusBalance

      -
    • getCompBalance(_address: string, _provider?: string): Promise<any>
    • +
    • getVenusBalance(_address: string, _provider?: Provider | string): Promise<string>
    • -

      Get the balance of COMP tokens held by an address.

      +

      Get the balance of VENUS tokens held by an address.

      example
      (async function () {
      -  const bal = await Compound.comp.getCompBalance('0x2775b1c75658Be0F640272CCb8c72ac986009e38');
      +  const bal = await Venus.venus.getVenusBalance('0x2775b1c75658Be0F640272CCb8c72ac986009e38');
         console.log('Balance', bal);
       })().catch(console.error);
      @@ -377,15 +377,15 @@

      Parameters

    • _address: string
      -

      The address in which to find the COMP balance.

      +

      The address in which to find the VENUS balance.

    • -
      Default value _provider: string = "mainnet"
      +
      Default value _provider: Provider | string = "mainnet"
    -

    Returns Promise<any>

    -

    Returns a string of the numeric balance of COMP. The value +

    Returns Promise<string>

    +

    Returns a string of the numeric balance of VENUS. The value is scaled up by 18 decimal places.

    @@ -400,7 +400,7 @@

    toChecksumAddress

  • @@ -462,7 +462,7 @@

    Returns string - Compound.js - v0.1.2 + Venus.js - v0.0.1

    @@ -84,25 +84,25 @@

    Functions

    enterMarkets

      -
    • enterMarkets(markets?: any, options?: any): Promise<any>
    • +
    • enterMarkets(markets?: string | string[], options?: CallOptions): Promise<TrxResponse>
    • -

      Enters the user's address into Compound Protocol markets.

      +

      Enters the user's address into Venus Protocol markets.

      example
      -
      const compound = new Compound(window.ethereum);
      +									
      const venus = new Venus(window.ethereum);
       
       (async function () {
      -  const trx = await compound.enterMarkets(Compound.ETH); // Use [] for multiple
      +  const trx = await venus.enterMarkets(Venus.SXP); // Use [] for multiple
         console.log('Ethers.js transaction object', trx);
       })().catch(console.error);
      @@ -111,17 +111,17 @@

      enterMarkets

      Parameters

      • -
        Default value markets: any = []
        +
        Default value markets: string | string[] = []

        An array of strings of markets to enter, meaning use those supplied assets as collateral.

      • -
        Default value options: any = {}
        +
        Default value options: CallOptions = {}
      -

      Returns Promise<any>

      +

      Returns Promise<TrxResponse>

      Returns an Ethers.js transaction object of the enterMarkets transaction.

    • @@ -131,25 +131,25 @@

      Returns Promise

      exitMarket

        -
      • exitMarket(market: string, options?: any): Promise<any>
      • +
      • exitMarket(market: string, options?: CallOptions): Promise<TrxResponse>
      • -

        Exits the user's address from a Compound Protocol market.

        +

        Exits the user's address from a Venus Protocol market.

        example
        -
        const compound = new Compound(window.ethereum);
        +									
        const venus = new Venus(window.ethereum);
         
         (async function () {
        -  const trx = await compound.exitMarket(Compound.ETH);
        +  const trx = await venus.exitMarket(Venus.SXP);
           console.log('Ethers.js transaction object', trx);
         })().catch(console.error);
        @@ -164,10 +164,10 @@
        market: string
      • -
        Default value options: any = {}
        +
        Default value options: CallOptions = {}
      -

      Returns Promise<any>

      +

      Returns Promise<TrxResponse>

      Returns an Ethers.js transaction object of the exitMarket transaction.

      diff --git a/docs/modules/_constants_.html b/docs/modules/_constants_.html index 465b6dc..6938f7f 100644 --- a/docs/modules/_constants_.html +++ b/docs/modules/_constants_.html @@ -3,8 +3,8 @@ - "constants" | Compound.js - v0.1.2 - + "constants" | Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
    • Preparing search index...
    • The search index is not available
    - Compound.js - v0.1.2 + Venus.js - v0.0.1
    diff --git a/docs/modules/_ctoken_.html b/docs/modules/_ctoken_.html index e8a28b1..b36dd8e 100644 --- a/docs/modules/_ctoken_.html +++ b/docs/modules/_ctoken_.html @@ -3,8 +3,8 @@ - "cToken" | Compound.js - v0.1.2 - + "cToken" | Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1
    @@ -86,32 +86,32 @@

    Functions

    borrow

      -
    • borrow(asset: string, amount: any, options?: any): Promise<any>
    • +
    • borrow(asset: string, amount: string | number | BigNumber, options?: CallOptions): Promise<TrxResponse>
    • -

      Borrows an Ethereum asset from the Compound Protocol for the user. The user's - address must first have supplied collateral and entered a corresponding - market.

      +

      Borrows an Binance Smart Chain asset from the Venus Protocol for the user. + The user's address must first have supplied collateral and entered a + corresponding market.

      example
      -
      const compound = new Compound(window.ethereum);
      +									
      const venus = new Venus(window.ethereum);
       
       (async function() {
       
      -  const daiScaledUp = '32000000000000000000';
      +  const sxpScaledUp = '32000000000000000000';
         const trxOptions = { mantissa: true };
       
      -  console.log('Borrowing 32 Dai...');
      -  const trx = await compound.borrow(Compound.DAI, daiScaledUp, trxOptions);
      +  console.log('Borrowing 32 SXP...');
      +  const trx = await venus.borrow(Venus.SXP, sxpScaledUp, trxOptions);
       
         console.log('Ethers.js transaction object', trx);
       
      @@ -129,7 +129,7 @@ 
      asset: string
    • -
      amount: any
      +
      amount: string | number | BigNumber

      A string, number, or BigNumber object of the amount of an asset to borrow. Use the mantissa boolean in @@ -138,10 +138,10 @@

      amount: any
    • -
      Default value options: any = {}
      +
      Default value options: CallOptions = {}
    -

    Returns Promise<any>

    +

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the borrow transaction.

    @@ -151,27 +151,27 @@

    Returns Promise

    redeem

      -
    • redeem(asset: string, amount: any, options?: any): Promise<any>
    • +
    • redeem(asset: string, amount: string | number | BigNumber, options?: CallOptions): Promise<TrxResponse>
    • -

      Redeems the user's Ethereum asset from the Compound Protocol.

      +

      Redeems the user's Binance Smart Chain asset from the Venus Protocol.

      example
      -
      const compound = new Compound(window.ethereum);
      +									
      const venus = new Venus(window.ethereum);
       
       (async function() {
       
      -  console.log('Redeeming ETH...');
      -  const trx = await compound.redeem(Compound.ETH, 1); // also accepts cToken args
      +  console.log('Redeeming SXP...');
      +  const trx = await venus.redeem(Venus.SXP, 1); // also accepts vToken args
         console.log('Ethers.js transaction object', trx);
       
       })().catch(console.error);
      @@ -183,24 +183,24 @@

      Parameters

    • asset: string
      -

      A string of the asset to redeem, or its cToken name.

      +

      A string of the asset to redeem, or its vToken name.

    • -
      amount: any
      +
      amount: string | number | BigNumber

      A string, number, or BigNumber object of the amount of an asset to redeem. Use the mantissa boolean in the options parameter to indicate if this value is scaled up (so there are no decimals) or in its natural scale. This can be an amount of - cTokens or underlying asset (use the asset parameter to specify).

      + vTokens or underlying asset (use the asset parameter to specify).

    • -
      Default value options: any = {}
      +
      Default value options: CallOptions = {}
    -

    Returns Promise<any>

    +

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the redeem transaction.

    @@ -210,29 +210,29 @@

    Returns Promise

    repayBorrow

      -
    • repayBorrow(asset: string, amount: any, borrower: string, options?: any): Promise<any>
    • +
    • repayBorrow(asset: string, amount: string | number | BigNumber, borrower: string, noApprove?: boolean, options?: CallOptions): Promise<TrxResponse>
    • -

      Repays a borrowed Ethereum asset for the user or on behalf of another - Ethereum address.

      +

      Repays a borrowed Binance Smart Chain asset for the user or on behalf of + another Binance Smart Chain address.

      example
      -
      const compound = new Compound(window.ethereum);
      +									
      const venus = new Venus(window.ethereum);
       
       (async function() {
       
      -  console.log('Repaying Dai borrow...');
      +  console.log('Repaying SXP borrow...');
         const address = null; // set this to any address to repayBorrowBehalf
      -  const trx = await compound.repayBorrow(Compound.DAI, 32, address);
      +  const trx = await venus.repayBorrow(Venus.SXP, 32, address);
       
         console.log('Ethers.js transaction object', trx);
       
      @@ -250,7 +250,7 @@ 
      asset: string
    • -
      amount: any
      +
      amount: string | number | BigNumber

      A string, number, or BigNumber object of the amount of an asset to borrow. Use the mantissa boolean in @@ -262,10 +262,18 @@

      amount: any
      borrower: string
    • -
      Default value options: any = {}
      +
      Default value noApprove: boolean = false
      +
      +

      Explicitly prevent this method from attempting an + ERC-20 approve transaction prior to sending the subsequent repayment + transaction.

      +
      +
    • +
    • +
      Default value options: CallOptions = {}
    -

    Returns Promise<any>

    +

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the repayBorrow or repayBorrowBehalf transaction.

    @@ -275,30 +283,30 @@

    Returns Promise

    supply

      -
    • supply(asset: string, amount: any, noApprove?: boolean, options?: any): Promise<any>
    • +
    • supply(asset: string, amount: string | number | BigNumber, noApprove?: boolean, options?: CallOptions): Promise<TrxResponse>
    • -

      Supplies the user's Ethereum asset to the Compound Protocol.

      +

      Supplies the user's Binance Smart Chain asset to the Venus Protocol.

      example
      -
      const compound = new Compound(window.ethereum);
      +									
      const venus = new Venus(window.ethereum);
       
       // Ethers.js overrides are an optional 3rd parameter for `supply`
       // const trxOptions = { gasLimit: 250000, mantissa: false };
       
       (async function() {
       
      -  console.log('Supplying ETH to the Compound Protocol...');
      -  const trx = await compound.supply(Compound.ETH, 1);
      +  console.log('Supplying SXP to the Venus Protocol...');
      +  const trx = await venus.supply(Venus.SXP, 1);
         console.log('Ethers.js transaction object', trx);
       
       })().catch(console.error);
      @@ -314,7 +322,7 @@
      asset: string
    • -
      amount: any
      +
      amount: string | number | BigNumber

      A string, number, or BigNumber object of the amount of an asset to supply. Use the mantissa boolean in @@ -326,14 +334,14 @@

      amount: any
      Default value noApprove: boolean = false

      Explicitly prevent this method from attempting an - ERC-20 approve transaction prior to sending the mint transaction.

      + BEP-20 approve transaction prior to sending the mint transaction.

    • -
      Default value options: any = {}
      +
      Default value options: CallOptions = {}
    -

    Returns Promise<any>

    +

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the supply transaction.

    diff --git a/docs/modules/_eip712_.html b/docs/modules/_eip712_.html index 7195741..d8776c0 100644 --- a/docs/modules/_eip712_.html +++ b/docs/modules/_eip712_.html @@ -3,8 +3,8 @@ - "EIP712" | Compound.js - v0.1.2 - + "EIP712" | Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1

    diff --git a/docs/modules/_eth_.html b/docs/modules/_eth_.html index 0fdb54e..9b7521e 100644 --- a/docs/modules/_eth_.html +++ b/docs/modules/_eth_.html @@ -3,8 +3,8 @@ - "eth" | Compound.js - v0.1.2 - + "eth" | Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1
    @@ -85,13 +85,13 @@

    Functions

    getBalance

      -
    • getBalance(address: string, provider: any): Promise<any>
    • +
    • getBalance(address: string, provider: Provider | string): Promise<string>
    • @@ -102,8 +102,8 @@

      getBalance

      example
      (async function () {
       
      -  balance = await Compound.eth.getBalance(myAddress, provider);
      -  console.log('My ETH Balance', +balance);
      +  balance = await Venus.eth.getBalance(myAddress, provider);
      +  console.log('My BNB Balance', +balance);
       
       })().catch(console.error);
      @@ -114,15 +114,15 @@

      Parameters

    • address: string
      -

      The Ethereum address in which to get the ETH balance.

      +

      The Ethereum address in which to get the BNB balance.

    • -
      provider: any
      +
      provider: Provider | string
    -

    Returns Promise<any>

    -

    Returns a BigNumber hexadecimal value of the ETH balance +

    Returns Promise<string>

    +

    Returns a BigNumber hexadecimal value of the BNB balance of the address.

    @@ -137,7 +137,7 @@

    read

  • @@ -150,18 +150,18 @@

    read

    example
    -
    const cEthAddress = Compound.util.getAddress(Compound.cETH);
    +									
    const vBnbAddress = Venus.util.getAddress(Venus.vBNB);
     
     (async function() {
     
    -  const srpb = await Compound.eth.read(
    -    cEthAddress,
    +  const srpb = await Venus.eth.read(
    +    vBnbAddress,
         'function supplyRatePerBlock() returns (uint256)',
         // [], // [optional] parameters
         // {}  // [optional] call options, provider, network, plus Ethers.js "overrides"
       );
     
    -  console.log('cETH market supply rate per block:', srpb.toString());
    +  console.log('vBNB market supply rate per block:', srpb.toString());
     
     })().catch(console.error);
    @@ -204,7 +204,7 @@

    trx

  • @@ -216,15 +216,15 @@

    trx

    example
    const oneEthInWei = '1000000000000000000';
    -const cEthAddress = '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5';
    +const vBnbAddress = '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5';
     const provider = window.ethereum;
     
     (async function() {
    -  console.log('Supplying ETH to the Compound Protocol...');
    +  console.log('Supplying BNB to the Venus Protocol...');
     
    -  // Mint some cETH by supplying ETH to the Compound Protocol
    -  const trx = await Compound.eth.trx(
    -    cEthAddress,
    +  // Mint some vBNB by supplying BNB to the Venus Protocol
    +  const trx = await Venus.eth.trx(
    +    vBnbAddress,
         'function mint() payable',
         [],
         {
    diff --git a/docs/modules/_gov_.html b/docs/modules/_gov_.html
    index e1460fc..eae915e 100644
    --- a/docs/modules/_gov_.html
    +++ b/docs/modules/_gov_.html
    @@ -3,8 +3,8 @@
     
     	
     	
    -	"gov" | Compound.js - v0.1.2
    -	
    +	"gov" | Venus.js - v0.0.1
    +	
     	
     	
     
    @@ -22,7 +22,7 @@
     						
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1
    @@ -85,25 +85,25 @@

    Functions

    castVote

      -
    • castVote(proposalId: number, support: boolean, options?: any): Promise<any>
    • +
    • castVote(proposalId: number, support: boolean, options?: CallOptions): Promise<TrxResponse>
    • -

      Submit a vote on a Compound Governance proposal.

      +

      Submit a vote on a Venus Governance proposal.

      example
      -
      const compound = new Compound(window.ethereum);
      +									
      const venus = new Venus(window.ethereum);
       
       (async function() {
      -  const castVoteTx = await compound.castVote(12, true);
      +  const castVoteTx = await venus.castVote(12, true);
         console.log('Ethers.js transaction object', castVoteTx);
       })().catch(console.error);
      @@ -126,10 +126,10 @@
      support: boolean
    • -
      Default value options: any = {}
      +
      Default value options: CallOptions = {}
    -

    Returns Promise<any>

    +

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the vote transaction.

  • @@ -139,25 +139,25 @@

    Returns Promise

    castVoteBySig

      -
    • castVoteBySig(proposalId: number, support: boolean, signature?: any, options?: any): Promise<any>
    • +
    • castVoteBySig(proposalId: number, support: boolean, signature: Signature, options?: CallOptions): Promise<TrxResponse>
    • -

      Submit a vote on a Compound Governance proposal using an EIP-712 signature.

      +

      Submit a vote on a Venus Governance proposal using an EIP-712 signature.

      example
      -
      const compound = new Compound(window.ethereum);
      +									
      const venus = new Venus(window.ethereum);
       
       (async function() {
      -  const castVoteTx = await compound.castVoteBySig(
      +  const castVoteTx = await venus.castVoteBySig(
           12,
           true,
           {
      @@ -188,17 +188,17 @@ 
      support: boolean
    • -
      Default value signature: any = {}
      +
      signature: Signature

      An object that contains the v, r, and, s values of an EIP-712 signature.

    • -
      Default value options: any = {}
      +
      Default value options: CallOptions = {}
    -

    Returns Promise<any>

    +

    Returns Promise<TrxResponse>

    Returns an Ethers.js transaction object of the vote transaction.

  • @@ -208,32 +208,32 @@

    Returns Promise

    createVoteSignature

      -
    • createVoteSignature(proposalId: number, support: boolean): Promise<any>
    • +
    • createVoteSignature(proposalId: number, support: boolean): Promise<Signature>
    • -

      Create a vote signature for a Compound Governance proposal using EIP-712. +

      Create a vote signature for a Venus Governance proposal using EIP-712. This can be used to create an 'empty ballot' without burning gas. The signature can then be sent to someone else to post to the blockchain. The recipient can post one signature using the castVoteBySig method.

      example
      -
      const compound = new Compound(window.ethereum);
      +									
      const venus = new Venus(window.ethereum);
       
       (async () => {
       
      -  const voteForSignature = await compound.createVoteSignature(20, true);
      +  const voteForSignature = await venus.createVoteSignature(20, true);
         console.log('voteForSignature', voteForSignature);
       
      -  const voteAgainstSignature = await compound.createVoteSignature(20, false);
      +  const voteAgainstSignature = await venus.createVoteSignature(20, false);
         console.log('voteAgainstSignature', voteAgainstSignature);
       
       })().catch(console.error);
      @@ -258,7 +258,7 @@
      support: boolean
    -

    Returns Promise<any>

    +

    Returns Promise<Signature>

    Returns an object that contains the v, r, and s components of an Ethereum signature as hexadecimal strings.

    diff --git a/docs/modules/_helpers_.html b/docs/modules/_helpers_.html index 026d211..977317f 100644 --- a/docs/modules/_helpers_.html +++ b/docs/modules/_helpers_.html @@ -3,8 +3,8 @@ - "helpers" | Compound.js - v0.1.2 - + "helpers" | Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1

    diff --git a/docs/modules/_index_.html b/docs/modules/_index_.html index 4c03d42..ac578b2 100644 --- a/docs/modules/_index_.html +++ b/docs/modules/_index_.html @@ -3,8 +3,8 @@ - "index" | Compound.js - v0.1.2 - + "index" | Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1
    @@ -71,7 +71,7 @@

    Index

    Functions

    @@ -80,39 +80,39 @@

    Functions

    Functions

    - -

    Const Export assignment Compound

    + +

    Const Export assignment Venus

      -
    • Compound(provider?: any, options?: any): any
    • +
    • Venus(provider?: Provider | string, options?: CompoundOptions): CompoundInstance
    • -

      Creates an instance of the Compound.js SDK.

      +

      Creates an instance of the Venus.js SDK.

      example
      -
      var compound = new Compound(window.ethereum); // web browser
      +									
      var venus = new Venus(window.ethereum); // web browser
       
      -var compound = new Compound('http://127.0.0.1:8545'); // HTTP provider
      +var venus = new Venus('http://127.0.0.1:8545'); // HTTP provider
       
      -var compound = new Compound(); // Uses Ethers.js fallback mainnet (for testing only)
      +var venus = new Venus(); // Uses Ethers.js fallback mainnet (for testing only)
       
      -var compound = new Compound('ropsten'); // Uses Ethers.js fallback (for testing only)
      +var venus = new Venus('ropsten'); // Uses Ethers.js fallback (for testing only)
       
       // Init with private key (server side)
      -var compound = new Compound('https://mainnet.infura.io/v3/_your_project_id_', {
      +var venus = new Venus('https://mainnet.infura.io/v3/_your_project_id_', {
         privateKey: '0x_your_private_key_', // preferably with environment variable
       });
       
       // Init with HD mnemonic (server side)
      -var compound = new Compound('mainnet' {
      +var venus = new Venus('mainnet' {
         mnemonic: 'clutch captain shoe...', // preferably with environment variable
       });
      @@ -121,14 +121,14 @@

      Const Parameters

      • -
        Default value provider: any = "mainnet"
        +
        Default value provider: Provider | string = "mainnet"
      • -
        Default value options: any = {}
        +
        Default value options: CompoundOptions = {}
      -

      Returns any

      -

      Returns an instance of the Compound.js SDK.

      +

      Returns CompoundInstance

      +

      Returns an instance of the Venus.js SDK.

    @@ -172,7 +172,7 @@

    Returns any diff --git a/docs/modules/_pricefeed_.html b/docs/modules/_pricefeed_.html index bcc9726..d80bf67 100644 --- a/docs/modules/_pricefeed_.html +++ b/docs/modules/_pricefeed_.html @@ -3,8 +3,8 @@ - "priceFeed" | Compound.js - v0.1.2 - + "priceFeed" | Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1

    @@ -83,13 +83,13 @@

    Functions

    getPrice

      -
    • getPrice(asset: string, inAsset?: string): Promise<any>
    • +
    • getPrice(asset: string, inAsset?: string): Promise<number>
    -

    Returns Promise<any>

    +

    Returns Promise<number>

    Returns a string of the numeric value of the asset.

    diff --git a/docs/modules/_types_index_.html b/docs/modules/_types_index_.html new file mode 100644 index 0000000..443d9a1 --- /dev/null +++ b/docs/modules/_types_index_.html @@ -0,0 +1,96 @@ + + + + + + "types/index" | Venus.js - v0.0.1 + + + + + +
    +
    +
    +
    + +
    +
    + Options +
    +
    + All +
      +
    • Public
    • +
    • Public/Protected
    • +
    • All
    • +
    +
    + + + + +
    +
    + Menu +
    +
    +
    +
    +
    +
    + +

    Module "types/index"

    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +

    Legend

    +
    +
      +
    • Function
    • +
    +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/docs/modules/_util_.html b/docs/modules/_util_.html index 881da0f..3cd0d59 100644 --- a/docs/modules/_util_.html +++ b/docs/modules/_util_.html @@ -3,8 +3,8 @@ - "util" | Compound.js - v0.1.2 - + "util" | Venus.js - v0.0.1 + @@ -22,7 +22,7 @@
  • Preparing search index...
  • The search index is not available
  • - Compound.js - v0.1.2 + Venus.js - v0.0.1
    @@ -85,13 +85,13 @@

    Functions

    getAbi

      -
    • getAbi(contract: string): any
    • +
    • getAbi(contract: string): AbiType[]
    -

    Returns any

    +

    Returns AbiType[]

    Returns the ABI of the contract as a JavaScript array.

    @@ -123,13 +123,13 @@

    Returns any

    getAddress

      -
    • getAddress(contract: string, network?: string): any
    • +
    • getAddress(contract: string, network?: string): string
    • @@ -155,7 +155,7 @@
      contract: string
      Default value network: string = "mainnet"
    -

    Returns any

    +

    Returns string

    Returns the address of the contract.

    @@ -164,13 +164,13 @@

    Returns any

    getNetNameWithChainId

      -
    • getNetNameWithChainId(chainId: number): any
    • +
    • getNetNameWithChainId(chainId: number): string
    -

    Returns any

    +

    Returns string

    Returns the name of the Ethereum network.

    diff --git a/examples/nodejs/borrow.js b/examples/nodejs/borrow.js index 348b5ba..12e39f0 100644 --- a/examples/nodejs/borrow.js +++ b/examples/nodejs/borrow.js @@ -1,5 +1,5 @@ /** - * Example of supplying ETH to the Compound protocol with Compound.js + * Example of supplying ETH to the Venus protocol with Venus.js * * Run ganache-cli in another command line window before running this script. Be * sure to fork mainnet. @@ -11,17 +11,17 @@ ganache-cli \ */ -const Compound = require('../../dist/nodejs/index.js'); +const Venus = require('../../dist/nodejs/index.js'); const myAddress = '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'; const privateKey = '0xb8c1b5c1d81f9475fdf2e334517d29f733bdfa40682207571b12fc1142cbf329'; const provider = 'http://localhost:8545'; -const compound = new Compound(provider, { privateKey }); +const venus = new Venus(provider, { privateKey }); const getDaiBalance = (address) => { - const daiAddress = Compound.util.getAddress(Compound.DAI); - return Compound.eth.read( + const daiAddress = Venus.util.getAddress(Venus.DAI); + return Venus.eth.read( daiAddress, 'function balanceOf(address) returns (uint256)', [ address ], @@ -35,18 +35,18 @@ const getDaiBalance = (address) => { console.log(`My Dai Balance: ${ (myDaiBalance / 1e18).toString() }`); console.log('Supplying 10 ETH...'); - const trx1 = await compound.supply(Compound.ETH, 10); + const trx1 = await venus.supply(Venus.ETH, 10); console.log('Entering ETH market (use as collateral)...'); - const trx2 = await compound.enterMarkets(Compound.ETH); // also accepts [] + const trx2 = await venus.enterMarkets(Venus.ETH); // also accepts [] console.log('Borrowing Dai against ETH...'); - const trx3 = await compound.borrow(Compound.DAI, 32, { gasLimit: 500000 }); + const trx3 = await venus.borrow(Venus.DAI, 32, { gasLimit: 500000 }); myDaiBalance = await getDaiBalance(myAddress); console.log(`My Dai Balance: ${ (myDaiBalance / 1e18).toString() }`); // Exit a market (string argument of only 1 market at a time) - // const trx = await compound.exitMarket(Compound.ETH); + // const trx = await venus.exitMarket(Venus.ETH); })().catch(console.error); diff --git a/examples/nodejs/eth_call.js b/examples/nodejs/eth_call.js index 4ecb7bd..0c0d945 100644 --- a/examples/nodejs/eth_call.js +++ b/examples/nodejs/eth_call.js @@ -1,11 +1,11 @@ -// Example of calling JSON RPC's eth_call with Compound.js -const Compound = require('../../dist/nodejs/index.js'); +// Example of calling JSON RPC's eth_call with Venus.js +const Venus = require('../../dist/nodejs/index.js'); -const cEthAddress = Compound.util.getAddress(Compound.cETH); +const cEthAddress = Venus.util.getAddress(Venus.cETH); (async function() { - const srpb = await Compound.eth.read( + const srpb = await Venus.eth.read( cEthAddress, 'function supplyRatePerBlock() returns (uint256)', // [], // [optional] parameters diff --git a/examples/nodejs/eth_sendTransaction.js b/examples/nodejs/eth_sendTransaction.js index 7808d0b..f29427b 100644 --- a/examples/nodejs/eth_sendTransaction.js +++ b/examples/nodejs/eth_sendTransaction.js @@ -1,5 +1,5 @@ /** - * Example of calling JSON RPC's eth_sendTransaction with Compound.js + * Example of calling JSON RPC's eth_sendTransaction with Venus.js * * Run ganache-cli in another command line window before running this script. Be * sure to fork mainnet. @@ -11,19 +11,19 @@ ganache-cli \ */ -const Compound = require('../../dist/nodejs/index.js'); +const Venus = require('../../dist/nodejs/index.js'); const oneEthInWei = '1000000000000000000'; -const cEthAddress = Compound.util.getAddress(Compound.cETH); +const cEthAddress = Venus.util.getAddress(Venus.cETH); const provider = 'http://localhost:8545'; const privateKey = '0xb8c1b5c1d81f9475fdf2e334517d29f733bdfa40682207571b12fc1142cbf329'; // const mnemonic = 'clutch captain shoe salt awake harvest setup primary inmate ugly among become'; (async function() { - console.log('Supplying ETH to the Compound Protocol...'); + console.log('Supplying ETH to the Venus Protocol...'); - // Mint some cETH by supplying ETH to the Compound Protocol - const trx = await Compound.eth.trx( + // Mint some cETH by supplying ETH to the Venus Protocol + const trx = await Venus.eth.trx( cEthAddress, 'function mint() payable', [], diff --git a/examples/nodejs/getAddress.js b/examples/nodejs/getAddress.js index 6037911..87da78f 100644 --- a/examples/nodejs/getAddress.js +++ b/examples/nodejs/getAddress.js @@ -1,9 +1,9 @@ -// Example of fetching a Compound protocol contract address with Compound.js -const Compound = require('../../dist/nodejs/index.js'); +// Example of fetching a Venus protocol contract address with Venus.js +const Venus = require('../../dist/nodejs/index.js'); -const batAddress = Compound.util.getAddress(Compound.BAT); -const cbatAddress = Compound.util.getAddress(Compound.cBAT); -const cEthAddressRopsten = Compound.util.getAddress(Compound.cETH, 'ropsten'); +const batAddress = Venus.util.getAddress(Venus.BAT); +const cbatAddress = Venus.util.getAddress(Venus.cBAT); +const cEthAddressRopsten = Venus.util.getAddress(Venus.cETH, 'ropsten'); console.log('BAT (mainnet)', batAddress); console.log('cBAT (mainnet)', cbatAddress); diff --git a/examples/nodejs/getPrice.js b/examples/nodejs/getPrice.js index 9279bfd..9b07a20 100644 --- a/examples/nodejs/getPrice.js +++ b/examples/nodejs/getPrice.js @@ -1,21 +1,21 @@ -// Example of fetching prices from the Compound protocol's open price feed using -// Compound.js -const Compound = require('../../dist/nodejs/index.js'); -const compound = new Compound(); +// Example of fetching prices from the Venus protocol's open price feed using +// Venus.js +const Venus = require('../../dist/nodejs/index.js'); +const venus = new Venus(); let price; (async function() { - price = await compound.getPrice(Compound.BAT); + price = await venus.getPrice(Venus.BAT); console.log('BAT in USDC', price); - price = await compound.getPrice(Compound.cBAT); + price = await venus.getPrice(Venus.cBAT); console.log('cBAT in USDC', price); - price = await compound.getPrice(Compound.BAT, Compound.cUSDC); + price = await venus.getPrice(Venus.BAT, Venus.cUSDC); console.log('BAT in cUSDC', price); - price = await compound.getPrice(Compound.BAT, Compound.ETH); + price = await venus.getPrice(Venus.BAT, Venus.ETH); console.log('BAT in ETH', price); })().catch(console.error); diff --git a/examples/nodejs/redeem.js b/examples/nodejs/redeem.js index a89fe88..65b8e3a 100644 --- a/examples/nodejs/redeem.js +++ b/examples/nodejs/redeem.js @@ -1,5 +1,5 @@ /** - * Example of redeeming ETH from the Compound protocol with Compound.js + * Example of redeeming ETH from the Venus protocol with Venus.js * * Run ganache-cli in another command line window before running this script. Be * sure to fork mainnet. @@ -11,22 +11,22 @@ ganache-cli \ */ -const Compound = require('../../dist/nodejs/index.js'); +const Venus = require('../../dist/nodejs/index.js'); const privateKey = '0xb8c1b5c1d81f9475fdf2e334517d29f733bdfa40682207571b12fc1142cbf329'; -const compound = new Compound('http://localhost:8545', { privateKey }); +const venus = new Venus('http://localhost:8545', { privateKey }); // Ethers.js overrides are an optional 3rd parameter for `supply` or `redeem` const trxOptions = { gasLimit: 250000, mantissa: false }; (async function() { - console.log('Supplying ETH to the Compound protocol...'); - const trx1 = await compound.supply(Compound.ETH, 1); + console.log('Supplying ETH to the Venus protocol...'); + const trx1 = await venus.supply(Venus.ETH, 1); console.log('Supply transaction: ', trx1); console.log('Redeeming ETH...'); - const trx2 = await compound.redeem(Compound.ETH, 1); // also accepts cToken args + const trx2 = await venus.redeem(Venus.ETH, 1); // also accepts cToken args console.log('Redeem transaction: ', trx2); })().catch(console.error); diff --git a/examples/nodejs/repayBorrow.js b/examples/nodejs/repayBorrow.js index dbfc0d2..fe3b4e0 100644 --- a/examples/nodejs/repayBorrow.js +++ b/examples/nodejs/repayBorrow.js @@ -1,5 +1,5 @@ /** - * Example of supplying ETH to the Compound protocol with Compound.js + * Example of supplying ETH to the Venus protocol with Venus.js * * Run ganache-cli in another command line window before running this script. Be * sure to fork mainnet. @@ -11,17 +11,17 @@ ganache-cli \ */ -const Compound = require('../../dist/nodejs/index.js'); +const Venus = require('../../dist/nodejs/index.js'); const myAddress = '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'; const privateKey = '0xb8c1b5c1d81f9475fdf2e334517d29f733bdfa40682207571b12fc1142cbf329'; const provider = 'http://localhost:8545'; -const compound = new Compound(provider, { privateKey }); +const venus = new Venus(provider, { privateKey }); const getDaiBalance = (address) => { - const daiAddress = Compound.util.getAddress(Compound.DAI); - return Compound.eth.read( + const daiAddress = Venus.util.getAddress(Venus.DAI); + return Venus.eth.read( daiAddress, 'function balanceOf(address) returns (uint256)', [ address ], @@ -35,20 +35,20 @@ const getDaiBalance = (address) => { console.log(`My Dai Balance: ${ (myDaiBalance / 1e18).toString() }`); console.log('Supplying 10 ETH...'); - const trx1 = await compound.supply(Compound.ETH, 10); + const trx1 = await venus.supply(Venus.ETH, 10); console.log('Entering ETH market (use as collateral)...'); - const trx2 = await compound.enterMarkets(Compound.ETH); + const trx2 = await venus.enterMarkets(Venus.ETH); console.log('Borrowing Dai against ETH...'); - const trx3 = await compound.borrow(Compound.DAI, 32, { gasLimit: 500000 }); + const trx3 = await venus.borrow(Venus.DAI, 32, { gasLimit: 500000 }); myDaiBalance = await getDaiBalance(myAddress); console.log(`My Dai Balance: ${ (myDaiBalance / 1e18).toString() }`); console.log('Repaying Dai borrow...'); const address = null; // set this to any address to repayBorrowBehalf - const trx4 = await compound.repayBorrow(Compound.DAI, 32, address, { gasLimit: 500000 }); + const trx4 = await venus.repayBorrow(Venus.DAI, 32, address, { gasLimit: 500000 }); myDaiBalance = await getDaiBalance(myAddress); console.log(`My Dai Balance: ${ (myDaiBalance / 1e18).toString() }`); diff --git a/examples/nodejs/supply.js b/examples/nodejs/supply.js index 0280149..cef0c5b 100644 --- a/examples/nodejs/supply.js +++ b/examples/nodejs/supply.js @@ -1,5 +1,5 @@ /** - * Example of supplying ETH to the Compound protocol with Compound.js + * Example of supplying ETH to the Venus protocol with Venus.js * * Run ganache-cli in another command line window before running this script. Be * sure to fork mainnet. @@ -11,18 +11,18 @@ ganache-cli \ */ -const Compound = require('../../dist/nodejs/index.js'); +const Venus = require('../../dist/nodejs/index.js'); const privateKey = '0xb8c1b5c1d81f9475fdf2e334517d29f733bdfa40682207571b12fc1142cbf329'; -const compound = new Compound('http://localhost:8545', { privateKey }); +const venus = new Venus('http://localhost:8545', { privateKey }); // Ethers.js overrides are an optional 3rd parameter for `supply` const trxOptions = { gasLimit: 250000, mantissa: false }; (async function() { - console.log('Supplying ETH to the Compound protocol...'); - const trx = await compound.supply(Compound.ETH, 1); + console.log('Supplying ETH to the Venus protocol...'); + const trx = await venus.supply(Venus.ETH, 1); console.log('Ethers.js transaction object', trx); })().catch(console.error); diff --git a/examples/web/index.html b/examples/web/index.html index 7d8d52d..cac9f41 100644 --- a/examples/web/index.html +++ b/examples/web/index.html @@ -34,13 +34,13 @@ @keyframes spin { to { -webkit-transform: rotate(360deg); } } @-webkit-keyframes spin { to { -webkit-transform: rotate(360deg); } } - Compound.js Examples + Venus.js Examples
    -

    Compound.js Examples [Alpha]

    +

    Venus.js Examples [Alpha]

    - Code examples for client interaction with the Compound protocol via Compound.js. + Code examples for client interaction with the Venus protocol via Venus.js.

      @@ -70,7 +70,7 @@

    Ethereum Read (JSON RPC eth_call)

    (async function() { - const srpb = await Compound.eth.read( + const srpb = await Venus.eth.read( cEthAddress, 'function supplyRatePerBlock() returns (uint256)', // [], // [optional] parameters @@ -86,7 +86,7 @@

    Ethereum Read (JSON RPC eth_call)

    Ethereum Send Transaction (JSON RPC eth_sendTransaction)

    -

    Create and send an Ethereum transaction with JSON RPC. This button's transaction transfers your Ether to the Compound protocol using the trx method.

    +

    Create and send an Ethereum transaction with JSON RPC. This button's transaction transfers your Ether to the Venus protocol using the trx method.


    @@ -95,10 +95,10 @@

    Ethereum Send Transaction (JSON RPC eth_sendTransaction)

    const provider = window.ethereum; (async function() { - console.log('Supplying ETH to the Compound Protocol...'); + console.log('Supplying ETH to the Venus Protocol...'); - // Mint some cETH by supplying ETH to the Compound Protocol - const trx = await Compound.eth.trx( + // Mint some cETH by supplying ETH to the Venus Protocol + const trx = await Venus.eth.trx( cEthAddress, 'function mint() payable', [], @@ -118,19 +118,19 @@

    Ethereum Send Transaction (JSON RPC eth_sendTransaction)

    Supply

    -

    This button's transaction transfers your Ether to the Compound protocol using the supply method.

    +

    This button's transaction transfers your Ether to the Venus protocol using the supply method.


    -
    const compound = new Compound(window.ethereum);
    +      
    const venus = new Venus(window.ethereum);
     
     // Ethers.js overrides are an optional 3rd parameter for `supply`
     // const trxOptions = { gasLimit: 250000, mantissa: false };
     
     (async function() {
     
    -  console.log('Supplying ETH to the Compound protocol...');
    -  const trx = await compound.supply(Compound.ETH, 1);
    +  console.log('Supplying ETH to the Venus protocol...');
    +  const trx = await venus.supply(Venus.ETH, 1);
       console.log('Ethers.js transaction object', trx);
     
     })().catch(console.error);
    @@ -140,16 +140,16 @@

    Supply

    Redeem

    -

    This button's transaction redeems your Ether from the Compound protocol using the redeem method.

    +

    This button's transaction redeems your Ether from the Venus protocol using the redeem method.


    -
    const compound = new Compound(window.ethereum);
    +      
    const venus = new Venus(window.ethereum);
     
     (async function() {
     
       console.log('Redeeming ETH...');
    -  const trx = await compound.redeem(Compound.ETH, 1); // also accepts cToken args
    +  const trx = await venus.redeem(Venus.ETH, 1); // also accepts cToken args
       console.log('Ethers.js transaction object', trx);
     
     })().catch(console.error);
    @@ -164,17 +164,17 @@ 

    Enter Markets


    -
    const compound = new Compound(window.ethereum);
    +      
    const venus = new Venus(window.ethereum);
     
     (async function() {
     
       console.log('Entering ETH market (use as collateral)...');
    -  const trx = await compound.enterMarkets(Compound.ETH); // also accepts []
    +  const trx = await venus.enterMarkets(Venus.ETH); // also accepts []
     
       console.log('Ethers.js transaction object', trx);
     
       // Exit a market (string argument of only 1 market at a time)
    -  // const trx = await compound.exitMarket(Compound.ETH);
    +  // const trx = await venus.exitMarket(Venus.ETH);
     
     })().catch(console.error);
    @@ -187,7 +187,7 @@

    Borrow


    -
    const compound = new Compound(window.ethereum);
    +      
    const venus = new Venus(window.ethereum);
     
     (async function() {
     
    @@ -195,7 +195,7 @@ 

    Borrow

    const trxOptions = { mantissa: true }; console.log('Borrowing 32 Dai...'); - const trx = await compound.borrow(Compound.DAI, daiScaledUp, trxOptions); + const trx = await venus.borrow(Venus.DAI, daiScaledUp, trxOptions); console.log('Ethers.js transaction object', trx); @@ -210,13 +210,13 @@

    Repay Borrow


    -
    const compound = new Compound(window.ethereum);
    +      
    const venus = new Venus(window.ethereum);
     
     (async function() {
     
       console.log('Repaying Dai borrow...');
       const address = null; // set this to any address to repayBorrowBehalf
    -  const trx = await compound.repayBorrow(Compound.DAI, 32, address);
    +  const trx = await venus.repayBorrow(Venus.DAI, 32, address);
     
       console.log('Ethers.js transaction object', trx);
     
    @@ -234,7 +234,7 @@ 

    Get Price

    (async function() {
     
       // Accepts 2 args, cTokens or underlyings. Second arg defaults to USDC.
    -  const price = await compound.getPrice(Compound.BAT);
    +  const price = await venus.getPrice(Venus.BAT);
       console.log('BAT in USDC', price);
     
     })().catch(console.error);
    @@ -249,7 +249,7 @@

    Get Address


    // Accepts cTokens or underlyings. Second arg defaults to main net.
    -const cEthAddressRopsten = Compound.util.getAddress(Compound.cETH, 'ropsten');
    +const cEthAddressRopsten = Venus.util.getAddress(Venus.cETH, 'ropsten');
      @@ -293,7 +293,7 @@

    Get Address

    (async function() { - const srpb = await Compound.eth.read( + const srpb = await Venus.eth.read( cEthAddress, 'function supplyRatePerBlock() returns (uint256)', // [], // [optional] parameters @@ -328,10 +328,10 @@

    Get Address

    const provider = window.ethereum; (async function() { - console.log('Supplying ETH to the Compound Protocol...'); + console.log('Supplying ETH to the Venus Protocol...'); - // Mint some cETH by supplying ETH to the Compound Protocol - const trx = await Compound.eth.trx( + // Mint some cETH by supplying ETH to the Venus Protocol + const trx = await Venus.eth.trx( cEthAddress, 'function mint() payable', [], @@ -366,15 +366,15 @@

    Get Address

    const supplyExample = () => { spin(supplyContent); - const compound = new Compound(window.ethereum); + const venus = new Venus(window.ethereum); // Ethers.js overrides are an optional 3rd parameter for `supply` // const trxOptions = { gasLimit: 250000, mantissa: false }; (async function() { - console.log('Supplying ETH to the Compound protocol...'); - const trx = await compound.supply(Compound.ETH, 1); + console.log('Supplying ETH to the Venus protocol...'); + const trx = await venus.supply(Venus.ETH, 1); supplyContent.innerText = 'Success, see the developer console for the Ethers.js transaction object.'; console.log('Ethers.js transaction object', trx); @@ -397,12 +397,12 @@

    Get Address

    const redeemExample = () => { spin(redeemContent); - const compound = new Compound(window.ethereum); + const venus = new Venus(window.ethereum); (async function() { console.log('Redeeming ETH...'); - const trx = await compound.redeem(Compound.ETH, 1); // also accepts cToken args + const trx = await venus.redeem(Venus.ETH, 1); // also accepts cToken args console.log('Ethers.js transaction object', trx); redeemContent.innerText = 'Success, see the developer console for the Ethers.js transaction object.'; @@ -426,17 +426,17 @@

    Get Address

    const enterMarketExample = () => { spin(enterMarketContent); - const compound = new Compound(window.ethereum); + const venus = new Venus(window.ethereum); (async function() { console.log('Entering ETH market (use as collateral)...'); - const trx = await compound.enterMarkets(Compound.ETH); // also accepts [] + const trx = await venus.enterMarkets(Venus.ETH); // also accepts [] console.log('Ethers.js transaction object', trx); // Exit a market (string parameter of only 1 market at a time) - // const trx = await compound.exitMarket(Compound.ETH); + // const trx = await venus.exitMarket(Venus.ETH); enterMarketContent.innerText = 'Success, see the developer console for the Ethers.js transaction object.'; @@ -460,7 +460,7 @@

    Get Address

    const borrowExample = () => { spin(borrowContent); - const compound = new Compound(window.ethereum); + const venus = new Venus(window.ethereum); (async function() { @@ -468,7 +468,7 @@

    Get Address

    const trxOptions = { mantissa: true }; console.log('Borrowing 32 Dai...'); - const trx = await compound.borrow(Compound.DAI, daiScaledUp, trxOptions); + const trx = await venus.borrow(Venus.DAI, daiScaledUp, trxOptions); borrowContent.innerText = 'Success, see the developer console for the Ethers.js transaction object.'; console.log('Ethers.js transaction object', trx); @@ -493,13 +493,13 @@

    Get Address

    const repayBorrowExample = () => { spin(repayBorrowContent); - const compound = new Compound(window.ethereum); + const venus = new Venus(window.ethereum); (async function() { console.log('Repaying Dai borrow...'); const address = null; // set this to any address to repayBorrowBehalf - const trx = await compound.repayBorrow(Compound.DAI, 32, address); + const trx = await venus.repayBorrow(Venus.DAI, 32, address); repayBorrowContent.innerText = 'Success, see the developer console for the Ethers.js transaction object.'; console.log('Ethers.js transaction object', trx); @@ -515,12 +515,12 @@

    Get Address

    const getPriceExample = () => { spin(getPriceContent); - const compound = new Compound(); + const venus = new Venus(); (async function() { // Accepts 2 args, cTokens or underlyings. Second arg defaults to USDC. - const price = await compound.getPrice(Compound.BAT); + const price = await venus.getPrice(Venus.BAT); console.log('BAT in USDC', price); getPriceContent.innerText = price.toString(); @@ -536,12 +536,12 @@

    Get Address

    const getAddressExample = () => { spin(getAddressContent); - const compound = new Compound(); + const venus = new Venus(); (async function() { // Accepts cTokens or underlyings. Second arg defaults to main net. - const cEthAddressRopsten = Compound.util.getAddress(Compound.cETH, 'ropsten'); + const cEthAddressRopsten = Venus.util.getAddress(Venus.cETH, 'ropsten'); getAddressContent.innerText = cEthAddressRopsten.toString(); diff --git a/scripts/compound-docs.js b/scripts/compound-docs.js index 2a28053..e47cecb 100644 --- a/scripts/compound-docs.js +++ b/scripts/compound-docs.js @@ -196,9 +196,9 @@ function getAllFilePaths(srcPath, resultPaths) { let intro = ''; intro += '
    \n\n'; -intro += '# Compound.js\n\n'; +intro += '# Venus.js\n\n'; intro += '## Introduction\n\n'; -intro += '[Compound.js](https://github.com/compound-finance/compound-js) is a '; +intro += '[Venus.js](https://github.com/SwipeWallet/venus-js) is a '; intro += 'JavaScript SDK for Ethereum and the Compound Protocol. It wraps '; intro += 'around Ethers.js, which is its only dependency. It is designed for '; intro += 'both the web browser and Node.js.\n\n'; diff --git a/src/helpers.ts b/src/helpers.ts index 0c1cac1..3b8f90d 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -2,14 +2,14 @@ import { CompoundInstance } from './types'; /** * This function acts like a decorator for all methods that interact with the - * blockchain. In order to use the correct Compound Protocol addresses, the - * Compound.js SDK must know which network its provider points to. This + * blockchain. In order to use the correct Venus Protocol addresses, the + * Venus.js SDK must know which network its provider points to. This * function holds up a transaction until the main constructor has determined * the network ID. * * @hidden * - * @param {Compound} _compound The instance of the Compound.js SDK. + * @param {Venus} _compound The instance of the Venus.js SDK. * */ export async function netId(_compound: CompoundInstance): Promise { diff --git a/typedoc.json b/typedoc.json index 5d490d7..4929369 100644 --- a/typedoc.json +++ b/typedoc.json @@ -5,5 +5,5 @@ "includeDeclarations": true, "hideGenerator": true, "includeVersion": true, - "name": "Compound.js" + "name": "Venus.js" } From e870a19d22c4409a155ce5d5a3e269fab464cb9d Mon Sep 17 00:00:00 2001 From: Zhao TengHu Date: Mon, 30 Nov 2020 05:32:05 +1000 Subject: [PATCH 06/20] Update examples and docs --- README.md | 16 +++--- docs/assets/js/search.json | 2 +- docs/index.html | 16 +++--- docs/modules/_api_.html | 77 +++++--------------------- docs/modules/_comp_.html | 14 ++--- docs/modules/_comptroller_.html | 4 +- docs/modules/_ctoken_.html | 8 +-- docs/modules/_eth_.html | 6 +- docs/modules/_gov_.html | 6 +- docs/modules/_index_.html | 2 +- docs/modules/_pricefeed_.html | 2 +- docs/modules/_util_.html | 6 +- examples/nodejs/eth_call.js | 6 +- examples/nodejs/eth_sendTransaction.js | 6 +- examples/nodejs/getAddress.js | 12 ++-- examples/nodejs/getPrice.js | 16 +++--- examples/web/index.html | 10 ++-- src/api.ts | 45 ++++----------- 18 files changed, 90 insertions(+), 164 deletions(-) diff --git a/README.md b/README.md index 4d96bf3..4ff5449 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A JavaScript SDK for Ethereum and the Venus Protocol. Wraps around [Ethers.js](https://github.com/ethers-io/ethers.js/). Works in the **web browser** and **Node.js**. -[Venus.js Documentation](https://compound.finance/docs/compound-js) +[Venus.js Documentation](https://docs927beta.venus.io) This SDK is in **open beta**, and is constantly under development. **USE AT YOUR OWN RISK**. @@ -14,7 +14,7 @@ JSON RPC based Ethereum **read** and **write**. ```js const Venus = require('@compound-finance/compound-js'); // in Node.js -const cUsdtAddress = Venus.util.getAddress(Venus.cUSDT); +const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT); (async function() { @@ -133,10 +133,10 @@ var compound = new Venus('mainnet' { Names of contracts, their addresses, ABIs, token decimals, and more can be found in `/src/constants.ts`. Addresses, for all networks, can be easily fetched using the `getAddress` function, combined with contract name constants. ```js -console.log(Venus.DAI, Venus.ETH, Venus.cETH); -// DAI, ETH, cETH +console.log(Venus.DAI, Venus.BNB, Venus.vSXP); +// DAI, BNB, vSXP -const cUsdtAddress = Venus.util.getAddress(Venus.cUSDT); +const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT); // Mainnet cUSDT address. Second parameter can be a network like 'ropsten'. ``` @@ -198,18 +198,18 @@ const main = async () => { "network": "ropsten" }); - let daiBorrowBalance = 0; + let sxpBorrowBalance = 0; if (Object.isExtensible(account) && account.accounts) { account.accounts.forEach((acc) => { acc.tokens.forEach((tok) => { - if (tok.symbol === Venus.cDAI) { + if (tok.symbol === Venus.vSXP) { daiBorrowBalance = +tok.borrow_balance_underlying.value; } }); }); } - console.log('daiBorrowBalance', daiBorrowBalance); + console.log('sxpBorrowBalance', sxpBorrowBalance); } main().catch(console.error); diff --git a/docs/assets/js/search.json b/docs/assets/js/search.json index 1de0512..d431613 100644 --- a/docs/assets/js/search.json +++ b/docs/assets/js/search.json @@ -1 +1 @@ -{"kinds":{"1":"Module","64":"Function"},"rows":[{"id":0,"kind":1,"name":"\"types/index\"","url":"modules/_types_index_.html","classes":"tsd-kind-module"},{"id":1,"kind":1,"name":"\"EIP712\"","url":"modules/_eip712_.html","classes":"tsd-kind-module"},{"id":2,"kind":1,"name":"\"constants\"","url":"modules/_constants_.html","classes":"tsd-kind-module"},{"id":3,"kind":1,"name":"\"util\"","url":"modules/_util_.html","classes":"tsd-kind-module"},{"id":4,"kind":64,"name":"getAddress","url":"modules/_util_.html#getaddress","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":5,"kind":64,"name":"getAbi","url":"modules/_util_.html#getabi","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":6,"kind":64,"name":"getNetNameWithChainId","url":"modules/_util_.html#getnetnamewithchainid","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":7,"kind":1,"name":"\"api\"","url":"modules/_api_.html","classes":"tsd-kind-module"},{"id":8,"kind":64,"name":"account","url":"modules/_api_.html#account","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":9,"kind":64,"name":"cToken","url":"modules/_api_.html#ctoken","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":10,"kind":64,"name":"vToken","url":"modules/_api_.html#vtoken","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":11,"kind":64,"name":"marketHistory","url":"modules/_api_.html#markethistory","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":12,"kind":64,"name":"governance","url":"modules/_api_.html#governance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":13,"kind":1,"name":"\"eth\"","url":"modules/_eth_.html","classes":"tsd-kind-module"},{"id":14,"kind":64,"name":"read","url":"modules/_eth_.html#read","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":15,"kind":64,"name":"trx","url":"modules/_eth_.html#trx","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":16,"kind":64,"name":"getBalance","url":"modules/_eth_.html#getbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":17,"kind":1,"name":"\"helpers\"","url":"modules/_helpers_.html","classes":"tsd-kind-module"},{"id":18,"kind":1,"name":"\"cToken\"","url":"modules/_ctoken_.html","classes":"tsd-kind-module"},{"id":19,"kind":64,"name":"supply","url":"modules/_ctoken_.html#supply","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":20,"kind":64,"name":"redeem","url":"modules/_ctoken_.html#redeem","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":21,"kind":64,"name":"borrow","url":"modules/_ctoken_.html#borrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":22,"kind":64,"name":"repayBorrow","url":"modules/_ctoken_.html#repayborrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":23,"kind":1,"name":"\"comp\"","url":"modules/_comp_.html","classes":"tsd-kind-module"},{"id":24,"kind":64,"name":"toChecksumAddress","url":"modules/_comp_.html#tochecksumaddress","classes":"tsd-kind-function tsd-parent-kind-module tsd-is-not-exported","parent":"\"comp\""},{"id":25,"kind":64,"name":"getVenusBalance","url":"modules/_comp_.html#getvenusbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":26,"kind":64,"name":"getVenusAccrued","url":"modules/_comp_.html#getvenusaccrued","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":27,"kind":64,"name":"claimVenus","url":"modules/_comp_.html#claimvenus","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":28,"kind":64,"name":"delegate","url":"modules/_comp_.html#delegate","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":29,"kind":64,"name":"delegateBySig","url":"modules/_comp_.html#delegatebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":30,"kind":64,"name":"createDelegateSignature","url":"modules/_comp_.html#createdelegatesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":31,"kind":1,"name":"\"comptroller\"","url":"modules/_comptroller_.html","classes":"tsd-kind-module"},{"id":32,"kind":64,"name":"enterMarkets","url":"modules/_comptroller_.html#entermarkets","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":33,"kind":64,"name":"exitMarket","url":"modules/_comptroller_.html#exitmarket","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":34,"kind":1,"name":"\"gov\"","url":"modules/_gov_.html","classes":"tsd-kind-module"},{"id":35,"kind":64,"name":"castVote","url":"modules/_gov_.html#castvote","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":36,"kind":64,"name":"castVoteBySig","url":"modules/_gov_.html#castvotebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":37,"kind":64,"name":"createVoteSignature","url":"modules/_gov_.html#createvotesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":38,"kind":1,"name":"\"priceFeed\"","url":"modules/_pricefeed_.html","classes":"tsd-kind-module"},{"id":39,"kind":64,"name":"getPrice","url":"modules/_pricefeed_.html#getprice","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"priceFeed\""},{"id":40,"kind":1,"name":"\"index\"","url":"modules/_index_.html","classes":"tsd-kind-module"},{"id":41,"kind":64,"name":"Venus","url":"modules/_index_.html#venus","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"index\""}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,33.557]],["parent/0",[]],["name/1",[1,33.557]],["parent/1",[]],["name/2",[2,33.557]],["parent/2",[]],["name/3",[3,22.571]],["parent/3",[]],["name/4",[4,33.557]],["parent/4",[3,1.907]],["name/5",[5,33.557]],["parent/5",[3,1.907]],["name/6",[6,33.557]],["parent/6",[3,1.907]],["name/7",[7,18.894]],["parent/7",[]],["name/8",[8,33.557]],["parent/8",[7,1.597]],["name/9",[9,18.894]],["parent/9",[7,1.597]],["name/10",[10,33.557]],["parent/10",[7,1.597]],["name/11",[11,33.557]],["parent/11",[7,1.597]],["name/12",[12,33.557]],["parent/12",[7,1.597]],["name/13",[13,22.571]],["parent/13",[]],["name/14",[14,33.557]],["parent/14",[13,1.907]],["name/15",[15,33.557]],["parent/15",[13,1.907]],["name/16",[16,33.557]],["parent/16",[13,1.907]],["name/17",[17,33.557]],["parent/17",[]],["name/18",[9,18.894]],["parent/18",[]],["name/19",[18,33.557]],["parent/19",[9,1.597]],["name/20",[19,33.557]],["parent/20",[9,1.597]],["name/21",[20,33.557]],["parent/21",[9,1.597]],["name/22",[21,33.557]],["parent/22",[9,1.597]],["name/23",[22,16.211]],["parent/23",[]],["name/24",[23,33.557]],["parent/24",[22,1.37]],["name/25",[24,33.557]],["parent/25",[22,1.37]],["name/26",[25,33.557]],["parent/26",[22,1.37]],["name/27",[26,33.557]],["parent/27",[22,1.37]],["name/28",[27,33.557]],["parent/28",[22,1.37]],["name/29",[28,33.557]],["parent/29",[22,1.37]],["name/30",[29,33.557]],["parent/30",[22,1.37]],["name/31",[30,25.084]],["parent/31",[]],["name/32",[31,33.557]],["parent/32",[30,2.12]],["name/33",[32,33.557]],["parent/33",[30,2.12]],["name/34",[33,22.571]],["parent/34",[]],["name/35",[34,33.557]],["parent/35",[33,1.907]],["name/36",[35,33.557]],["parent/36",[33,1.907]],["name/37",[36,33.557]],["parent/37",[33,1.907]],["name/38",[37,28.449]],["parent/38",[]],["name/39",[38,33.557]],["parent/39",[37,2.404]],["name/40",[39,28.449]],["parent/40",[]],["name/41",[40,33.557]],["parent/41",[39,2.404]]],"invertedIndex":[["account",{"_index":8,"name":{"8":{}},"parent":{}}],["api",{"_index":7,"name":{"7":{}},"parent":{"8":{},"9":{},"10":{},"11":{},"12":{}}}],["borrow",{"_index":20,"name":{"21":{}},"parent":{}}],["castvote",{"_index":34,"name":{"35":{}},"parent":{}}],["castvotebysig",{"_index":35,"name":{"36":{}},"parent":{}}],["claimvenus",{"_index":26,"name":{"27":{}},"parent":{}}],["comp",{"_index":22,"name":{"23":{}},"parent":{"24":{},"25":{},"26":{},"27":{},"28":{},"29":{},"30":{}}}],["comptroller",{"_index":30,"name":{"31":{}},"parent":{"32":{},"33":{}}}],["constants",{"_index":2,"name":{"2":{}},"parent":{}}],["createdelegatesignature",{"_index":29,"name":{"30":{}},"parent":{}}],["createvotesignature",{"_index":36,"name":{"37":{}},"parent":{}}],["ctoken",{"_index":9,"name":{"9":{},"18":{}},"parent":{"19":{},"20":{},"21":{},"22":{}}}],["delegate",{"_index":27,"name":{"28":{}},"parent":{}}],["delegatebysig",{"_index":28,"name":{"29":{}},"parent":{}}],["eip712",{"_index":1,"name":{"1":{}},"parent":{}}],["entermarkets",{"_index":31,"name":{"32":{}},"parent":{}}],["eth",{"_index":13,"name":{"13":{}},"parent":{"14":{},"15":{},"16":{}}}],["exitmarket",{"_index":32,"name":{"33":{}},"parent":{}}],["getabi",{"_index":5,"name":{"5":{}},"parent":{}}],["getaddress",{"_index":4,"name":{"4":{}},"parent":{}}],["getbalance",{"_index":16,"name":{"16":{}},"parent":{}}],["getnetnamewithchainid",{"_index":6,"name":{"6":{}},"parent":{}}],["getprice",{"_index":38,"name":{"39":{}},"parent":{}}],["getvenusaccrued",{"_index":25,"name":{"26":{}},"parent":{}}],["getvenusbalance",{"_index":24,"name":{"25":{}},"parent":{}}],["gov",{"_index":33,"name":{"34":{}},"parent":{"35":{},"36":{},"37":{}}}],["governance",{"_index":12,"name":{"12":{}},"parent":{}}],["helpers",{"_index":17,"name":{"17":{}},"parent":{}}],["index",{"_index":39,"name":{"40":{}},"parent":{"41":{}}}],["markethistory",{"_index":11,"name":{"11":{}},"parent":{}}],["pricefeed",{"_index":37,"name":{"38":{}},"parent":{"39":{}}}],["read",{"_index":14,"name":{"14":{}},"parent":{}}],["redeem",{"_index":19,"name":{"20":{}},"parent":{}}],["repayborrow",{"_index":21,"name":{"22":{}},"parent":{}}],["supply",{"_index":18,"name":{"19":{}},"parent":{}}],["tochecksumaddress",{"_index":23,"name":{"24":{}},"parent":{}}],["trx",{"_index":15,"name":{"15":{}},"parent":{}}],["types/index",{"_index":0,"name":{"0":{}},"parent":{}}],["util",{"_index":3,"name":{"3":{}},"parent":{"4":{},"5":{},"6":{}}}],["venus",{"_index":40,"name":{"41":{}},"parent":{}}],["vtoken",{"_index":10,"name":{"10":{}},"parent":{}}]],"pipeline":[]}} \ No newline at end of file +{"kinds":{"1":"Module","64":"Function"},"rows":[{"id":0,"kind":1,"name":"\"types/index\"","url":"modules/_types_index_.html","classes":"tsd-kind-module"},{"id":1,"kind":1,"name":"\"EIP712\"","url":"modules/_eip712_.html","classes":"tsd-kind-module"},{"id":2,"kind":1,"name":"\"constants\"","url":"modules/_constants_.html","classes":"tsd-kind-module"},{"id":3,"kind":1,"name":"\"util\"","url":"modules/_util_.html","classes":"tsd-kind-module"},{"id":4,"kind":64,"name":"getAddress","url":"modules/_util_.html#getaddress","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":5,"kind":64,"name":"getAbi","url":"modules/_util_.html#getabi","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":6,"kind":64,"name":"getNetNameWithChainId","url":"modules/_util_.html#getnetnamewithchainid","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"util\""},{"id":7,"kind":1,"name":"\"api\"","url":"modules/_api_.html","classes":"tsd-kind-module"},{"id":8,"kind":64,"name":"account","url":"modules/_api_.html#account","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":9,"kind":64,"name":"vToken","url":"modules/_api_.html#vtoken","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":10,"kind":64,"name":"marketHistory","url":"modules/_api_.html#markethistory","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":11,"kind":64,"name":"governance","url":"modules/_api_.html#governance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"api\""},{"id":12,"kind":1,"name":"\"eth\"","url":"modules/_eth_.html","classes":"tsd-kind-module"},{"id":13,"kind":64,"name":"read","url":"modules/_eth_.html#read","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":14,"kind":64,"name":"trx","url":"modules/_eth_.html#trx","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":15,"kind":64,"name":"getBalance","url":"modules/_eth_.html#getbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"eth\""},{"id":16,"kind":1,"name":"\"helpers\"","url":"modules/_helpers_.html","classes":"tsd-kind-module"},{"id":17,"kind":1,"name":"\"cToken\"","url":"modules/_ctoken_.html","classes":"tsd-kind-module"},{"id":18,"kind":64,"name":"supply","url":"modules/_ctoken_.html#supply","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":19,"kind":64,"name":"redeem","url":"modules/_ctoken_.html#redeem","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":20,"kind":64,"name":"borrow","url":"modules/_ctoken_.html#borrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":21,"kind":64,"name":"repayBorrow","url":"modules/_ctoken_.html#repayborrow","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"cToken\""},{"id":22,"kind":1,"name":"\"comp\"","url":"modules/_comp_.html","classes":"tsd-kind-module"},{"id":23,"kind":64,"name":"toChecksumAddress","url":"modules/_comp_.html#tochecksumaddress","classes":"tsd-kind-function tsd-parent-kind-module tsd-is-not-exported","parent":"\"comp\""},{"id":24,"kind":64,"name":"getVenusBalance","url":"modules/_comp_.html#getvenusbalance","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":25,"kind":64,"name":"getVenusAccrued","url":"modules/_comp_.html#getvenusaccrued","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":26,"kind":64,"name":"claimVenus","url":"modules/_comp_.html#claimvenus","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":27,"kind":64,"name":"delegate","url":"modules/_comp_.html#delegate","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":28,"kind":64,"name":"delegateBySig","url":"modules/_comp_.html#delegatebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":29,"kind":64,"name":"createDelegateSignature","url":"modules/_comp_.html#createdelegatesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comp\""},{"id":30,"kind":1,"name":"\"comptroller\"","url":"modules/_comptroller_.html","classes":"tsd-kind-module"},{"id":31,"kind":64,"name":"enterMarkets","url":"modules/_comptroller_.html#entermarkets","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":32,"kind":64,"name":"exitMarket","url":"modules/_comptroller_.html#exitmarket","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"comptroller\""},{"id":33,"kind":1,"name":"\"gov\"","url":"modules/_gov_.html","classes":"tsd-kind-module"},{"id":34,"kind":64,"name":"castVote","url":"modules/_gov_.html#castvote","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":35,"kind":64,"name":"castVoteBySig","url":"modules/_gov_.html#castvotebysig","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":36,"kind":64,"name":"createVoteSignature","url":"modules/_gov_.html#createvotesignature","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"gov\""},{"id":37,"kind":1,"name":"\"priceFeed\"","url":"modules/_pricefeed_.html","classes":"tsd-kind-module"},{"id":38,"kind":64,"name":"getPrice","url":"modules/_pricefeed_.html#getprice","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"priceFeed\""},{"id":39,"kind":1,"name":"\"index\"","url":"modules/_index_.html","classes":"tsd-kind-module"},{"id":40,"kind":64,"name":"Venus","url":"modules/_index_.html#venus","classes":"tsd-kind-function tsd-parent-kind-module","parent":"\"index\""}],"index":{"version":"2.3.9","fields":["name","parent"],"fieldVectors":[["name/0",[0,33.322]],["parent/0",[]],["name/1",[1,33.322]],["parent/1",[]],["name/2",[2,33.322]],["parent/2",[]],["name/3",[3,22.336]],["parent/3",[]],["name/4",[4,33.322]],["parent/4",[3,1.877]],["name/5",[5,33.322]],["parent/5",[3,1.877]],["name/6",[6,33.322]],["parent/6",[3,1.877]],["name/7",[7,20.329]],["parent/7",[]],["name/8",[8,33.322]],["parent/8",[7,1.708]],["name/9",[9,33.322]],["parent/9",[7,1.708]],["name/10",[10,33.322]],["parent/10",[7,1.708]],["name/11",[11,33.322]],["parent/11",[7,1.708]],["name/12",[12,22.336]],["parent/12",[]],["name/13",[13,33.322]],["parent/13",[12,1.877]],["name/14",[14,33.322]],["parent/14",[12,1.877]],["name/15",[15,33.322]],["parent/15",[12,1.877]],["name/16",[16,33.322]],["parent/16",[]],["name/17",[17,20.329]],["parent/17",[]],["name/18",[18,33.322]],["parent/18",[17,1.708]],["name/19",[19,33.322]],["parent/19",[17,1.708]],["name/20",[20,33.322]],["parent/20",[17,1.708]],["name/21",[21,33.322]],["parent/21",[17,1.708]],["name/22",[22,15.976]],["parent/22",[]],["name/23",[23,33.322]],["parent/23",[22,1.343]],["name/24",[24,33.322]],["parent/24",[22,1.343]],["name/25",[25,33.322]],["parent/25",[22,1.343]],["name/26",[26,33.322]],["parent/26",[22,1.343]],["name/27",[27,33.322]],["parent/27",[22,1.343]],["name/28",[28,33.322]],["parent/28",[22,1.343]],["name/29",[29,33.322]],["parent/29",[22,1.343]],["name/30",[30,24.849]],["parent/30",[]],["name/31",[31,33.322]],["parent/31",[30,2.088]],["name/32",[32,33.322]],["parent/32",[30,2.088]],["name/33",[33,22.336]],["parent/33",[]],["name/34",[34,33.322]],["parent/34",[33,1.877]],["name/35",[35,33.322]],["parent/35",[33,1.877]],["name/36",[36,33.322]],["parent/36",[33,1.877]],["name/37",[37,28.214]],["parent/37",[]],["name/38",[38,33.322]],["parent/38",[37,2.371]],["name/39",[39,28.214]],["parent/39",[]],["name/40",[40,33.322]],["parent/40",[39,2.371]]],"invertedIndex":[["account",{"_index":8,"name":{"8":{}},"parent":{}}],["api",{"_index":7,"name":{"7":{}},"parent":{"8":{},"9":{},"10":{},"11":{}}}],["borrow",{"_index":20,"name":{"20":{}},"parent":{}}],["castvote",{"_index":34,"name":{"34":{}},"parent":{}}],["castvotebysig",{"_index":35,"name":{"35":{}},"parent":{}}],["claimvenus",{"_index":26,"name":{"26":{}},"parent":{}}],["comp",{"_index":22,"name":{"22":{}},"parent":{"23":{},"24":{},"25":{},"26":{},"27":{},"28":{},"29":{}}}],["comptroller",{"_index":30,"name":{"30":{}},"parent":{"31":{},"32":{}}}],["constants",{"_index":2,"name":{"2":{}},"parent":{}}],["createdelegatesignature",{"_index":29,"name":{"29":{}},"parent":{}}],["createvotesignature",{"_index":36,"name":{"36":{}},"parent":{}}],["ctoken",{"_index":17,"name":{"17":{}},"parent":{"18":{},"19":{},"20":{},"21":{}}}],["delegate",{"_index":27,"name":{"27":{}},"parent":{}}],["delegatebysig",{"_index":28,"name":{"28":{}},"parent":{}}],["eip712",{"_index":1,"name":{"1":{}},"parent":{}}],["entermarkets",{"_index":31,"name":{"31":{}},"parent":{}}],["eth",{"_index":12,"name":{"12":{}},"parent":{"13":{},"14":{},"15":{}}}],["exitmarket",{"_index":32,"name":{"32":{}},"parent":{}}],["getabi",{"_index":5,"name":{"5":{}},"parent":{}}],["getaddress",{"_index":4,"name":{"4":{}},"parent":{}}],["getbalance",{"_index":15,"name":{"15":{}},"parent":{}}],["getnetnamewithchainid",{"_index":6,"name":{"6":{}},"parent":{}}],["getprice",{"_index":38,"name":{"38":{}},"parent":{}}],["getvenusaccrued",{"_index":25,"name":{"25":{}},"parent":{}}],["getvenusbalance",{"_index":24,"name":{"24":{}},"parent":{}}],["gov",{"_index":33,"name":{"33":{}},"parent":{"34":{},"35":{},"36":{}}}],["governance",{"_index":11,"name":{"11":{}},"parent":{}}],["helpers",{"_index":16,"name":{"16":{}},"parent":{}}],["index",{"_index":39,"name":{"39":{}},"parent":{"40":{}}}],["markethistory",{"_index":10,"name":{"10":{}},"parent":{}}],["pricefeed",{"_index":37,"name":{"37":{}},"parent":{"38":{}}}],["read",{"_index":13,"name":{"13":{}},"parent":{}}],["redeem",{"_index":19,"name":{"19":{}},"parent":{}}],["repayborrow",{"_index":21,"name":{"21":{}},"parent":{}}],["supply",{"_index":18,"name":{"18":{}},"parent":{}}],["tochecksumaddress",{"_index":23,"name":{"23":{}},"parent":{}}],["trx",{"_index":14,"name":{"14":{}},"parent":{}}],["types/index",{"_index":0,"name":{"0":{}},"parent":{}}],["util",{"_index":3,"name":{"3":{}},"parent":{"4":{},"5":{},"6":{}}}],["venus",{"_index":40,"name":{"40":{}},"parent":{}}],["vtoken",{"_index":9,"name":{"9":{}},"parent":{}}]],"pipeline":[]}} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 5fcc8b1..e43b8e5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -66,7 +66,7 @@

    Venus.js - v0.0.1

    Venus.js

    A JavaScript SDK for Ethereum and the Venus Protocol. Wraps around Ethers.js. Works in the web browser and Node.js.

    -

    Venus.js Documentation

    +

    Venus.js Documentation

    This SDK is in open beta, and is constantly under development. USE AT YOUR OWN RISK.

    Ethereum Read & Write

    @@ -76,7 +76,7 @@

    Ethereum Read & Write

    Read

    const Venus = require('@compound-finance/compound-js'); // in Node.js
    -const cUsdtAddress = Venus.util.getAddress(Venus.cUSDT);
    +const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT);
     
     (async function() {
     
    @@ -175,10 +175,10 @@ 

    Instance Creation

    Constants and Contract Addresses

    Names of contracts, their addresses, ABIs, token decimals, and more can be found in /src/constants.ts. Addresses, for all networks, can be easily fetched using the getAddress function, combined with contract name constants.

    -
    console.log(Venus.DAI, Venus.ETH, Venus.cETH);
    -// DAI, ETH, cETH
    +				
    console.log(Venus.DAI, Venus.BNB, Venus.vSXP);
    +// DAI, BNB, vSXP
     
    -const cUsdtAddress = Venus.util.getAddress(Venus.cUSDT);
    +const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT);
     // Mainnet cUSDT address. Second parameter can be a network like 'ropsten'.

    Mantissas

    @@ -232,18 +232,18 @@

    API

    "network": "ropsten" }); - let daiBorrowBalance = 0; + let sxpBorrowBalance = 0; if (Object.isExtensible(account) && account.accounts) { account.accounts.forEach((acc) => { acc.tokens.forEach((tok) => { - if (tok.symbol === Venus.cDAI) { + if (tok.symbol === Venus.vSXP) { daiBorrowBalance = +tok.borrow_balance_underlying.value; } }); }); } - console.log('daiBorrowBalance', daiBorrowBalance); + console.log('sxpBorrowBalance', sxpBorrowBalance); } main().catch(console.error);
    diff --git a/docs/modules/_api_.html b/docs/modules/_api_.html index 0447f59..e26ba3b 100644 --- a/docs/modules/_api_.html +++ b/docs/modules/_api_.html @@ -72,7 +72,6 @@

    Index

    Functions

    • account
    • -
    • cToken
    • governance
    • marketHistory
    • vToken
    • @@ -93,7 +92,7 @@

      account

    • @@ -110,18 +109,18 @@

      account

      "network": "ropsten" }); - let daiBorrowBalance = 0; + let sxpBorrowBalance = 0; if (Object.isExtensible(account) && account.accounts) { account.accounts.forEach((acc) => { acc.tokens.forEach((tok) => { - if (tok.symbol === Venus.cDAI) { - daiBorrowBalance = +tok.borrow_balance_underlying.value; + if (tok.symbol === Venus.vSXP) { + sxpBorrowBalance = +tok.borrow_balance_underlying.value; } }); }); } - console.log('daiBorrowBalance', daiBorrowBalance); + console.log('sxpBorrowBalance', sxpBorrowBalance); })().catch(console.error);
    @@ -140,51 +139,6 @@

    Returns Promise

    -
    - -

    cToken

    -
      -
    • cToken(options: CTokenServiceRequest): Promise<APIResponse>
    • -
    -
      -
    • - -
      -
      -

      Makes a request to the CTokenService API. The vToken API retrieves - information about vToken contract interaction. For more details, see the - Venus API documentation.

      -
      -
      -
      example
      -
      (async function() {
      -  const cDaiData = await Venus.api.cToken({
      -    "addresses": Venus.util.getAddress(Venus.cDAI)
      -  });
      -
      -  console.log('cDaiData', cDaiData); // JavaScript Object
      -})().catch(console.error);
      -
      -
      -
      -

      Parameters

      -
        -
      • -
        options: CTokenServiceRequest
        -
        -

        A JavaScript object of API request parameters.

        -
        -
      • -
      -

      Returns Promise<APIResponse>

      -

      Returns the HTTP response body or error.

      -
    • -
    -

    governance

    @@ -195,7 +149,7 @@

    governance

  • @@ -248,7 +202,7 @@

    marketHistory

  • @@ -260,14 +214,14 @@

    marketHistory

    example
    (async function() {
    -  const cUsdcMarketData = await Venus.api.marketHistory({
    -    "asset": Venus.util.getAddress(Venus.cUSDC),
    +  const vUsdcMarketData = await Venus.api.marketHistory({
    +    "asset": Venus.util.getAddress(Venus.vUSDC),
         "min_block_timestamp": 1559339900,
         "max_block_timestamp": 1598320674,
         "num_buckets": 10,
       });
     
    -  console.log('cUsdcMarketData', cUsdcMarketData); // JavaScript Object
    +  console.log('vUsdcMarketData', vUsdcMarketData); // JavaScript Object
     })().catch(console.error);
    @@ -296,7 +250,7 @@

    vToken

  • @@ -308,11 +262,11 @@

    vToken

    example
    (async function() {
    -  const cDaiData = await Venus.api.vToken({
    -    "addresses": Venus.util.getAddress(Venus.cDAI)
    +  const vSxpData = await Venus.api.vToken({
    +    "addresses": Venus.util.getAddress(Venus.vSXP)
       });
     
    -  console.log('cDaiData', cDaiData); // JavaScript Object
    +  console.log('vSxpData', vSxpData); // JavaScript Object
     })().catch(console.error);
    @@ -373,9 +327,6 @@

    Returns Promise account

  • -
  • - cToken -
  • governance
  • diff --git a/docs/modules/_comp_.html b/docs/modules/_comp_.html index b1f8544..b235a1a 100644 --- a/docs/modules/_comp_.html +++ b/docs/modules/_comp_.html @@ -95,7 +95,7 @@

    claimVenus

  • @@ -138,7 +138,7 @@

    createDelegateSignature

  • @@ -189,7 +189,7 @@

    delegate

  • @@ -236,7 +236,7 @@

    delegateBySig

  • @@ -312,7 +312,7 @@

    getVenusAccrued

  • @@ -356,7 +356,7 @@

    getVenusBalance

  • @@ -400,7 +400,7 @@

    toChecksumAddress

  • diff --git a/docs/modules/_comptroller_.html b/docs/modules/_comptroller_.html index 9f464b1..303eef5 100644 --- a/docs/modules/_comptroller_.html +++ b/docs/modules/_comptroller_.html @@ -90,7 +90,7 @@

    enterMarkets

  • @@ -137,7 +137,7 @@

    exitMarket

  • diff --git a/docs/modules/_ctoken_.html b/docs/modules/_ctoken_.html index b36dd8e..b5817f2 100644 --- a/docs/modules/_ctoken_.html +++ b/docs/modules/_ctoken_.html @@ -92,7 +92,7 @@

    borrow

  • @@ -157,7 +157,7 @@

    redeem

  • @@ -216,7 +216,7 @@

    repayBorrow

  • @@ -289,7 +289,7 @@

    supply

  • diff --git a/docs/modules/_eth_.html b/docs/modules/_eth_.html index 9b7521e..2d75007 100644 --- a/docs/modules/_eth_.html +++ b/docs/modules/_eth_.html @@ -91,7 +91,7 @@

    getBalance

  • @@ -137,7 +137,7 @@

    read

  • @@ -204,7 +204,7 @@

    trx

  • diff --git a/docs/modules/_gov_.html b/docs/modules/_gov_.html index eae915e..c6d33c9 100644 --- a/docs/modules/_gov_.html +++ b/docs/modules/_gov_.html @@ -91,7 +91,7 @@

    castVote

  • @@ -145,7 +145,7 @@

    castVoteBySig

  • @@ -214,7 +214,7 @@

    createVoteSignature

  • diff --git a/docs/modules/_index_.html b/docs/modules/_index_.html index ac578b2..6a6bb4b 100644 --- a/docs/modules/_index_.html +++ b/docs/modules/_index_.html @@ -89,7 +89,7 @@

    Const
    diff --git a/docs/modules/_pricefeed_.html b/docs/modules/_pricefeed_.html index d80bf67..071b6ff 100644 --- a/docs/modules/_pricefeed_.html +++ b/docs/modules/_pricefeed_.html @@ -89,7 +89,7 @@

    getPrice

  • diff --git a/docs/modules/_util_.html b/docs/modules/_util_.html index 3cd0d59..fc8e45c 100644 --- a/docs/modules/_util_.html +++ b/docs/modules/_util_.html @@ -91,7 +91,7 @@

    getAbi

  • @@ -129,7 +129,7 @@

    getAddress

  • @@ -170,7 +170,7 @@

    getNetNameWithChainId

  • diff --git a/examples/nodejs/eth_call.js b/examples/nodejs/eth_call.js index 0c0d945..1be5da7 100644 --- a/examples/nodejs/eth_call.js +++ b/examples/nodejs/eth_call.js @@ -1,17 +1,17 @@ // Example of calling JSON RPC's eth_call with Venus.js const Venus = require('../../dist/nodejs/index.js'); -const cEthAddress = Venus.util.getAddress(Venus.cETH); +const vSxpAddress = Venus.util.getAddress(Venus.vSXP); (async function() { const srpb = await Venus.eth.read( - cEthAddress, + vSxpAddress, 'function supplyRatePerBlock() returns (uint256)', // [], // [optional] parameters // {} // [optional] call options, provider, network, plus ethers "overrides" ); - console.log('cETH market supply rate per block:', srpb.toString()); + console.log('vSXP market supply rate per block:', srpb.toString()); })().catch(console.error); diff --git a/examples/nodejs/eth_sendTransaction.js b/examples/nodejs/eth_sendTransaction.js index f29427b..209378b 100644 --- a/examples/nodejs/eth_sendTransaction.js +++ b/examples/nodejs/eth_sendTransaction.js @@ -14,7 +14,7 @@ ganache-cli \ const Venus = require('../../dist/nodejs/index.js'); const oneEthInWei = '1000000000000000000'; -const cEthAddress = Venus.util.getAddress(Venus.cETH); +const vSxpAddress = Venus.util.getAddress(Venus.vSXP); const provider = 'http://localhost:8545'; const privateKey = '0xb8c1b5c1d81f9475fdf2e334517d29f733bdfa40682207571b12fc1142cbf329'; // const mnemonic = 'clutch captain shoe salt awake harvest setup primary inmate ugly among become'; @@ -22,9 +22,9 @@ const privateKey = '0xb8c1b5c1d81f9475fdf2e334517d29f733bdfa40682207571b12fc1142 (async function() { console.log('Supplying ETH to the Venus Protocol...'); - // Mint some cETH by supplying ETH to the Venus Protocol + // Mint some vSXP by supplying SXP to the Venus Protocol const trx = await Venus.eth.trx( - cEthAddress, + vSxpAddress, 'function mint() payable', [], { diff --git a/examples/nodejs/getAddress.js b/examples/nodejs/getAddress.js index 87da78f..cfba748 100644 --- a/examples/nodejs/getAddress.js +++ b/examples/nodejs/getAddress.js @@ -1,11 +1,11 @@ // Example of fetching a Venus protocol contract address with Venus.js const Venus = require('../../dist/nodejs/index.js'); -const batAddress = Venus.util.getAddress(Venus.BAT); -const cbatAddress = Venus.util.getAddress(Venus.cBAT); -const cEthAddressRopsten = Venus.util.getAddress(Venus.cETH, 'ropsten'); +const sxpAddress = Venus.util.getAddress(Venus.SXP); +const vsxpAddress = Venus.util.getAddress(Venus.vSXP); +const vBNBAddressRopsten = Venus.util.getAddress(Venus.vBNB, 'ropsten'); -console.log('BAT (mainnet)', batAddress); -console.log('cBAT (mainnet)', cbatAddress); +console.log('SXP (mainnet)', sxpAddress); +console.log('vSXP (mainnet)', vsxpAddress); -console.log('cETH (ropsten)', cEthAddressRopsten); +console.log('vBNB (ropsten)', vBNBAddressRopsten); diff --git a/examples/nodejs/getPrice.js b/examples/nodejs/getPrice.js index 9b07a20..1b73da9 100644 --- a/examples/nodejs/getPrice.js +++ b/examples/nodejs/getPrice.js @@ -6,16 +6,16 @@ const venus = new Venus(); let price; (async function() { - price = await venus.getPrice(Venus.BAT); - console.log('BAT in USDC', price); + price = await venus.getPrice(Venus.SXP); + console.log('SXP in USDC', price); - price = await venus.getPrice(Venus.cBAT); - console.log('cBAT in USDC', price); + price = await venus.getPrice(Venus.vSXP); + console.log('vSXP in USDC', price); - price = await venus.getPrice(Venus.BAT, Venus.cUSDC); - console.log('BAT in cUSDC', price); + price = await venus.getPrice(Venus.SXP, Venus.vUSDC); + console.log('SXP in vUSDC', price); - price = await venus.getPrice(Venus.BAT, Venus.ETH); - console.log('BAT in ETH', price); + price = await venus.getPrice(Venus.SXP, Venus.BNB); + console.log('SXP in BNB', price); })().catch(console.error); diff --git a/examples/web/index.html b/examples/web/index.html index cac9f41..f3d3ce8 100644 --- a/examples/web/index.html +++ b/examples/web/index.html @@ -248,8 +248,8 @@

    Get Address


    -
    // Accepts cTokens or underlyings. Second arg defaults to main net.
    -const cEthAddressRopsten = Venus.util.getAddress(Venus.cETH, 'ropsten');
    +
    // Accepts vTokens or underlyings. Second arg defaults to main net.
    +const vSXPAddressRopsten = Venus.util.getAddress(Venus.vSXP, 'ropsten');
      @@ -540,10 +540,10 @@

    Get Address

    (async function() { - // Accepts cTokens or underlyings. Second arg defaults to main net. - const cEthAddressRopsten = Venus.util.getAddress(Venus.cETH, 'ropsten'); + // Accepts vTokens or underlyings. Second arg defaults to main net. + const vSxpAddressRopsten = Venus.util.getAddress(Venus.vSXP, 'ropsten'); - getAddressContent.innerText = cEthAddressRopsten.toString(); + getAddressContent.innerText = vSxpAddressRopsten.toString(); })().catch((err) => { getAddressContent.innerText = 'Error occured; See developer console for details.'; diff --git a/src/api.ts b/src/api.ts index 9e6bbdc..7ecf038 100644 --- a/src/api.ts +++ b/src/api.ts @@ -55,18 +55,18 @@ import { * "network": "ropsten" * }); * - * let daiBorrowBalance = 0; + * let sxpBorrowBalance = 0; * if (Object.isExtensible(account) && account.accounts) { * account.accounts.forEach((acc) => { * acc.tokens.forEach((tok) => { - * if (tok.symbol === Venus.cDAI) { - * daiBorrowBalance = +tok.borrow_balance_underlying.value; + * if (tok.symbol === Venus.vSXP) { + * sxpBorrowBalance = +tok.borrow_balance_underlying.value; * } * }); * }); * } * - * console.log('daiBorrowBalance', daiBorrowBalance); + * console.log('sxpBorrowBalance', sxpBorrowBalance); * })().catch(console.error); * ``` */ @@ -88,36 +88,11 @@ export function account(options: AccountServiceRequest): Promise { * * ``` * (async function() { - * const cDaiData = await Venus.api.cToken({ - * "addresses": Venus.util.getAddress(Venus.cDAI) + * const vSxpData = await Venus.api.vToken({ + * "addresses": Venus.util.getAddress(Venus.vSXP) * }); * - * console.log('cDaiData', cDaiData); // JavaScript Object - * })().catch(console.error); - * ``` - */ -export function cToken(options: CTokenServiceRequest): Promise { - return queryApi(options, 'cToken', '/api/v2/ctoken'); -} - -/** - * Makes a request to the CTokenService API. The vToken API retrieves - * information about vToken contract interaction. For more details, see the - * Venus API documentation. - * - * @param {object} options A JavaScript object of API request parameters. - * - * @returns {object} Returns the HTTP response body or error. - * - * @example - * - * ``` - * (async function() { - * const cDaiData = await Venus.api.vToken({ - * "addresses": Venus.util.getAddress(Venus.cDAI) - * }); - * - * console.log('cDaiData', cDaiData); // JavaScript Object + * console.log('vSxpData', vSxpData); // JavaScript Object * })().catch(console.error); * ``` */ @@ -138,14 +113,14 @@ export function vToken(options: CTokenServiceRequest): Promise { * * ``` * (async function() { - * const cUsdcMarketData = await Venus.api.marketHistory({ - * "asset": Venus.util.getAddress(Venus.cUSDC), + * const vUsdcMarketData = await Venus.api.marketHistory({ + * "asset": Venus.util.getAddress(Venus.vUSDC), * "min_block_timestamp": 1559339900, * "max_block_timestamp": 1598320674, * "num_buckets": 10, * }); * - * console.log('cUsdcMarketData', cUsdcMarketData); // JavaScript Object + * console.log('vUsdcMarketData', vUsdcMarketData); // JavaScript Object * })().catch(console.error); * ``` */ From 2a9ae999f22a4899e60991a25f24692f028bb11a Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Sun, 29 Nov 2020 22:36:56 +0200 Subject: [PATCH 07/20] Updated priceFeed --- src/constants.ts | 3 +- src/priceFeed.ts | 97 ++++++++++++++++++++++++++++-------------------- 2 files changed, 58 insertions(+), 42 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index b883ce3..559ce74 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -181,7 +181,7 @@ export const address = { // bsc testnet "vBNB": "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c", - "vUSDC": "0x16227D60f7a0e586C66B005219dfc887D13C9531", + "vUSDC": "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", "vUSDT": "0xA11c8D9DC9b66E209Ef60F0C8D969D3CD988782c", "vSXP": "0x74469281310195A04840Daf6EdF576F559a3dE80", "DAI": "0x8301F2213c0eeD49a7E28Ae4c3e91722919B8B47", @@ -203,6 +203,7 @@ export const abi = { Comptroller: [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"action","type":"string"},{"indexed":false,"internalType":"bool","name":"pauseState","type":"bool"}],"name":"ActionPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"string","name":"action","type":"string"},{"indexed":false,"internalType":"bool","name":"pauseState","type":"bool"}],"name":"ActionPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":true,"internalType":"address","name":"borrower","type":"address"},{"indexed":false,"internalType":"uint256","name":"venusDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"venusBorrowIndex","type":"uint256"}],"name":"DistributedBorrowerVenus","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":true,"internalType":"address","name":"supplier","type":"address"},{"indexed":false,"internalType":"uint256","name":"venusDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"venusSupplyIndex","type":"uint256"}],"name":"DistributedSupplierVenus","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"error","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"info","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"detail","type":"uint256"}],"name":"Failure","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"MarketEntered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"MarketExited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"}],"name":"MarketListed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"bool","name":"isVenus","type":"bool"}],"name":"MarketVenus","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldCloseFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCloseFactorMantissa","type":"uint256"}],"name":"NewCloseFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldCollateralFactorMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newCollateralFactorMantissa","type":"uint256"}],"name":"NewCollateralFactor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldLiquidationIncentiveMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newLiquidationIncentiveMantissa","type":"uint256"}],"name":"NewLiquidationIncentive","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldMaxAssets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxAssets","type":"uint256"}],"name":"NewMaxAssets","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldPauseGuardian","type":"address"},{"indexed":false,"internalType":"address","name":"newPauseGuardian","type":"address"}],"name":"NewPauseGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract PriceOracle","name":"oldPriceOracle","type":"address"},{"indexed":false,"internalType":"contract PriceOracle","name":"newPriceOracle","type":"address"}],"name":"NewPriceOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract VAIControllerInterface","name":"oldVAIController","type":"address"},{"indexed":false,"internalType":"contract VAIControllerInterface","name":"newVAIController","type":"address"}],"name":"NewVAIController","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldVAIMintRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newVAIMintRate","type":"uint256"}],"name":"NewVAIMintRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"oldVenusRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newVenusRate","type":"uint256"}],"name":"NewVenusRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract VToken","name":"vToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"newSpeed","type":"uint256"}],"name":"VenusSpeedUpdated","type":"event"},{"constant":false,"inputs":[{"internalType":"address[]","name":"vTokens","type":"address[]"}],"name":"_addVenusMarkets","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract Unitroller","name":"unitroller","type":"address"}],"name":"_become","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"_borrowGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"}],"name":"_dropVenusMarket","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"_mintGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"_setBorrowPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newCloseFactorMantissa","type":"uint256"}],"name":"_setCloseFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"},{"internalType":"uint256","name":"newCollateralFactorMantissa","type":"uint256"}],"name":"_setCollateralFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newLiquidationIncentiveMantissa","type":"uint256"}],"name":"_setLiquidationIncentive","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newMaxAssets","type":"uint256"}],"name":"_setMaxAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"},{"internalType":"bool","name":"state","type":"bool"}],"name":"_setMintPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newPauseGuardian","type":"address"}],"name":"_setPauseGuardian","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract PriceOracle","name":"newOracle","type":"address"}],"name":"_setPriceOracle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"_setSeizePaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"state","type":"bool"}],"name":"_setTransferPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VAIControllerInterface","name":"vaiController_","type":"address"}],"name":"_setVAIController","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"newVAIMintRate","type":"uint256"}],"name":"_setVAIMintRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"venusRate_","type":"uint256"}],"name":"_setVenusRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"}],"name":"_supportMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"accountAssets","outputs":[{"internalType":"contract VToken","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allMarkets","outputs":[{"internalType":"contract VToken","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"borrowGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"borrowVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"contract VToken","name":"vToken","type":"address"}],"name":"checkMembership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"contract VToken[]","name":"vTokens","type":"address[]"}],"name":"claimVenus","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"holder","type":"address"}],"name":"claimVenus","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"holders","type":"address[]"},{"internalType":"contract VToken[]","name":"vTokens","type":"address[]"},{"internalType":"bool","name":"borrowers","type":"bool"},{"internalType":"bool","name":"suppliers","type":"bool"}],"name":"claimVenus","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"closeFactorMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comptrollerImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"vTokens","type":"address[]"}],"name":"enterMarkets","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenAddress","type":"address"}],"name":"exitMarket","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAllMarkets","outputs":[{"internalType":"contract VToken[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAssetsIn","outputs":[{"internalType":"contract VToken[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getBlockNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"vTokenModify","type":"address"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"}],"name":"getHypotheticalAccountLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"getMintableVAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getVAIMintRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getXVSAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isComptroller","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"liquidateBorrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"liquidateBorrowVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"}],"name":"liquidateCalculateSeizeTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"liquidationIncentiveMantissa","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"markets","outputs":[{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"},{"internalType":"bool","name":"isVenus","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"mintAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"mintVAIAmount","type":"uint256"}],"name":"mintVAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"actualMintAmount","type":"uint256"},{"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"mintVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"mintedVAIOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintedVAIs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"oracle","outputs":[{"internalType":"contract PriceOracle","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pauseGuardian","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pendingComptrollerImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"redeemer","type":"address"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeemAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"redeemer","type":"address"},{"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"redeemVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"refreshVenusSpeeds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"repayAmount","type":"uint256"}],"name":"repayBorrowAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"actualRepayAmount","type":"uint256"},{"internalType":"uint256","name":"borrowerIndex","type":"uint256"}],"name":"repayBorrowVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"repayVAIAmount","type":"uint256"}],"name":"repayVAI","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seizeAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"seizeGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vTokenCollateral","type":"address"},{"internalType":"address","name":"vTokenBorrowed","type":"address"},{"internalType":"address","name":"liquidator","type":"address"},{"internalType":"address","name":"borrower","type":"address"},{"internalType":"uint256","name":"seizeTokens","type":"uint256"}],"name":"seizeVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMintedVAIOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"transferTokens","type":"uint256"}],"name":"transferAllowed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"transferGuardianPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"vToken","type":"address"},{"internalType":"address","name":"src","type":"address"},{"internalType":"address","name":"dst","type":"address"},{"internalType":"uint256","name":"transferTokens","type":"uint256"}],"name":"transferVerify","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"vaiController","outputs":[{"internalType":"contract VAIControllerInterface","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vaiMintRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"venusAccrued","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"venusBorrowState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"block","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"venusBorrowerIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"venusClaimThreshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"venusInitialIndex","outputs":[{"internalType":"uint224","name":"","type":"uint224"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"venusRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"venusSpeeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"venusSupplierIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"venusSupplyState","outputs":[{"internalType":"uint224","name":"index","type":"uint224"},{"internalType":"uint32","name":"block","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"}], PriceFeed: ["function price(string symbol) returns (uint256)"], CompoundLens: [{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"},{"internalType":"address payable","name":"account","type":"address"}],"name":"cTokenBalances","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"balanceOf","type":"uint256"},{"internalType":"uint256","name":"borrowBalanceCurrent","type":"uint256"},{"internalType":"uint256","name":"balanceOfUnderlying","type":"uint256"},{"internalType":"uint256","name":"tokenBalance","type":"uint256"},{"internalType":"uint256","name":"tokenAllowance","type":"uint256"}],"internalType":"struct CompoundLens.CTokenBalances","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"},{"internalType":"address payable","name":"account","type":"address"}],"name":"cTokenBalancesAll","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"balanceOf","type":"uint256"},{"internalType":"uint256","name":"borrowBalanceCurrent","type":"uint256"},{"internalType":"uint256","name":"balanceOfUnderlying","type":"uint256"},{"internalType":"uint256","name":"tokenBalance","type":"uint256"},{"internalType":"uint256","name":"tokenAllowance","type":"uint256"}],"internalType":"struct CompoundLens.CTokenBalances[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"}],"name":"cTokenMetadata","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"exchangeRateCurrent","type":"uint256"},{"internalType":"uint256","name":"supplyRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"borrowRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"reserveFactorMantissa","type":"uint256"},{"internalType":"uint256","name":"totalBorrows","type":"uint256"},{"internalType":"uint256","name":"totalReserves","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"totalCash","type":"uint256"},{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"},{"internalType":"address","name":"underlyingAssetAddress","type":"address"},{"internalType":"uint256","name":"cTokenDecimals","type":"uint256"},{"internalType":"uint256","name":"underlyingDecimals","type":"uint256"}],"internalType":"struct CompoundLens.CTokenMetadata","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"}],"name":"cTokenMetadataAll","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"exchangeRateCurrent","type":"uint256"},{"internalType":"uint256","name":"supplyRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"borrowRatePerBlock","type":"uint256"},{"internalType":"uint256","name":"reserveFactorMantissa","type":"uint256"},{"internalType":"uint256","name":"totalBorrows","type":"uint256"},{"internalType":"uint256","name":"totalReserves","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"totalCash","type":"uint256"},{"internalType":"bool","name":"isListed","type":"bool"},{"internalType":"uint256","name":"collateralFactorMantissa","type":"uint256"},{"internalType":"address","name":"underlyingAssetAddress","type":"address"},{"internalType":"uint256","name":"cTokenDecimals","type":"uint256"},{"internalType":"uint256","name":"underlyingDecimals","type":"uint256"}],"internalType":"struct CompoundLens.CTokenMetadata[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken","name":"cToken","type":"address"}],"name":"cTokenUnderlyingPrice","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"underlyingPrice","type":"uint256"}],"internalType":"struct CompoundLens.CTokenUnderlyingPrice","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract CToken[]","name":"cTokens","type":"address[]"}],"name":"cTokenUnderlyingPriceAll","outputs":[{"components":[{"internalType":"address","name":"cToken","type":"address"},{"internalType":"uint256","name":"underlyingPrice","type":"uint256"}],"internalType":"struct CompoundLens.CTokenUnderlyingPrice[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract ComptrollerLensInterface","name":"comptroller","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getAccountLimits","outputs":[{"components":[{"internalType":"contract CToken[]","name":"markets","type":"address[]"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"shortfall","type":"uint256"}],"internalType":"struct CompoundLens.AccountLimits","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"contract Comp","name":"comp","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getCompBalanceMetadata","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"},{"internalType":"address","name":"delegate","type":"address"}],"internalType":"struct CompoundLens.CompBalanceMetadata","name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract Comp","name":"comp","type":"address"},{"internalType":"contract ComptrollerLensInterface","name":"comptroller","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"getXVSBalanceMetadataExt","outputs":[{"components":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"},{"internalType":"address","name":"delegate","type":"address"},{"internalType":"uint256","name":"allocated","type":"uint256"}],"internalType":"struct CompoundLens.CompBalanceMetadataExt","name":"","type":"tuple"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"contract Comp","name":"comp","type":"address"},{"internalType":"address","name":"account","type":"address"},{"internalType":"uint32[]","name":"blockNumbers","type":"uint32[]"}],"name":"getCompVotes","outputs":[{"components":[{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"}],"internalType":"struct CompoundLens.CompVotes[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract GovernorAlpha","name":"governor","type":"address"},{"internalType":"uint256[]","name":"proposalIds","type":"uint256[]"}],"name":"getGovProposals","outputs":[{"components":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"address","name":"proposer","type":"address"},{"internalType":"uint256","name":"eta","type":"uint256"},{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"string[]","name":"signatures","type":"string[]"},{"internalType":"bytes[]","name":"calldatas","type":"bytes[]"},{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"forVotes","type":"uint256"},{"internalType":"uint256","name":"againstVotes","type":"uint256"},{"internalType":"bool","name":"canceled","type":"bool"},{"internalType":"bool","name":"executed","type":"bool"}],"internalType":"struct CompoundLens.GovProposal[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract GovernorAlpha","name":"governor","type":"address"},{"internalType":"address","name":"voter","type":"address"},{"internalType":"uint256[]","name":"proposalIds","type":"uint256[]"}],"name":"getGovReceipts","outputs":[{"components":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"bool","name":"hasVoted","type":"bool"},{"internalType":"bool","name":"support","type":"bool"},{"internalType":"uint96","name":"votes","type":"uint96"}],"internalType":"struct CompoundLens.GovReceipt[]","name":"","type":"tuple[]"}],"payable":false,"stateMutability":"view","type":"function"}], + PriceOracle: [{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousPriceMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requestedPriceMantissa","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPriceMantissa","type":"uint256"}],"name":"PricePosted","type":"event"},{"constant":true,"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"assetPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"}],"name":"getUnderlyingPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isPriceOracle","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setDirectPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"contract VToken","name":"vToken","type":"address"},{"internalType":"uint256","name":"underlyingPriceMantissa","type":"uint256"}],"name":"setUnderlyingPrice","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}], }; export const cTokens = [ diff --git a/src/priceFeed.ts b/src/priceFeed.ts index cde7616..268d929 100644 --- a/src/priceFeed.ts +++ b/src/priceFeed.ts @@ -20,16 +20,16 @@ function validateAsset( throw Error(errorPrefix + 'Argument `' + argument + '` must be a non-empty string.'); } - const assetIsCToken = asset[0] === 'c'; + const assetIsVToken = asset[0] === 'v'; - const cTokenName = assetIsCToken ? asset : 'c' + asset; - const cTokenAddress = address[this._network.name][cTokenName]; + const vTokenName = assetIsVToken ? asset : 'v' + asset; + const vTokenAddress = address[this._network.name][vTokenName]; - let underlyingName = assetIsCToken ? asset.slice(1, asset.length) : asset; + let underlyingName = assetIsVToken ? asset.slice(1, asset.length) : asset; const underlyingAddress = address[this._network.name][underlyingName]; if ( - (!cTokens.includes(cTokenName) || !underlyings.includes(underlyingName)) && + (!cTokens.includes(vTokenName) || !underlyings.includes(underlyingName)) && !opfAssets.includes(underlyingName) ) { throw Error(errorPrefix + 'Argument `' + argument + '` is not supported.'); @@ -40,31 +40,31 @@ function validateAsset( // The open price feed reveals BTC, not WBTC. underlyingName = underlyingName === 'WBTC' ? 'BTC' : underlyingName; - return [assetIsCToken, cTokenName, cTokenAddress, underlyingName, underlyingAddress, underlyingDecimals]; + return [assetIsVToken, vTokenName, vTokenAddress, underlyingName, underlyingAddress, underlyingDecimals]; } -async function cTokenExchangeRate( - cTokenAddress: string, - cTokenName: string, +async function vTokenExchangeRate( + vTokenAddress: string, + vTokenName: string, underlyingDecimals: number ) : Promise { - const address = cTokenAddress; + const address = vTokenAddress; const method = 'exchangeRateCurrent'; const options = { _compoundProvider: this._provider, - abi: cTokenName === constants.cETH ? abi.cEther : abi.cErc20, + abi: vTokenName === constants.vBNB ? abi.vBNB : abi.vBep20, }; const exchangeRateCurrent = await eth.read(address, method, [], options); - const mantissa = 18 + underlyingDecimals - 8; // cToken always 8 decimals - const oneCTokenInUnderlying = exchangeRateCurrent / Math.pow(10, mantissa); + const mantissa = 18 + underlyingDecimals - 8; // vToken always 8 decimals + const oneVTokenInUnderlying = exchangeRateCurrent / Math.pow(10, mantissa); - return oneCTokenInUnderlying; + return oneVTokenInUnderlying; } /** - * Gets an asset's price from the Compound Protocol open price feed. The price + * Gets an asset's price from the Venus Protocol open price feed. The price * of the asset can be returned in any other supported asset value, including - * all cTokens and underlyings. + * all vTokens and underlyings. * * @param {string} asset A string of a supported asset in which to find the * current price. @@ -75,16 +75,16 @@ async function cTokenExchangeRate( * * @example * ``` - * const compound = new Compound(window.ethereum); + * const venus = new Venus(window.ethereum); * let price; * * (async function () { * - * price = await compound.getPrice(Compound.WBTC); - * console.log('WBTC in USD', price); // 6 decimals, see Open Price Feed docs + * price = await venus.getPrice(Venus.BNB); + * console.log('BNB in USD', price); // 6 decimals, see Open Price Feed docs * - * price = await compound.getPrice(Compound.BAT, Compound.USDC); // supports cTokens too - * console.log('BAT in USDC', price); + * price = await venus.getPrice(Venus.SXP, Venus.USDC); // supports vTokens too + * console.log('SXP in USDC', price); * * })().catch(console.error); * ``` @@ -94,50 +94,65 @@ export async function getPrice( inAsset: string = constants.USDC ) : Promise { await netId(this); - const errorPrefix = 'Compound [getPrice] | '; + const errorPrefix = 'Venus [getPrice] | '; const [ // eslint-disable-next-line @typescript-eslint/no-unused-vars - assetIsCToken, cTokenName, cTokenAddress, underlyingName, underlyingAddress, underlyingDecimals + assetIsVToken, vTokenName, vTokenAddress, underlyingName, underlyingAddress, underlyingDecimals ] = validateAsset.bind(this)(asset, 'asset', errorPrefix); const [ // eslint-disable-next-line @typescript-eslint/no-unused-vars - inAssetIsCToken, inAssetCTokenName, inAssetCTokenAddress, inAssetUnderlyingName, inAssetUnderlyingAddress, inAssetUnderlyingDecimals + inAssetIsVToken, inAssetVTokenName, inAssetVTokenAddress, inAssetUnderlyingName, inAssetUnderlyingAddress, inAssetUnderlyingDecimals ] = validateAsset.bind(this)(inAsset, 'inAsset', errorPrefix); - const priceFeedAddress = address[this._network.name].PriceFeed; - const trxOptions: CallOptions = { + // const priceFeedAddress = address[this._network.name].PriceFeed; + const comptrollerAddress = address[this._network.name].Comptroller; + + const oracleTrxOptions: CallOptions = { _compoundProvider: this._provider, - abi: abi.PriceFeed, + abi: abi.Comptroller, }; + const priceOracleAddress = await eth.read(comptrollerAddress, 'oracle', [], oracleTrxOptions); + + // const trxOptions: CallOptions = { + // _compoundProvider: this._provider, + // abi: abi.PriceFeed, + // }; + + // const assetUnderlyingPrice = await eth.read(priceFeedAddress, 'price', [ underlyingName ], trxOptions); + // const inAssetUnderlyingPrice = await eth.read(priceFeedAddress, 'price', [ inAssetUnderlyingName ], trxOptions); - const assetUnderlyingPrice = await eth.read(priceFeedAddress, 'price', [ underlyingName ], trxOptions); - const inAssetUnderlyingPrice = await eth.read(priceFeedAddress, 'price', [ inAssetUnderlyingName ], trxOptions); + const trxOptions: CallOptions = { + _compoundProvider: this._provider, + abi: abi.PriceOracle, + }; + const assetUnderlyingPrice = await eth.read(priceOracleAddress, 'getUnderlyingPrice', [ vTokenAddress ], trxOptions); + const inAssetUnderlyingPrice = await eth.read(priceOracleAddress, 'getUnderlyingPrice', [ inAssetVTokenAddress ], trxOptions); - let assetCTokensInUnderlying, inAssetCTokensInUnderlying; + let assetVTokensInUnderlying, inAssetVTokensInUnderlying; - if (assetIsCToken) { - assetCTokensInUnderlying = await cTokenExchangeRate.bind(this)(cTokenAddress, cTokenName, underlyingDecimals); + if (assetIsVToken) { + assetVTokensInUnderlying = await vTokenExchangeRate.bind(this)(vTokenAddress, vTokenName, underlyingDecimals); } - if (inAssetIsCToken) { - inAssetCTokensInUnderlying = await cTokenExchangeRate.bind(this)(inAssetCTokenAddress, inAssetCTokenName, inAssetUnderlyingDecimals); + if (inAssetIsVToken) { + inAssetVTokensInUnderlying = await vTokenExchangeRate.bind(this)(inAssetVTokenAddress, inAssetVTokenName, inAssetUnderlyingDecimals); } let result; - if (!assetIsCToken && !inAssetIsCToken) { + if (!assetIsVToken && !inAssetIsVToken) { result = assetUnderlyingPrice / inAssetUnderlyingPrice; - } else if (assetIsCToken && !inAssetIsCToken) { + } else if (assetIsVToken && !inAssetIsVToken) { const assetInOther = assetUnderlyingPrice / inAssetUnderlyingPrice; - result = assetInOther * assetCTokensInUnderlying; - } else if (!assetIsCToken && inAssetIsCToken) { + result = assetInOther * assetVTokensInUnderlying; + } else if (!assetIsVToken && inAssetIsVToken) { const assetInOther = assetUnderlyingPrice / inAssetUnderlyingPrice; - result = assetInOther / inAssetCTokensInUnderlying; + result = assetInOther / inAssetVTokensInUnderlying; } else { const assetInOther = assetUnderlyingPrice / inAssetUnderlyingPrice; - const cTokensInUnderlying = assetInOther / assetCTokensInUnderlying; - result = inAssetCTokensInUnderlying * cTokensInUnderlying; + const vTokensInUnderlying = assetInOther / assetVTokensInUnderlying; + result = inAssetVTokensInUnderlying * vTokensInUnderlying; } return result; From 3bb168682b98ca2835d71567943cee6698c8d492 Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Sun, 29 Nov 2020 23:25:31 +0200 Subject: [PATCH 08/20] Updated getPrice decimal --- src/constants.ts | 2 +- src/priceFeed.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 559ce74..6b63bc9 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -182,7 +182,7 @@ export const address = { // bsc testnet "vBNB": "0x2E7222e51c0f6e98610A1543Aa3836E092CDe62c", "vUSDC": "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", - "vUSDT": "0xA11c8D9DC9b66E209Ef60F0C8D969D3CD988782c", + "vUSDT": "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A", "vSXP": "0x74469281310195A04840Daf6EdF576F559a3dE80", "DAI": "0x8301F2213c0eeD49a7E28Ae4c3e91722919B8B47", "USDC": "0x16227D60f7a0e586C66B005219dfc887D13C9531", diff --git a/src/priceFeed.ts b/src/priceFeed.ts index 268d929..8caf071 100644 --- a/src/priceFeed.ts +++ b/src/priceFeed.ts @@ -9,6 +9,7 @@ import { netId } from './helpers'; import { constants, address, abi, cTokens, underlyings, decimals, opfAssets } from './constants'; +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber'; import { CallOptions } from './types'; function validateAsset( @@ -127,9 +128,17 @@ export async function getPrice( _compoundProvider: this._provider, abi: abi.PriceOracle, }; - const assetUnderlyingPrice = await eth.read(priceOracleAddress, 'getUnderlyingPrice', [ vTokenAddress ], trxOptions); + let assetUnderlyingPrice = await eth.read(priceOracleAddress, 'getUnderlyingPrice', [ vTokenAddress ], trxOptions); const inAssetUnderlyingPrice = await eth.read(priceOracleAddress, 'getUnderlyingPrice', [ inAssetVTokenAddress ], trxOptions); + const assetDecimal = decimals[asset]; + const inAssetDecimal = decimals[inAsset]; + if ((assetDecimal-inAssetDecimal) > 0) { + assetUnderlyingPrice = assetUnderlyingPrice.mul(BigNumber.from("10").pow(assetDecimal-inAssetDecimal)); + } else { + assetUnderlyingPrice = assetUnderlyingPrice.div(BigNumber.from("10").pow(inAssetDecimal-assetDecimal)); + } + let assetVTokensInUnderlying, inAssetVTokensInUnderlying; if (assetIsVToken) { From 1314f5805261c41d7ae66865937db939e2509461 Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Wed, 2 Dec 2020 09:46:15 +0200 Subject: [PATCH 09/20] Added mainnet addresses --- src/cToken.ts | 1 + src/comp.ts | 6 +++++- src/constants.ts | 41 ++++++++++++++++++++++++++++++++--------- src/index.ts | 8 ++++++-- 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/cToken.ts b/src/cToken.ts index 9006f3a..3e4b205 100644 --- a/src/cToken.ts +++ b/src/cToken.ts @@ -194,6 +194,7 @@ export async function redeem( amount = ethers.BigNumber.from(amount.toString()); const trxOptions: CallOptions = { + ...options, _compoundProvider: this._provider, abi: vTokenName === constants.vBNB ? abi.vBNB : abi.vBep20, }; diff --git a/src/comp.ts b/src/comp.ts index ad78b6e..6006ec1 100644 --- a/src/comp.ts +++ b/src/comp.ts @@ -179,7 +179,11 @@ export async function claimVenus( await netId(this); try { - const userAddress = this._provider.address; + let userAddress = this._provider.address; + if (!userAddress && this._provider.getAddress) { + userAddress = await this._provider.getAddress(); + } + const comptrollerAddress = address[this._network.name].Comptroller; const trxOptions: CallOptions = { ...options, diff --git a/src/constants.ts b/src/constants.ts index 6b63bc9..c294f94 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -36,10 +36,13 @@ export const constants = { 'vUSDC': 'vUSDC', 'vUSDT': 'vUSDT', 'vSXP': 'vSXP', - 'DAI': 'DAI', + 'vBUSD': 'vBUSD', + 'vXVS': 'vXVS', + 'BUSD': 'BUSD', 'USDC': 'USDC', 'USDT': 'USDT', 'SXP': 'SXP', + 'XVS': 'XVS', 'BNB': 'BNB', }; @@ -48,10 +51,10 @@ export const address = { "PriceFeed": "0x922018674c12a7f0d394ebeef9b58f186cde13c1", "Maximillion": "0xf859A1AD94BcF445A406B892eF0d3082f4174088", "CompoundLens": "0xd513d22422a3062Bd342Ae374b4b9c20E0a9a074", - "GovernorAlpha": "0xc0dA01a04C3f3E0be433606045bB7017A7323E38", - "Comptroller": "0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B", + "GovernorAlpha": "0x406f48f47D25E9caa29f17e7Cfbd1dc6878F078f", + "Comptroller": "0xfD36E2c2a6789Db23113685031d7F16329158384", "Reservoir": "0x2775b1c75658Be0F640272CCb8c72ac986009e38", - "COMP": "0xc00e94Cb662C3520282E6f5717214004A7f26888", + "COMP": "0xcF6BB5389c92Bdda8a3747Ddb454cB7a64626C63", "cBAT": "0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E", "cCOMP": "0x70e36f6bf80a52b3b46b3af8e106cc0ed743e8e4", "cDAI": "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643", @@ -68,10 +71,23 @@ export const address = { "REP": "0x1985365e9f78359a9B6AD760e32412f4a445E862", "SAI": "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359", "UNI": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", - "USDC": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7", + // "USDC": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", + // "USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "WBTC": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", "ZRX": "0xE41d2489571d322189246DaFA5ebDe1F4699F498", + + // bsc mainnet + "vBNB": "0xA07c5b74C9B40447a954e1466938b865b6BBea36", + "vUSDC": "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", + "vUSDT": "0xfD5840Cd36d94D7229439859C0112a4185BC0255", + "vSXP": "0x2fF3d0F6990a40261c66E1ff2017aCBc282EB6d0", + "vBUSD": "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", + "vXVS": "0x151B1e2635A717bcDc836ECd6FbB62B674FE3E1D", + "USDC": "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + "USDT": "0x55d398326f99059fF775485246999027B3197955", + "SXP": "0x47BEAd2563dCBf3bF2c9407fEa4dC236fAbA485A", + "BUSD": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + "XVS": "0xcF6BB5389c92Bdda8a3747Ddb454cB7a64626C63", }, "rinkeby": { "PriceFeed": "0x5722A3F60fa4F0EC5120DCD6C386289A4758D1b2", @@ -184,10 +200,13 @@ export const address = { "vUSDC": "0xD5C4C2e2facBEB59D0216D0595d63FcDc6F9A1a7", "vUSDT": "0xb7526572FFE56AB9D7489838Bf2E18e3323b441A", "vSXP": "0x74469281310195A04840Daf6EdF576F559a3dE80", - "DAI": "0x8301F2213c0eeD49a7E28Ae4c3e91722919B8B47", + "vBUSD": "0x08e0A5575De71037aE36AbfAfb516595fE68e5e4", + "vXVS": "0x6d6F697e34145Bb95c54E77482d97cc261Dc237E", "USDC": "0x16227D60f7a0e586C66B005219dfc887D13C9531", "USDT": "0xA11c8D9DC9b66E209Ef60F0C8D969D3CD988782c", "SXP": "0x75107940Cf1121232C0559c747A986DEfbc69DA9", + "BUSD": "0x8301F2213c0eeD49a7E28Ae4c3e91722919B8B47", + "XVS": "0xB9e0E753630434d7863528cc73CB7AC638a7c8ff", } }; @@ -209,12 +228,12 @@ export const abi = { export const cTokens = [ 'cBAT', 'cCOMP', 'cDAI', 'cETH', 'cREP', 'cSAI', 'cUNI', 'cUSDC', 'cUSDT', 'cWBTC', 'cZRX', // venus tokens - 'vBNB', 'vUSDC', 'vUSDT', 'vSXP', + 'vBNB', 'vUSDC', 'vUSDT', 'vSXP', 'vBUSD', 'vXVS', ]; export const underlyings = [ 'BAT', 'COMP', 'DAI', 'ETH', 'REP', 'SAI', 'UNI', 'USDC', 'USDT', 'WBTC', 'ZRX', // venus underlyings - 'BNB', 'USDC', 'USDT', 'SXP', + 'BNB', 'USDC', 'USDT', 'SXP', 'BUSD', 'XVS', ]; // additional assets supported by the open price feed @@ -251,10 +270,14 @@ export const decimals = { 'vUSDC': 8, 'vUSDT': 8, 'vSXP': 8, + 'vBUSD': 8, + 'vXVS': 8, 'BNB': 18, 'USDC': 6, 'USDT': 6, 'SXP': 18, + 'BUSD': 18, + 'XVS': 18, }; export const errorCodes = { diff --git a/src/index.ts b/src/index.ts index 89c59c8..014e1bd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -73,7 +73,12 @@ const Venus = function( // Instance needs to know which network the provider connects to, so it can // use the correct contract addresses. - instance._networkPromise = eth.getProviderNetwork(provider).then((network) => { + instance._networkPromise = eth.getProviderNetwork(provider).then((network) => { + instance.decimals = decimals; + if (network.id === 56 && network.name === "mainnet") { + instance.decimals.USDC = 18; + instance.decimals.USDT = 18; + } delete instance._networkPromise; instance._network = network; }); @@ -85,7 +90,6 @@ Venus.eth = eth; Venus.api = api; Venus.util = util; Venus._ethers = ethers; -Venus.decimals = decimals; Venus.venus = { getVenusBalance: comp.getVenusBalance, getVenusAccrued: comp.getVenusAccrued, From 2b6b3da2a4f76100fe144b0d52e8268539894837 Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Wed, 2 Dec 2020 09:59:29 +0200 Subject: [PATCH 10/20] Updated priceFeed comment --- src/priceFeed.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/priceFeed.ts b/src/priceFeed.ts index 8caf071..444bdec 100644 --- a/src/priceFeed.ts +++ b/src/priceFeed.ts @@ -82,7 +82,7 @@ async function vTokenExchangeRate( * (async function () { * * price = await venus.getPrice(Venus.BNB); - * console.log('BNB in USD', price); // 6 decimals, see Open Price Feed docs + * console.log('BNB in USD', price); * * price = await venus.getPrice(Venus.SXP, Venus.USDC); // supports vTokens too * console.log('SXP in USDC', price); From 5596e0b57b14d29ccb4f57357ab1bd102644bdcd Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Wed, 2 Dec 2020 10:57:19 +0200 Subject: [PATCH 11/20] Updated lens address on mainnet --- src/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index c294f94..66ca74c 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -50,7 +50,7 @@ export const address = { "mainnet": { "PriceFeed": "0x922018674c12a7f0d394ebeef9b58f186cde13c1", "Maximillion": "0xf859A1AD94BcF445A406B892eF0d3082f4174088", - "CompoundLens": "0xd513d22422a3062Bd342Ae374b4b9c20E0a9a074", + "CompoundLens": "0x595e9DDfEbd47B54b996c839Ef3Dd97db3ED19bA", "GovernorAlpha": "0x406f48f47D25E9caa29f17e7Cfbd1dc6878F078f", "Comptroller": "0xfD36E2c2a6789Db23113685031d7F16329158384", "Reservoir": "0x2775b1c75658Be0F640272CCb8c72ac986009e38", From 2bf66f89dd7a17cd73632157a23b301c6a5b9e80 Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Wed, 2 Dec 2020 11:57:21 +0200 Subject: [PATCH 12/20] Updated Venus.decimals --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 014e1bd..9aead79 100644 --- a/src/index.ts +++ b/src/index.ts @@ -90,6 +90,7 @@ Venus.eth = eth; Venus.api = api; Venus.util = util; Venus._ethers = ethers; +Venus.decimals = decimals; Venus.venus = { getVenusBalance: comp.getVenusBalance, getVenusAccrued: comp.getVenusAccrued, From dff5c17be33fd111c49004527bd73929639a9ba6 Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Wed, 2 Dec 2020 12:57:27 +0200 Subject: [PATCH 13/20] Updated mainnet decimal check --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 9aead79..c02ef7c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -75,7 +75,7 @@ const Venus = function( // use the correct contract addresses. instance._networkPromise = eth.getProviderNetwork(provider).then((network) => { instance.decimals = decimals; - if (network.id === 56 && network.name === "mainnet") { + if (network.id === 56 || network.name === "mainnet") { instance.decimals.USDC = 18; instance.decimals.USDT = 18; } From 2815fede4b4afdad03a7290e54c169cff00300dd Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Wed, 2 Dec 2020 13:00:32 +0200 Subject: [PATCH 14/20] Updated docs --- docs/modules/_api_.html | 8 ++++---- docs/modules/_comp_.html | 14 +++++++------- docs/modules/_comptroller_.html | 4 ++-- docs/modules/_ctoken_.html | 8 ++++---- docs/modules/_eth_.html | 6 +++--- docs/modules/_gov_.html | 6 +++--- docs/modules/_index_.html | 2 +- docs/modules/_pricefeed_.html | 16 ++++++++-------- docs/modules/_util_.html | 6 +++--- 9 files changed, 35 insertions(+), 35 deletions(-) diff --git a/docs/modules/_api_.html b/docs/modules/_api_.html index e26ba3b..f178e22 100644 --- a/docs/modules/_api_.html +++ b/docs/modules/_api_.html @@ -92,7 +92,7 @@

    account

  • @@ -149,7 +149,7 @@

    governance

  • @@ -202,7 +202,7 @@

    marketHistory

  • @@ -250,7 +250,7 @@

    vToken

  • diff --git a/docs/modules/_comp_.html b/docs/modules/_comp_.html index b235a1a..e3bd682 100644 --- a/docs/modules/_comp_.html +++ b/docs/modules/_comp_.html @@ -95,7 +95,7 @@

    claimVenus

  • @@ -138,7 +138,7 @@

    createDelegateSignature

  • @@ -189,7 +189,7 @@

    delegate

  • @@ -236,7 +236,7 @@

    delegateBySig

  • @@ -312,7 +312,7 @@

    getVenusAccrued

  • @@ -356,7 +356,7 @@

    getVenusBalance

  • @@ -400,7 +400,7 @@

    toChecksumAddress

  • diff --git a/docs/modules/_comptroller_.html b/docs/modules/_comptroller_.html index 303eef5..c03990d 100644 --- a/docs/modules/_comptroller_.html +++ b/docs/modules/_comptroller_.html @@ -90,7 +90,7 @@

    enterMarkets

  • @@ -137,7 +137,7 @@

    exitMarket

  • diff --git a/docs/modules/_ctoken_.html b/docs/modules/_ctoken_.html index b5817f2..9933424 100644 --- a/docs/modules/_ctoken_.html +++ b/docs/modules/_ctoken_.html @@ -92,7 +92,7 @@

    borrow

  • @@ -157,7 +157,7 @@

    redeem

  • @@ -216,7 +216,7 @@

    repayBorrow

  • @@ -289,7 +289,7 @@

    supply

  • diff --git a/docs/modules/_eth_.html b/docs/modules/_eth_.html index 2d75007..95ac389 100644 --- a/docs/modules/_eth_.html +++ b/docs/modules/_eth_.html @@ -91,7 +91,7 @@

    getBalance

  • @@ -137,7 +137,7 @@

    read

  • @@ -204,7 +204,7 @@

    trx

  • diff --git a/docs/modules/_gov_.html b/docs/modules/_gov_.html index c6d33c9..77d055e 100644 --- a/docs/modules/_gov_.html +++ b/docs/modules/_gov_.html @@ -91,7 +91,7 @@

    castVote

  • @@ -145,7 +145,7 @@

    castVoteBySig

  • @@ -214,7 +214,7 @@

    createVoteSignature

  • diff --git a/docs/modules/_index_.html b/docs/modules/_index_.html index 6a6bb4b..4aacd45 100644 --- a/docs/modules/_index_.html +++ b/docs/modules/_index_.html @@ -89,7 +89,7 @@

    Const
    diff --git a/docs/modules/_pricefeed_.html b/docs/modules/_pricefeed_.html index 071b6ff..6fe5bae 100644 --- a/docs/modules/_pricefeed_.html +++ b/docs/modules/_pricefeed_.html @@ -89,27 +89,27 @@

    getPrice

  • -

    Gets an asset's price from the Compound Protocol open price feed. The price +

    Gets an asset's price from the Venus Protocol open price feed. The price of the asset can be returned in any other supported asset value, including - all cTokens and underlyings.

    + all vTokens and underlyings.

    example
    -
    const compound = new Compound(window.ethereum);
    +									
    const venus = new Venus(window.ethereum);
     let price;
     
     (async function () {
     
    -  price = await compound.getPrice(Compound.WBTC);
    -  console.log('WBTC in USD', price); // 6 decimals, see Open Price Feed docs
    +  price = await venus.getPrice(Venus.BNB);
    +  console.log('BNB in USD', price);
     
    -  price = await compound.getPrice(Compound.BAT, Compound.USDC); // supports cTokens too
    -  console.log('BAT in USDC', price);
    +  price = await venus.getPrice(Venus.SXP, Venus.USDC); // supports vTokens too
    +  console.log('SXP in USDC', price);
     
     })().catch(console.error);
    diff --git a/docs/modules/_util_.html b/docs/modules/_util_.html index fc8e45c..3988797 100644 --- a/docs/modules/_util_.html +++ b/docs/modules/_util_.html @@ -91,7 +91,7 @@

    getAbi

  • @@ -129,7 +129,7 @@

    getAddress

  • @@ -170,7 +170,7 @@

    getNetNameWithChainId

  • From 0018d40f920c61b6fbeb0a901ef84b0ba453bf59 Mon Sep 17 00:00:00 2001 From: Zhao TengHu Date: Thu, 3 Dec 2020 02:11:20 +1000 Subject: [PATCH 15/20] Update config and docs --- LICENSE | 2 +- README.md | 50 +++++++++---------- docs/index.html | 54 ++++++++++----------- docs/modules/_api_.html | 8 +-- docs/modules/_comp_.html | 14 +++--- docs/modules/_comptroller_.html | 4 +- docs/modules/_ctoken_.html | 8 +-- docs/modules/_eth_.html | 6 +-- docs/modules/_gov_.html | 6 +-- docs/modules/_index_.html | 2 +- docs/modules/_pricefeed_.html | 2 +- docs/modules/_util_.html | 16 +++--- examples/README.md | 4 +- examples/web/index.html | 6 +-- package.json | 10 ++-- rollup.config.ts | 6 +-- scripts/README.md | 4 +- scripts/{compound-docs.js => venus-docs.js} | 6 +-- src/api.ts | 4 +- src/util.ts | 12 ++--- 20 files changed, 113 insertions(+), 111 deletions(-) rename scripts/{compound-docs.js => venus-docs.js} (96%) diff --git a/LICENSE b/LICENSE index 50b2d26..0544dbb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2020 Compound Labs, Inc. +Copyright 2020 Venus Labs, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 4ff5449..7d7009f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ JSON RPC based Ethereum **read** and **write**. ### Read ```js -const Venus = require('@compound-finance/compound-js'); // in Node.js +const Venus = require('@swipewallet/venus-js'); // in Node.js const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT); (async function() { @@ -57,7 +57,7 @@ const toAddress = '0xa0df350d2637096571F7A701CBc1C5fdE30dF76A'; Simple methods for using the Venus protocol. ```js -const compound = new Venus(window.ethereum); // in a web browser +const venus = new Venus(window.ethereum); // in a web browser // Ethers.js overrides are an optional 3rd parameter for `supply` // const trxOptions = { gasLimit: 250000, mantissa: false }; @@ -65,7 +65,7 @@ const compound = new Venus(window.ethereum); // in a web browser (async function() { console.log('Supplying ETH to the Venus protocol...'); - const trx = await compound.supply(Venus.ETH, 1); + const trx = await venus.supply(Venus.ETH, 1); console.log('Ethers.js transaction object', trx); })().catch(console.error); @@ -76,7 +76,7 @@ const compound = new Venus(window.ethereum); // in a web browser Web Browser ```html - + + - + ``` ### Node.js Build @@ -239,5 +239,5 @@ npm run build const Venus = require('./dist/nodejs/index.js'); // Public NPM build -const Venus = require('@compound-finance/compound-js'); +const Venus = require('@swipewallet/venus-js'); ``` diff --git a/docs/index.html b/docs/index.html index e43b8e5..ffb782e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -75,7 +75,7 @@

    Ethereum Read & Write

    Read

    -
    const Venus = require('@compound-finance/compound-js'); // in Node.js
    +				
    const Venus = require('@swipewallet/venus-js'); // in Node.js
     const cUsdtAddress = Venus.util.getAddress(Venus.vUSDT);
     
     (async function() {
    @@ -114,7 +114,7 @@ 

    Write

    Venus Protocol

    Simple methods for using the Venus protocol.

    -
    const compound = new Venus(window.ethereum); // in a web browser
    +				
    const venus = new Venus(window.ethereum); // in a web browser
     
     // Ethers.js overrides are an optional 3rd parameter for `supply`
     // const trxOptions = { gasLimit: 250000, mantissa: false };
    @@ -122,7 +122,7 @@ 

    Venus Protocol

    (async function() { console.log('Supplying ETH to the Venus protocol...'); - const trx = await compound.supply(Venus.ETH, 1); + const trx = await venus.supply(Venus.ETH, 1); console.log('Ethers.js transaction object', trx); })().catch(console.error);
    @@ -130,45 +130,45 @@

    Venus Protocol

    Install / Import

    Web Browser

    -
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@compound-finance/compound-js@latest/dist/browser/compound.min.js"></script>
    +				
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@swipewallet/venus-js@latest/dist/browser/venus.min.js"></script>
     
     <script type="text/javascript">
       window.Venus; // or `Venus`
     </script>

    Node.js

    -
    npm install @compound-finance/compound-js
    -
    const Venus = require('@compound-finance/compound-js');
    +				
    npm install @swipewallet/venus-js
    +
    const Venus = require('@swipewallet/venus-js');
     
     // or, when using ES6
     
    -import Venus from '@compound-finance/compound-js';
    +import Venus from '@swipewallet/venus-js';

    More Code Examples

    -

    To run, boot Ganache fork of mainnet locally

    +

    To run, boot Ganache fork of mainnet locally

    Instance Creation

    The following are valid Ethereum providers for initialization of the SDK.

    -
    var compound = new Venus(window.ethereum); // web browser
    +				
    var venus = new Venus(window.ethereum); // web browser
     
    -var compound = new Venus('http://127.0.0.1:8545'); // HTTP provider
    +var venus = new Venus('http://127.0.0.1:8545'); // HTTP provider
     
    -var compound = new Venus(); // Uses Ethers.js fallback mainnet (for testing only)
    +var venus = new Venus(); // Uses Ethers.js fallback mainnet (for testing only)
     
    -var compound = new Venus('ropsten'); // Uses Ethers.js fallback (for testing only)
    +var venus = new Venus('ropsten'); // Uses Ethers.js fallback (for testing only)
     
     // Init with private key (server side)
    -var compound = new Venus('https://mainnet.infura.io/v3/_your_project_id_', {
    +var venus = new Venus('https://mainnet.infura.io/v3/_your_project_id_', {
       privateKey: '0x_your_private_key_', // preferably with environment variable
     });
     
     // Init with HD mnemonic (server side)
    -var compound = new Venus('mainnet' {
    +var venus = new Venus('mainnet' {
       mnemonic: 'clutch captain shoe...', // preferably with environment variable
     });
    @@ -185,10 +185,10 @@

    Mantissas

    Parameters of number values can be plain numbers or their scaled up mantissa values. There is a transaction option boolean to tell the SDK what the developer is passing.

    // 1 Dai
    -await compound.borrow(Venus.DAI, '1000000000000000000', { mantissa: true });
    +await venus.borrow(Venus.DAI, '1000000000000000000', { mantissa: true });
     
     // `mantissa` defaults to false if it is not specified or if an options object is not passed
    -await compound.borrow(Venus.DAI, 1, { mantissa: false });
    +await venus.borrow(Venus.DAI, 1, { mantissa: false });

    Transaction Options

    @@ -212,14 +212,14 @@

    Transaction Options

    API

    -

    The Venus API is accessible from Venus.js. The corresponding services are defined in the api namespace on the class.

    +

    The Venus API is accessible from Venus.js. The corresponding services are defined in the api namespace on the class.

    • Venus.api.account
    • Venus.api.cToken
    • Venus.api.marketHistory
    • Venus.api.governance
    -

    The governance method requires a second parameter (string) for the corresponding endpoint shown in the documentation.

    +

    The governance method requires a second parameter (string) for the corresponding endpoint shown in the documentation.

    • proposals
    • voteReceipts
    • @@ -250,18 +250,18 @@

      API

      Build for Node.js & Web Browser

      -
      git clone git@github.com:compound-finance/compound-js.git
      -cd compound-js/
      -npm install
      -npm run build
      +
      git clone git@github.com:SwipeWallet/venus-js.git
      +cd venus-js/
      +npm install
      +npm run build

      Web Browser Build

      <!-- Local build (do `npm install` first) -->
      -<script type="text/javascript" src="./dist/browser/compound.min.js"></script>
      +<script type="text/javascript" src="./dist/browser/venus.min.js"></script>
       
       <!-- Public NPM -> jsdeliver build -->
      -<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@compound-finance/compound-js@latest/dist/browser/compound.min.js"></script>
      +<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@swipewallet/venus-js@latest/dist/browser/venus.min.js"></script>

    Node.js Build

    @@ -269,7 +269,7 @@

    Node.js Build

    const Venus = require('./dist/nodejs/index.js'); // Public NPM build -const Venus = require('@compound-finance/compound-js');
    +const Venus = require('@swipewallet/venus-js');
  • @@ -149,7 +149,7 @@

    governance

  • @@ -202,7 +202,7 @@

    marketHistory

  • @@ -250,7 +250,7 @@

    vToken

  • diff --git a/docs/modules/_comp_.html b/docs/modules/_comp_.html index e3bd682..61a8f3f 100644 --- a/docs/modules/_comp_.html +++ b/docs/modules/_comp_.html @@ -95,7 +95,7 @@

    claimVenus

  • @@ -138,7 +138,7 @@

    createDelegateSignature

  • @@ -189,7 +189,7 @@

    delegate

  • @@ -236,7 +236,7 @@

    delegateBySig

  • @@ -312,7 +312,7 @@

    getVenusAccrued

  • @@ -356,7 +356,7 @@

    getVenusBalance

  • @@ -400,7 +400,7 @@

    toChecksumAddress

  • diff --git a/docs/modules/_comptroller_.html b/docs/modules/_comptroller_.html index c03990d..5ad5369 100644 --- a/docs/modules/_comptroller_.html +++ b/docs/modules/_comptroller_.html @@ -90,7 +90,7 @@

    enterMarkets

  • @@ -137,7 +137,7 @@

    exitMarket

  • diff --git a/docs/modules/_ctoken_.html b/docs/modules/_ctoken_.html index 9933424..bdc626e 100644 --- a/docs/modules/_ctoken_.html +++ b/docs/modules/_ctoken_.html @@ -92,7 +92,7 @@

    borrow

  • @@ -157,7 +157,7 @@

    redeem

  • @@ -216,7 +216,7 @@

    repayBorrow

  • @@ -289,7 +289,7 @@

    supply

  • diff --git a/docs/modules/_eth_.html b/docs/modules/_eth_.html index 95ac389..5bdfded 100644 --- a/docs/modules/_eth_.html +++ b/docs/modules/_eth_.html @@ -91,7 +91,7 @@

    getBalance

  • @@ -137,7 +137,7 @@

    read

  • @@ -204,7 +204,7 @@

    trx

  • diff --git a/docs/modules/_gov_.html b/docs/modules/_gov_.html index 77d055e..6c004b0 100644 --- a/docs/modules/_gov_.html +++ b/docs/modules/_gov_.html @@ -91,7 +91,7 @@

    castVote

  • @@ -145,7 +145,7 @@

    castVoteBySig

  • @@ -214,7 +214,7 @@

    createVoteSignature

  • diff --git a/docs/modules/_index_.html b/docs/modules/_index_.html index 4aacd45..58aba4b 100644 --- a/docs/modules/_index_.html +++ b/docs/modules/_index_.html @@ -89,7 +89,7 @@

    Const
    diff --git a/docs/modules/_pricefeed_.html b/docs/modules/_pricefeed_.html index 6fe5bae..82e26a1 100644 --- a/docs/modules/_pricefeed_.html +++ b/docs/modules/_pricefeed_.html @@ -89,7 +89,7 @@

    getPrice

  • diff --git a/docs/modules/_util_.html b/docs/modules/_util_.html index 3988797..d436202 100644 --- a/docs/modules/_util_.html +++ b/docs/modules/_util_.html @@ -91,17 +91,17 @@

    getAbi

  • Gets a contract ABI as a JavaScript array. This method supports - contracts used by the Compound Protocol.

    + contracts used by the Venus Protocol.

    example
    -
    console.log('cETH ABI: ', Compound.util.getAbi(Compound.cETH));
    +
    console.log('cETH ABI: ', Venus.util.getAbi(Venus.cETH));
    @@ -129,17 +129,17 @@

    getAddress

  • Gets the contract address of the named contract. This method supports - contracts used by the Compound Protocol.

    + contracts used by the Venus Protocol.

    example
    -
    console.log('cETH Address: ', Compound.util.getAddress(Compound.cETH));
    +
    console.log('cETH Address: ', Venus.util.getAddress(Venus.cETH));
    @@ -170,7 +170,7 @@

    getNetNameWithChainId

  • @@ -179,7 +179,7 @@

    getNetNameWithChainId

    example
    -
    console.log('Ropsten : ', Compound.util.getNetNameWithChainId(3));
    +
    console.log('Ropsten : ', Venus.util.getNetNameWithChainId(3));
  • diff --git a/examples/README.md b/examples/README.md index 46f1f02..897f36c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -2,8 +2,8 @@ Be sure to **build the SDK** from the root directory before running the Node.js examples: `npm run build`. -- [Node.js](https://github.com/compound-developers/compound-js/tree/master/examples/nodejs) Source code files. -- [Web Browser](https://compound-finance.github.io/compound-js/examples/web/) Easiest to surf in the GitHub Pages webpage. +- [Node.js](https://github.com/SwipeWallet/venus-js/tree/master/examples/nodejs) Source code files. +- [Web Browser](https://github.com/SwipeWallet/venus-js/examples/web/) Easiest to surf in the GitHub Pages webpage. ## Use Ganache Run [ganache-cli](https://www.npmjs.com/package/ganache-cli) or [Ganache](https://www.trufflesuite.com/ganache) in another command line window before running the `eth_sendTransaction` type examples. Be sure to fork mainnet. diff --git a/examples/web/index.html b/examples/web/index.html index f3d3ce8..8ab2c45 100644 --- a/examples/web/index.html +++ b/examples/web/index.html @@ -2,10 +2,10 @@ - + - + @@ -40,7 +40,7 @@

    Venus.js Examples [Alpha]

    - Code examples for client interaction with the Venus protocol via Venus.js. + Code examples for client interaction with the Venus protocol via Venus.js.

      diff --git a/package.json b/package.json index e9c0079..689eb74 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "venus-js", + "name": "@swipewallet/venus-js", "version": "0.0.1", "author": "Venus Labs, Inc.", "description": "A JavaScript SDK for Ethereum and the Venus Protocol.", @@ -9,7 +9,7 @@ "lint": "./node_modules/.bin/eslint ./src/*.ts", "build": "npm run lint && ./node_modules/.bin/tsc && npm run rollup", "docs": "./node_modules/typedoc/bin/typedoc --out ./docs/ ./src/", - "compound_docs": "node ./scripts/compound-docs.js", + "venus_docs": "node ./scripts/venus-docs.js", "prepare": "npm run build", "publish_patch": "npm version patch && npm publish --access public", "publish_minor": "npm version minor && npm publish --access public", @@ -19,7 +19,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/compound-finance/compound-js.git" + "url": "https://github.com/SwipeWallet/venus-js" }, "keywords": [ "venus", @@ -28,7 +28,9 @@ "venus protocol", "decentralized finance", "defi", - "ethereum" + "ethereum", + "binance", + "binance smart chain" ], "devDependencies": { "@babel/core": "^7.10.2", diff --git a/rollup.config.ts b/rollup.config.ts index 1193d93..a6590d0 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -4,7 +4,7 @@ import commonjs from 'rollup-plugin-commonjs'; import minify from 'rollup-plugin-babel-minify'; import json from '@rollup/plugin-json'; -const BrowserBuildPath = './dist/browser/compound.min.js'; +const BrowserBuildPath = './dist/browser/venus.min.js'; export default [{ input: './dist/nodejs/index.js', @@ -12,7 +12,7 @@ export default [{ if (message.code === 'MISSING_NODE_BUILTINS') return; }, output: { - name: 'Compound', + name: 'Venus', file: BrowserBuildPath, format: 'iife', sourcemap: false, @@ -29,7 +29,7 @@ export default [{ browser: true, }), commonjs({ - namedExports: { Compound: ['Compound'] }, + namedExports: { Venus: ['Venus'] }, }), minify({ comments: false }), json(), diff --git a/scripts/README.md b/scripts/README.md index 60c95a8..e940bca 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -2,6 +2,6 @@ These are scripts for build functionality. -## Compound Docs +## Venus Docs -To build the Compound docs, `npm run compound_docs` or `node ./scripts/compound-docs.js`. Move the contents of `/scripts/out.md` into the internal project `/src/elm/LandingSite/Docs/CompoundJsDoc.elm`. +To build the Venus docs, `npm run venus_docs` or `node ./scripts/venus-docs.js`. Move the contents of `/scripts/out.md` into the internal project `/src/elm/LandingSite/Docs/CompoundJsDoc.elm`. diff --git a/scripts/compound-docs.js b/scripts/venus-docs.js similarity index 96% rename from scripts/compound-docs.js rename to scripts/venus-docs.js index e47cecb..ee872bc 100644 --- a/scripts/compound-docs.js +++ b/scripts/venus-docs.js @@ -87,7 +87,7 @@ function markdownify(block, functionName) { if (functionName === 'function') { id = 'constructor'; - title = 'Compound Constructor'; + title = 'Venus Constructor'; } if (title === 'Get Abi') { @@ -199,12 +199,12 @@ intro += '
    \n\n'; intro += '# Venus.js\n\n'; intro += '## Introduction\n\n'; intro += '[Venus.js](https://github.com/SwipeWallet/venus-js) is a '; -intro += 'JavaScript SDK for Ethereum and the Compound Protocol. It wraps '; +intro += 'JavaScript SDK for Ethereum and the Venus Protocol. It wraps '; intro += 'around Ethers.js, which is its only dependency. It is designed for '; intro += 'both the web browser and Node.js.\n\n'; intro += 'The SDK is currently in open beta. For bugs reports and feature '; intro += 'requests, either create an issue in the GitHub repository or send a'; -intro += ' message in the Development channel of the Compound Discord.\n\n'; +intro += ' message in the Development channel of the Venus Discord.\n\n'; intro += '
    \n\n'; const srcDir = './src/'; diff --git a/src/api.ts b/src/api.ts index 7ecf038..8f4bac2 100644 --- a/src/api.ts +++ b/src/api.ts @@ -174,7 +174,7 @@ function queryApi(options: APIRequest, name: string, path: string): Promise { diff --git a/src/util.ts b/src/util.ts index 852ebed..b621759 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,6 +1,6 @@ /** * @file Utility - * @desc These methods are helpers for the Compound class. + * @desc These methods are helpers for the Venus class. */ import { address, abi } from './constants'; @@ -166,7 +166,7 @@ export function request(options: any) : Promise { /** * Gets the contract address of the named contract. This method supports - * contracts used by the Compound Protocol. + * contracts used by the Venus Protocol. * * @param {string} contract The name of the contract. * @param {string} [network] Optional name of the Ethereum network. Main net and @@ -176,7 +176,7 @@ export function request(options: any) : Promise { * * @example * ``` - * console.log('cETH Address: ', Compound.util.getAddress(Compound.cETH)); + * console.log('cETH Address: ', Venus.util.getAddress(Venus.cETH)); * ``` */ export function getAddress(contract: string, network='mainnet') : string { @@ -185,7 +185,7 @@ export function getAddress(contract: string, network='mainnet') : string { /** * Gets a contract ABI as a JavaScript array. This method supports - * contracts used by the Compound Protocol. + * contracts used by the Venus Protocol. * * @param {string} contract The name of the contract. * @@ -193,7 +193,7 @@ export function getAddress(contract: string, network='mainnet') : string { * * @example * ``` - * console.log('cETH ABI: ', Compound.util.getAbi(Compound.cETH)); + * console.log('cETH ABI: ', Venus.util.getAbi(Venus.cETH)); * ``` */ export function getAbi(contract: string): AbiType[] { @@ -209,7 +209,7 @@ export function getAbi(contract: string): AbiType[] { * * @example * ``` - * console.log('Ropsten : ', Compound.util.getNetNameWithChainId(3)); + * console.log('Ropsten : ', Venus.util.getNetNameWithChainId(3)); * ``` */ export function getNetNameWithChainId(chainId: number) : string { From 6609e889743c52b754d9b9724f12c6ac537862bc Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Wed, 2 Dec 2020 18:37:57 +0200 Subject: [PATCH 16/20] Updated util comment and docs --- docs/modules/_api_.html | 8 ++++---- docs/modules/_comp_.html | 14 +++++++------- docs/modules/_comptroller_.html | 4 ++-- docs/modules/_ctoken_.html | 8 ++++---- docs/modules/_eth_.html | 6 +++--- docs/modules/_gov_.html | 6 +++--- docs/modules/_index_.html | 2 +- docs/modules/_pricefeed_.html | 2 +- docs/modules/_util_.html | 10 +++++----- src/util.ts | 4 ++-- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/modules/_api_.html b/docs/modules/_api_.html index 8d992e4..894fec4 100644 --- a/docs/modules/_api_.html +++ b/docs/modules/_api_.html @@ -92,7 +92,7 @@

    account

  • @@ -149,7 +149,7 @@

    governance

  • @@ -202,7 +202,7 @@

    marketHistory

  • @@ -250,7 +250,7 @@

    vToken

  • diff --git a/docs/modules/_comp_.html b/docs/modules/_comp_.html index 61a8f3f..2df43f4 100644 --- a/docs/modules/_comp_.html +++ b/docs/modules/_comp_.html @@ -95,7 +95,7 @@

    claimVenus

  • @@ -138,7 +138,7 @@

    createDelegateSignature

  • @@ -189,7 +189,7 @@

    delegate

  • @@ -236,7 +236,7 @@

    delegateBySig

  • @@ -312,7 +312,7 @@

    getVenusAccrued

  • @@ -356,7 +356,7 @@

    getVenusBalance

  • @@ -400,7 +400,7 @@

    toChecksumAddress

  • diff --git a/docs/modules/_comptroller_.html b/docs/modules/_comptroller_.html index 5ad5369..c574693 100644 --- a/docs/modules/_comptroller_.html +++ b/docs/modules/_comptroller_.html @@ -90,7 +90,7 @@

    enterMarkets

  • @@ -137,7 +137,7 @@

    exitMarket

  • diff --git a/docs/modules/_ctoken_.html b/docs/modules/_ctoken_.html index bdc626e..dd5bd77 100644 --- a/docs/modules/_ctoken_.html +++ b/docs/modules/_ctoken_.html @@ -92,7 +92,7 @@

    borrow

  • @@ -157,7 +157,7 @@

    redeem

  • @@ -216,7 +216,7 @@

    repayBorrow

  • @@ -289,7 +289,7 @@

    supply

  • diff --git a/docs/modules/_eth_.html b/docs/modules/_eth_.html index 5bdfded..fedac47 100644 --- a/docs/modules/_eth_.html +++ b/docs/modules/_eth_.html @@ -91,7 +91,7 @@

    getBalance

  • @@ -137,7 +137,7 @@

    read

  • @@ -204,7 +204,7 @@

    trx

  • diff --git a/docs/modules/_gov_.html b/docs/modules/_gov_.html index 6c004b0..372bc0c 100644 --- a/docs/modules/_gov_.html +++ b/docs/modules/_gov_.html @@ -91,7 +91,7 @@

    castVote

  • @@ -145,7 +145,7 @@

    castVoteBySig

  • @@ -214,7 +214,7 @@

    createVoteSignature

  • diff --git a/docs/modules/_index_.html b/docs/modules/_index_.html index 58aba4b..3bab8c2 100644 --- a/docs/modules/_index_.html +++ b/docs/modules/_index_.html @@ -89,7 +89,7 @@

    Const
    diff --git a/docs/modules/_pricefeed_.html b/docs/modules/_pricefeed_.html index 82e26a1..c579e6f 100644 --- a/docs/modules/_pricefeed_.html +++ b/docs/modules/_pricefeed_.html @@ -89,7 +89,7 @@

    getPrice

  • diff --git a/docs/modules/_util_.html b/docs/modules/_util_.html index d436202..10aec74 100644 --- a/docs/modules/_util_.html +++ b/docs/modules/_util_.html @@ -91,7 +91,7 @@

    getAbi

  • @@ -101,7 +101,7 @@

    getAbi

    example
    -
    console.log('cETH ABI: ', Venus.util.getAbi(Venus.cETH));
    +
    console.log('vBNB ABI: ', Venus.util.getAbi(Venus.vBNB));
  • @@ -129,7 +129,7 @@

    getAddress

  • @@ -139,7 +139,7 @@

    getAddress

    example
    -
    console.log('cETH Address: ', Venus.util.getAddress(Venus.cETH));
    +
    console.log('vBNB Address: ', Venus.util.getAddress(Venus.vBNB));
  • @@ -170,7 +170,7 @@

    getNetNameWithChainId

  • diff --git a/src/util.ts b/src/util.ts index b621759..c4a10d0 100644 --- a/src/util.ts +++ b/src/util.ts @@ -176,7 +176,7 @@ export function request(options: any) : Promise { * * @example * ``` - * console.log('cETH Address: ', Venus.util.getAddress(Venus.cETH)); + * console.log('vBNB Address: ', Venus.util.getAddress(Venus.vBNB)); * ``` */ export function getAddress(contract: string, network='mainnet') : string { @@ -193,7 +193,7 @@ export function getAddress(contract: string, network='mainnet') : string { * * @example * ``` - * console.log('cETH ABI: ', Venus.util.getAbi(Venus.cETH)); + * console.log('vBNB ABI: ', Venus.util.getAbi(Venus.vBNB)); * ``` */ export function getAbi(contract: string): AbiType[] { From 5124cefb5cafbb59e03e9156979bafbdb0f94ddc Mon Sep 17 00:00:00 2001 From: ferrari105 Date: Wed, 2 Dec 2020 18:46:54 +0200 Subject: [PATCH 17/20] Updated sricpt/readme and docs --- docs/modules/_api_.html | 8 ++++---- docs/modules/_comp_.html | 14 +++++++------- docs/modules/_comptroller_.html | 4 ++-- docs/modules/_ctoken_.html | 8 ++++---- docs/modules/_eth_.html | 6 +++--- docs/modules/_gov_.html | 6 +++--- docs/modules/_index_.html | 2 +- docs/modules/_pricefeed_.html | 2 +- docs/modules/_util_.html | 6 +++--- scripts/README.md | 2 +- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/modules/_api_.html b/docs/modules/_api_.html index 894fec4..b31e722 100644 --- a/docs/modules/_api_.html +++ b/docs/modules/_api_.html @@ -92,7 +92,7 @@

    account

  • @@ -149,7 +149,7 @@

    governance

  • @@ -202,7 +202,7 @@

    marketHistory

  • @@ -250,7 +250,7 @@

    vToken

  • diff --git a/docs/modules/_comp_.html b/docs/modules/_comp_.html index 2df43f4..316dcd4 100644 --- a/docs/modules/_comp_.html +++ b/docs/modules/_comp_.html @@ -95,7 +95,7 @@

    claimVenus

  • @@ -138,7 +138,7 @@

    createDelegateSignature

  • @@ -189,7 +189,7 @@

    delegate

  • @@ -236,7 +236,7 @@

    delegateBySig

  • @@ -312,7 +312,7 @@

    getVenusAccrued

  • @@ -356,7 +356,7 @@

    getVenusBalance

  • @@ -400,7 +400,7 @@

    toChecksumAddress

  • diff --git a/docs/modules/_comptroller_.html b/docs/modules/_comptroller_.html index c574693..7c1cef9 100644 --- a/docs/modules/_comptroller_.html +++ b/docs/modules/_comptroller_.html @@ -90,7 +90,7 @@

    enterMarkets

  • @@ -137,7 +137,7 @@

    exitMarket

  • diff --git a/docs/modules/_ctoken_.html b/docs/modules/_ctoken_.html index dd5bd77..5542399 100644 --- a/docs/modules/_ctoken_.html +++ b/docs/modules/_ctoken_.html @@ -92,7 +92,7 @@

    borrow

  • @@ -157,7 +157,7 @@

    redeem

  • @@ -216,7 +216,7 @@

    repayBorrow

  • @@ -289,7 +289,7 @@

    supply

  • diff --git a/docs/modules/_eth_.html b/docs/modules/_eth_.html index fedac47..cfd07d6 100644 --- a/docs/modules/_eth_.html +++ b/docs/modules/_eth_.html @@ -91,7 +91,7 @@

    getBalance

  • @@ -137,7 +137,7 @@

    read

  • @@ -204,7 +204,7 @@

    trx

  • diff --git a/docs/modules/_gov_.html b/docs/modules/_gov_.html index 372bc0c..260d527 100644 --- a/docs/modules/_gov_.html +++ b/docs/modules/_gov_.html @@ -91,7 +91,7 @@

    castVote

  • @@ -145,7 +145,7 @@

    castVoteBySig

  • @@ -214,7 +214,7 @@

    createVoteSignature

  • diff --git a/docs/modules/_index_.html b/docs/modules/_index_.html index 3bab8c2..375d46b 100644 --- a/docs/modules/_index_.html +++ b/docs/modules/_index_.html @@ -89,7 +89,7 @@

    Const
    diff --git a/docs/modules/_pricefeed_.html b/docs/modules/_pricefeed_.html index c579e6f..1f1a83c 100644 --- a/docs/modules/_pricefeed_.html +++ b/docs/modules/_pricefeed_.html @@ -89,7 +89,7 @@

    getPrice

  • diff --git a/docs/modules/_util_.html b/docs/modules/_util_.html index 10aec74..ffdffde 100644 --- a/docs/modules/_util_.html +++ b/docs/modules/_util_.html @@ -91,7 +91,7 @@

    getAbi

  • @@ -129,7 +129,7 @@

    getAddress

  • @@ -170,7 +170,7 @@

    getNetNameWithChainId

  • diff --git a/scripts/README.md b/scripts/README.md index e940bca..db65ff0 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -4,4 +4,4 @@ These are scripts for build functionality. ## Venus Docs -To build the Venus docs, `npm run venus_docs` or `node ./scripts/venus-docs.js`. Move the contents of `/scripts/out.md` into the internal project `/src/elm/LandingSite/Docs/CompoundJsDoc.elm`. +To build the Venus docs, `npm run venus_docs` or `node ./scripts/venus-docs.js`. Move the contents of `/scripts/out.md` into the internal project `/src/elm/LandingSite/Docs/VenusJsDoc.elm`. From 16fa2dec6ff8ff1c283ebf579a2b25e20f6e3f05 Mon Sep 17 00:00:00 2001 From: Zhao TengHu Date: Thu, 3 Dec 2020 02:51:59 +1000 Subject: [PATCH 18/20] 1.0.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index bfd3925..3b8adad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "venus-js", - "version": "0.0.1", + "version": "1.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 689eb74..39e6657 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swipewallet/venus-js", - "version": "0.0.1", + "version": "1.0.0", "author": "Venus Labs, Inc.", "description": "A JavaScript SDK for Ethereum and the Venus Protocol.", "license": "BSD-3-Clause", From fb4661a59c15cc489a37d07eb9e7c7eaba5cc398 Mon Sep 17 00:00:00 2001 From: Zhao TengHu Date: Thu, 3 Dec 2020 02:55:22 +1000 Subject: [PATCH 19/20] 2.0.0 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3b8adad..da8153a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "venus-js", - "version": "1.0.0", + "version": "2.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 39e6657..4ba948d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swipewallet/venus-js", - "version": "1.0.0", + "version": "2.0.0", "author": "Venus Labs, Inc.", "description": "A JavaScript SDK for Ethereum and the Venus Protocol.", "license": "BSD-3-Clause", From 6e64a57a2683527977846a82290fe1acd6315126 Mon Sep 17 00:00:00 2001 From: Zhao TengHu Date: Thu, 3 Dec 2020 03:07:07 +1000 Subject: [PATCH 20/20] Patch version --- package.json | 2 +- test.js | 35 ----------------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 test.js diff --git a/package.json b/package.json index 4ba948d..9203194 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swipewallet/venus-js", - "version": "2.0.0", + "version": "0.0.2", "author": "Venus Labs, Inc.", "description": "A JavaScript SDK for Ethereum and the Venus Protocol.", "license": "BSD-3-Clause", diff --git a/test.js b/test.js deleted file mode 100644 index 9610d30..0000000 --- a/test.js +++ /dev/null @@ -1,35 +0,0 @@ -const BigNumber = require('bignumber.js'); -const Venus = require('.'); -const provider = 'http://3.10.133.254:8575'; -const privateKey = '0x04fd4490c7fe1e857557bdf12b1132315a718c115dfef5d8ae41045a174e5215'; -// const venus = new Venus(provider); -const venus = new Venus(provider, { privateKey, network: 'ropsten' }); - -const Web3 = require('web3'); -const web3 = new Web3(provider); - -(async function () { - - const block = await venus._provider.provider.getBlockNumber(); - console.log('block', block); - - const gasPrice = new BigNumber(await web3.eth.getGasPrice()).times(1.5).dp(0, 2).toNumber(); - let preDefinedGasValue = new BigNumber(500000).dp(0, 2).toNumber(); - let nonce = await web3.eth.getTransactionCount('0x58E312B1b0A16dF7F3D103cAB7BE438de301e534'); - // const gasLimit = new BigNumber(preDefinedGasValue).multipliedBy(new BigNumber(gasPrice)).dp(0, 2).toNumber(); - const gasLimit = new BigNumber(150000).dp(0, 2).toNumber(); - - const options = { - gasPrice: `0x${gasPrice.toString(16)}`, - gas: `0x${preDefinedGasValue.toString(16)}`, - value: '0x00', - nonce: `0x${nonce.toString(16)}`, - // chainId, - // from: options.from, - gasLimit: `0x${gasLimit.toString(16)}`, - } - console.log('options object', options); - const trx = await venus.exitMarket(Venus.SXP, options); // Use [] for multiple - console.log('Ethers.js transaction object', trx); - -})().catch(console.error);