mirror of https://github.com/crytic/slither
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.
59 lines
1.0 KiB
59 lines
1.0 KiB
4 years ago
|
// pragma solidity ^0.5.0;
|
||
6 years ago
|
|
||
6 years ago
|
contract Uninitialized{
|
||
6 years ago
|
|
||
4 years ago
|
address payable destination;
|
||
6 years ago
|
|
||
6 years ago
|
function transfer() payable public{
|
||
6 years ago
|
destination.transfer(msg.value);
|
||
|
}
|
||
|
|
||
|
}
|
||
6 years ago
|
|
||
|
|
||
|
contract Test {
|
||
|
mapping (address => uint) balances;
|
||
|
mapping (address => uint) balancesInitialized;
|
||
|
|
||
|
|
||
4 years ago
|
function init() public{
|
||
6 years ago
|
balancesInitialized[msg.sender] = 0;
|
||
|
}
|
||
|
|
||
4 years ago
|
function use() view public{
|
||
6 years ago
|
// random operation to use the mapping
|
||
|
require(balances[msg.sender] == balancesInitialized[msg.sender]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
library Lib{
|
||
|
|
||
|
struct MyStruct{
|
||
|
uint val;
|
||
|
}
|
||
|
|
||
4 years ago
|
function set(MyStruct storage st, uint v) public{
|
||
|
st.val = v;
|
||
6 years ago
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
contract Test2 {
|
||
|
using Lib for Lib.MyStruct;
|
||
|
|
||
|
Lib.MyStruct st;
|
||
2 years ago
|
Lib.MyStruct stinitialized;
|
||
6 years ago
|
uint v; // v is used as parameter of the lib, but is never init
|
||
6 years ago
|
|
||
4 years ago
|
function init() public{
|
||
2 years ago
|
stinitialized.set(v);
|
||
6 years ago
|
}
|
||
|
|
||
4 years ago
|
function use() view public{
|
||
6 years ago
|
// random operation to use the structure
|
||
2 years ago
|
require(st.val == stinitialized.val);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
}
|