File tree Expand file tree Collapse file tree 3 files changed +51
-6
lines changed Expand file tree Collapse file tree 3 files changed +51
-6
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,16 @@ const Conditional = {
99 group (
1010 concat ( [
1111 path . call ( print , 'condition' ) ,
12- indent ( line ) ,
13- '? ' ,
14- path . call ( print , 'trueExpression' ) ,
15- indent ( line ) ,
16- ': ' ,
17- path . call ( print , 'falseExpression' )
12+ indent (
13+ concat ( [
14+ line ,
15+ '? ' ,
16+ path . call ( print , 'trueExpression' ) ,
17+ line ,
18+ ': ' ,
19+ path . call ( print , 'falseExpression' )
20+ ] )
21+ )
1822 ] )
1923 )
2024} ;
Original file line number Diff line number Diff line change @@ -4,6 +4,15 @@ pragma solidity ^0.4.24;
44contract Conditional {
55 function foo () {
66 address contextAddress = longAddress_ == address (0 ) ? msg .sender : currentContextAddress_;
7+ asset == ETH
8+ ? require (address (uint160 (msg .sender )).send (quantity), "failed to transfer ether " ) // explicit casting to `address payable`
9+ : transferTokensToAccountSecurely (Token (asset), quantity, msg .sender );
10+ asset == ETH
11+ ? true
12+ : transferTokensToAccountSecurely (Token (asset), quantity, msg .sender );
13+ asset == ETH
14+ ? require (address (uint160 (msg .sender )).send (quantity), "failed to transfer ether " )
15+ : false ;
716 }
817
918 // TODO: work with a break in the condition level.
Original file line number Diff line number Diff line change @@ -7,6 +7,15 @@ pragma solidity ^0.4.24;
77contract Conditional {
88 function foo() {
99 address contextAddress = longAddress_ == address (0 ) ? msg .sender : currentContextAddress_ ;
10+ asset == ETH
11+ ? require (address (uint160 (msg .sender )).send (quantity ), " failed to transfer ether" ) // explicit casting to \`address payable\`
12+ : transferTokensToAccountSecurely (Token (asset ), quantity , msg .sender );
13+ asset == ETH
14+ ? true
15+ : transferTokensToAccountSecurely (Token (asset ), quantity , msg .sender );
16+ asset == ETH
17+ ? require (address (uint160 (msg .sender )).send (quantity ), " failed to transfer ether" )
18+ : false ;
1019 }
1120
1221 // TODO: work with a break in the condition level.
@@ -26,6 +35,29 @@ contract Conditional {
2635 address contextAddress = longAddress_ == address (0 )
2736 ? msg .sender
2837 : currentContextAddress_ ;
38+ asset == ETH
39+ ? require (
40+ address (uint160 (msg .sender )).send (quantity ),
41+ " failed to transfer ether"
42+ ) // explicit casting to \`address payable\`
43+ : transferTokensToAccountSecurely (
44+ Token (asset ),
45+ quantity ,
46+ msg .sender
47+ );
48+ asset == ETH
49+ ? true
50+ : transferTokensToAccountSecurely (
51+ Token (asset ),
52+ quantity ,
53+ msg .sender
54+ );
55+ asset == ETH
56+ ? require (
57+ address (uint160 (msg .sender )).send (quantity ),
58+ " failed to transfer ether"
59+ )
60+ : false ;
2961 }
3062
3163 // TODO: work with a break in the condition level.
You can’t perform that action at this time.
0 commit comments