|
19 | 19 | destination = contract.get_state_variable_from_name("destination")
|
20 | 20 | source = contract.get_state_variable_from_name("source")
|
21 | 21 |
|
22 |
| -print( |
23 |
| - "{} is dependent of {}: {}".format( |
24 |
| - source, destination, is_dependent(source, destination, contract) |
25 |
| - ) |
26 |
| -) |
| 22 | +print(f"{source} is dependent of {destination}: {is_dependent(source, destination, contract)}") |
27 | 23 | assert not is_dependent(source, destination, contract)
|
28 |
| -print( |
29 |
| - "{} is dependent of {}: {}".format( |
30 |
| - destination, source, is_dependent(destination, source, contract) |
31 |
| - ) |
32 |
| -) |
| 24 | +print(f"{destination} is dependent of {source}: {is_dependent(destination, source, contract)}") |
33 | 25 | assert is_dependent(destination, source, contract)
|
34 |
| -print("{} is tainted {}".format(source, is_tainted(source, contract))) |
| 26 | +print(f"{source} is tainted {is_tainted(source, contract)}") |
35 | 27 | assert not is_tainted(source, contract)
|
36 |
| -print("{} is tainted {}".format(destination, is_tainted(destination, contract))) |
| 28 | +print(f"{destination} is tainted {is_tainted(destination, contract)}") |
37 | 29 | assert is_tainted(destination, contract)
|
38 | 30 |
|
39 | 31 | contracts = slither.get_contract_from_name("Reference")
|
|
45 | 37 | assert source
|
46 | 38 |
|
47 | 39 | print("Reference contract")
|
48 |
| -print( |
49 |
| - "{} is dependent of {}: {}".format( |
50 |
| - source, destination, is_dependent(source, destination, contract) |
51 |
| - ) |
52 |
| -) |
| 40 | +print(f"{source} is dependent of {destination}: {is_dependent(source, destination, contract)}") |
53 | 41 | assert not is_dependent(source, destination, contract)
|
54 |
| -print( |
55 |
| - "{} is dependent of {}: {}".format( |
56 |
| - destination, source, is_dependent(destination, source, contract) |
57 |
| - ) |
58 |
| -) |
| 42 | +print(f"{destination} is dependent of {source}: {is_dependent(destination, source, contract)}") |
59 | 43 | assert is_dependent(destination, source, contract)
|
60 |
| -print("{} is tainted {}".format(source, is_tainted(source, contract))) |
| 44 | +print(f"{source} is tainted {is_tainted(source, contract)}") |
61 | 45 | assert not is_tainted(source, contract)
|
62 |
| -print("{} is tainted {}".format(destination, is_tainted(destination, contract))) |
| 46 | +print(f"{destination} is tainted {is_tainted(destination, contract)}") |
63 | 47 | assert is_tainted(destination, contract)
|
64 | 48 |
|
65 | 49 | destination_indirect_1 = contract.get_state_variable_from_name("destination_indirect_1")
|
66 |
| -print( |
67 |
| - "{} is tainted {}".format(destination_indirect_1, is_tainted(destination_indirect_1, contract)) |
68 |
| -) |
| 50 | +print(f"{destination_indirect_1} is tainted {is_tainted(destination_indirect_1, contract)}") |
69 | 51 | assert is_tainted(destination_indirect_1, contract)
|
70 | 52 | destination_indirect_2 = contract.get_state_variable_from_name("destination_indirect_2")
|
71 |
| -print( |
72 |
| - "{} is tainted {}".format(destination_indirect_2, is_tainted(destination_indirect_2, contract)) |
73 |
| -) |
| 53 | +print(f"{destination_indirect_2} is tainted {is_tainted(destination_indirect_2, contract)}") |
74 | 54 | assert is_tainted(destination_indirect_2, contract)
|
75 | 55 |
|
76 | 56 | print("SolidityVar contract")
|
|
83 | 63 | addr_2 = contract.get_state_variable_from_name("addr_2")
|
84 | 64 | assert addr_2
|
85 | 65 | msgsender = SolidityVariableComposed("msg.sender")
|
86 |
| -print( |
87 |
| - "{} is dependent of {}: {}".format(addr_1, msgsender, is_dependent(addr_1, msgsender, contract)) |
88 |
| -) |
| 66 | +print(f"{addr_1} is dependent of {msgsender}: {is_dependent(addr_1, msgsender, contract)}") |
89 | 67 | assert is_dependent(addr_1, msgsender, contract)
|
90 |
| -print( |
91 |
| - "{} is dependent of {}: {}".format(addr_2, msgsender, is_dependent(addr_2, msgsender, contract)) |
92 |
| -) |
| 68 | +print(f"{addr_2} is dependent of {msgsender}: {is_dependent(addr_2, msgsender, contract)}") |
93 | 69 | assert not is_dependent(addr_2, msgsender, contract)
|
94 | 70 |
|
95 | 71 |
|
|
102 | 78 | source = contract.get_state_variable_from_name("source")
|
103 | 79 | assert source
|
104 | 80 |
|
105 |
| -print( |
106 |
| - "{} is dependent of {}: {}".format( |
107 |
| - destination, source, is_dependent(destination, source, contract) |
108 |
| - ) |
109 |
| -) |
| 81 | +print(f"{destination} is dependent of {source}: {is_dependent(destination, source, contract)}") |
110 | 82 | assert is_dependent(destination, source, contract)
|
111 | 83 |
|
112 | 84 | print("Base Derived contract")
|
|
117 | 89 | destination = contract.get_state_variable_from_name("destination")
|
118 | 90 | source = contract.get_state_variable_from_name("source")
|
119 | 91 |
|
120 |
| -print( |
121 |
| - "{} is dependent of {}: {} (base)".format( |
122 |
| - destination, source, is_dependent(destination, source, contract) |
123 |
| - ) |
124 |
| -) |
| 92 | +print(f"{destination} is dependent of {source}: {is_dependent(destination, source, contract)}") |
125 | 93 | assert not is_dependent(destination, source, contract)
|
126 | 94 | print(
|
127 |
| - "{} is dependent of {}: {} (derived)".format( |
128 |
| - destination, source, is_dependent(destination, source, contract_derived) |
129 |
| - ) |
| 95 | + f"{destination} is dependent of {source}: {is_dependent(destination, source, contract_derived)}" |
130 | 96 | )
|
131 | 97 | assert is_dependent(destination, source, contract_derived)
|
132 | 98 |
|
|
147 | 113 | f2 = contract.get_function_from_signature("f2(uint256,uint256)")
|
148 | 114 |
|
149 | 115 | print(
|
150 |
| - "{} is dependent of {}: {} (base)".format( |
151 |
| - var_dependant, user_input, is_dependent(var_dependant, user_input, contract) |
152 |
| - ) |
| 116 | + f"{var_dependant} is dependent of {user_input}: {is_dependent(var_dependant, user_input, contract)} (base)" |
153 | 117 | )
|
154 | 118 | assert is_dependent(var_dependant, user_input, contract)
|
155 |
| -print("{} is tainted: {}".format(var_tainted, is_tainted(var_tainted, contract))) |
| 119 | +print(f"{var_tainted} is tainted: {is_tainted(var_tainted, contract)}") |
156 | 120 | assert is_tainted(var_tainted, contract)
|
157 |
| -print("{} is tainted: {}".format(var_not_tainted, is_tainted(var_not_tainted, contract))) |
| 121 | +print(f"{var_not_tainted} is tainted: {is_tainted(var_not_tainted, contract)}") |
158 | 122 | assert not is_tainted(var_not_tainted, contract)
|
0 commit comments