Add more documentation and begin with templates

This commit is contained in:
pistomat
2023-12-07 17:44:47 +01:00
parent b7b750de38
commit a7798374e1
8 changed files with 114 additions and 32 deletions

View File

@@ -8,18 +8,35 @@ To create a VM implementation, it is required two provide a manifest file as wel
### Prerequisites
1. Start by making a local copy of the Propeller Protocol Lib repository:
1. Install [Foundry](https://book.getfoundry.sh/getting-started/installation#using-foundryup).
```bash
curl -L https://foundry.paradigm.xyz | bash
```
2. Start by making a local copy of the Propeller Protocol Lib repository:
```bash
git clone https://github.com/propeller-heads/propeller-protocol-lib
```
2. Install `Foundry`, the smart contract development toolchain we use. We recommend installation using [foundryup](https://book.getfoundry.sh/getting-started/installation#using-foundryup)
3. Install forge dependencies:
```bash
cd evm
cd ./propeller-protocol-lib/evm/
forge install
```
4. Your integration should be in a separate directory in the `evm/src` folder. You can clone one of the example directories `evm/src/uniswap-v2` or `evm/src/balancer` and rename it to your integration name.
```
### Understanding the ISwapAdapter
1. Read the the documentation of the [Ethereum Solidity interface](ethereum-solidity.md). It describes the functions that need to be implemented as well as the manifest file.
2. Additionally read through the docstring of the [ISwapAdapter.sol](../../../evm/src/interfaces/ISwapAdapter.sol) interface and the [ISwapAdapterTypes.sol](../../../evm/src/interfaces/ISwapAdapterTypes.sol) interface which defines the data types and errors used by the adapter interface.
3. You can also generate the documentation locally and the look at the generated documentation in the `./docs` folder:
```bash
forge doc
```
### Implementing the ISwapAdapter interface
1. Your integration should be in a separate directory in the `evm/src` folder. Start by cloning the template directory:
```bash
cp -r ./evm/src/template ./evm/src/<your-adapter-name>
```
2. Implement the `ISwapAdapter` interface in the `./evm/src/<your-adapter-name>.sol` file.
3. Create tests for your implementation in the `./evm/test/<your-adapter-name>.t.sol` file, again based on the template `./evm/test/TemplateSwapAdapter.t.sol`.