Skip to content

Commit

Permalink
Merge branch 'master' into stake-in-yearn-vault
Browse files Browse the repository at this point in the history
  • Loading branch information
antonnell authored Dec 10, 2021
2 parents a7ef0e9 + cf63564 commit 351a01a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 31 deletions.
4 changes: 2 additions & 2 deletions components/ffCurveGauge/ffCurveGauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export default function ffCurveGauge({ asset }) {
disabled={depositLoading || !depositApprovalNotRequired}
onClick={onDeposit}
>
<Typography className={classes.actionButtonText}>{depositLoading ? `Depositing` : `Deposit`}</Typography>
<Typography className={classes.actionButtonText}>{depositLoading ? `Staking` : `Stake`}</Typography>
{depositLoading && <CircularProgress size={10} className={classes.loadingCircle} />}
</Button>
</div>
Expand All @@ -438,7 +438,7 @@ export default function ffCurveGauge({ asset }) {
disabled={depositLoading}
onClick={onWithdraw}
>
<Typography className={classes.actionButtonText}>{depositLoading ? `Withdrawing` : `Withdraw`}</Typography>
<Typography className={classes.actionButtonText}>{depositLoading ? `Unstaking` : `Unstake`}</Typography>
{depositLoading && <CircularProgress size={10} className={classes.loadingCircle} />}
</Button>
</div>
Expand Down
15 changes: 14 additions & 1 deletion components/ffVest/ffVest.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
.vestPeriodToggle {
background: none;
font-size: 12px !important;
margin-top: 10px;
transform: scale(0.84);
opacity: 0.6;
}
Expand Down Expand Up @@ -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;
Expand Down
19 changes: 11 additions & 8 deletions components/ffVest/lockDuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -98,12 +98,15 @@ export default function ffLockDuration({ ibff, veIBFF, veIBFFOld }) {
shrink: true,
}}
/>
<RadioGroup className={classes.vestPeriodToggle} row aria-label="position" name="position" onChange={handleChange} value={selectedValue}>
<FormControlLabel value="week" control={<Radio color="primary" />} label="1 week" labelPlacement="left" />
<FormControlLabel value="month" control={<Radio color="primary" />} label="1 month" labelPlacement="left" />
<FormControlLabel value="year" control={<Radio color="primary" />} label="1 year" labelPlacement="left" />
<FormControlLabel value="years" control={<Radio color="primary" />} label="4 years" labelPlacement="left" />
</RadioGroup>
<div className={ classes.inline }>
<Typography className={ classes.expiresIn }>Expires in </Typography>
<RadioGroup className={classes.vestPeriodToggle} row aria-label="position" name="position" onChange={handleChange} value={selectedValue}>
<FormControlLabel value="week" control={<Radio color="primary" />} label="1 week" labelPlacement="left" />
<FormControlLabel value="month" control={<Radio color="primary" />} label="1 month" labelPlacement="left" />
<FormControlLabel value="year" control={<Radio color="primary" />} label="1 year" labelPlacement="left" />
<FormControlLabel value="years" control={<Radio color="primary" />} label="4 years" labelPlacement="left" />
</RadioGroup>
</div>
</div>
</div>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion components/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ function Navigation(props) {
</Grid>
</Grid>
</div>
<Typography className={classes.smallVersion}>Version 0.7.0</Typography>
<Typography className={classes.smallVersion}>Version 0.7.1</Typography>
{ warningOpen &&
<FFWarning close={ closeWarning } />
}
Expand Down
38 changes: 19 additions & 19 deletions stores/fixedForexStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1389,30 +1389,30 @@ class Store {

_getVestingInfo = async (web3, account, veIBFF) => {
try {
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 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);
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(account.address).call()

console.log(balanceOf)

// 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),
totalSupply: BigNumber(totalSupply)
.div(10 ** veIBFF.decimals)
.toFixed(veIBFF.decimals),
};
} catch (ex) {
console.log(ex);
return null;
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) {
console.log(ex)
return null
}
};

Expand Down

0 comments on commit 351a01a

Please sign in to comment.