Skip to content

Commit

Permalink
chore: responses to review
Browse files Browse the repository at this point in the history
renamed some files from treasury/stablecoin to vaultFactory
annotated some ts-ignore statements in tests.

regenerated png files in docs/threat_models
  • Loading branch information
Chris-Hibbert committed Dec 29, 2021
1 parent 479b301 commit 61dd1c8
Show file tree
Hide file tree
Showing 22 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/threat_models/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

[![./smart_contracts/multipool_autoswap/mpas_sequence_003.png](./smart_contracts/multipool_autoswap/mpas_sequence_003.png)](./smart_contracts/multipool_autoswap/mpas_sequence_003.png)

## ./treasury/treasury.png
## ./vaultFactory/vaultFactory.png

[![./treasury/treasury.png](./treasury/treasury.png)](./treasury/treasury.png)
[![./vaultFactory/vaultFactory.png](./vaultFactory/vaultFactory.png)](./vaultFactory/vaultFactory.png)

Binary file modified docs/threat_models/pegasus/pegasus_component.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/threat_models/pegasus/pegasus_sequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/threat_models/treasury/treasury.png
Binary file not shown.
Binary file added docs/threat_models/vaultFactory/vaultFactory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@startuml
header Agoric Systems Operating Company.
footer v0.0.1
title Treasury
title VaultFactory

skinparam componentStyle rectangle
skinparam defaultTextAlignment center


actor "TreasuryCreator aka Governance" as tc
actor "VaultFactoryCreator aka Governance" as vfc

actor Borrower

Expand All @@ -19,7 +19,7 @@ node LiquidationSeat {
circle getPayouts
}
node "Vat" {
node Treasury {
node VaultFactory {
node AMM
node "publicAPI" {
circle getCollaterals
Expand Down Expand Up @@ -52,7 +52,7 @@ Borrower -u-> getPayouts: retrieve any proceeds
Borrower -d-> LiquidationPromise: did loan get liquidated?
Borrower -> AdjustBalancesInvitation: add or remove collateral or \nincrease or decrease the loan balance
Borrower -l-> CloseVaultInvitation: close loan and withdraw \nany remaining collateral
tc -d-> makeAddTypeInvitation
vfc -d-> makeAddTypeInvitation
Borrower -d-> getDebtAmount: how much do I owe
Borrower -d-> getCollateralAmount: how much did I \ndeposit as collateral

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function checkGetOutput(t, args, result) {

const testGetInputPrice = (t, inputs, runIn) => {
const args = runIn ? prepareRUNInTest(inputs) : prepareRUNOutTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
const result = pricesForStatedInput(...args);
checkGetInput(t, args, result);
};
Expand All @@ -128,7 +128,7 @@ const testGetInputPriceThrows = (t, inputs, message, runIn) => {
t.throws(
_ => {
const args = runIn ? prepareRUNInTest(inputs) : prepareRUNOutTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
return pricesForStatedInput(...args);
},
{
Expand All @@ -139,15 +139,15 @@ const testGetInputPriceThrows = (t, inputs, message, runIn) => {

const testGetInputPriceNoTrade = (t, inputs, runIn) => {
const args = runIn ? prepareRUNInTest(inputs) : prepareRUNOutTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
const result = pricesForStatedInput(...args);
t.truthy(AmountMath.isEmpty(result.swapperGets));
t.truthy(AmountMath.isEmpty(result.swapperGives));
};

const testGetOutputPrice = (t, inputs, runIn) => {
const args = runIn ? prepareRUNInTest(inputs) : prepareRUNOutTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
const result = pricesForStatedOutput(...args);
checkGetOutput(t, args, result);
};
Expand All @@ -156,7 +156,7 @@ const getOutputPriceThrows = (t, inputs, message, runIn) => {
t.throws(
_ => {
const args = runIn ? prepareRUNInTest(inputs) : prepareRUNOutTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
return pricesForStatedOutput(...args);
},
{
Expand All @@ -167,7 +167,7 @@ const getOutputPriceThrows = (t, inputs, message, runIn) => {

const testGetOutputPriceNoTrade = (t, inputs, runIn) => {
const args = runIn ? prepareRUNInTest(inputs) : prepareRUNOutTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
const result = pricesForStatedOutput(...args);
t.truthy(AmountMath.isEmpty(result.swapperGets));
t.truthy(AmountMath.isEmpty(result.swapperGives));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const prepareSwapInTest = ({ inputReserve, outputReserve, inputValue }) => {

const testInputGetPrice = (t, inputs, expectedOutput) => {
const { args, bld } = prepareSwapInTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
const result = pricesForStatedInput(...args);
t.deepEqual(result.swapperGets, bld(expectedOutput));
};
Expand All @@ -48,7 +48,7 @@ const getInputPriceThrows = (t, inputs, message) => {
t.throws(
_ => {
const { args } = prepareSwapInTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
return pricesForStatedInput(...args);
},
{
Expand Down Expand Up @@ -87,14 +87,14 @@ const prepareSwapOutTest = ({ inputReserve, outputReserve, outputValue }) => {

const testGetOutputPrice = (t, inputs, expectedInput) => {
const { args, run } = prepareSwapOutTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
const result = pricesForStatedOutput(...args);
t.deepEqual(result.swapperGives, run(expectedInput));
};

const getOutputPriceThrows = (t, inputs, message) => {
const { args } = prepareSwapOutTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
t.throws(_ => pricesForStatedOutput(...args), {
message,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test('pricesForStatedInput README example', async t => {
const protocolFeeRatio = makeRatio(5n, moolaKit.brand, BASIS_POINTS);
const poolFeeRatio = makeRatio(25n, bucksKit.brand, BASIS_POINTS);

// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
const noFeesResult = swapInNoFees({ amountGiven, poolAllocation });
t.deepEqual(noFeesResult.amountIn, moola(29996n));
t.deepEqual(noFeesResult.amountOut, bucks(2248n));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const prepareSwapInTest = ({

const testGetPrice = (t, inputs, expectedOutput) => {
const { args, run, bld } = prepareSwapInTest(inputs);
// @ts-ignore
// @ts-ignore typescript doesn't like param list built by destructuring
const result = pricesForStatedInput(...args);
const expected = harden({
protocolFee: run(expectedOutput.protocolFee),
Expand Down

0 comments on commit 61dd1c8

Please sign in to comment.