From 49e2c343b2e8b8738465e0c9cd2a6605c72e03fd Mon Sep 17 00:00:00 2001 From: antonnell Date: Fri, 10 Dec 2021 07:48:17 +0200 Subject: [PATCH 1/2] Goes into negative. Apparently you can just balanceOf... Signed-off-by: antonnell --- stores/fixedForexStore.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/stores/fixedForexStore.js b/stores/fixedForexStore.js index cf2767b..3d64606 100644 --- a/stores/fixedForexStore.js +++ b/stores/fixedForexStore.js @@ -1221,18 +1221,19 @@ class Store { const veIBFFContract = new web3.eth.Contract(abis.veIBFFABI, FF_VEKP3R_ADDRESS) const lockedInfo = await veIBFFContract.methods.locked(account.address).call() const totalSupply = await veIBFFContract.methods.totalSupply().call() + const balanceOf = await veIBFFContract.methods.balanceOf().call(account) - const fourYears = 126144000 // 60 * 60 * 24 * 365 * 4 - const now = Math.floor(Date.now() / 1000) - const maxLock = BigNumber(now).plus(fourYears).toNumber() - const percentOfFourYearsLocked = 1-BigNumber(maxLock).minus(lockedInfo.end).div(fourYears).toFixed(veIBFF.decimals) + // const fourYears = 126144000 // 60 * 60 * 24 * 365 * 4 + // const now = Math.floor(Date.now() / 1000) + // const maxLock = BigNumber(now).plus(fourYears).toNumber() + // const percentOfFourYearsLocked = 1-BigNumber(maxLock).minus(lockedInfo.end).div(fourYears).toFixed(veIBFF.decimals) const locked = BigNumber(lockedInfo.amount).div(10**veIBFF.decimals).toFixed(veIBFF.decimals) return { locked: locked, lockEnds: lockedInfo.end, - lockValue: BigNumber(locked).times(percentOfFourYearsLocked).toFixed(veIBFF.decimals), - votePower: BigNumber(locked).times(percentOfFourYearsLocked).toFixed(veIBFF.decimals), + lockValue: BigNumber(balanceOf).div(10**veIBFF.decimals).toFixed(veIBFF.decimals), + votePower: BigNumber(balanceOf).div(10**veIBFF.decimals).toFixed(veIBFF.decimals), totalSupply: BigNumber(totalSupply).div(10**veIBFF.decimals).toFixed(veIBFF.decimals), } } catch(ex) { From cf6356458690be7e030ad4702db495c714c6fa91 Mon Sep 17 00:00:00 2001 From: antonnell Date: Fri, 10 Dec 2021 08:04:02 +0200 Subject: [PATCH 2/2] tweaks to vesting. Signed-off-by: antonnell --- components/ffCurveGauge/ffCurveGauge.js | 4 ++-- components/ffVest/ffVest.module.css | 15 ++++++++++++++- components/ffVest/lockDuration.js | 19 +++++++++++-------- components/navigation/navigation.js | 2 +- stores/fixedForexStore.js | 4 +++- 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/components/ffCurveGauge/ffCurveGauge.js b/components/ffCurveGauge/ffCurveGauge.js index fae305a..a8213f1 100644 --- a/components/ffCurveGauge/ffCurveGauge.js +++ b/components/ffCurveGauge/ffCurveGauge.js @@ -361,7 +361,7 @@ export default function ffCurveGauge({ asset }) { disabled={ depositLoading || !depositApprovalNotRequired } onClick={ onDeposit } > - { depositLoading ? `Depositing` : `Deposit` } + { depositLoading ? `Staking` : `Stake` } { depositLoading && } @@ -377,7 +377,7 @@ export default function ffCurveGauge({ asset }) { disabled={ depositLoading } onClick={ onWithdraw } > - { depositLoading ? `Withdrawing` : `Withdraw` } + { depositLoading ? `Unstaking` : `Unstake` } { depositLoading && } diff --git a/components/ffVest/ffVest.module.css b/components/ffVest/ffVest.module.css index 7edfdc2..84d029c 100644 --- a/components/ffVest/ffVest.module.css +++ b/components/ffVest/ffVest.module.css @@ -58,7 +58,6 @@ .vestPeriodToggle { background: none; font-size: 12px !important; - margin-top: 10px; transform: scale(0.84); opacity: 0.6; } @@ -258,6 +257,20 @@ height: 130px; } +.inline { + display: flex; + align-items: center; + margin-top: 10px; +} + +.expiresIn { + background: none; + + -webkit-transform: scale(0.84); + transform: scale(0.84); + opacity: 0.6; +} + @media screen and (max-width: 1200px) { .container { top: 180px; diff --git a/components/ffVest/lockDuration.js b/components/ffVest/lockDuration.js index 0a38d0d..5a3b4f7 100644 --- a/components/ffVest/lockDuration.js +++ b/components/ffVest/lockDuration.js @@ -37,7 +37,7 @@ export default function ffLockDuration({ ibff, veIBFF, veIBFFOld }) { }, []); useEffect(() => { - if(veIBFF.vestingInfo.lockEnds) { + if(veIBFF && veIBFF.vestingInfo && veIBFF.vestingInfo.lockEnds) { setSelectedDate(moment.unix(veIBFF.vestingInfo.lockEnds).format('YYYY-MM-DD')) setSelectedValue(null) } @@ -67,7 +67,7 @@ export default function ffLockDuration({ ibff, veIBFF, veIBFFOld }) { break; default: } - const newDate = moment.unix(veIBFF.vestingInfo.lockEnds).add(days, 'days').format('YYYY-MM-DD'); + const newDate = moment().add(days, 'days').format('YYYY-MM-DD'); setSelectedDate(newDate); } @@ -98,12 +98,15 @@ export default function ffLockDuration({ ibff, veIBFF, veIBFFOld }) { shrink: true, }} /> - - } label="1 week" labelPlacement="left" /> - } label="1 month" labelPlacement="left" /> - } label="1 year" labelPlacement="left" /> - } label="4 years" labelPlacement="left" /> - +
+ Expires in + + } label="1 week" labelPlacement="left" /> + } label="1 month" labelPlacement="left" /> + } label="1 year" labelPlacement="left" /> + } label="4 years" labelPlacement="left" /> + +
diff --git a/components/navigation/navigation.js b/components/navigation/navigation.js index 0c340f4..eb05137 100644 --- a/components/navigation/navigation.js +++ b/components/navigation/navigation.js @@ -512,7 +512,7 @@ function Navigation(props) { - Version 0.7.0 + Version 0.7.1 { warningOpen && } diff --git a/stores/fixedForexStore.js b/stores/fixedForexStore.js index 3d64606..2230f31 100644 --- a/stores/fixedForexStore.js +++ b/stores/fixedForexStore.js @@ -1221,7 +1221,9 @@ class Store { const veIBFFContract = new web3.eth.Contract(abis.veIBFFABI, FF_VEKP3R_ADDRESS) const lockedInfo = await veIBFFContract.methods.locked(account.address).call() const totalSupply = await veIBFFContract.methods.totalSupply().call() - const balanceOf = await veIBFFContract.methods.balanceOf().call(account) + const balanceOf = await veIBFFContract.methods.balanceOf(account.address).call() + + console.log(balanceOf) // const fourYears = 126144000 // 60 * 60 * 24 * 365 * 4 // const now = Math.floor(Date.now() / 1000)