From 7bf8713959fe7d9e2d8d13d73d724f1f7ee2c198 Mon Sep 17 00:00:00 2001 From: yudan <825503231@qq.com> Date: Sun, 9 Sep 2018 16:04:58 +0800 Subject: [PATCH] Create Short-Address-Attack.sol --- Short-Address-Attack.sol | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Short-Address-Attack.sol diff --git a/Short-Address-Attack.sol b/Short-Address-Attack.sol new file mode 100644 index 0000000..4744eb5 --- /dev/null +++ b/Short-Address-Attack.sol @@ -0,0 +1,17 @@ +pragma solidity ^0.4.24; +contract Test{ + uint totalSupply = 1e18; + mapping(address => uint) balance; + event TransferTo(address to,uint value); + constructor() public { + balance[msg.sender] = totalSupply; + } + function transferTo(address _to,uint _value) public { + balance[msg.sender] -= _value; + balance[_to] += _value; + emit TransferTo(_to,_value); + } + function BalanceOf(address _owner) view returns(uint){ + return balance[_owner]; + } +}