Coder Social home page Coder Social logo

splitter's People

Contributors

micahu-zz avatar

Watchers

 avatar

splitter's Issues

Handle odd numbers

Handle remainder after dividing odd number by 2.
Choices to consider:
a. send it back
b. store +=1 in the sender's account for future withdrawal
c. arbitrarily award it one of the recipients,
d. give it to the contract owner
e. reject all odd numbers

Spec

Contract

  • There are 3 people: Alice, Bob and Carol ([A], [B], [C]).
  • When [A] sends ether to the contract, half goes to [B], half to [C].

User Interface

  • [A] can send ether to the contract from the Web page.
  • Web page shows the balance of the Splitter contract.
  • Web page shows the balances of [A], [B], [C]

Open questions

(none)

Reorder within functions to transfer flow control late

Transfer control late by moving anything affording chances at re-entry, that is, any implicit transfer of control. Order as such:

  1. Optimistic accounting - get the contract state in order (including emit)
  2. Then transfer flow control (call, send, transfer)
  3. Check result and revert if needed

Defend against DoS with withdrawal method

Consider Bob and Carol could be functions, so use a withdrawal, and/or approve/transferFrom flow. If Carol decides to revert (might be a contract), then would prevent (DoS) Bob from getting paid. And vice versa with Bob.

Still emit event so that they (UI?) can subscribe to the occurrence.
This will avoid contact with more than one "untrusted" contract at a time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.