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

Allow pay_with_call to take multiple arguments #1401

Merged
merged 4 commits into from
Sep 21, 2022

Conversation

HCastano
Copy link
Contributor

We were using the wrong metavariable when accepting function arguments to the
pay_with_call macro, as reported here.

@HCastano
Copy link
Contributor Author

Looks like Codecov is broken on master too 😒

crates/ink/tests/ui/pay_with_call/pass/multiple_args.rs Outdated Show resolved Hide resolved
fn check_compiles(&self) {
ink::env::pay_with_call!(self.message0(), 0);
ink::env::pay_with_call!(self.message1(0), 0);
ink::env::pay_with_call!(self.message2(0, 0), 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ink::env::pay_with_call!(self.message2(0, 0), 0);
ink::env::pay_with_call!(self.message2(4*64, 0), 0);

just to make sure it really works with expr; fun fact: it will compile regardless the value of the expr is out of bounds

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get what you mean here, can you clarify?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, just wanted to pass it a lil more interesting expr than just 0; 4*64 evaluates to 256 which is out of u8 bounds; still this would compile, while passing just 256 - not

@HCastano HCastano mentioned this pull request Sep 20, 2022
@HCastano HCastano merged commit b04f097 into master Sep 21, 2022
@HCastano HCastano deleted the hc-fix-pay-with-call-macro branch September 21, 2022 08:26
@ascjones ascjones mentioned this pull request Sep 21, 2022
agryaznov added a commit that referenced this pull request Oct 20, 2022
* Add `ink_env::pay_with_call!` helper macro for off-chain emulation of sending payments with contract msg calls (#1379)

* first ver.: transfer_in api function implememted but we can't have it in on-chain env

* transfer_in moved to test_api

* doc + example updated

* Update examples/contract-transfer/lib.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* use stmt moved to macro

* docs and nitty gritties

* moved the macro to the test mod

* spell fix

* next review round suggestions applied

* Use four spaces for macro indentation

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Allow `pay_with_call` to take multiple arguments (#1401)

* Moved constants from `match` to a separate constants (#1418)

* fix tests

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: Andrew Jones <ascjones@gmail.com>
@ascjones ascjones mentioned this pull request Feb 15, 2023
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.

2 participants