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

Refactor #3 #34

Merged
merged 5 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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