Static Analyzer for Solidity
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
slither/tests/e2e/vyper_parsing/test_data/if.vy

25 lines
760 B

@external
@view
def limit_p_o(p: uint256):
p_new: uint256 = p
dt: uint256 = 1
ratio: uint256 = 0
if dt > 0:
old_p_o: uint256 = 1
old_ratio: uint256 = 2
# ratio = p_o_min / p_o_max
if p > old_p_o:
ratio = unsafe_div(old_p_o * 10**18, p)
if ratio < 10**36 / 1:
p_new = unsafe_div(old_p_o * 1, 10**18)
ratio = 10**36 / 1
else:
ratio = unsafe_div(p * 10**18, old_p_o)
if ratio < 10**36 / 1:
p_new = unsafe_div(old_p_o * 10**18, 1)
ratio = 10**36 / 1
# ratio is guaranteed to be less than 1e18
# Also guaranteed to be limited, therefore can have all ops unsafe
ratio = 1