Skip to content

Commit 6a1e9f0

Browse files
authored
Merge branch 'master' into fix-yearn-endpoint-apy
2 parents cdec689 + 3bc08c7 commit 6a1e9f0

File tree

9 files changed

+61
-43
lines changed

9 files changed

+61
-43
lines changed

components/ffAssets/ffAssetsTable.js

-3
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,6 @@ export default function EnhancedTable({ assets }) {
350350
<Typography variant='h2' className={classes.textSpaced}>
351351
{formatCurrency(row.yearn.userVaultBalance)}
352352
</Typography>
353-
<Typography variant='h5' className={classes.textSpaced} color='textSecondary'>
354-
{row.yearn.poolSymbol}
355-
</Typography>
356353
<Typography variant='h5' className={classes.textSpaced} color='textSecondary'>
357354
{row.yearn.apy}%
358355
</Typography>

components/ffClaimAll/ffClaimAll.js

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function NoRewardsIcon(props) {
2121
export default function ffClaimAll() {
2222

2323
const [ claimLoading, setClaimLoading ] = useState(false)
24+
const [ claimedAsset, setClaimedAsset ] = useState(null)
2425
const [ claimable, setClaimable ] = useState([])
2526
const [ crv, setCRV ] = useState(null)
2627
const [ ibEUR, setIBEUR ] = useState(null)
@@ -116,6 +117,7 @@ export default function ffClaimAll() {
116117

117118
const onClaim = () => {
118119
setClaimLoading(true)
120+
setClaimedAsset(null)
119121
stores.dispatcher.dispatch({ type: FIXED_FOREX_CLAIM_ALL, content: { claimable }})
120122
}
121123

components/ffClaimAll/ffClaimAllTable.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ export default function EnhancedTable({ claimable, crv, ibEUR, rKP3R }) {
225225
const [order, setOrder] = React.useState('desc');
226226
const [orderBy, setOrderBy] = React.useState('balance');
227227
const [claimLoading, setClaimLoading ] = React.useState(false)
228+
const [claimedAsset, setClaimedAsset] = React.useState(null)
228229

229230
React.useEffect(() => {
230231
const rewardClaimed = () => {
@@ -254,6 +255,7 @@ export default function EnhancedTable({ claimable, crv, ibEUR, rKP3R }) {
254255

255256
const onClaim = (asset) => {
256257
setClaimLoading(true)
258+
setClaimedAsset(asset)
257259

258260
if(asset.gauge) {
259261
// this is a gauge
@@ -341,10 +343,10 @@ export default function EnhancedTable({ claimable, crv, ibEUR, rKP3R }) {
341343
variant='contained'
342344
size='large'
343345
color='primary'
344-
disabled={ claimLoading }
346+
disabled={ claimLoading && (!claimedAsset || claimedAsset.symbol === row.symbol) }
345347
onClick={ () => { onClaim(row) } }>
346-
<Typography className={ classes.actionButtonText }>{ claimLoading ? `Claiming` : `Claim` }</Typography>
347-
{ claimLoading && <CircularProgress size={10} className={ classes.loadingCircle } /> }
348+
<Typography className={ classes.actionButtonText }>{ claimLoading && (!claimedAsset || claimedAsset.symbol === row.symbol) ? `Claiming` : `Claim` }</Typography>
349+
{ claimLoading && (!claimedAsset || claimedAsset.symbol === row.symbol) && <CircularProgress size={10} className={ classes.loadingCircle } /> }
348350
</Button>
349351
</TableCell>
350352
</TableRow>

components/ffCurveGauge/ffCurveGauge.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export default function ffCurveGauge({ asset }) {
423423
disabled={depositLoading || !depositApprovalNotRequired}
424424
onClick={onDeposit}
425425
>
426-
<Typography className={classes.actionButtonText}>{depositLoading ? `Depositing` : `Deposit`}</Typography>
426+
<Typography className={classes.actionButtonText}>{depositLoading ? `Staking` : `Stake`}</Typography>
427427
{depositLoading && <CircularProgress size={10} className={classes.loadingCircle} />}
428428
</Button>
429429
</div>
@@ -438,7 +438,7 @@ export default function ffCurveGauge({ asset }) {
438438
disabled={depositLoading}
439439
onClick={onWithdraw}
440440
>
441-
<Typography className={classes.actionButtonText}>{depositLoading ? `Withdrawing` : `Withdraw`}</Typography>
441+
<Typography className={classes.actionButtonText}>{depositLoading ? `Unstaking` : `Unstake`}</Typography>
442442
{depositLoading && <CircularProgress size={10} className={classes.loadingCircle} />}
443443
</Button>
444444
</div>

components/ffDashboardClaimAll/ffDashboardClaimAllTable.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ export default function EnhancedTable({ claimable, crv, ibEUR, rKP3R }) {
212212
const [order, setOrder] = React.useState('desc');
213213
const [orderBy, setOrderBy] = React.useState('balance');
214214
const [claimLoading, setClaimLoading ] = React.useState(false)
215+
const [claimedAsset, setClaimedAsset] = React.useState()
215216

216217
React.useEffect(() => {
217218
const rewardClaimed = () => {
@@ -242,18 +243,18 @@ export default function EnhancedTable({ claimable, crv, ibEUR, rKP3R }) {
242243
const onClaim = (asset) => {
243244
console.log(asset)
244245
setClaimLoading(true)
246+
setClaimedAsset(asset)
245247

246248
if(asset.gauge) {
247249
// this is a gauge
248250
stores.dispatcher.dispatch({ type: FIXED_FOREX_CLAIM_CURVE_REWARDS, content: { asset: asset.gauge }})
249251
} else if(asset.type === 'Fixed Forex' && asset.description === 'Fee Claim') {
250252
stores.dispatcher.dispatch({ type: FIXED_FOREX_CLAIM_DISTRIBUTION_REWARD, content: { }})
251-
} else if(gauge.type === 'Fixed Forex' && gauge.description === 'Vesting Rewards') {
253+
} else if(asset.type === 'Fixed Forex' && asset.description === 'Vesting Rewards') {
252254
stores.dispatcher.dispatch({ type: FIXED_FOREX_CLAIM_VESTING_REWARD, content: { }})
253-
} else if(gauge.type === 'Fixed Forex' && gauge.description === 'Redeemable KP3R') {
255+
} else if(asset.type === 'Fixed Forex' && asset.description === 'Redeemable KP3R') {
254256
stores.dispatcher.dispatch({ type: FIXED_FOREX_CLAIM_RKP3R, content: { }})
255257
}
256-
257258
}
258259

259260
if (!claimable) {
@@ -349,10 +350,10 @@ export default function EnhancedTable({ claimable, crv, ibEUR, rKP3R }) {
349350
variant='contained'
350351
size='large'
351352
color='primary'
352-
disabled={ claimLoading }
353+
disabled={ claimLoading && (!claimedAsset || claimedAsset.symbol === row.symbol) }
353354
onClick={ () => { onClaim(row) } }>
354-
<Typography className={ classes.actionButtonText }>{ claimLoading ? `Claiming` : `Claim` }</Typography>
355-
{ claimLoading && <CircularProgress size={10} className={ classes.loadingCircle } /> }
355+
<Typography className={ classes.actionButtonText }>{ claimLoading && (!claimedAsset || claimedAsset.symbol === row.symbol) ? `Claiming` : `Claim` }</Typography>
356+
{ claimLoading && (!claimedAsset || claimedAsset.symbol === row.symbol) && <CircularProgress size={10} className={ classes.loadingCircle } /> }
356357
</Button>
357358

358359
</Grid>

components/ffVest/ffVest.module.css

+14-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
.vestPeriodToggle {
5959
background: none;
6060
font-size: 12px !important;
61-
margin-top: 10px;
6261
transform: scale(0.84);
6362
opacity: 0.6;
6463
}
@@ -258,6 +257,20 @@
258257
height: 130px;
259258
}
260259

260+
.inline {
261+
display: flex;
262+
align-items: center;
263+
margin-top: 10px;
264+
}
265+
266+
.expiresIn {
267+
background: none;
268+
269+
-webkit-transform: scale(0.84);
270+
transform: scale(0.84);
271+
opacity: 0.6;
272+
}
273+
261274
@media screen and (max-width: 1200px) {
262275
.container {
263276
top: 180px;

components/ffVest/lockDuration.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function ffLockDuration({ ibff, veIBFF, veIBFFOld }) {
3737
}, []);
3838

3939
useEffect(() => {
40-
if(veIBFF.vestingInfo.lockEnds) {
40+
if(veIBFF && veIBFF.vestingInfo && veIBFF.vestingInfo.lockEnds) {
4141
setSelectedDate(moment.unix(veIBFF.vestingInfo.lockEnds).format('YYYY-MM-DD'))
4242
setSelectedValue(null)
4343
}
@@ -67,7 +67,7 @@ export default function ffLockDuration({ ibff, veIBFF, veIBFFOld }) {
6767
break;
6868
default:
6969
}
70-
const newDate = moment.unix(veIBFF.vestingInfo.lockEnds).add(days, 'days').format('YYYY-MM-DD');
70+
const newDate = moment().add(days, 'days').format('YYYY-MM-DD');
7171

7272
setSelectedDate(newDate);
7373
}
@@ -98,12 +98,15 @@ export default function ffLockDuration({ ibff, veIBFF, veIBFFOld }) {
9898
shrink: true,
9999
}}
100100
/>
101-
<RadioGroup className={classes.vestPeriodToggle} row aria-label="position" name="position" onChange={handleChange} value={selectedValue}>
102-
<FormControlLabel value="week" control={<Radio color="primary" />} label="1 week" labelPlacement="left" />
103-
<FormControlLabel value="month" control={<Radio color="primary" />} label="1 month" labelPlacement="left" />
104-
<FormControlLabel value="year" control={<Radio color="primary" />} label="1 year" labelPlacement="left" />
105-
<FormControlLabel value="years" control={<Radio color="primary" />} label="4 years" labelPlacement="left" />
106-
</RadioGroup>
101+
<div className={ classes.inline }>
102+
<Typography className={ classes.expiresIn }>Expires in </Typography>
103+
<RadioGroup className={classes.vestPeriodToggle} row aria-label="position" name="position" onChange={handleChange} value={selectedValue}>
104+
<FormControlLabel value="week" control={<Radio color="primary" />} label="1 week" labelPlacement="left" />
105+
<FormControlLabel value="month" control={<Radio color="primary" />} label="1 month" labelPlacement="left" />
106+
<FormControlLabel value="year" control={<Radio color="primary" />} label="1 year" labelPlacement="left" />
107+
<FormControlLabel value="years" control={<Radio color="primary" />} label="4 years" labelPlacement="left" />
108+
</RadioGroup>
109+
</div>
107110
</div>
108111
</div>
109112
</Grid>

components/navigation/navigation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ function Navigation(props) {
512512
</Grid>
513513
</Grid>
514514
</div>
515-
<Typography className={classes.smallVersion}>Version 0.7.0</Typography>
515+
<Typography className={classes.smallVersion}>Version 0.7.1</Typography>
516516
{ warningOpen &&
517517
<FFWarning close={ closeWarning } />
518518
}

stores/fixedForexStore.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -1389,30 +1389,30 @@ class Store {
13891389

13901390
_getVestingInfo = async (web3, account, veIBFF) => {
13911391
try {
1392-
const veIBFFContract = new web3.eth.Contract(abis.veIBFFABI, FF_VEKP3R_ADDRESS);
1393-
const lockedInfo = await veIBFFContract.methods.locked(account.address).call();
1394-
const totalSupply = await veIBFFContract.methods.totalSupply().call();
13951392

1396-
const fourYears = 126144000; // 60 * 60 * 24 * 365 * 4
1397-
const now = Math.floor(Date.now() / 1000);
1398-
const maxLock = BigNumber(now).plus(fourYears).toNumber();
1399-
const percentOfFourYearsLocked = 1 - BigNumber(maxLock).minus(lockedInfo.end).div(fourYears).toFixed(veIBFF.decimals);
1400-
const locked = BigNumber(lockedInfo.amount)
1401-
.div(10 ** veIBFF.decimals)
1402-
.toFixed(veIBFF.decimals);
1393+
const veIBFFContract = new web3.eth.Contract(abis.veIBFFABI, FF_VEKP3R_ADDRESS)
1394+
const lockedInfo = await veIBFFContract.methods.locked(account.address).call()
1395+
const totalSupply = await veIBFFContract.methods.totalSupply().call()
1396+
const balanceOf = await veIBFFContract.methods.balanceOf(account.address).call()
1397+
1398+
console.log(balanceOf)
1399+
1400+
// const fourYears = 126144000 // 60 * 60 * 24 * 365 * 4
1401+
// const now = Math.floor(Date.now() / 1000)
1402+
// const maxLock = BigNumber(now).plus(fourYears).toNumber()
1403+
// const percentOfFourYearsLocked = 1-BigNumber(maxLock).minus(lockedInfo.end).div(fourYears).toFixed(veIBFF.decimals)
1404+
const locked = BigNumber(lockedInfo.amount).div(10**veIBFF.decimals).toFixed(veIBFF.decimals)
14031405

14041406
return {
14051407
locked: locked,
14061408
lockEnds: lockedInfo.end,
1407-
lockValue: BigNumber(locked).times(percentOfFourYearsLocked).toFixed(veIBFF.decimals),
1408-
votePower: BigNumber(locked).times(percentOfFourYearsLocked).toFixed(veIBFF.decimals),
1409-
totalSupply: BigNumber(totalSupply)
1410-
.div(10 ** veIBFF.decimals)
1411-
.toFixed(veIBFF.decimals),
1412-
};
1413-
} catch (ex) {
1414-
console.log(ex);
1415-
return null;
1409+
lockValue: BigNumber(balanceOf).div(10**veIBFF.decimals).toFixed(veIBFF.decimals),
1410+
votePower: BigNumber(balanceOf).div(10**veIBFF.decimals).toFixed(veIBFF.decimals),
1411+
totalSupply: BigNumber(totalSupply).div(10**veIBFF.decimals).toFixed(veIBFF.decimals),
1412+
}
1413+
} catch(ex) {
1414+
console.log(ex)
1415+
return null
14161416
}
14171417
};
14181418

0 commit comments

Comments
 (0)