Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
caglacelik committed Dec 4, 2024
1 parent b941dcd commit d7bbcf2
Show file tree
Hide file tree
Showing 30 changed files with 216 additions and 1,366 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ update:

# Build the contracts
build:
forge clean && forge build
forge build

# Generate gas snapshot
snapshot:
forge snapshot

# Test the contracts forked base-sepolia network with 4 parallel jobs
test:
forge clean && forge test --fork-url $(BASE_TEST_RPC_URL) --no-match-contract "InvariantTest" --jobs 4
forge test --fork-url $(BASE_TEST_RPC_URL) --no-match-contract "InvariantTest" --jobs 4

# Run invariant tests on local network with 4 parallel jobs
test-inv:
forge clean && forge test --match-contract "InvariantTest" --jobs 4
forge test --match-contract "InvariantTest" --jobs 4

anvil:
anvil --fork-url $(BASE_TEST_RPC_URL)
Expand All @@ -61,7 +61,7 @@ fmt:

# Coverage
cov:
forge clean && forge coverage --no-match-coverage "(test|mock|script)" --jobs 4
forge coverage --no-match-coverage "(test|mock|script)" --jobs 4

# Verify contract on blockscout
verify:
Expand Down
90 changes: 60 additions & 30 deletions docs/src/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Swan Protocol
Swan is a **Decentralized Protocol** where AI agents (buyers) dynamically interact with asset creators. Agents operate with budgets to purchase assets that match their objectives. Asset creators design assets to align with buyers’ needs to convince the LLM to buy their asset/assets.

This document provides instructions for swan contracts using Foundry.

## Test

Compile the contracts:
## Compile
Compile the contracts with:

```sh
make build
Expand All @@ -14,32 +12,19 @@ make build
>
> Please prepare a valid `.env` according to `.env.example` before running tests.
Run tests on forked base-sepolia:

```sh
make test
```

## Coverage
## Test

Check coverages with:
Run tests on forked base-sepolia with:

```sh
bash coverage.sh
make test
```

You can see coverages under the coverage directory.

## Storage Layout

Get storage layout with:

Run invariant tests on local with:
```sh
bash storage.sh
make test-inv
```

You can see storage layouts under the storage directory.

## Deployment

**Step 1.**
Expand Down Expand Up @@ -97,6 +82,54 @@ make deploy base-sepolia

You can see deployed contract addresses under the `deployment/<chainid>.json`

## Verify Contract

Verify contract manually with:

```sh
make verify base-sepolia <contractAddress> <contractName>
```
## Coverage

Check coverages with:

```sh
bash coverage.sh
```
or to see summarized coverages on terminal:

```sh
make cov
```

You can see coverages under the coverage directory.

## Storage Layout

Get storage layout with:

```sh
bash storage.sh
```

You can see storage layouts under the storage directory.

## Format

Format code with:

```sh
make fmt
```

## Update

Update modules with:

```sh
make update
```

## Gas Snapshot

Take the gas snapshot with:
Expand All @@ -105,17 +138,14 @@ Take the gas snapshot with:
make snapshot
```

You can see the snapshot `.gas-snapshot` in the current directory.
You can see the snapshot `.gas-snapshot` file in the current directory.

## Generate documentation

Generate documentation with:

```sh
make doc
```

You can also use the command below if you want to see docs locally with the given port number.

```sh
make doc --serve --port <port-number>

```
You can see the documentation under the `docs/` directory.
36 changes: 11 additions & 25 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
# Summary
- [Home](README.md)
# contracts
- [❱ libraries](contracts/libraries/README.md)
- [Statistics](contracts/libraries/Statistics.sol/library.Statistics.md)
- [❱ llm](contracts/llm/README.md)
- [LLMOracleCoordinator](contracts/llm/LLMOracleCoordinator.sol/contract.LLMOracleCoordinator.md)
- [LLMOracleManager](contracts/llm/LLMOracleManager.sol/contract.LLMOracleManager.md)
- [LLMOracleKind](contracts/llm/LLMOracleRegistry.sol/enum.LLMOracleKind.md)
- [LLMOracleRegistry](contracts/llm/LLMOracleRegistry.sol/contract.LLMOracleRegistry.md)
- [LLMOracleTaskParameters](contracts/llm/LLMOracleTask.sol/struct.LLMOracleTaskParameters.md)
- [LLMOracleTask](contracts/llm/LLMOracleTask.sol/interface.LLMOracleTask.md)
- [❱ mock](contracts/mock/README.md)
- [LLMOracleCoordinatorV2](contracts/mock/LLMOracleCoordinatorV2.sol/contract.LLMOracleCoordinatorV2.md)
- [LLMOracleRegistryV2](contracts/mock/LLMOracleRegistryV2.sol/contract.LLMOracleRegistryV2.md)
- [SwanV2](contracts/mock/SwanV2.sol/contract.SwanV2.md)
- [❱ swan](contracts/swan/README.md)
- [BuyerAgentFactory](contracts/swan/BuyerAgent.sol/contract.BuyerAgentFactory.md)
- [BuyerAgent](contracts/swan/BuyerAgent.sol/contract.BuyerAgent.md)
- [Swan](contracts/swan/Swan.sol/contract.Swan.md)
- [Swan constants](contracts/swan/Swan.sol/constants.Swan.md)
- [SwanAssetFactory](contracts/swan/SwanAsset.sol/contract.SwanAssetFactory.md)
- [SwanAsset](contracts/swan/SwanAsset.sol/contract.SwanAsset.md)
- [SwanMarketParameters](contracts/swan/SwanManager.sol/struct.SwanMarketParameters.md)
- [SwanManager](contracts/swan/SwanManager.sol/abstract.SwanManager.md)
- [❱ token](contracts/token/README.md)
- [WETH9](contracts/token/WETH9.sol/contract.WETH9.md)
# src
- [❱ mock](src/mock/README.md)
- [SwanV2](src/mock/SvanV2.sol/contract.SwanV2.md)
- [BuyerAgentFactory](src/BuyerAgent.sol/contract.BuyerAgentFactory.md)
- [BuyerAgent](src/BuyerAgent.sol/contract.BuyerAgent.md)
- [Swan](src/Swan.sol/contract.Swan.md)
- [Swan constants](src/Swan.sol/constants.Swan.md)
- [SwanAssetFactory](src/SwanAsset.sol/contract.SwanAssetFactory.md)
- [SwanAsset](src/SwanAsset.sol/contract.SwanAsset.md)
- [SwanMarketParameters](src/SwanManager.sol/struct.SwanMarketParameters.md)
- [SwanManager](src/SwanManager.sol/abstract.SwanManager.md)
8 changes: 0 additions & 8 deletions docs/src/contracts/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/src/contracts/libraries/README.md

This file was deleted.

71 changes: 0 additions & 71 deletions docs/src/contracts/libraries/Statistics.sol/library.Statistics.md

This file was deleted.

Loading

0 comments on commit d7bbcf2

Please sign in to comment.