File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,19 @@ contract C {
7474 print ("greeter1 = {} " .format (address (greeter1)));
7575 greeter1.greet ();
7676 }
77+
78+ function test_value_sender () public payable returns (uint256 ) {
79+ return this .test_value_receiver {value: msg .value }();
80+ }
81+
82+ event Received (uint256 value );
83+
84+ function test_value_receiver () public payable returns (uint256 ) {
85+ uint256 value = msg .value ;
86+ emit Received (value);
87+ assert (value == 1000000000000000000 );
88+ return value;
89+ }
7790}
7891
7992contract Greeter {
Original file line number Diff line number Diff line change @@ -53,6 +53,22 @@ fn milestone_2() {
5353 )
5454 . unwrap ( ) ;
5555 println ! ( "{}" , stdout) ;
56+
57+ stdout = send (
58+ dir,
59+ & address,
60+ [ "test_value_sender()" , "--value=1000000000000000000" ] ,
61+ )
62+ . unwrap ( ) ;
63+ println ! ( "{}" , stdout) ;
64+
65+ let line = stdout
66+ . lines ( )
67+ . find ( |line| line. starts_with ( "logs" ) )
68+ . unwrap ( ) ;
69+ // smoelius: keccak256("Reason(uint256)") = 0xa8142743f8f70a4c26f3691cf4ed59718381fb2f18070ec52be1f1022d855557
70+ // 0x0de0b6b3a7640000 = 1000000000000000000
71+ assert ! ( line. contains( r#""topics":["0xa8142743f8f70a4c26f3691cf4ed59718381fb2f18070ec52be1f1022d855557"],"data":"0x0000000000000000000000000000000000000000000000000de0b6b3a7640000""# ) ) ;
5672}
5773
5874fn label_test_block_output ( stdout : & str ) -> String {
You can’t perform that action at this time.
0 commit comments