# BalancerV2: The Python Edition

Originally written in Solidity, our team has translated the files attempting to achieve the exact same results in python. In order to achieve accurate results, the python Decimal library was used in all of the following.&#x20;

#### &#x20;The Python edition of BalancerV2 contains these modules:

\
The Python edition of BalancerV2 contains these modules:

* [StableMath.py - ](balancer_py_edition/stablemath.py)this file contains the calculations for a stable pool.&#x20;
* [StablePool.py](balancer_py_edition/stablepool.py) - this file contains all the functions that enable a stable pool to take actions such as swapping or joining a pool. &#x20;
* [WeightedMath.py](balancer_py_edition/weightedpool.py) - this file contains the calculations for a weighted pool.&#x20;
* [WeightedPool.py](balancer_py_edition/weightedpool.py-1) - this file contains all the functions that enable a weighted pool to take actions such as swapping or joining a pool.&#x20;
* [BalancerConstants.py ](balancer_py_edition/balancerconstants.py)- this file contains all of the constant values that are needed to make precise calculations.&#x20;
* [util.py](balancer_py_edition/util.py) - this file handles all of the basic mathematical functions such as adding, subtracting, multiplying and dividing however each one having a version that either rounds up or down ex. mulUp and mulDown.&#x20;



