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/detectors/test_data/uninitialized-state/0.7.6/uninitialized.sol

59 lines
1.0 KiB

// pragma solidity ^0.5.0;
contract Uninitialized{
address payable destination;
function transfer() payable public{
destination.transfer(msg.value);
}
}
contract Test {
mapping (address => uint) balances;
mapping (address => uint) balancesInitialized;
function init() public{
balancesInitialized[msg.sender] = 0;
}
function use() view public{
// random operation to use the mapping
require(balances[msg.sender] == balancesInitialized[msg.sender]);
}
}
library Lib{
struct MyStruct{
uint val;
}
function set(MyStruct storage st, uint v) public{
st.val = v;
}
}
contract Test2 {
using Lib for Lib.MyStruct;
Lib.MyStruct st;
Lib.MyStruct stinitialized;
uint v; // v is used as parameter of the lib, but is never init
function init() public{
stinitialized.set(v);
}
function use() view public{
// random operation to use the structure
require(st.val == stinitialized.val);
}
}