-
Notifications
You must be signed in to change notification settings - Fork 0
Offline mode #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Offline mode #11
Conversation
[wip]: still missing the integration with the frontend;
…the order, it's missing the price estimative from the driver;
wip: Clear the mess;
refactor: joining the poc-offline-mode/src with poc-offline-mode/contracts/src
…t to the autogenerated inside the poc-offline-mode folder;
…wap-v2 build output into .gitignore;
…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
…oy-cowhookstrampoline-contract
…ine-price-fetching' into luizhatem/npm-dependencies
…oy-cowhookstrampoline-contract
…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;
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
| - -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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
| "WETH": "0x0E9eAf7d33972F56831E1fc87AC7Ed00c8943F51", | ||
| "USDC": "0x3835b40C692AFfA1e2D0dC3bB6dE93aB91e7f805", | ||
| "DAI": "0x0e13b765c10B085CF5648537cB6E5121E683a9a1", | ||
| "USDT": "0xfE71f4aFfD20f7e1CA13E15D1cEecd9c024ead05", | ||
| "GNO": "0xFB408F28D8b38b127b00d9F07daD87Fb21745831" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: repeated token addresses
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
feat: Making the test-playground-order.ts work; fix: Coingecko mock now calculates the price using uniswap v2 pairs; chore: removing unused files;
chore: removing unused/duplicated files; feat: using uniswap pairs for coingecko mocked prices;
chore: fixing readme.md;
…et for the coingecko-mock;
fix: Fixing cowshed order tests;
feat: Adding a deployer via docker-compose;
Luizhatem/split deployment
Description
Offline mode deployment with test scripts.
Deployment of:
How to test:
Testing an order:
npm run test:order --sellToken USDC --buyToken DAI --sellAmount 100e6 --from 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80Testing cowshed:
npm run test:cowshed