I have an app that is pulling all erc20 tokens for each address. Now I want to store these values already calculated to the right amount into my postgres db. Right now, I am using the column type of plain numerical.
Could this be any issue later on? Do I need to set some sort of precision and scale for the numeric column?
What is the best approach overall to store these balances which I am formatting like this
try {
const divisor = new BigNumber(10).pow(token.decimals);
let balance = new BigNumber(result);
balance = balance.div(divisor);
if (balance.isGreaterThan(0)) {
const balanceObj = await this.balanceService.create({
address: wallet,
amount: balance.toNumber(),
token: token,
});
}