feat[docs]: add docs for @raw_return decorator#4699
feat[docs]: add docs for @raw_return decorator#4699charles-cooper merged 7 commits intovyperlang:masterfrom
@raw_return decorator#4699Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4699 +/- ##
=======================================
Coverage 92.94% 92.94%
=======================================
Files 131 131
Lines 19037 19037
Branches 3309 3309
=======================================
Hits 17694 17694
Misses 905 905
Partials 438 438 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
docs/control-structures.rst
Outdated
| ``@view`` Function does not alter contract state | ||
| ``@payable`` Function is able to receive Ether | ||
| ``@nonreentrant`` Function cannot be called back into during an external call | ||
| ``@raw_return`` Function returns raw bytes without ABI-encoding (external functions only) |
There was a problem hiding this comment.
| ``@raw_return`` Function returns raw bytes without ABI-encoding (external functions only) | |
| ``@raw_return`` Function returns raw bytes without ABI-encoding (``@external`` functions only) |
docs/control-structures.rst
Outdated
| * It can only be used on ``@external`` functions | ||
| * The function must have a ``Bytes[N]`` return type | ||
| * It cannot be used on ``@deploy`` (constructor) functions | ||
| * It cannot be used on internal functions |
There was a problem hiding this comment.
| * It cannot be used on internal functions | |
| * It cannot be used on ``@internal`` functions |
docs/control-structures.rst
Outdated
| @raw_return | ||
| def forward_call(target: address) -> Bytes[1024]: | ||
| # Returns the raw bytes from the external call without ABI-encoding | ||
| return raw_call(target, msg.data, max_outsize=1024, is_delegate_call=True) |
There was a problem hiding this comment.
to make the example more generic, let's add @payable and also msg.value to raw_call
docs/control-structures.rst
Outdated
|
|
||
| * It can only be used on ``@external`` functions | ||
| * The function must have a ``Bytes[N]`` return type | ||
| * It cannot be used on ``@deploy`` (constructor) functions |
There was a problem hiding this comment.
| * It cannot be used on ``@deploy`` (constructor) functions | |
| * It cannot be used on ``@deploy`` (constructor) functions (you can however use it in the `__default__()` function) |
|
maybe let's add a note that calling such function via interface is impossible and that |
|
also maybe mention the potential pitfall of having multiple return statements one of which doesn't expect the data to not be abi encoded |
What I did
How I did it
How to verify it
Commit message
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
Cute Animal Picture