Skip to content

Commit

Permalink
updates docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Oct 16, 2023
1 parent 92331bc commit df0281b
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 19 deletions.
9 changes: 4 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ git push -f feature-branch

_now, we have completed our feature, so we create a PR to merge the branch into main_

Once the PR is approved, we perform a final rebase, if necessary, and then a _squash merge_. This means each PR results in a single commit to `main`.

If two people are working in a branch then you should `git pull --rebase origin feature-branch` _before_ `git push origin feature-branch`.
We also recommend that you start each working session with a `pull` and end it with a `push`, so that your colleagues can work asynchronously while you are not.
Once the PR is approved, we perform a final rebase, if necessary, and then a _squash merge_.
This means each PR results in a single commit to `main`.
Please provide a brief description of the PR in the summary, as opposed to a list of commit strings.

# Contributing a new bot policy

Expand All @@ -38,5 +37,5 @@ Submit a pull request that meets the following criteria:

1. Do something an existing policy doesn't already accomplish
2. Be well-documented and follow our existing [STYLEGUIDE.md](STYLEGUIDE.md).
3. Pass all linting checks, including `black` and `pylint`.
3. Pass all linting and type checks (the GH actions will check this for you).
4. Describe the bot's behavior in a `describe` [classmethod](https://docs.python.org/3/library/functions.html#classmethod) similarly to existing bots, ending in a `super().describe()` call.
43 changes: 35 additions & 8 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ git clone git@github.com:delvtech/elf-simulations.git <repo_location>

Follow [Pyenv install instructions](https://github.com/pyenv/pyenv#installation).


## 3. Set up a virtual environment

You can use any environment; we use [venv](https://docs.python.org/3/library/venv.html):
Expand Down Expand Up @@ -68,28 +67,56 @@ pip install agent0[lateral] # Installs dependent sub-packages from git (e.g., et

# Working with smart contracts

We run tests and offer utilities that depend on executing bytecode compiled from Hyperdrive solidity contracts. This is not required to use elfpy.
We run tests and offer utilities that depend on executing bytecode compiled from Hyperdrive solidity contracts.
This is not required to use elfpy.

NOTE: The Hyperdrive solidity implementation is currently under security review, and thus is not available publicly.
The following instructions will not work for anyone who is not a member of Delv.

## 1. Set up smart contracts

Clone the hyperdrive repo, then create a [sym link](https://en.wikipedia.org/wiki/Symbolic_link#POSIX_and_Unix-like_operating_systems) at `hyperdrive_solidity/` pointing to the repo location.
Clone the hyperdrive repo:

```bash
git clone git@github.com:delvtech/hyperdrive.git ../hyperdrive
ln -s ../hyperdrive hyperdrive_solidity
```

## 2. Install Hyperdrive

Complete the steps in Hyperdrive's [Pre-requisites](https://github.com/delvtech/hyperdrive#pre-requisites) and [Build](https://github.com/delvtech/hyperdrive#build) sections.

## 3. Copy ABI & bytecode files
Copy the contract `sol` folders from the generated `out` directory in the `hyperdrive` repository root.
These folder should contain the ABI JSON and bytecode files for each contract.
Paste the folders into `elf-simulations/packages/hyperdrive/src/abis/`.

```bash
cp ../hyperdrive/out/*.sol packages/hyperdrive/src/abis/
```

Our codebase uses the following contracts:

```bash
ERC20Mintable.sol/
ERC4626DataProvider.sol/
ERC4626HyperdriveDeployer.sol/
ERC4626HyperdriveFactory.sol/
ForwarderFactory.sol/
IHyperdrive.sol/
MockERC4626.sol/
```

You then can update the generated `hypertypes` python package by running `pypechain` on this folder:

```bash
pip install --upgrade pip && pip intstall --upgrade pypechain
pypechain packages/hyperdrive/src/abis/ --output_dir lib/hypertypes/hypertypes/
```

# Additional useful applications

You can test against a local testnet node using [Anvil](https://book.getfoundry.sh/reference/anvil/) with `anvil`.
You can test against a local testnet node using [Anvil](https://book.getfoundry.sh/reference/anvil/).

We use [Docker](docs.docker.com/get-docker) for building images. Tests also use docker to launch a local postgres server.
If there are Docker issues when running tests, ensure "Allow the default Docker socket to be used" is set under Advanced settings (typically when running
Docker Desktop on Macs).
We use [Docker](docs.docker.com/get-docker) for building images.
Some tests also use Docker to launch a local postgres server and Anvil chain.
If there are Docker issues when running tests, ensure "Allow the default Docker socket to be used" is set under Advanced settings (typically when running Docker Desktop on Macs).
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
This project is a work-in-progress. All code is provided as is and without guarantee.
The language used in this code and documentation is not intended to, and does not, have any particular financial, legal, or regulatory significance.

Documentation can be found [here](https://elfpy.delv.tech).

## Packages

Our current supported packages are:
This monorepo houses internal packages that are still under development. They are:

- agent0 ([README](https://github.com/delvtech/elf-simulations/tree/main/lib/agent0/README.md))
- chainsync ([README](https://github.com/delvtech/elf-simulations/tree/main/lib/chainsync/README.md))
- elfpy ([README](https://github.com/delvtech/elf-simulations/tree/main/lib/elfpy/README.md))
- ethpy ([README](https://github.com/delvtech/elf-simulations/tree/main/lib/ethpy/README.md))
- elfpy (**WILL BE DEPRECATED NOV 2023** [README](https://github.com/delvtech/elf-simulations/tree/main/lib/elfpy/README.md))

We also utilize internal packages that are "in production," which is to say they live in their own repo:

- pypechain ([README](https://github.com/delvtech/pypechain/tree/main#readme), [pypi](https://pypi.org/project/pypechain/))
- fixedpointmath ([README](https://github.com/delvtech/agent_0/tree/main/lib/fixedpointmath#readme), [pypi](https://pypi.org/project/fixedpointmath/))

## Install

Expand Down Expand Up @@ -57,11 +60,12 @@ Please refer to [CONTRIBUTING.md](https://github.com/delvtech/elf-simulations/bl

## Number format

Internally Elfpy conducts all operations using 18-decimal fixed-point precision integers and arithmetic.
Internally we frequently utilize 18-decimal fixed-point precision numbers for arithmetic.
Briefly, this means our representation for unity, "one", is `1 * 10 ** 18`, which would be `1.0` when cast to a float.
Unlike typical floats, a FixedPoint numeric always supports 18 decimal digits of precision, regardless of the scale of the number.

This can lead to confusion when additionally dealing with standard Python floats and ints.
As such, we have purposefully constrain support for mixed-type operations that include the FixedPoint type.
As such, we have purposefully constrained support for mixed-type operations that include the FixedPoint type.
Due to a lack of known precision, operations against Python floats are not allowed (e.g. `float * FixedPoint` will raise an error).
However, operations against `int` are allowed.
In this case, the `int` _argument_ is assumed to be "unscaled", i.e. if you write `int(8) * FixedPoint(8)` we will scale up the first variable return a `FixedPoint` number that represents the float `64.0` in 18-decimal FixedPoint format.
Expand Down

0 comments on commit df0281b

Please sign in to comment.