diff --git a/src/features/configure/pools.js b/src/features/configure/pools.js
index 6c4fe06c7..f4e594e35 100644
--- a/src/features/configure/pools.js
+++ b/src/features/configure/pools.js
@@ -1,8 +1,12 @@
+import BigNumber from "bignumber.js";
// id: '池子id',
// name: '池子名字',
// token: '池子代币',
// tokenDescription: '代币描述',
// tokenAddress: '代币ERC20地址',
+// tokenDecimals: '存入精度'
+// itokenDecimals: '提取精度'
+// depostLimit: '存入最大数量限制' 0时不限制
// earnedToken: '奖励代币',
// earnedTokenAddress: '奖励代币ERC20地址',
// earnContractAddress: '池子合约地址',
@@ -16,6 +20,8 @@ export const pools = [
tokenDescription: 'ETH',
tokenAddress: '',
tokenDecimals: 18,
+ itokenDecimals: 18,
+ depostLimit:0,
tokenDescriptionUrl: '',
tokenDescriptionUrl2: '',
earnedToken: 'iWETH',
@@ -32,6 +38,8 @@ export const pools = [
tokenDescription: 'WETH',
tokenAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
tokenDecimals: 18,
+ itokenDecimals: 18,
+ depostLimit:0,
tokenDescriptionUrl: '',
tokenDescriptionUrl2: '',
earnedToken: 'iWETH',
@@ -48,6 +56,8 @@ export const pools = [
tokenDescription: 'USDT',
tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
tokenDecimals: 6,
+ itokenDecimals: 6,
+ depostLimit:0,
tokenDescriptionUrl: '',
tokenDescriptionUrl2: '',
earnedToken: 'iUSDT',
@@ -63,6 +73,8 @@ export const pools = [
tokenDescription: 'USDC',
tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
tokenDecimals: 6,
+ itokenDecimals: 6,
+ depostLimit:0,
tokenDescriptionUrl: '',
tokenDescriptionUrl2: '',
earnedToken: 'iUSDC',
@@ -79,6 +91,8 @@ export const pools = [
tokenDescription: 'DAI',
tokenAddress: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
tokenDecimals: 18,
+ itokenDecimals: 18,
+ depostLimit:0,
tokenDescriptionUrl: '',
tokenDescriptionUrl2: 'https://docs.dfi.money/#/zh-cn/buy-tokens?id=_2-dai%e5%85%91%e6%8d%a2',
earnedToken: 'iDAI',
@@ -89,12 +103,31 @@ export const pools = [
pastPricePerFullShare: 1
},
{
+ id: 'husd',
+ name: 'HUSD',
+ token: 'HUSD',
+ tokenDescription: 'HUSD',
+ tokenAddress: '0xdF574c24545E5FfEcb9a659c229253D4111d87e1',
+ tokenDecimals: 8,
+ itokenDecimals: 18,
+ depostLimit:new BigNumber('10').pow(5).toNumber(),
+ tokenDescriptionUrl: '',
+ tokenDescriptionUrl2: '',
+ earnedToken: 'iHUSD',
+ earnedTokenAddress: '0xED434A25612B8d64E3257Fff5f96B33031729fDF',
+ earnContractAddress: '0xED434A25612B8d64E3257Fff5f96B33031729fDF',
+ defaultApy: "42.63",
+ pricePerFullShare: 1,
+ pastPricePerFullShare: 1
+ },{
id: 'busd',
name: 'BUSD',
token: 'BUSD',
tokenDescription: 'BUSD',
tokenAddress: '0x4Fabb145d64652a948d72533023f6E7A623C7C53',
tokenDecimals: 18,
+ itokenDecimals: 18,
+ depostLimit:0,
tokenDescriptionUrl: '',
tokenDescriptionUrl2: '',
earnedToken: 'iBUSD',
@@ -111,6 +144,8 @@ export const pools = [
tokenDescription: 'HBTC',
tokenAddress: '0x0316eb71485b0ab14103307bf65a021042c6d380',
tokenDecimals: 18,
+ itokenDecimals: 18,
+ depostLimit:0,
tokenDescriptionUrl: '',
tokenDescriptionUrl2: '',
earnedToken: 'iHBTC',
@@ -127,6 +162,8 @@ export const pools = [
tokenDescription: 'TUSD',
tokenAddress: '0x0000000000085d4780B73119b644AE5ecd22b376',
tokenDecimals: 18,
+ itokenDecimals: 18,
+ depostLimit:0,
tokenDescriptionUrl: '',
tokenDescriptionUrl2: '',
earnedToken: 'iTUSD',
@@ -143,6 +180,8 @@ export const pools = [
tokenDescription: 'yCRV',
tokenAddress: '0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8',
tokenDecimals: 18,
+ itokenDecimals: 18,
+ depostLimit:0,
tokenDescriptionUrl: 'https://docs.dfi.money/#/using-crv?id=how-to-get-ycrv',
tokenDescriptionUrl2: 'https://docs.dfi.money/#/zh-cn/buy-tokens?id=_5-ycrv%e5%85%91%e6%8d%a2',
earnedToken: 'iYCRV',
diff --git a/src/features/vault/sections/SectionPools.js b/src/features/vault/sections/SectionPools.js
index 97f7afcd0..2ad43a6cc 100644
--- a/src/features/vault/sections/SectionPools.js
+++ b/src/features/vault/sections/SectionPools.js
@@ -38,7 +38,7 @@ import CustomSlider from 'components/CustomSlider/CustomSlider';
import sectionPoolsStyle from "../jss/sections/sectionPoolsStyle";
import { reflect } from 'async';
-import { inputLimitPass,inputFinalVal } from 'features/helpers/utils';
+import { inputLimitPass,inputFinalVal,isEmpty } from 'features/helpers/utils';
const useStyles = makeStyles(sectionPoolsStyle);
@@ -174,7 +174,7 @@ export default function SectionPools() {
address,
web3,
isAll,
- amount: new BigNumber(amountValue).multipliedBy(new BigNumber(10).exponentiatedBy(pool.tokenDecimals)).toString(10),
+ amount: new BigNumber(amountValue).multipliedBy(new BigNumber(10).exponentiatedBy(pool.itokenDecimals)).toString(10),
contractAddress: pool.earnContractAddress,
index
}).then(
@@ -187,7 +187,7 @@ export default function SectionPools() {
address,
web3,
isAll,
- amount: new BigNumber(amountValue).multipliedBy(new BigNumber(10).exponentiatedBy(pool.tokenDecimals)).toString(10),
+ amount: new BigNumber(amountValue).multipliedBy(new BigNumber(10).exponentiatedBy(pool.itokenDecimals)).toString(10),
contractAddress: pool.earnContractAddress,
index
}).then(
@@ -223,6 +223,13 @@ export default function SectionPools() {
}
}, [address, web3, fetchBalances, fetchPoolBalances]);
+ const isMoreDepostLimit = (value,depostLimit) => {
+ if(isEmpty(value) || depostLimit==0 || value < depostLimit){
+ return false
+ }
+ return true;
+ }
+
useEffect(() => {
fetchContractApy();
}, [pools, fetchContractApy]);
@@ -261,7 +268,7 @@ export default function SectionPools() {
let balanceSingle = byDecimals(tokens[pool.token].tokenBalance, pool.tokenDecimals);
// balanceSingle = byDecimals(random(1, 1000000), 1)
// balanceSingle = new BigNumber(random(1, 1000000000000000))
- let singleDepositedBalance = byDecimals(tokens[pool.earnedToken].tokenBalance, pool.tokenDecimals);
+ let singleDepositedBalance = byDecimals(tokens[pool.earnedToken].tokenBalance, pool.itokenDecimals);
// singleDepositedBalance = byDecimals(random(1, 1000000), 1)
// singleDepositedBalance = new BigNumber(random(1, 1000))
let depositedApy = contractApy[pool.id] || 0;
@@ -433,7 +440,7 @@ export default function SectionPools() {
round
onFocus={(event) => event.stopPropagation()}
disabled={
- !Boolean(depositedBalance[index]) || fetchDepositPending[index] || (new BigNumber(depositedBalance[index]).toNumber() > balanceSingle.toNumber())
+ !Boolean(depositedBalance[index]) || !Boolean(depositedBalance[index]!=0) || fetchDepositPending[index] || (new BigNumber(depositedBalance[index]).toNumber() > balanceSingle.toNumber() || isMoreDepostLimit(new BigNumber(depositedBalance[index]).toNumber(),pool.depostLimit) )
}
onClick={onDeposit.bind(this, pool, index, false, balanceSingle)}
>{t('Vault-DepositButton')}
@@ -451,7 +458,7 @@ export default function SectionPools() {
round
onFocus={(event) => event.stopPropagation()}
disabled={
- fetchDepositPending[index] || (new BigNumber(depositedBalance[index]).toNumber() > balanceSingle.toNumber())
+ fetchDepositPending[index] || (new BigNumber(depositedBalance[index]).toNumber() > balanceSingle.toNumber() || isMoreDepostLimit(balanceSingle.toNumber(),pool.depostLimit) )
}
onClick={onDeposit.bind(this, pool, index, true, balanceSingle)}
>{t('Vault-DepositButtonAll')}
@@ -469,7 +476,7 @@ export default function SectionPools() {
{fetchWithdrawPending[index] ? `${t('Vault-WithdrawING')}`: `${t('Vault-WithdrawButton')}`}
diff --git a/src/images/HUSD-logo.png b/src/images/HUSD-logo.png
new file mode 100644
index 000000000..ef49cb217
Binary files /dev/null and b/src/images/HUSD-logo.png differ