-
Notifications
You must be signed in to change notification settings - Fork 104
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
Update erc20 contract to 0.8 #68
Conversation
39da3b5
to
ba1b0a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
But if you are open, I can suggest a much more radical change using Uint128 for input types and making full use of cosmwasm storage. If you look at the staking demo contract, we have transfer and query balance implemented in many fewer lines. I don't know if it is too much magic for you, but I think this would make this contract much easier to extend.
messages: vec![], | ||
log: vec![ | ||
log("action", "transfer_from"), | ||
log( | ||
"spender", | ||
deps.api.human_address(&env.message.signer)?.as_str(), | ||
deps.api.human_address(&env.message.sender)?.as_str(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were discussing to remove the human / canonical address division if we use a binary encoding scheme, so we can just pass in canonical addresses.
This is one place where we will want to convert to human readable in any case. So we will need the hooks, just have to use them much less
Updated the public interfaces to Uint128 – good point. One helper function less we need. However, I kept the balance and allowance storage 16 raw bytes, which is more compact that using JSON encoded decimal strings. We can change that later if we want. |
Fair enough, let's merge this! |
Based on #67
Part of #65