Skip to content

Commit

Permalink
refactor: integrate with #5397
Browse files Browse the repository at this point in the history
update interchainPool tests

switch minInitialPoolLiquidity back to Nat in startupAmm since it has
to be driven from text values in environment variables.
  • Loading branch information
Chris-Hibbert committed May 24, 2022
1 parent 26833c7 commit 2d536b8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/run-protocol/src/interchainPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const start = (zcf, { bankManager }) => {
} = seat2.getProposal();
AmountMath.coerce(interAsset.brand, secondaryAmt);

const liquidityIssuer = await E(ammPub).addPool(
const liquidityIssuer = await E(ammPub).addIssuer(
interAsset.issuer,
`Interchain${kwNonce}`,
);
Expand All @@ -95,7 +95,7 @@ export const start = (zcf, { bankManager }) => {
seat2.incrementBy(seat.decrementBy(harden({ Central: centralAmt })));
zcf.reallocate(seat, seat2);

const invitation = await E(ammPub).makeAddLiquidityInvitation();
const invitation = await E(ammPub).addPoolInvitation();
const { userSeatPromise, deposited } = await offerTo(
zcf,
invitation,
Expand Down
6 changes: 2 additions & 4 deletions packages/run-protocol/src/proposals/econ-behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,14 @@ export const setupAmm = async (
E(E(zoe).getInvitationIssuer()).getAmountOf(poserInvitationP),
runBrandP,
]);
const {
minInitialPoolLiquidity = AmountMath.make(runBrand, 1_000_000_000n),
} = opts;
const { minInitialPoolLiquidity = 1_000_000_000n } = opts;

const timer = await chainTimerService; // avoid promise for legibility

const ammTerms = makeAmmTerms(
timer,
poserInvitationAmount,
minInitialPoolLiquidity,
AmountMath.make(runBrand, minInitialPoolLiquidity),
);

const ammGovernorTerms = {
Expand Down
2 changes: 1 addition & 1 deletion packages/run-protocol/test/amm/vpool-xyk-amm/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const setupAmmServices = async (
options: { econCommitteeOptions: electorateTerms },
}),
setupAmm(space, {
minInitialPoolLiquidity: AmountMath.make(centralR.brand, 1000n),
minInitialPoolLiquidity: 1000n,
}),
]);

Expand Down
8 changes: 4 additions & 4 deletions packages/run-protocol/test/test-gov-collateral.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ const makeScenario = async t => {
} = home;

return harden({
makePool: async (atomQty = 100n, istQty = 500n) => {
makePool: async (atomQty = 500n, istQty = 1000n) => {
const istBrand = await E(agoricNames).lookup('brand', 'RUN');
const istAmt = qty => AmountMath.make(istBrand, qty * 1_000_000n);
const interchainPoolAPI = E(zoe).getPublicFacet(
Expand Down Expand Up @@ -411,7 +411,7 @@ test('Benefactor can add to reserve', async t => {
await s.startDevNet();
await s.provisionMembers();
await s.startRunPreview();
await s.benefactor.makePool(2000n, 100n);
await s.benefactor.makePool(2000n, 1000n);
await Promise.all([
s.enactVaultAssetProposal(),
s.enactInviteEconCommitteeProposal(),
Expand Down Expand Up @@ -458,7 +458,7 @@ test('assets are in AMM, Vaults', async t => {
await s.startDevNet();
await s.provisionMembers();
await s.startRunPreview();
await s.benefactor.makePool(2000n, 100n);
await s.benefactor.makePool(2000n, 1000n);

await Promise.all([
s.enactVaultAssetProposal(),
Expand Down Expand Up @@ -494,7 +494,7 @@ test('Committee can raise debt limit', async t => {
await s.startDevNet();
const purses = await s.provisionMembers();
await s.startRunPreview();
await s.benefactor.makePool(2000n, 100n);
await s.benefactor.makePool(2000n, 1000n);

await Promise.all([
s.enactVaultAssetProposal(),
Expand Down
7 changes: 4 additions & 3 deletions packages/run-protocol/test/test-interchainPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test('make interchain pool', async t => {
const { make, add } = AmountMath;
const { zoe, istKit, installation } = t.context;

const minimumCentral = make(istKit.brand, 100n * 1_000_000n);
const minimumCentral = make(istKit.brand, 1000n * 1_000_000n);

// Start AMM
const {
Expand Down Expand Up @@ -108,7 +108,7 @@ test('make interchain pool', async t => {
const pmt = await actualPayouts[kw];
// eslint-disable-next-line no-await-in-loop
const actual = await E(issuers[kw]).getAmountOf(pmt);
t.deepEqual(actual, amts[kw]);
t.deepEqual(actual, amts[kw], `amount mismatch for ${kw}`);
}
};

Expand Down Expand Up @@ -156,7 +156,8 @@ test('make interchain pool', async t => {
{
Central: make(istKit.brand, 0n),
Secondary: make(ibcBrand, 0n),
Liquidity: make(liqBrand, proposal1.give.Central.value),
// @ts-expect-error proposal1.give.Central.value is Nat
Liquidity: make(liqBrand, proposal1.give.Central.value - 1000n),
},
{
Central: istKit.issuer,
Expand Down
2 changes: 1 addition & 1 deletion packages/run-protocol/test/vaultFactory/test-liquidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const setupAmmAndElectorate = async (t, aethLiquidity, runLiquidity) => {
options: { econCommitteeOptions: electorateTerms },
});
setupAmm(space, {
minInitialPoolLiquidity: AmountMath.make(runBrand, 1000n),
minInitialPoolLiquidity: 1000n,
});

const governorCreatorFacet = consume.ammGovernorCreatorFacet;
Expand Down
3 changes: 1 addition & 2 deletions packages/run-protocol/test/vaultFactory/test-vaultFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ const setupAmmAndElectorate = async (t, aethLiquidity, runLiquidity) => {
const {
zoe,
aethKit: { issuer: aethIssuer },
runKit: { brand: runBrand },
electorateTerms = { committeeName: 'The Cabal', committeeSize: 1 },
timer,
} = t.context;
Expand All @@ -148,7 +147,7 @@ const setupAmmAndElectorate = async (t, aethLiquidity, runLiquidity) => {
space.installation.produce.amm.resolve(t.context.installation.amm);
await startEconomicCommittee(space, electorateTerms);
await setupAmm(space, {
minInitialPoolLiquidity: AmountMath.make(runBrand, 300n),
minInitialPoolLiquidity: 300n,
});

const governorCreatorFacet = consume.ammGovernorCreatorFacet;
Expand Down

0 comments on commit 2d536b8

Please sign in to comment.