mirror of https://github.com/ConsenSys/mythril
Add support to older solc versions (#1726)
parent
d82bd717af
commit
29bb08b411
@ -0,0 +1,20 @@ |
||||
import pytest |
||||
import json |
||||
import sys |
||||
|
||||
from tests import PROJECT_DIR, TESTDATA |
||||
from utils import output_of |
||||
|
||||
MYTH = str(PROJECT_DIR / "myth") |
||||
test_data = ( |
||||
("old_origin.sol", 1), |
||||
("old_version.sol", 2), |
||||
) |
||||
|
||||
|
||||
@pytest.mark.parametrize("file_name, issues", test_data) |
||||
def test_analysis_old(file_name, issues): |
||||
file = str(TESTDATA / "input_contracts" / file_name) |
||||
command = f"python3 {MYTH} analyze {file} -o jsonv2" |
||||
output = json.loads(output_of(command)) |
||||
assert len(output[0]["issues"]) == issues |
@ -0,0 +1,36 @@ |
||||
pragma solidity ^0.4.11; |
||||
|
||||
|
||||
contract Origin { |
||||
address public owner; |
||||
|
||||
|
||||
/** |
||||
* @dev The Ownable constructor sets the original `owner` of the contract to the sender |
||||
* account. |
||||
*/ |
||||
function Origin() { |
||||
owner = msg.sender; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @dev Throws if called by any account other than the owner. |
||||
*/ |
||||
modifier onlyOwner() { |
||||
require(tx.origin != owner); |
||||
_; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @dev Allows the current owner to transfer control of the contract to a newOwner. |
||||
* @param newOwner The address to transfer ownership to. |
||||
*/ |
||||
function transferOwnership(address newOwner) public onlyOwner { |
||||
if (newOwner != address(0)) { |
||||
owner = newOwner; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,2 @@ |
||||
pragma solidity 0.4.11; |
||||
contract test { } |
Loading…
Reference in new issue