ensuro
Prototype and wrappers to work with Ensuro Smart Contracts
This package is for working with the Ensuro Protocol (https://github.com/ensuro/ensuro) from Python.
It includes the prototype written in pure-python that can be used for simulation of Ensuro. Also includes the wrappers that together with the compiled contracts can be used to deploy or use contracts deployed on the blockchain.
Getting information from Ensuro objects
- PremiumsAccount
.active_pure_premiums
.surplus: balance of pure premiums of finalized policies.
.won_pure_premiums: accumulated pure premiums of expired/not defaulted policies.
.borrowed_active_pp: pure premiums of active policies that were used for payouts. Always <= active_pure_premiums` and always = 0 if won_pure_premiums != 0.
.pure_premiums: it’s a property that computes the total pure premiums as self.active_pure_premiums + self.won_pure_premiums - self.borrowed_active_pp
- EToken
.total_supply(): total amount in dollars in the pool.
.scr: amount that it’s locked as solvency capital of active policies
.scr_interest_rate: weighted average of the interest rate paid by the active policies
.utilization_rate: percentage of utilization of the eToken. Property calculated as scr / total_supply
.token_interest_rate: interest rate for the EToken, it’s calculated as scr_interest_rate * utilization_rate
.funds_available: available capital (total_supply - scr)
.funds_available_to_lock: available capital that can be used as scr, (total_supply - scr) * max_utilization_rate
.total_withdrawable(): amount that can be withdrawn, considering the liquidity_requirement.
.get_loan(): current debt of the pool with this eToken
- RiskModule
.active_exposure: total exposure currently allocated for this module
.get_minimum_premium(payout, loss_prob, expiration): minimum premium
Copying files from Ensuro main repository
Instructions to copy files from ensuro repository:
rm src/ensuro/contracts/*.json
for x in `find ../ensuro/artifacts/contracts/ -maxdepth 2 -name "*.json" -not -name "*.dbg.json" `; do
cp $x src/ensuro/contracts/ ;
done
for x in `find ../ensuro/artifacts/contracts/interfaces/ -maxdepth 2 -name "*.json" -not -name "*.dbg.json" `; do
cp $x src/ensuro/contracts/ ;
done
for x in ERC1967Proxy.json IERC20Metadata.json IERC20.json IERC721.json ; do
cp `find ../ensuro/artifacts/@openzeppelin/ -name $x` src/ensuro/contracts/$x ;
done
cp ../ensuro/artifacts/contracts/mocks/TestCurrency.sol/TestCurrency.json src/ensuro/contracts/TestCurrency.json
cp ../ensuro/prototype/ensuro.py src/ensuro/prototype.py
cp ../ensuro/prototype/wrappers.py src/ensuro/wrappers.py
cp ../ensuro/prototype/utils.py src/ensuro/utils.py
Note
This project has been set up using PyScaffold 4.1.1. For details and usage information on PyScaffold see https://pyscaffold.org/.
Metadata
Release files for ensuro 2.8.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ensuro-2.8.3.tar.gz | 206.3 kB | Without provenance | Details for ensuro-2.8.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ensuro-2.8.3-py3-none-any.whl | Python 3 | none | any | Details for ensuro-2.8.3-py3-none-any.whl |
Total release size: 413.1 kB
Release files / ensuro-2.8.3.tar.gz
| Download URL | ensuro-2.8.3.tar.gz |
|---|---|
| Size | 206.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
165c747be4bc6586bd70ef41e18f5006bb64e70ca928f7cf076a8da71bed782e
|
|
BLAKE2b-256 checksum How to use checksums |
81264077eca5e38d663b4011cb745f25e563364bdd54b4f7a9ba7239b55b055a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Release files / ensuro-2.8.3-py3-none-any.whl
| Download URL | ensuro-2.8.3-py3-none-any.whl |
|---|---|
| Size | 206.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
597e183cbfc68c0ac78c267c8bfb70ed866b767338d67ca4ad7408c599b90b09
|
|
BLAKE2b-256 checksum How to use checksums |
53622127e5dbd2e829c4225b1503846ae3bcfe9de0bb765a2e3c39941642f3b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Security for ensuro 2.8.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.