Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Algorand Coding Challenge Submission
What was the bug?
-> Given code after debugging give an error at
*** ptxn.receiver == Global.current application_id ***
and
***Txn.sender, Global.current application address ***
because, above both are comparing the Address type and Application type
=>In (1) expression, ptxn.receiver returns the Address type but Global.current application id returns the application type comparing both gives an error.
=> In (2) expression, op.app_opted_ in method is comparing the T×n.sender(returns Application type) and Global.current_application_address ( returns Address type) here, we are comparing different types of data so we get an error.
How did you fix the bug?
=> To solve (1) we need to use the current_ application_address (returns address type) method in Global class
Global.current application_address }
=> To solve (2) we need to use the current_application id method(returns Application type) in Global class {
Global.current_application_id }
Console Screenshot: