Skip to content

Commit 96c9c4f

Browse files
authored
refactor: separate planning tools from ymax contract (#11988)
## Description ### Security / Scaling / Upgrade Considerations pure refactor; no runtime impact ### Documentation / Testing Considerations clarifies boundaries of contract a bit
2 parents 2dc434e + 015f1ad commit 96c9c4f

File tree

17 files changed

+34
-26
lines changed

17 files changed

+34
-26
lines changed

.prettierrc.json5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{
3232
// Keep network definitions readable on wide lines
3333
files: [
34-
'packages/portfolio-contract/src/network/network.prod.ts',
34+
'packages/portfolio-contract/tools/network/network.prod.ts',
3535
'packages/portfolio-contract/test/network/test-network.ts',
3636
],
3737
options: {

multichain-testing/scripts/ymax-tool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
type ProposalType,
1414
type TargetAllocation,
1515
} from '@aglocal/portfolio-contract/src/type-guards.ts';
16-
import { makePortfolioSteps } from '@aglocal/portfolio-contract/src/plan-transfers.ts';
16+
import { makePortfolioSteps } from '@aglocal/portfolio-contract/tools/plan-transfers.ts';
1717
import { makePortfolioQuery } from '@aglocal/portfolio-contract/tools/portfolio-actors.ts';
1818
import {
1919
axelarConfigTestnet,

packages/portfolio-contract/test/network/buildGraph.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import test from 'ava';
22
import { Far } from '@endo/marshal';
33
import { AmountMath } from '@agoric/ertp';
4-
import type { NetworkSpec } from '../../src/network/network-spec.js';
5-
import { makeGraphFromDefinition } from '../../src/network/buildGraph.js';
6-
import { planRebalanceFlow } from '../../src/plan-solve.js';
4+
75
import { gasEstimator } from '../mocks.js';
6+
import type { NetworkSpec } from '../../tools/network/network-spec.js';
7+
import { makeGraphFromDefinition } from '../../tools/network/buildGraph.js';
8+
import { planRebalanceFlow } from '../../tools/plan-solve.js';
89

910
const brand = Far('TestBrand') as any;
1011
const feeBrand = Far('TestFeeBrand') as any;

packages/portfolio-contract/test/network/test-network.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable camelcase */
22

33
import type { SupportedChain } from '@agoric/portfolio-api/src/constants.js';
4-
import type { NetworkSpec } from '../../src/network/network-spec.js';
4+
import type { NetworkSpec } from '../../tools/network/network-spec.js';
55
import type { PoolKey } from '../../src/type-guards.js';
66
import type { AssetPlaceRef } from '../../src/type-guards-steps.js';
77

packages/portfolio-contract/test/plan-deposit-transfers.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { AmountMath, type Brand } from '@agoric/ertp';
33
import { Far } from '@endo/pass-style';
44
import type { TargetAllocation } from '@aglocal/portfolio-contract/src/type-guards.js';
55
import { makeTracer } from '@agoric/internal';
6-
import { planDepositTransfers } from '../src/plan-transfers.ts';
6+
import { planDepositTransfers } from '../tools/plan-transfers.ts';
77

88
const brand = Far('mock brand') as Brand<'nat'>;
99
const trace = makeTracer('planDepositTransfers');

packages/portfolio-contract/test/portfolio.flows.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import {
6666
type ProposalType,
6767
type StatusFor,
6868
} from '../src/type-guards.ts';
69-
import { makePortfolioSteps } from '../src/plan-transfers.ts';
69+
import { makePortfolioSteps } from '../tools/plan-transfers.ts';
7070
import { decodeFunctionCall } from './abi-utils.ts';
7171
import {
7272
axelarIdsMock,

packages/portfolio-contract/test/rebalance.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { Far } from '@endo/marshal';
1111
import type {
1212
NetworkSpec,
1313
TransferProtocol,
14-
} from '../src/network/network-spec.js';
15-
import { planRebalanceFlow } from '../src/plan-solve.js';
16-
import type { FlowEdge, RebalanceMode } from '../src/plan-solve.js';
14+
} from '../tools/network/network-spec.js';
15+
import { planRebalanceFlow } from '../tools/plan-solve.js';
16+
import type { FlowEdge, RebalanceMode } from '../tools/plan-solve.js';
1717
import type { PoolKey } from '../src/type-guards.js';
1818
import type { AssetPlaceRef } from '../src/type-guards-steps.js';
1919
import { TEST_NETWORK } from './network/test-network.js';

packages/portfolio-contract/src/graph-diagnose.ts renamed to packages/portfolio-contract/tools/graph-diagnose.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import { provideLazyMap } from '@agoric/internal/src/js-utils.js';
88

99
import type { NetworkSpec } from './network/network-spec.js';
1010
import type { RebalanceGraph, LpModel } from './plan-solve.js';
11-
import { PoolPlaces, type PoolKey, type PoolPlaceInfo } from './type-guards.js';
11+
import {
12+
PoolPlaces,
13+
type PoolKey,
14+
type PoolPlaceInfo,
15+
} from '../src/type-guards.js';
1216

1317
/**
1418
* Build human-readable diagnostics for infeasible models.
File renamed without changes.

packages/portfolio-contract/src/network/buildGraph.ts renamed to packages/portfolio-contract/tools/network/buildGraph.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { NatAmount, Amount } from '@agoric/ertp/src/types.js';
33
import { partialMap } from '@agoric/internal/src/js-utils.js';
44

55
import { buildBaseGraph, type FlowEdge } from '../plan-solve.js';
6-
import { PoolPlaces, type PoolKey } from '../type-guards.js';
7-
import type { AssetPlaceRef } from '../type-guards-steps.js';
6+
import { PoolPlaces, type PoolKey } from '../../src/type-guards.js';
7+
import type { AssetPlaceRef } from '../../src/type-guards-steps.js';
88

99
import type { NetworkSpec } from './network-spec.js';
1010

0 commit comments

Comments
 (0)