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

feat: add default_return_value kwarg for calls #2839

Merged
merged 11 commits into from
May 13, 2022

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented May 4, 2022

What I did

implement #2812

How I did it

How to verify it

Commit message

this commit adds a new kwarg, `default_return_value`, available to all
external calls. its purpose is to make it easier to interface with
contracts which are not compliant with their interfaces (e.g., bad ERC20
implementations) without having to drop down to `raw_call`.

since the logic for handling kwargs in `external_call.py` was getting a
little gnarly, this commit also refactors and that module a bit. for
consistency, it also switches to exclusively using the
typechecker type of the function.

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

add default_return_value kwarg for external calls.

Cute Animal Picture

image

@codecov-commenter
Copy link

codecov-commenter commented May 4, 2022

Codecov Report

Merging #2839 (fa21400) into master (efe1dbe) will increase coverage by 0.02%.
The diff coverage is 96.29%.

❗ Current head fa21400 differs from pull request most recent head 83f030b. Consider uploading reports for the commit 83f030b to get more accurate results

@@            Coverage Diff             @@
##           master    #2839      +/-   ##
==========================================
+ Coverage   87.65%   87.67%   +0.02%     
==========================================
  Files          94       94              
  Lines       10179    10183       +4     
  Branches     2503     2501       -2     
==========================================
+ Hits         8922     8928       +6     
+ Misses        791      790       -1     
+ Partials      466      465       -1     
Impacted Files Coverage Δ
vyper/codegen/expr.py 80.73% <ø> (ø)
vyper/semantics/types/function.py 87.21% <80.00%> (+0.09%) ⬆️
vyper/codegen/external_call.py 98.07% <97.36%> (+1.99%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efe1dbe...83f030b. Read the comment docs.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented May 11, 2022

This pull request introduces 1 alert when merging ced9e66 into efe1dbe - view on LGTM.com

new alerts:

  • 1 for Syntax error

@charles-cooper charles-cooper changed the title new keyword - if_empty_return_override feat: add default_return_value kwarg for calls May 13, 2022
@charles-cooper charles-cooper marked this pull request as ready for review May 13, 2022 11:57
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

Successfully merging this pull request may close these issues.

None yet

3 participants