@agoric/fast-usdc 0.1.1-dev-fdc566c.0 → 0.1.1-dev-2288a0c.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/fast-usdc",
3
- "version": "0.1.1-dev-fdc566c.0+fdc566c",
3
+ "version": "0.1.1-dev-2288a0c.0+2288a0c",
4
4
  "description": "CLI and library for Fast USDC product",
5
5
  "type": "module",
6
6
  "files": [
@@ -22,9 +22,9 @@
22
22
  "lint:eslint": "eslint ."
23
23
  },
24
24
  "devDependencies": {
25
- "@agoric/swingset-liveslots": "0.10.3-dev-fdc566c.0+fdc566c",
26
- "@agoric/vats": "0.15.2-dev-fdc566c.0+fdc566c",
27
- "@agoric/zone": "0.2.3-dev-fdc566c.0+fdc566c",
25
+ "@agoric/swingset-liveslots": "0.10.3-dev-2288a0c.0+2288a0c",
26
+ "@agoric/vats": "0.15.2-dev-2288a0c.0+2288a0c",
27
+ "@agoric/zone": "0.2.3-dev-2288a0c.0+2288a0c",
28
28
  "@fast-check/ava": "^2.0.1",
29
29
  "ava": "^5.3.0",
30
30
  "c8": "^10.1.2",
@@ -32,16 +32,16 @@
32
32
  "ts-blank-space": "^0.4.4"
33
33
  },
34
34
  "dependencies": {
35
- "@agoric/client-utils": "0.1.1-dev-fdc566c.0+fdc566c",
36
- "@agoric/cosmic-proto": "0.4.1-dev-fdc566c.0+fdc566c",
37
- "@agoric/ertp": "0.16.3-dev-fdc566c.0+fdc566c",
38
- "@agoric/internal": "0.3.3-dev-fdc566c.0+fdc566c",
39
- "@agoric/notifier": "0.6.3-dev-fdc566c.0+fdc566c",
40
- "@agoric/orchestration": "0.1.1-dev-fdc566c.0+fdc566c",
41
- "@agoric/store": "0.9.3-dev-fdc566c.0+fdc566c",
42
- "@agoric/vat-data": "0.5.3-dev-fdc566c.0+fdc566c",
43
- "@agoric/vow": "0.1.1-dev-fdc566c.0+fdc566c",
44
- "@agoric/zoe": "0.26.3-dev-fdc566c.0+fdc566c",
35
+ "@agoric/client-utils": "0.1.1-dev-2288a0c.0+2288a0c",
36
+ "@agoric/cosmic-proto": "0.4.1-dev-2288a0c.0+2288a0c",
37
+ "@agoric/ertp": "0.16.3-dev-2288a0c.0+2288a0c",
38
+ "@agoric/internal": "0.3.3-dev-2288a0c.0+2288a0c",
39
+ "@agoric/notifier": "0.6.3-dev-2288a0c.0+2288a0c",
40
+ "@agoric/orchestration": "0.1.1-dev-2288a0c.0+2288a0c",
41
+ "@agoric/store": "0.9.3-dev-2288a0c.0+2288a0c",
42
+ "@agoric/vat-data": "0.5.3-dev-2288a0c.0+2288a0c",
43
+ "@agoric/vow": "0.1.1-dev-2288a0c.0+2288a0c",
44
+ "@agoric/zoe": "0.26.3-dev-2288a0c.0+2288a0c",
45
45
  "@cosmjs/proto-signing": "^0.32.4",
46
46
  "@cosmjs/stargate": "^0.32.4",
47
47
  "@endo/base64": "^1.0.9",
@@ -81,5 +81,5 @@
81
81
  "publishConfig": {
82
82
  "access": "public"
83
83
  },
84
- "gitHead": "fdc566ceba2386ac9cccd2e095741dcd316b575b"
84
+ "gitHead": "2288a0cbfa5956216597ea9d9202f8c8e1ac90c9"
85
85
  }
@@ -113,7 +113,6 @@ const NatAmountShape = { brand: BrandShape, value: M.nat() };
113
113
  export const FeeConfigShape = {
114
114
  flat: NatAmountShape,
115
115
  variableRate: RatioShape,
116
- maxVariable: NatAmountShape,
117
116
  contractRate: RatioShape,
118
117
  };
119
118
  harden(FeeConfigShape);
package/src/types.ts CHANGED
@@ -62,9 +62,11 @@ export interface PendingTx extends CctpTxEvidence {
62
62
  }
63
63
 
64
64
  export type FeeConfig = {
65
+ /** flat fee charged for every advance */
65
66
  flat: Amount<'nat'>;
67
+ /** proportion of advance kept as a fee */
66
68
  variableRate: Ratio;
67
- maxVariable: Amount<'nat'>;
69
+ /** proportion of fees that goes to the contract (remaining goes to LPs) */
68
70
  contractRate: Ratio;
69
71
  };
70
72
 
package/src/utils/fees.js CHANGED
@@ -4,7 +4,7 @@ import { Fail } from '@endo/errors';
4
4
  import { mustMatch } from '@endo/patterns';
5
5
  import { FeeConfigShape } from '../type-guards.js';
6
6
 
7
- const { add, isGTE, min, subtract } = AmountMath;
7
+ const { add, isGTE, subtract } = AmountMath;
8
8
 
9
9
  /**
10
10
  * @import {Amount} from '@agoric/ertp';
@@ -15,7 +15,7 @@ const { add, isGTE, min, subtract } = AmountMath;
15
15
  /** @param {FeeConfig} feeConfig */
16
16
  export const makeFeeTools = feeConfig => {
17
17
  mustMatch(feeConfig, FeeConfigShape, 'Must provide feeConfig');
18
- const { flat, variableRate, maxVariable } = feeConfig;
18
+ const { flat, variableRate } = feeConfig;
19
19
  const feeTools = harden({
20
20
  /**
21
21
  * Calculate the net amount to advance after withholding fees.
@@ -34,8 +34,7 @@ export const makeFeeTools = feeConfig => {
34
34
  * @throws {Error} if requested does not exceed fees
35
35
  */
36
36
  calculateAdvanceFee(requested) {
37
- const variable = min(multiplyBy(requested, variableRate), maxVariable);
38
- const fee = add(variable, flat);
37
+ const fee = add(multiplyBy(requested, variableRate), flat);
39
38
  !isGTE(fee, requested) || Fail`Request must exceed fees.`;
40
39
  return fee;
41
40
  },