Previously:
storage.balances.get(user).unwrap_or(0);
Now:
storage.balances.get(user).try_read().unwrap_or(0);
I don’t see the point of introducing try_read()
if we are going to use it like this. It probably adds to gas cost too.
So i am guessing there is something i am missing. So how do I best use try_read()
? Also when would I use write()
instead of what we had previously - using map.insert()