Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
pragma solidity ^0.4.23;
contract Splitter {
address sender;
address public receiver1;
address public receiver2;
event AmountTransferred(address owner, uint amount);
constructor(address _sender,address _receiver1, address _receiver2) public{
sender = _sender;
receiver1 = _receiver1;
receiver2 = _receiver2;
modifier amountGreaterThanOne() {
require(msg.value > 1);
modifier onlySender() {
require(msg.sender == sender);
function getreceiver1Balance() public view returns (uint) {
return receiver1.balance;
function getreceiver2Balance() public view returns (uint) {
return receiver2.balance;
function payReceivers() payable public onlySender amountGreaterThanOne {
uint amount = msg.value/2;
emit AmountTransferred(receiver1,amount);
emit AmountTransferred(receiver2,amount);
Copy link

rob-Hitchens commented Apr 27, 2018

Line 26 & 30 ... these functions that return <address>balance don't do anything useful because everyone everywhere can check can check anyone's balance without our help. You will see something very similar in the actual solution that solves for DoS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment