Skip to content
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

Error "execution reverted" #2

Closed
dappstatus opened this issue Mar 3, 2021 · 6 comments
Closed

Error "execution reverted" #2

dappstatus opened this issue Mar 3, 2021 · 6 comments

Comments

@dappstatus
Copy link

dappstatus commented Mar 3, 2021

I try to use "$token->name()" in a loop. It works most of the time. But sometimes i run into an error "execution reverted".
Any idea how to handle this?

This is an example transaction / address where it happens.
Transaction: https://etherscan.io/tx/0x15bc9ee5c237f381dca60c1be0e8fee470a1491c5fe62b967d9e5cf3d1c698d0
Address: 0x656acfd86be535353f0a08a327368ccf7304e819

111
222

@lessmore92
Copy link
Owner

0x656acfd86be535353f0a08a327368ccf7304e819 seems it is not standard ERC20 contract, that not support name method

@dappstatus
Copy link
Author

The contract is 0x15bc9ee5c237f381dca60c1be0e8fee470a1491c5fe62b967d9e5cf3d1c698d0
0x656acfd86be535353f0a08a327368ccf7304e819 is the address that is used to get the token name from.

@dappstatus
Copy link
Author

If you check the logs of that contract https://etherscan.io/tx/0x15bc9ee5c237f381dca60c1be0e8fee470a1491c5fe62b967d9e5cf3d1c698d0
You can see it has 5 logs.
I have a loop for the logs to check all the names of each log entry. The first 3 log entries work. Number 4 with the log address 0x656acfd86be535353f0a08a327368ccf7304e819 shows the error.

@lessmore92
Copy link
Owner

lessmore92 commented Mar 3, 2021

0x15bc9ee5c237f381dca60c1be0e8fee470a1491c5fe62b967d9e5cf3d1c698d0 is Transaction ID and Contarct is 0x656acfd86be535353f0a08a327368ccf7304e819

@dappstatus
Copy link
Author

dappstatus commented Mar 3, 2021

Oh you are right. It's late here :D
Anyways. Any idea how i can handle this in my loop? Since the first 3 logs work and the error only appears on the 4th log address. You say it's not an ERC20 standard that supports name, how can i avoid the error in that case?

Is there a way to check if the address support ->name() before actually using it? Because if i use it, it triggers the error and stops my loop, how to know before using it?

@lessmore92
Copy link
Owner

As simple solution you can catch the RuntimeException Exception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants