Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in TODTransfer Pattern #45

Open
ritzdorf opened this issue Nov 20, 2018 · 0 comments
Open

Errors in TODTransfer Pattern #45

ritzdorf opened this issue Nov 20, 2018 · 0 comments
Labels
Bug Something isn't working
Milestone

Comments

@ritzdorf
Copy link
Collaborator

Reference:

Additional examples:

pragma solidity 0.4.24;

contract game {
  bool won = false;
  
  function play() public {
    if (!won) {
      won = true;
      msg.sender.transfer(1);
    }
  }

  function play2() public {
    require(!won);
    won = true;
    msg.sender.transfer(1);
  }
}

play and play2 have different analysis results with regards to TODTransfer.

pragma solidity 0.4.24;

contract game {
  bool won = false;

  function play() public {
    if (!won) {
      won = true;
      msg.sender.transfer(10 ** 18);
    } else {
      msg.sender.transfer(10 ** 18);
    }
    msg.sender.transfer(10 ** 18);
  }
}

The last transfer is also tagged as TODTransfer. It is unclear whether that is desirable or not.

@ritzdorf ritzdorf added the Bug Something isn't working label Nov 20, 2018
@MatthiasEgli-chainsecurity MatthiasEgli-chainsecurity added this to the Sprint #2 milestone Nov 20, 2018
@hiqua hiqua removed their assignment Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants