Skip to content

Conversation

@lgahdl
Copy link

@lgahdl lgahdl commented Dec 4, 2025

Description

Offline mode deployment with test scripts.
Deployment of:

  • Tokens (USDT, USDC, DAI, WETH, GNO)
  • Uniswap V2 Pairs and Router (10 pairs in total)
  • Cow Core contracts and Periphery (Missing only ComposableCoW)

How to test:

  • Testing an order: npm run test:order --sellToken USDC --buyToken DAI --sellAmount 100e6 --from 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

  • Testing cowshed: npm run test:cowshed

Luiz Gustavo Abou Hatem de Liz added 30 commits November 7, 2025 19:16
[wip]: still missing the integration with the frontend;
…the order, it's missing the price estimative from the driver;
refactor: joining the poc-offline-mode/src with poc-offline-mode/contracts/src
…t to the autogenerated inside the poc-offline-mode folder;
…ing the files to configs/offline;

fix: fixing the python sign_order.py script;
…, now it will keep it's size after deployment);
… all combinations;

feat: Creating a new test script that you can pass parameters to define the transaction;
refactor: changing from poc-offline-mode to offline-mode;
feat: Deterministic deployment addresses;
feat: configuring docker-compose.offline.yml file to start coingecko mock and add it to the price estimators;
…iswapv2pairs' into luizhatem/cow-542-implement-coingecko-api-mock-for-offline-price-fetching
…ine-price-fetching' into luizhatem/npm-dependencies
…ine-price-fetching' into luizhatem/npm-dependencies
Luiz Gustavo Abou Hatem de Liz added 10 commits November 26, 2025 18:39
…nto luizhatem/cow-566-replace-custom-balancessol-with-official-gpv2tradesimulator

# Conflicts:
#	configs/offline/driver.toml
#	playground/.env.offline
#	playground/offline-mode/state/anvil-state.json
…oy-cowhookstrampoline-contract

# Conflicts:
#	configs/offline/driver.toml
…nto luizhatem/cow-566-replace-custom-balancessol-with-official-gpv2tradesimulator
…ng unused interfaces;

feat: Replacing uniswap built contract by prebuilt bytecodes directly from npm dependency;
@lgahdl lgahdl self-assigned this Dec 4, 2025
Comment on lines 8 to 16
- -c
- |
if [ -f ./state/anvil-state.json ]; then
echo "📂 Loading existing blockchain state..."
anvil --load-state ./state/anvil-state.json --host 0.0.0.0 --port 8545 --chain-id 31337 --block-time 1 --gas-limit 30000000 --code-size-limit 50000 --accounts 10
else
echo "Error: No state file found at /state/anvil-state.json. Please run locally with start-anvil.sh and deploy-all.sh scripts to create the state first."
exit 1
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: wouldn't this be better on a script file of its own?

coingecko-mock:
build:
context: ./mocks/coingecko
dockerfile: Dockerfile

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: I haven't created docker compose files in a while. Isn't Dockerfile the default path it looks for? Shouldn't it have an extension?

cargo build --bin orderbook
target/aarch64-unknown-linux-gnu/debug/orderbook
env_file: .env.offline
environment:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: lots of env vars. can't you create an env file and use the env_file attribute, instead of assigning each all of them here?

export const TOKENS: Record<string, TokenConfig> = {
// WETH - Wrapped Ether
'0x0e9eaf7d33972f56831e1fc87ac7ed00c8943f51': {
address: '0x0E9eAf7d33972F56831E1fc87AC7Ed00c8943F51',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: this is not lowercase. can this become an issue?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that I'll take them from environment variable, this will no longer be a problem, but the addresses were being trimmed and lowercased, so this was not a technical issue.

Comment on lines 4 to 8
"WETH": "0x0E9eAf7d33972F56831E1fc87AC7Ed00c8943F51",
"USDC": "0x3835b40C692AFfA1e2D0dC3bB6dE93aB91e7f805",
"DAI": "0x0e13b765c10B085CF5648537cB6E5121E683a9a1",
"USDT": "0xfE71f4aFfD20f7e1CA13E15D1cEecd9c024ead05",
"GNO": "0xFB408F28D8b38b127b00d9F07daD87Fb21745831"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: repeated token addresses

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to create this structured object from .env.offline, good point

import {Script} from "forge-std/Script.sol";
import {console} from "forge-std/console.sol";

interface IERC20 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why not import the interface from open zeppelin?

' }'
));

string memory json = string(abi.encodePacked(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: maybe generate each json in a function: that way you don't have so many variables in a single one. you can also read only the needed ones from the env file. as far as ive seen, each one is only used once, so i think that would increase readability.

mkdir -p config
mkdir -p state

# Step 1: Deploy Tokens

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: any way to have each of these steps inside its own file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants