-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* 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>
- Loading branch information
1 parent
c131bf1
commit f06c961
Showing
7 changed files
with
138 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use ink_lang as ink; | ||
|
||
#[ink::contract] | ||
mod contract { | ||
use ink_env as env; | ||
|
||
#[ink(storage)] | ||
pub struct Contract {} | ||
|
||
impl Contract { | ||
#[ink(constructor)] | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
|
||
#[ink(message)] | ||
pub fn message0(&self) {} | ||
|
||
#[ink(message)] | ||
pub fn message1(&self, _arg1: u8) {} | ||
|
||
#[ink(message)] | ||
pub fn message2(&self, _arg1: u8, _arg2: (u8, AccountId)) {} | ||
|
||
fn check_compiles(&self) { | ||
env::pay_with_call!(self.message0(), 0); | ||
env::pay_with_call!(self.message1(0), 0); | ||
env::pay_with_call!(self.message2(0, (0, Self::env().account_id())), 0); | ||
} | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters