From 6dbfd8e39cdda421b2606727a53e41f7ca0405b0 Mon Sep 17 00:00:00 2001 From: jin10086 Date: Sun, 18 Oct 2020 09:51:41 +0800 Subject: [PATCH 1/4] Update pools.js --- src/features/configure/pools.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/features/configure/pools.js b/src/features/configure/pools.js index 6c4fe06c7..be859110c 100644 --- a/src/features/configure/pools.js +++ b/src/features/configure/pools.js @@ -89,6 +89,21 @@ export const pools = [ pastPricePerFullShare: 1 }, { + id: 'husd', + name: 'HUSD', + token: 'HUSD', + tokenDescription: 'HUSD', + tokenAddress: '0xdF574c24545E5FfEcb9a659c229253D4111d87e1', + tokenDecimals: 8, + tokenDescriptionUrl: '', + tokenDescriptionUrl2: '', + earnedToken: 'iHUSD', + earnedTokenAddress: '0x27cD6c92Ef1e5aa5286EFA1Ede3AEbDaD623Bf3b', + earnContractAddress: '0x27cD6c92Ef1e5aa5286EFA1Ede3AEbDaD623Bf3b', + defaultApy: "42.63", + pricePerFullShare: 1, + pastPricePerFullShare: 1 + },{ id: 'busd', name: 'BUSD', token: 'BUSD', From f1b477b98549364341462c6564deffaf08042df4 Mon Sep 17 00:00:00 2001 From: jin10086 Date: Sun, 18 Oct 2020 10:24:59 +0800 Subject: [PATCH 2/4] add husd test --- src/features/configure/pools.js | 4 ++-- src/images/HUSD-logo.png | Bin 0 -> 1947 bytes 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 src/images/HUSD-logo.png diff --git a/src/features/configure/pools.js b/src/features/configure/pools.js index be859110c..22da68ad1 100644 --- a/src/features/configure/pools.js +++ b/src/features/configure/pools.js @@ -98,8 +98,8 @@ export const pools = [ tokenDescriptionUrl: '', tokenDescriptionUrl2: '', earnedToken: 'iHUSD', - earnedTokenAddress: '0x27cD6c92Ef1e5aa5286EFA1Ede3AEbDaD623Bf3b', - earnContractAddress: '0x27cD6c92Ef1e5aa5286EFA1Ede3AEbDaD623Bf3b', + earnedTokenAddress: '0xED434A25612B8d64E3257Fff5f96B33031729fDF', + earnContractAddress: '0xED434A25612B8d64E3257Fff5f96B33031729fDF', defaultApy: "42.63", pricePerFullShare: 1, pastPricePerFullShare: 1 diff --git a/src/images/HUSD-logo.png b/src/images/HUSD-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..ef49cb217c9506b4c2d65ba581ec486cced6b933 GIT binary patch literal 1947 zcmW+$2{@Hm1OBchlv0+sTPib5qNx5EV?socP(n9L?&cyDMxl~x%R1IXWvP@km&#VM z+@g}Lx|&h>N7D$E<@@ga?!JBV-OlrzbKY~#`@ZKr&vVYnIpn>6^-A1I0035dxV!qI z{T@}-R!7^auGB@e(+GF=at46=g{$NgO>~Tj^WE!0m4_okcnXXoFRS?EWjtMkqX~?ImvAWOJI01C z;3!;N=pv5B$5EEo(_pNM34NC=}0+pv~2F=-oqjJ%BDj~WfifKF(nixmnVQDa)iq7!y zpx63qL8If)#adx;n>eFMB$gs;j)DHU ze4`L(GXv5K1YMHg=t`lsKiJ2SNo2_Q-*Tx82`>|5HH#Q!f{kI2X&4k&Efk26=n7%u zpyW^{T+=UELjp;E@XNZyfdzcKcpkY#pdSo+UxF1%WPK=9-6Qc#hcoYrlIw&cQ}W>{ z`IEOYX1(a)xO7`Iw_`*ql_TC6ux}Q;E)Z-Tk`n1q(F3uzA9(4m$mJrOSR=HF;hw!I zJat{rHZ0W+0Cy+yQX53fI#FOgUo1m@uM%E;C@$>~Hw;K_^hiRB`R0+_18H#K193J> zl-?*hcU$=KgY5OR-0?gwsaCipiksIeN^2DDxd5luqp3t6YL9uM*U$HiulEr^sezFx z)i4TmDMmvq*KE7nB&Qa_LMz$)lb@tyx!m}8|$$RD7r9}s& zQ^EV9H|iGM@A5@OTON&v6oi~SRT$#F#-sv$B90!e&VHl;R=FTyX5ZQuM?2|T=FMM> zqUGRH3;l5OJ4acIqeX0x%;x2fkM4}w?rcv8W1vMD)V+1Y%Z#-sZv1E}?~as@g**{w_M0}+0Sgn(Yj98f1@=?oH3e-Hc4{&S2iKQ=G4?PoyAIZ z&S&lb#x$m@UsIz?x2UEWXw-k#u#4=umO1w=xj&V2yez%t-*>$ncJj6fc8lO!TUHp^ z*>Ig z@Yzbug6id}E{lw1B5hdfd^y!eyEhf=m;K_3)Ai(#Bi&`ESFmsP?Y+hUMql@(rx;y+ z@_?Nk;y}sy_9)8rrd5O&xqa|y$+H8u<1YWBpuO-SL|%C8GsxkYrT?KjWnpGffM1v& zGuY*f3%k%r^rSkRSl51X2f>^1zp4GV@92CE9@F){w(EI(a(mgpHG^xT@Y%ZjV&%>_ z!HK!V4|D3jFgT_E9PFu>Aa31QSM5yN{?VeOxYEvNU;m9#;$0hJ1>E<3VsSpSIm!7~ zmgV-PAq>C&O6SkBg-h`%Hm5rEwm(fPGGk_6nJUtEPWX&rZt`~%*#U>Nt=V}G6E_9v zLbQxEWaDis$dU)t4JKOsZn=3{BW3AEv$iA?AiwU&mt0=D0YIDG%0A_-MMx?8n7r?c zOs^8y)Q+`cv0~JBCmm|vY-_EQPRy2m5#Otc-$MF2=S(1a6R&vXl;5nbHJ83VaPLm$ zEp*oGJ54PWf9 zun*S*9nYn$N@OgnWCX@T^hQId1j7gd*kWgUeRqk z;vScCJD;gbJ{xOSNzBXjV@ZF{uGpBB6JI$yxWL^SQPB~t34FGj(9f-Wh;LkJKTS7W zaaHG18OMr!!Q;LS`(R}IofDXC3$na(DVHs+StB`MY3Ian_&K)4@Oz&t+leW`f%Qh~ zCHb#BH2SNCFutLe-^jY%t*zd2%98JXdip3+tKh1v;m_WQm}QrN8Eafe`Q literal 0 HcmV?d00001 From daad47455be3a5ac21dc0ceb0006e882bc4bcef3 Mon Sep 17 00:00:00 2001 From: LancelotM Date: Sun, 18 Oct 2020 12:51:57 +0800 Subject: [PATCH 3/4] #add value config itokenDecimals depostLimit --- src/features/configure/pools.js | 24 +++++++++++++++++++++ src/features/vault/sections/SectionPools.js | 21 ++++++++++++------ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/features/configure/pools.js b/src/features/configure/pools.js index 22da68ad1..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', @@ -95,6 +109,8 @@ export const pools = [ tokenDescription: 'HUSD', tokenAddress: '0xdF574c24545E5FfEcb9a659c229253D4111d87e1', tokenDecimals: 8, + itokenDecimals: 18, + depostLimit:new BigNumber('10').pow(5).toNumber(), tokenDescriptionUrl: '', tokenDescriptionUrl2: '', earnedToken: 'iHUSD', @@ -110,6 +126,8 @@ export const pools = [ tokenDescription: 'BUSD', tokenAddress: '0x4Fabb145d64652a948d72533023f6E7A623C7C53', tokenDecimals: 18, + itokenDecimals: 18, + depostLimit:0, tokenDescriptionUrl: '', tokenDescriptionUrl2: '', earnedToken: 'iBUSD', @@ -126,6 +144,8 @@ export const pools = [ tokenDescription: 'HBTC', tokenAddress: '0x0316eb71485b0ab14103307bf65a021042c6d380', tokenDecimals: 18, + itokenDecimals: 18, + depostLimit:0, tokenDescriptionUrl: '', tokenDescriptionUrl2: '', earnedToken: 'iHBTC', @@ -142,6 +162,8 @@ export const pools = [ tokenDescription: 'TUSD', tokenAddress: '0x0000000000085d4780B73119b644AE5ecd22b376', tokenDecimals: 18, + itokenDecimals: 18, + depostLimit:0, tokenDescriptionUrl: '', tokenDescriptionUrl2: '', earnedToken: 'iTUSD', @@ -158,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..a16c94fc6 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 = (inputValueNum,depostLimit) => { + if(isEmpty(inputValueNum) || depostLimit==0 || inputValueNum { 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]) || 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(new BigNumber(depositedBalance[index]).toNumber(),pool.depostLimit)) } onClick={onDeposit.bind(this, pool, index, true, balanceSingle)} >{t('Vault-DepositButtonAll')} @@ -469,7 +476,7 @@ export default function SectionPools() { Date: Sun, 18 Oct 2020 14:33:18 +0800 Subject: [PATCH 4/4] =?UTF-8?q?#Change=20Vaults=E9=A1=B5=E9=9D=A2=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=A1=86=E5=88=A0=E9=99=A40=E5=86=8D=E8=BE=93?= =?UTF-8?q?=E5=85=A50=E4=B9=8B=E5=90=8E=E5=8D=95=E4=B8=AA=E5=AD=98?= =?UTF-8?q?=E5=85=A5=E6=8F=90=E5=8F=96=E6=8C=89=E9=92=AE=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E7=94=A8=E7=9A=84BUG=20&&=20=E5=85=A8=E9=83=A8=E5=AD=98?= =?UTF-8?q?=E5=85=A5=E6=8C=89=E9=92=AE=E9=99=90=E5=88=B6=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E4=BD=99=E9=A2=9D=E4=B8=8D=E8=83=BD=E5=A4=A7=E4=BA=8E=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E9=99=90=E5=88=B6=EF=BC=8C=E5=A4=A7=E4=BA=8E=E7=9A=84?= =?UTF-8?q?=E8=AF=9D=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/vault/sections/SectionPools.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/features/vault/sections/SectionPools.js b/src/features/vault/sections/SectionPools.js index a16c94fc6..2ad43a6cc 100644 --- a/src/features/vault/sections/SectionPools.js +++ b/src/features/vault/sections/SectionPools.js @@ -223,9 +223,9 @@ export default function SectionPools() { } }, [address, web3, fetchBalances, fetchPoolBalances]); - const isMoreDepostLimit = (inputValueNum,depostLimit) => { - if(isEmpty(inputValueNum) || depostLimit==0 || inputValueNum { + if(isEmpty(value) || depostLimit==0 || value < depostLimit){ + return false } return true; } @@ -440,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() || isMoreDepostLimit(new BigNumber(depositedBalance[index]).toNumber(),pool.depostLimit)) + !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')} @@ -458,7 +458,7 @@ export default function SectionPools() { round onFocus={(event) => event.stopPropagation()} disabled={ - fetchDepositPending[index] || (new BigNumber(depositedBalance[index]).toNumber() > balanceSingle.toNumber() || isMoreDepostLimit(new BigNumber(depositedBalance[index]).toNumber(),pool.depostLimit)) + 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')} @@ -502,7 +502,7 @@ export default function SectionPools() { round type="button" color="primary" - disabled={fetchWithdrawPending[index] || !Boolean(withdrawAmount[index])} + disabled={fetchWithdrawPending[index] || !Boolean(withdrawAmount[index]) || !Boolean(withdrawAmount[index]!=0)} onClick={onWithdraw.bind(this, pool, index, false, singleDepositedBalance)} > {fetchWithdrawPending[index] ? `${t('Vault-WithdrawING')}`: `${t('Vault-WithdrawButton')}`}