Skip to content

Commit

Permalink
make contracts compiler version agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
incertia committed Aug 14, 2019
1 parent f9ded9c commit 30bb707
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion examples/solidity/abiv2/Ballot.sol
@@ -1,5 +1,4 @@
pragma experimental ABIEncoderV2;
pragma solidity ^0.4.25;

contract Ballot {
struct Voter { // Struct
Expand Down
3 changes: 1 addition & 2 deletions examples/solidity/abiv2/Dynamic.sol
@@ -1,5 +1,4 @@
pragma experimental ABIEncoderV2;
pragma solidity ^0.4.25;

contract Dynamic {
struct Yolo { // Struct
Expand All @@ -11,7 +10,7 @@ contract Dynamic {
bool cond = true;

function yolo(Yolo memory y) public returns (bool) {
if (keccak256(y.s) == keccak256("yolo")) {
if (keccak256(abi.encodePacked(y.s)) == keccak256(abi.encodePacked("yolo"))) {
cond = false;
}
return(true);
Expand Down
4 changes: 1 addition & 3 deletions examples/solidity/abiv2/Dynamic2.sol
@@ -1,10 +1,8 @@
pragma solidity ^0.4.25;

contract Dynamic {
bool cond = true;

function yolo(uint256 x, string memory s, uint256 y) public returns (bool) {
if (keccak256(s) == keccak256("yolo")) {
if (keccak256(abi.encodePacked(s)) == keccak256(abi.encodePacked("yolo"))) {
cond = false;
}
return(true);
Expand Down

0 comments on commit 30bb707

Please sign in to comment.