- Notifications
You must be signed in to change notification settings - Fork 483
ERC20.transaction doesn't assigns to WriteOperation.transaction property fix #713
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
ERC20.transaction doesn't assigns to WriteOperation.transaction property fix #713
Conversation
…n` never assigns to `Contract.transaction` for any given method that writes on chain. Obviously it's a bug spreading all over the `Token` implementation. So this fix should be applied to all `ERC*.swift` methods that returns `WriteOperation`. This is the special case of web3swift-team#712. Closes web3swift-team#711
ERC20.transaction doesn't assigns to WriteOperation.transaction propertyERC20.transaction doesn't assigns to WriteOperation.transaction property fix 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.
LGTM! 👍
| guard let value = Utilities.parseToBigUInt(amount, decimals: intDecimals) else { | ||
| throw Web3Error.inputError(desc: "Can not parse inputted amount") | ||
| } | ||
| contract.transaction = transaction |
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.
Why don't we do the same in all of the functions left?
For example, check public func setAllowance. It looks almost identical to public func transfer in terms of the logic of each step inside the function: set transaction from, to and callOnBlock ; call read-only "decimals" function; create WriteOperation.
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.
This one is actually a bug that I've left. It's fixed just yet.
| I'd completely remove |
For the long term I agree (and I would actually completely rewrite the ERC20 class) but as I understood Yaroslav this was only supposed to be a quick fix. Also about your other comments, he articulated that this will have to be done for all classes in #712. |
| @janndriessen |
| @yaroslavyaroslav But I still think we should update the rest of the functions across this and other ERCs implementations we have. Because it's basically the same bug that is repeating from one function to the other. |
| @yaroslavyaroslav I think this PR is sort of ready to be merged but a have a few concerns that were reflected in my comment above. |
I'll look into adding a PR on top for that. |
The designed pipeline of contract iteration flow was: The intention that I've got in minds while refactoring this bit was:
The In the given pipeline So to sum up: |
A contrary question here is, how the user would be manage an arbitrary (Non |
| @JeneaVranceanu I guess we've paused this topic for a holiday, but it's still required to be done, to present appropriate bug-fix. |
Do you see anything else to be done besides the clean up in #715? |
@yaroslavyaroslav @janndriessen It looks good now. I've left a review in #715 but this particular PR is ready to be merged. |
| @janndriessen please approve the PR and merge it within |
This one fixing the ERC20 implementation bug, where
ERC20.transactionnever assigns toContract.transactionfor any given method that writes on chain.Obviously it's a bug spreading all over the
Tokenimplementation. So this fix should be applied to allERC*.swiftmethods that returnsWriteOperation.This is the special case of #712.
Closes #711