Open hav-noms opened 5 years ago
I've started looking into this. Is the idea that we calculate new balances based on the event? It seems like the event gets triggered many times, which makes this tricky.
So I guess I'll do something like this? Is that what you had in mind?
snxJSConnector.snxJS.sUSD.contract.on('Issued', () => getBalances());
Also I can seem to mint or burn on Kovan. Minting throws an error when I type in the input box and Burning fails after a while (Metamask is saying No conversion rate available) Any idea why that might be the case?
@clementbalestrat
@bachstatter you can filter on your address. So if the event is yours you can refresh your collat state. as you would have just locked/unlocked your SNX.
contract.on("Issued", (address, amount) => { console.log("address", address); console.log("amount", amount.toString()); }
Yea ok that make sense. I still say it's less error prone to just refetch the new balance, but for the sake of minimising request it might be worth doing it this way.
Do we have any test networks that mintr works on?
All of them - kovan
, rinkeby
and ropsten
@bachstatter yes I agree. If we wire up all the event handlers at least we can fetch data when the state changes and even be more clever about what data to fetch when what state changes. We don't need to poll for everything.
@hav-noms any reason you closed this issue?
I thought that was weird too. I've started on it, just been a bit smashed this week.
Just to confirm, the plan is to listen to events then fetch just the data necessary?
@bachstatter @clementbalestrat sorry boys I did not mean to close this.
yeah listen to mint and burn for your address and I think these events are so critical you need to refresh almost everything. Collat state till change synth balances
@hav-noms are you sure mint and burn for your address is enough? any burn/mint will change the system's state right?
but then we might end up refreshing the data a lot..