Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ writeRpc: $WRITE_RPC
subgraph: $SUBGRAPH
arbAddress: $ARB_ADDRESS
genericArbAddress: $GENERIC_ARB_ADDRESS
balancerArbAddress: $BALANCER_ARB_ADDRESS
dispair: $DISPAIR
liquidityProviders: $LIQUIDITY_PROVIDERS
route: $ROUTE
Expand All @@ -24,7 +25,7 @@ retries: $RETRIES
maxRatio: $MAX_RATIO
rpOnly: $RP_ONLY
ownerProfile: $OWNER_PROFILE
selfFundOrders: $SELF_FUND_ORDERS
selfFundVaults: $SELF_FUND_ORDERS
sgFilter:
includeOrders: $INCLUDE_ORDERS
excludeOrders: $EXCLUDE_ORDERS
Expand Down
3 changes: 3 additions & 0 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ arbAddress: "0x1234...5678"
# Generic arb contract address, optional
genericArbAddress: "0x1234...5678"

# Balancer arb contract address, optional
balancerArbAddress: "0x1234...5678"

# Dispair contract address, required
dispair: "0x1234...5678"

Expand Down
248 changes: 246 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"vitest": "npm run vitest:logger && vitest run --exclude ./src/logger/index.test.ts"
},
"dependencies": {
"@balancer/sdk": "^4.5.2",
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/core": "^1.22.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.49.1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/downtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DEFAULT_PAGE_SIZE, getTxsQuery } from "../src/subgraph/query";

config();

const DURATION = process.env.DURATION ? parseInt(process.env.DURATION) : 30; // 7 days default
const DURATION = process.env.DURATION ? parseInt(process.env.DURATION) : 7; // 7 days default
const THRESHOLD = (process.env.THRESHOLD ? parseInt(process.env.THRESHOLD) : 60) * 60 * 1000; // 60 minutes default

const subgraphs = JSON.parse(process.env.SUBGRAPHS ?? "{}") as Record<string, string>;
Expand Down
23 changes: 23 additions & 0 deletions src/common/abis/balancer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Prettify } from "viem";
import { batchRouterAbi_V3 } from "@balancer/sdk";

/** Keeps the BalancerBatchRouter contract ABIs */
export namespace BalancerBatchRouterAbi {
/** Balancer BatchRouter v3 contract structs */
export namespace Structs {
type _swapPathExactAmountInType = (typeof batchRouterAbi_V3)[21]["inputs"][0];
const _swapPathExactAmountIn = structuredClone(
batchRouterAbi_V3[21].inputs[0],
) as any as Prettify<Omit<_swapPathExactAmountInType, "type"> & { readonly type: "tuple" }>;
(_swapPathExactAmountIn as any).type = "tuple";

export const SwapPathExactAmountIn = _swapPathExactAmountIn;
export const SwapPathStep = batchRouterAbi_V3[21].inputs[0].components[1];
}

/** BalancerBatchRouter contract primary parsed ABI */
export namespace Primary {
/** Primary parsed ABI for SushiSwap RouteProcessor3 contract only including processRoute() function */
export const BatchRouterV3 = batchRouterAbi_V3;
}
}
2 changes: 2 additions & 0 deletions src/common/abis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { RouteProcessorAbi } from "./rp";
import { DeployerAbi } from "./deployer";
import { OrderbookAbi } from "./orderbook";
import { Multicall3Abi } from "./multicall";
import { BalancerBatchRouterAbi } from "./balancer";
import { ArbitrumNodeInterfaceAbi } from "./arbitrum";

/** Keeps all necesdsary ABIs for rain solver app */
Expand All @@ -11,5 +12,6 @@ export namespace ABI {
export import Orderbook = OrderbookAbi;
export import Multicall3 = Multicall3Abi;
export import RouteProcessor = RouteProcessorAbi;
export import BalancerBatchRouter = BalancerBatchRouterAbi;
export import ArbitrumNodeInterface = ArbitrumNodeInterfaceAbi;
}
2 changes: 2 additions & 0 deletions src/config/yaml.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ writeRpc:
- url: http://write-rpc.example.com
subgraph: ["http://subgraph.example.com"]
arbAddress: "0x1111111111111111111111111111111111111111"
balancerArbAddress: "0x3333333333333333333333333333333333333333"
dispair: "0x2222222222222222222222222222222222222222"
liquidityProviders:
- lp1
Expand Down Expand Up @@ -72,6 +73,7 @@ sgFilter:
writeRpc: [{ url: "http://write-rpc.example.com" }],
subgraph: ["http://subgraph.example.com"],
arbAddress: "0x1111111111111111111111111111111111111111",
balancerArbAddress: "0x3333333333333333333333333333333333333333",
dispair: "0x2222222222222222222222222222222222222222",
genericArbAddress: undefined,
liquidityProviders: ["lp1", "lp2"],
Expand Down
7 changes: 7 additions & 0 deletions src/config/yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export type AppOptions = {
dispair: string;
/** Generic arb contract address */
genericArbAddress?: string;
/** Balancer arb contract address */
balancerArbAddress?: string;
/** List of subgraph urls */
subgraph: string[];
/** Option to maximize maxIORatio, default is true */
Expand Down Expand Up @@ -141,6 +143,11 @@ export namespace AppOptions {
"genericArbAddress",
true,
),
balancerArbAddress: Validator.resolveAddress(
input.balancerArbAddress,
"balancerArbAddress",
true,
),
liquidityProviders: Validator.resolveLiquidityProviders(input.liquidityProviders),
route: Validator.resolveRouteType(input.route),
ownerProfile: Validator.resolveOwnerProfile(input.ownerProfile),
Expand Down
Loading
Loading