Skip to content

Commit

Permalink
feat: vault manager config with stability fee in basis points
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed May 10, 2023
1 parent 73249cb commit 281d9ac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/inter-protocol/scripts/add-collateral-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const defaultProposalBuilder = async (
{ publishRef, install: install0, wrapInstall },
{
debtLimitValue = undefined,
interestRateValue = undefined,
interestRateBP = undefined,
interchainAssetOptions = /** @type {object} */ ({}),
} = {},
{ env = process.env } = {},
Expand Down Expand Up @@ -37,7 +37,7 @@ export const defaultProposalBuilder = async (
getManifestForAddAssetToVault.name,
{
debtLimitValue: debtLimitValue && BigInt(debtLimitValue),
interestRateValue: interestRateValue && BigInt(interestRateValue),
interestRateBP: interestRateBP && BigInt(interestRateBP),
interchainAssetOptions: {
denom,
issuerBoardId,
Expand Down
16 changes: 8 additions & 8 deletions packages/inter-protocol/src/proposals/addAssetToVault.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export const registerScaledPriceAuthority = async (
* @param {object} config.options
* @param {InterchainAssetOptions} config.options.interchainAssetOptions
* @param {bigint | number | string} config.options.debtLimitValue
* @param {bigint} config.options.interestRateValue
* @param {bigint} config.options.interestRateBP
*/
export const addAssetToVault = async (
{
Expand All @@ -226,7 +226,7 @@ export const addAssetToVault = async (
debtLimitValue = 1_000n * 1_000_000n,
// Default to a safe value. Production will likely set this through governance.
// Allow setting through bootstrap to simplify testing.
interestRateValue = 1n,
interestRateBP = 250n,
interchainAssetOptions,
},
},
Expand All @@ -243,15 +243,15 @@ export const addAssetToVault = async (
const vaultFactoryCreator = E.get(vaultFactoryKit).creatorFacet;
await E(vaultFactoryCreator).addVaultType(interchainIssuer, oracleBrand, {
debtLimit: AmountMath.make(stable, BigInt(debtLimitValue)),
interestRate: makeRatio(interestRateValue, stable),
interestRate: makeRatio(BigInt(interestRateBP), stable, 100_00n),
// The rest of these we use safe defaults.
// In production they will be governed by the Econ Committee.
// Product deployments are also expected to have a low debtLimitValue at the outset,
// limiting the impact of these defaults.
liquidationPadding: makeRatio(25n, stable),
liquidationMargin: makeRatio(150n, stable),
liquidationPadding: makeRatio(20n, stable),
liquidationMargin: makeRatio(230n, stable),
mintFee: makeRatio(50n, stable, 10_000n),
liquidationPenalty: makeRatio(1n, stable),
liquidationPenalty: makeRatio(10n, stable),
});
const auctioneerCreator = E.get(auctioneerKit).creatorFacet;
await E(auctioneerCreator).addBrand(interchainIssuer, keyword);
Expand All @@ -261,7 +261,7 @@ export const getManifestForAddAssetToVault = (
{ restoreRef },
{
debtLimitValue,
interestRateValue,
interestRateBP,
interchainAssetOptions,
scaledPriceAuthorityRef,
},
Expand Down Expand Up @@ -329,7 +329,7 @@ export const getManifestForAddAssetToVault = (
options: {
debtLimitValue,
interchainAssetOptions,
interestRateValue,
interestRateBP,
},
};
};
4 changes: 2 additions & 2 deletions packages/vats/test/bootstrapTests/supports.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,15 @@ export const getNodeTestVaultsConfig = async (
config.coreProposals = config.coreProposals?.filter(
v => v !== '@agoric/pegasus/scripts/init-core.js',
);
// set to high interestRateValue to accelerate liquidation
// set to high interestRateBP to accelerate liquidation
for (const addVaultTypeProposal of (config.coreProposals || []).filter(
p =>
typeof p === 'object' &&
p.module === '@agoric/inter-protocol/scripts/add-collateral-core.js' &&
p.entrypoint === 'defaultProposalBuilder',
)) {
const opt = /** @type {any} */ (addVaultTypeProposal).args[0];
opt.interestRateValue = 10 * 100; // 10x APR
opt.interestRateBP = 10 * 100 * 100; // 10x APR
}

const testConfigPath = `${bundleDir}/decentral-test-vaults-config.json`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ test('open vault with insufficient funds gives helpful error', async t => {
const giveCollateral = 9.0;
const wantMinted = giveCollateral * 100;
const message =
'Proposed debt {"brand":"[Alleged: IST brand]","value":"[904500000n]"} exceeds max {"brand":"[Alleged: IST brand]","value":"[63462857n]"} for {"brand":"[Alleged: ATOM brand]","value":"[9000000n]"} collateral';
'Proposed debt {"brand":"[Alleged: IST brand]","value":"[904500000n]"} exceeds max {"brand":"[Alleged: IST brand]","value":"[44424000n]"} for {"brand":"[Alleged: ATOM brand]","value":"[9000000n]"} collateral';
await t.throwsAsync(
wd.executeOfferMaker(Offers.vaults.OpenVault, {
offerId: 'open-vault',
Expand Down

0 comments on commit 281d9ac

Please sign in to comment.