Skip to content

Commit

Permalink
chore: clean-up priceAuthority
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-Hibbert committed Dec 27, 2023
1 parent 830d52a commit 7f2f56d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/zoe/src/contractSupport/priceAuthority.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/* eslint @typescript-eslint/no-floating-promises: "warn" */
import { E } from '@endo/eventual-send';
import { Far } from '@endo/marshal';
import { assert, q, Fail } from '@agoric/assert';
import { makePromiseKit } from '@endo/promise-kit';
import { AmountMath, AmountShape, BrandShape } from '@agoric/ertp';
import { makeNotifier } from '@agoric/notifier';
import { makeTracer } from '@agoric/internal';
import { TimestampShape } from '@agoric/time';
import { M } from '@agoric/store';

const { quote: q, Fail } = assert;

const trace = makeTracer('PA', false);

/**
Expand Down Expand Up @@ -68,7 +69,7 @@ export const PriceAuthorityI = M.interface('PriceAuthority', {
* @param {Brand<'nat'>} opts.actualBrandOut
* @returns {PriceAuthorityKit}
*/
export function makeOnewayPriceAuthorityKit(opts) {
export const makeOnewayPriceAuthorityKit = opts => {
const {
timer,
createQuote,
Expand All @@ -80,7 +81,7 @@ export function makeOnewayPriceAuthorityKit(opts) {

let haveFirstQuote = false;

E(notifier)
void E(notifier)
.getUpdateSince()
.then(_ => (haveFirstQuote = true));

Expand Down Expand Up @@ -108,15 +109,16 @@ export function makeOnewayPriceAuthorityKit(opts) {
*
* @param {CompareAmount} compareAmountsFn
*/
const makeQuoteWhenOut = compareAmountsFn =>
const makeQuoteWhenOut =
compareAmountsFn =>
/**
* Return a quote when triggerWhen is true of the arguments.
*
* @param {Amount<'nat'>} amountIn the input value to the calcAmountTrigger
* @param {Amount} amountOutLimit the value to compare with the output
* of calcAmountTrigger
*/
async function quoteWhenOutTrigger(amountIn, amountOutLimit) {
async (amountIn, amountOutLimit) => {
amountIn = AmountMath.coerce(actualBrandIn, amountIn);
amountOutLimit = AmountMath.coerce(actualBrandOut, amountOutLimit);

Expand Down Expand Up @@ -169,12 +171,13 @@ export function makeOnewayPriceAuthorityKit(opts) {
*
* @param {CompareAmount} compareAmountsFn
*/
const makeMutableQuote = compareAmountsFn =>
const makeMutableQuote =
compareAmountsFn =>
/**
* @param {Amount<'nat'>} amountIn
* @param {Amount<'nat'>} amountOutLimit
*/
async function mutableQuoteWhenOutTrigger(amountIn, amountOutLimit) {
async (amountIn, amountOutLimit) => {
AmountMath.coerce(actualBrandIn, amountIn);
AmountMath.coerce(actualBrandOut, amountOutLimit);

Expand Down Expand Up @@ -376,4 +379,4 @@ export function makeOnewayPriceAuthorityKit(opts) {
});

return { priceAuthority, adminFacet: { fireTriggers } };
}
};

0 comments on commit 7f2f56d

Please sign in to comment.