Skip to content

Commit

Permalink
Rewards available change from .rewards() to .earned()
Browse files Browse the repository at this point in the history
Fixed pool info being called from the correct contract.
Stubbed home screen navigation.

Signed-off-by: Anton Nell <[email protected]>
  • Loading branch information
antonnell committed Jul 18, 2020
1 parent 0c9ae5c commit cfc3934
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
3 changes: 3 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ class App extends Component {
<Footer />
<Stake />
</Route>
<Route path="/staking">
<RewardsPools />
</Route>
<Route path="/">
<RewardsPools />
</Route>
Expand Down
32 changes: 10 additions & 22 deletions src/components/home/home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import {
} from '@material-ui/core';
import { withNamespaces } from 'react-i18next';
import { colors } from '../../theme'
import FlashOnIcon from '@material-ui/icons/FlashOn';
import AttachMoneyIcon from '@material-ui/icons/AttachMoney';
import SecurityIcon from '@material-ui/icons/Security';
import BarChartIcon from '@material-ui/icons/BarChart';
import PieChartIcon from '@material-ui/icons/PieChart';
import DetailsIcon from '@material-ui/icons/Details';
import HowToVoteIcon from '@material-ui/icons/HowToVote';
import WbIncandescentIcon from '@material-ui/icons/WbIncandescent';

const styles = theme => ({
root: {
Expand Down Expand Up @@ -190,27 +187,18 @@ class Home extends Component {

return (
<div className={ classes.root }>
<Card className={ `${classes.card} ${classes.earn}` } onClick={ () => { this.nav(location.pathname+'earn') } }>
<Card className={ `${classes.card} ${classes.earn}` } onClick={ () => { this.nav(location.pathname+'staking') } }>
<AttachMoneyIcon className={ `${classes.icon} icon` } />
<Typography variant={'h3'} className={ `${classes.title} title` }>{ t("Home.Earn") }</Typography>
<Typography variant={'h3'} className={ `${classes.title} title` }>Stake</Typography>
</Card>
<Card className={ `${classes.card} ${classes.zap}` } onClick={ () => { this.nav(location.pathname+'zap') } }>
<FlashOnIcon className={ `${classes.icon} icon` } />
<Typography variant={'h3'} className={ `${classes.title} title` }>{ t("Home.Zap") }</Typography>
<Card className={ `${classes.card} ${classes.zap}` } onClick={ () => { this.nav(location.pathname+'propose') } }>
<WbIncandescentIcon className={ `${classes.icon} icon` } />
<Typography variant={'h3'} className={ `${classes.title} title` }>Propose</Typography>
</Card>
<Card className={ `${classes.card} ${classes.apr}` } onClick={ () => { this.nav(location.pathname+'apr') } }>
<BarChartIcon className={ `${classes.icon} icon` } />
<Typography variant={'h3'} className={ `${classes.title} title` }>{ t("Home.Apr") }</Typography>
<Card className={ `${classes.card} ${classes.apr}` } onClick={ () => { this.nav(location.pathname+'vote') } }>
<HowToVoteIcon className={ `${classes.icon} icon` } />
<Typography variant={'h3'} className={ `${classes.title} title` }>Vote</Typography>
</Card>
<Card className={ `${classes.card} ${classes.cover}` } onClick={ () => { this.nav(location.pathname+'cover') }}>
<SecurityIcon className={ `${classes.icon} icon` } />
<Typography variant={'h3'} className={ `${classes.title} title` }>{ t("Home.Cover") }</Typography>
</Card>
<Card className={ `${classes.card} ${classes.pool}` } onClick={ () => { this.nav(location.pathname+'pool') }}>
<PieChartIcon className={ `${classes.icon} icon` } />
<Typography variant={'h3'} className={ `${classes.title} title` }>{ t("Home.Pool") }</Typography>
</Card>

</div>
)
};
Expand Down
10 changes: 5 additions & 5 deletions src/stores/store.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ class Store {
}

_getstakedBalance = async (web3, asset, account, callback) => {
let erc20Contract = new web3.eth.Contract(config.yCurveFiRewardsABI, config.yCurveFiRewardsAddress)
let erc20Contract = new web3.eth.Contract(asset.rewardsABI, asset.rewardsAddress)

try {
var balance = await erc20Contract.methods.balanceOf(account.address).call({ from: account.address });
Expand All @@ -337,12 +337,12 @@ class Store {
}

_getRewardsAvailable = async (web3, asset, account, callback) => {
let erc20Contract = new web3.eth.Contract(config.yCurveFiRewardsABI, config.yCurveFiRewardsAddress)
let erc20Contract = new web3.eth.Contract(asset.rewardsABI, asset.rewardsAddress)

try {
var rewards = await erc20Contract.methods.rewards(account.address).call({ from: account.address });
rewards = parseFloat(rewards)/10**asset.decimals
callback(null, parseFloat(rewards))
var earned = await erc20Contract.methods.earned(account.address).call({ from: account.address });
earned = parseFloat(earned)/10**asset.decimals
callback(null, parseFloat(earned))
} catch(ex) {
return callback(ex)
}
Expand Down

0 comments on commit cfc3934

Please sign in to comment.