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

Smart contract error not returned #203

Closed
ezhkovskii opened this issue Mar 15, 2024 · 2 comments
Closed

Smart contract error not returned #203

ezhkovskii opened this issue Mar 15, 2024 · 2 comments

Comments

@ezhkovskii
Copy link

The smart contract has a function
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}

I expect the SDK to return an error "caller is not the owner" if user != owner, but If there was an error in the smart contract, it is not returned.
abi_parser.parse_output(fn_name, output) function returns empty result.
status in transaction = 16 - RevertInstruction.

How can I read an error from a smart contract?

@coderkentzhang
Copy link
Contributor

coderkentzhang commented Mar 22, 2024

cause when error only string message return ,use sample code:
if str(status) is not '0':
outputbody = output[10:] #去掉0x[func_sig]共10个字符
errmsg = decode_single("(string)", decode_hex(outputbody))

@ezhkovskii
Copy link
Author

cause when error only string message return ,use sample code: if str(status) is not '0': outputbody = output[10:] #去掉0x[func_sig]共10个字符 errmsg = decode_single("(string)", decode_hex(outputbody))

спасибо!

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