-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #317 from EYBlockchain/lydia/contract_negation
fix: ! as unary operator in the contract
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: CC0 | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
contract Assign { | ||
|
||
secret bool private a; | ||
secret bool private c; | ||
bool public d; | ||
bool public g; | ||
|
||
|
||
function add( secret uint256 value, secret bool value_bool, bool value_publicbool) public { | ||
secret bool l = true; | ||
bool m = false; | ||
c = a && m && d; | ||
if(value > 10 && !c) { | ||
c=true; | ||
a= value_bool && value_publicbool; | ||
} | ||
if( value < 10) { | ||
a =!c; | ||
c= l || a || m; | ||
} | ||
} | ||
|
||
function addPublic(uint256 value, bool value_publicbool) public { | ||
if (value > 10) { | ||
d = true; | ||
g = value_publicbool; | ||
} | ||
if (value < 10) { | ||
d = false; | ||
g = !value_publicbool; | ||
} | ||
} | ||
|
||
|
||
} |