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.
45 lines
1.0 KiB
45 lines
1.0 KiB
4 years ago
|
// pragma solidity ^0.4.24;
|
||
4 years ago
|
|
||
|
library Lib{
|
||
|
|
||
|
struct MyStruct{
|
||
|
mapping(address => uint) maps;
|
||
|
}
|
||
|
|
||
4 years ago
|
function deleteSt(MyStruct[1] storage st) internal {
|
||
4 years ago
|
delete st[0];
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
contract Balances {
|
||
|
|
||
|
struct BalancesStruct{
|
||
|
address owner;
|
||
|
mapping(address => uint) balances;
|
||
|
}
|
||
|
|
||
|
mapping(uint => BalancesStruct) public stackBalance;
|
||
|
function createBalance(uint idx) public {
|
||
4 years ago
|
require(stackBalance[idx].owner == address(0));
|
||
|
BalancesStruct storage str = stackBalance[idx];
|
||
|
str.owner = msg.sender;
|
||
4 years ago
|
}
|
||
|
|
||
|
function deleteBalance(uint idx) public {
|
||
|
require(stackBalance[idx].owner == msg.sender);
|
||
|
delete stackBalance[idx];
|
||
|
}
|
||
|
|
||
|
function setBalance(uint idx, address addr, uint val) public {
|
||
|
require(stackBalance[idx].owner == msg.sender);
|
||
|
|
||
|
stackBalance[idx].balances[addr] = val;
|
||
|
}
|
||
|
|
||
|
function getBalance(uint idx, address addr) public view returns(uint){
|
||
|
return stackBalance[idx].balances[addr];
|
||
|
}
|
||
|
|
||
|
}
|