Skip to content

Commit

Permalink
Merge pull request #34 from countvajhula/sid-refactor-3
Browse files Browse the repository at this point in the history
Refactor #3
  • Loading branch information
countvajhula authored Nov 27, 2024
2 parents 497cf38 + e4d65c3 commit ea9d42d
Show file tree
Hide file tree
Showing 14 changed files with 565 additions and 503 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ RUN apt-mark hold git-man

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh
COPY oldabe/__init__.py /oldabe/__init__.py
COPY oldabe/money_in.py /oldabe/money_in.py
COPY oldabe/money_out.py /oldabe/money_out.py
COPY oldabe/models.py /oldabe/models.py
COPY oldabe /

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]
4 changes: 2 additions & 2 deletions docs/oldabe.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ One of the defining properties of ABE is that all accounting is publicly conduct

@section{Inputs}

Old Abe considers precisely three inputs in doing all of its accounting, and it will be useful to keep these in mind as we learn more:
Old Abe considers precisely four inputs in doing all of its accounting, and it will be useful to keep these in mind as we learn more:

@itemlist[
#:style 'ordered
Expand Down Expand Up @@ -56,7 +56,7 @@ Current accounting flows are a mix of manual and automated actions. Old Abe is n

@subsection{Payment}

When someone makes a payment to a project, Old Abe allocates portions of that payment to project contributors and creates a report that tells maintainers how much money the project owes to each individual contributor. We'll get deep into the weeds of how it does that in a moment. If the incoming payment represents an investment (that is, it brings the payer's total amount paid above the project price), the payer is considered a project contributor. The system adds them to the attributions file with a share equal to their investment (or increases their pre-existing attributive share). The project valuation is increased by the investment amount and all existing attributive shares are diluted so that percentage shares still add up 100%.
When someone makes a payment to a project, Old Abe allocates portions of that payment to project contributors and creates a report that tells maintainers how much money the project owes to each individual contributor. We'll get deep into the weeds of how it does that in a moment. If the incoming payment represents an investment (that is, it brings the payer's total amount paid above the project price), the payer is considered a project contributor. The system adds them to the attributions file with a share equal to their investment (or increases their pre-existing attributive share). The project valuation is increased by the investment amount and all existing attributive shares are diluted so that percentage shares still add up to 100%.

Now, let's talk about how Old Abe allocates an incoming payment.

Expand Down
2 changes: 2 additions & 0 deletions oldabe/accounting_utils.py → oldabe/accounting.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def correct_rounding_error(attributions, incoming_attribution):


def assert_attributions_normalized(attributions):
"""A complete set of attributions must be normalized, i.e. must add up to
1. This raises an error if the provided attributions are not normalized."""
print(_get_attributions_total(attributions))
assert _get_attributions_total(attributions) == Decimal("1")

Expand Down
Loading

0 comments on commit ea9d42d

Please sign in to comment.