Skip to content

Commit

Permalink
Merge pull request #87 from nnsW3/fix-improve-docs
Browse files Browse the repository at this point in the history
fix: improve docs
  • Loading branch information
Asem-Abdelhady authored Aug 8, 2024
2 parents a15a153 + 984aacf commit 090a650
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ The EVM implementation is used as a reference implementation.

# On Asset Pricing

For an indepth description of how to price assets, read `Unit of Liquidity`. The below seciton contains notable equations.
For an indepth description of how to price assets, read `Unit of Liquidity`. The below section contains notable equations.

## The Catalyst Equation

Let $P_i(w)$ be a decreasing, non-negative marginal price function for a token $i$. The equation which describes a Catalyst swap is then defined as:

$$U = \int_{i_t}^{i_t + \Delta i} P_i(w) \ dw$$

Where $i_t$ is the current balance in the vault, $\Delta i$ is the change in balance caused by the user and $U$ is Units: A measure of the value change by the user. The equation can be used both ways, where a positive change implies a "swap in" and a negative change implies a "swap out". It is implies that when assets are swapped out, $U$ the sign is flipped from positive to negative.
Where $i_t$ is the current balance in the vault, $\Delta i$ is the change in balance caused by the user and $U$ is Units: A measure of the value change by the user. The equation can be used both ways, where a positive change implies a "swap in" and a negative change implies a "swap out". It implies that when assets are swapped out, $U$ the sign is flipped from positive to negative.

This implies that the full swap from a token $i$ to another token $j$ can be computed as:

Expand All @@ -49,7 +49,7 @@ Amplification: $P^\theta(w)= \frac{W_i}{(W_i \cdot w)^\theta} \cdot (1-\theta)$

**LocalSwap**: A combination of *sendAsset* and *receiveAsset* executed atomically, often on a single chain.

**Invariant**: A measure used to measure the vault value. Specific to the *invariant* measure, is that it is constant whenever a swap is completed. If a vault implements a swap fee, the measure increases as fees accumulate in the vault. The invariant is not invariant to deposits or withdrawals. The invariants can continously be examined if the number of emitted Units is kept track of. In the below equations, this is representated as $\sum U$.
**Invariant**: A measure used to measure the vault value. Specific to the *invariant* measure, is that it is constant whenever a swap is completed. If a vault implements a swap fee, the measure increases as fees accumulate in the vault. The invariant is not invariant to deposits or withdrawals. The invariants can continuously be examined if the number of emitted Units is kept track of. In the below equations, this is represented as $\sum U$.

## The AMM Equations

Expand Down
6 changes: 3 additions & 3 deletions evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ More specifically, the code structure is as follows:

## CatalystVaultCommon.sol

An `abstract` contract (i.e. a contract that is made to be overriden), which enforces the core structure of a Catalyst vault and implements features which are generic to any pricing curve. Among these are:
An `abstract` contract (i.e. a contract that is made to be overridden), which enforces the core structure of a Catalyst vault and implements features which are generic to any pricing curve. Among these are:

- Vault administration, including fees and vault connections management
- Cross chain swaps acknowledgement and timeout
Expand Down Expand Up @@ -122,7 +122,7 @@ Compiling the tests takes a significant amount of time but running the tests the

The repository uses the Soldiity pipeline `--via-ir` to circumvent the *stack too deep* issue. The result is that when Foundry tries to re-compile the contracts without any optimisations it fails.

The forge argument `-ir-minimum` has to be used to compile the contracts using the `ir` representation. Note that this changes the mapping of source code to compiled code and some sections can be incorrectled marked as uncovered or covered.
The forge argument `-ir-minimum` has to be used to compile the contracts using the `ir` representation. Note that this changes the mapping of source code to compiled code and some sections can be incorrectly marked as uncovered or covered.

```
forge coverage --ir-minimum
Expand Down Expand Up @@ -293,7 +293,7 @@ contract ExampleTest is TestCommon {
```

This flow only has to be done once for each deployment and each chain. Since we are only simulating cross-chain connectivity, we only need to set the connection once. If we were to swap between 2 different chains, we would have to set connect the CCIs on both chains with their respective opposite addresses: (`CCI.connectNewChain(remoteChainIdentifier, remoteCCI, remoteGARP)`).¨
Security for vaults is handled by the vaults and we havn't set that yet. So lets set a connection for the vaults:
Security for vaults is handled by the vaults and we haven't set that yet. So lets set a connection for the vaults:

```solidity
import { ICatalystV1Vault } from "../src/ICatalystV1Vault.sol";
Expand Down
4 changes: 2 additions & 2 deletions solana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
- Specific Program: `anchor deploy -p <ProgramName>`
- Note: `<ProgramName>` is the name of the program in TitleCase
# Wallet
test-wallet.json contains the keypair used for testing of the Anchor programs.
test-wallet.json contains the keypair used for testing the Anchor programs.
# Add program
Add program key to Anchor.toml, example:
- programName = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
# Run test:
Run a specific test:
- `anchor test tests/<Path>/*.ts`
- Anchor.toml test script has been modified to allow running of specific tests. Original code:
- `test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"`
- `test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"`

0 comments on commit 090a650

Please sign in to comment.