Skip to content

Commit

Permalink
Goes into negative. Apparently you can just balanceOf...
Browse files Browse the repository at this point in the history
Signed-off-by: antonnell <[email protected]>
  • Loading branch information
antonnell committed Dec 10, 2021
1 parent d9afa4f commit 49e2c34
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions stores/fixedForexStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 49e2c34

Please sign in to comment.