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.
28 lines
492 B
28 lines
492 B
6 years ago
|
pragma solidity ^0.4.24;
|
||
|
|
||
|
library UnsafeMath{
|
||
|
|
||
|
function add(uint a, uint b) public pure returns(uint){
|
||
|
return a + b;
|
||
|
}
|
||
|
|
||
|
function min(uint a, uint b) public pure returns(uint){
|
||
|
return a - b;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
contract MyContract{
|
||
|
using UnsafeMath for uint;
|
||
|
|
||
|
mapping(address => uint) balances;
|
||
|
|
||
|
function transfer(address to, uint val) public{
|
||
|
|
||
|
balances[msg.sender] = balances[msg.sender].min(val);
|
||
|
balances[to] = balances[to].add(val);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|