-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish Reserve econ data: mint & burn #5753
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ const nonalphanumeric = /[^A-Za-z0-9]/g; | |
* | ||
* @property {AmountKeywordRecord} allocations | ||
* @property {Amount<'nat'>} shortfallBalance shortfall from liquiditation that | ||
* @property {Amount<'nat'>} mintedRUN total RUN minted to date | ||
* @property {Amount<'nat'>} burnedRUN total RUN burned to date | ||
* has not yet been compensated. | ||
*/ | ||
|
||
|
@@ -222,6 +224,9 @@ const start = async (zcf, privateArgs) => { | |
|
||
const { brand: runBrand } = await E(runMint).getIssuerRecord(); | ||
|
||
let mintedRUN = AmountMath.makeEmpty(runBrand); | ||
let burnedRUN = AmountMath.makeEmpty(runBrand); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just noting the variable names should continue to match the metric names There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
|
||
// shortfall in Vaults due to liquidations less than debt. This value can be | ||
// reduced by various actions which burn RUN. | ||
let shortfallBalance = AmountMath.makeEmpty(runBrand); | ||
|
@@ -236,6 +241,8 @@ const start = async (zcf, privateArgs) => { | |
const metrics = harden({ | ||
allocations: getAllocations(), | ||
shortfallBalance, | ||
mintedRUN, | ||
burnedRUN, | ||
}); | ||
metricsPublication.updateState(metrics); | ||
}; | ||
|
@@ -270,6 +277,8 @@ const start = async (zcf, privateArgs) => { | |
|
||
// create the RUN | ||
const offerToSeat = runMint.mintGains(harden({ RUN: runAmount })); | ||
mintedRUN = AmountMath.add(mintedRUN, runAmount); | ||
|
||
offerToSeat.incrementBy( | ||
collateralSeat.decrementBy( | ||
harden({ | ||
|
@@ -316,6 +325,7 @@ const start = async (zcf, privateArgs) => { | |
}), | ||
); | ||
zcf.reallocate(offerToSeat, collateralSeat); | ||
updateMetrics(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this needed here but not after There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is already called in |
||
}; | ||
|
||
const burnRUNToReduceShortfall = reduction => { | ||
|
@@ -328,6 +338,8 @@ const start = async (zcf, privateArgs) => { | |
} | ||
|
||
runMint.burnLosses(harden({ [runKeyword]: amountToBurn }), collateralSeat); | ||
burnedRUN = AmountMath.add(burnedRUN, amountToBurn); | ||
|
||
reduceLiquidationShortfall(amountToBurn); | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,9 @@ export const vaultManagerMetricsTracker = async (t, publicFacet) => { | |
assertFullyLiquidated, | ||
}); | ||
}; | ||
export const reserveInitialState = emptyRun => ({ | ||
allocations: {}, | ||
shortfallBalance: emptyRun, | ||
burnedRUN: emptyRun, | ||
mintedRUN: emptyRun, | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is valid only for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hoisted it when the vault test needed it as well. I didn't want the vault test to have to be updated if we add more to the record. I didn't see a better place to put it, and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, my mistake that it's used only in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use
Fee
instead ofRUN
per #4800and per
agoric-sdk/packages/run-protocol/src/vaultFactory/vaultManager.js
Line 46 in fb4b156
minted
should be second."total" helps convey that this is "minted ever" not any other time window.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done