Skip to content

Commit

Permalink
#45 fix failing tests, update README.md typo
Browse files Browse the repository at this point in the history
  • Loading branch information
anilhelvaci committed Apr 13, 2023
1 parent 3c5006e commit d516a70
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Please make sure you install the agoric-sdk first.
> Due to some problem related to ava setup we can only run test when we're in the contract/ directory.
> So you should cd to contract/ directory until this issue is resolved.
1. `cd contract`
2. Run `npx ava --verbose test/lendingPool/test-stopLoss.js`.
2. Run `npx ava -s -v test/test-stopLoss.js`.


# Demonstration scenarios
Expand Down
2 changes: 1 addition & 1 deletion contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@endo/far": "^0.2.9",
"@endo/nat": "^4.1.18",
"@endo/promise-kit": "^0.2.47",
"@agoric/inter-protocol": "0.11.0"
"@agoric/inter-protocol": "0.13.3"
},
"devDependencies": {
"@agoric/deploy-script-support": "^0.9.0",
Expand Down
4 changes: 2 additions & 2 deletions contract/src/stopLoss.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
assertIssuerKeywords,
assertProposalShape,
getAmountOut,
} from '@agoric/zoe/src/contractSupport';
offerTo,
} from '@agoric/zoe/src/contractSupport/index.js';
import { Far, E } from '@endo/far';
import { AmountMath } from '@agoric/ertp';
import { offerTo } from '@agoric/zoe/src/contractSupport/index.js';
import {
assertBoundaryShape,
assertExecutionMode,
Expand Down
3 changes: 2 additions & 1 deletion contract/test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,9 @@ export const makeAssertPayouts = (
};
};

export async function startStopLoss(zoe, issuerKeywordRecord, terms) {
export async function startStopLoss(t, zoe, issuerKeywordRecord, terms) {
const { publicFacet, creatorFacet } = await setupStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down
8 changes: 4 additions & 4 deletions contract/test/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ harden(setupAmmServices);


export const setupStopLoss = async (
t,
zoe,
issuerKeywordRecord,
terms,

) => {

const contractPath = new URL(contractRoots.stopLossRoot, import.meta.url).pathname;
const bundle = await bundleSource(contractPath);
const installation = await E(zoe).install(bundle);
const stopLossUrl = await importMetaResolve(contractRoots.stopLossRoot, import.meta.url);
const stopLossBundle = await provideBundle(t, new URL(stopLossUrl).pathname, 'stopLoss');
const installation = await E(zoe).install(stopLossBundle);

const { publicFacet, creatorFacet } = await E(zoe).startInstance(
installation,
Expand Down
16 changes: 16 additions & 0 deletions contract/test/test-stopLoss.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ test('lock-lpTokens', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -219,6 +220,7 @@ test('lock-additional-lpTokens', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -360,6 +362,7 @@ test('withdraw-locked-LpTokens ', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -489,6 +492,7 @@ test('withdraw-liquidity', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -621,6 +625,7 @@ test('trigger-lp-removal-price-moves-above-upper', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -752,6 +757,7 @@ test('trigger-lp-removal-price-moves-below-lower', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -883,6 +889,7 @@ test('update-boundaries-price-moves-below-old-lower-boundary', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -1031,6 +1038,7 @@ test('update-boundaries-price-moves-above-old-upper-boundary', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -1180,6 +1188,7 @@ test('update-boundaries-price-moves-above-old-upper-then-new-upper', async (t) =
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -1368,6 +1377,7 @@ test('update-boundaries-price-moves-below-old-lower-then-new-lower', async (t) =
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -1556,6 +1566,7 @@ test('update-boundaries-price-moves-below-old-lower-then-new-upper', async (t) =
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -1748,6 +1759,7 @@ test('boundaryWatcher-failed-no-tokens-locked', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -1860,6 +1872,7 @@ test('boundaryWatcher-failed-then-remove-tokens-locked', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -2016,6 +2029,7 @@ test('update-boundaries-outside-of-price-ratio', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -2184,6 +2198,7 @@ test('initiate-stoploss-with-boundaries-outside-of-price-ratio', async (t) => {
});

const testingPromise = startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down Expand Up @@ -2265,6 +2280,7 @@ test('remove-liquidity-failed-keep-tokens-locked', async (t) => {
});

const { creatorFacet, publicFacet } = await startStopLoss(
t,
zoe,
issuerKeywordRecord,
terms,
Expand Down

0 comments on commit d516a70

Please sign in to comment.