Skip to content

Commit

Permalink
feat: legacy cow amm safe indexer (#81)
Browse files Browse the repository at this point in the history
## Description

This PR adds a rust utility that indexes all legacy CoW AMMs that have
been created using the Safe module, to be used for statically populating
the `ConstantProductHelper.sol` contract in a forthcoming PR.

## Testing

1. Ensure you have a running `rust` environment (the devcontainer has
been updated to include one).
2. Change into the `utils` directory and: `RPC_URL=cargo run --bin
cow-amm-indexer`

**NOTE**: As this indexer looks back over previous blocks, the RPC being
used must have `receipts` available for the respective contracts that
are being analysed. For example, if you want to test this for mainnet,
`https://eth.merkle.io` is suitable.

---------

Co-authored-by: Federico Giacon <[email protected]>
  • Loading branch information
mfw78 and fedgiac authored Jun 26, 2024
1 parent 0e2c4b1 commit bf8ea37
Show file tree
Hide file tree
Showing 7 changed files with 3,582 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"name": "Foundry",
"image": "mcr.microsoft.com/devcontainers/base:0",
"features": {
"ghcr.io/nlordell/features/foundry": {},
},
"customizations": {
"vscode": {
"extensions": [
"JuanBlanco.solidity"
]
}
}
"name": "Foundry + Rust Development Container",
"image": "mcr.microsoft.com/devcontainers/base:debian",
"features": {
"ghcr.io/devcontainers/features/rust:1": {
"version": "nightly-2024-06-07"
},
"ghcr.io/nlordell/features/foundry": {}
},
"postCreateCommand": "sudo DEBIAN_FRONTEND=noninteractive apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y pkg-config libssl-dev",
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"JuanBlanco.solidity"
]
}
}
}

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ out/

# Dotenv file
.env

# Rust
/utils/target
Loading

0 comments on commit bf8ea37

Please sign in to comment.