Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix 189 balance #192

Merged
merged 21 commits into from
Sep 26, 2018
Merged

Bug fix 189 balance #192

merged 21 commits into from
Sep 26, 2018

Conversation

chrisfenos
Copy link
Contributor

  • Balance is loaded async
  • Ether - ERC20 abstracted to scripts directory for modularity
  • Balance Reducer created to track tokens and balances

let quant = state.walletTokens[0][key[1]];
let usdPrice = state.tokenConversions["ETH"].USD;
let total = quant*usdPrice;
return { ...state, initialBalance: total };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic should happen outside of the reducer. Move it to the appropriate action

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const ethers = require('ethers');

const processAllTokenBalances = async (privateKey, dataSet) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function has a lot of console.log()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

key = Object.keys(dataSet[i]);
const contract = new ethers.Contract(key[1], ERC20ABI, provider); //key[1] is contract address
const tokenBalance = await contract.balanceOf(wallet.address);
key = Object.keys(dataSet[i]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also on line 39

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Member

@GregTheGreek GregTheGreek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check for all the console.logs

const contract = new ethers.Contract(contractAdd, ERC20ABI, provider);
const tokenBalance = await contract.balanceOf(wallet.address);
const parsedTokenBalance = String(tokenBalance);
console.log('Token Balance', parsedTokenBalance);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

() => {
this.tokenBalanceLoop();
});
console.log('List refreshed');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tokenObj.symbol = dataSet[i].symbol;
if (dataSet[i].contractAddress === '') {
await this.getEthereumBalance(wallet.address)
.then((response) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GregTheGreek GregTheGreek merged commit 9766426 into staging Sep 26, 2018
@GregTheGreek GregTheGreek deleted the bugFix-189-balance branch September 26, 2018 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants