@ensuro/core 2.2.0 → 2.2.1

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.
Files changed (2) hide show
  1. package/js/deploy.js +21 -60
  2. package/package.json +1 -1
package/js/deploy.js CHANGED
@@ -342,26 +342,26 @@ async function deployRiskModule(
342
342
  );
343
343
  const rm = runAs === undefined ? contract : contract.connect(runAs);
344
344
 
345
- if (moc != 1.0) {
346
- moc = _W(moc);
347
- await rm.setParam(0, moc);
348
- }
349
- if (jrCollRatio != 0.0) {
350
- jrCollRatio = _W(jrCollRatio);
351
- await rm.setParam(1, jrCollRatio);
352
- }
353
- if (jrRoc != 0.0) {
354
- jrRoc = _W(jrRoc);
355
- await rm.setParam(5, jrRoc);
356
- }
357
- if (ensuroCocFee != 0) {
358
- ensuroCocFee = _W(ensuroCocFee);
359
- await rm.setParam(4, ensuroCocFee);
360
- }
361
- if (maxDuration != 24 * 365) {
362
- await rm.setParam(9, maxDuration);
363
- }
364
345
  if (opts.addComponent) {
346
+ if (moc != 1.0) {
347
+ moc = _W(moc);
348
+ await rm.setParam(0, moc);
349
+ }
350
+ if (jrCollRatio != 0.0) {
351
+ jrCollRatio = _W(jrCollRatio);
352
+ await rm.setParam(1, jrCollRatio);
353
+ }
354
+ if (jrRoc != 0.0) {
355
+ jrRoc = _W(jrRoc);
356
+ await rm.setParam(5, jrRoc);
357
+ }
358
+ if (ensuroCocFee != 0) {
359
+ ensuroCocFee = _W(ensuroCocFee);
360
+ await rm.setParam(4, ensuroCocFee);
361
+ }
362
+ if (maxDuration != 24 * 365) {
363
+ await rm.setParam(9, maxDuration);
364
+ }
365
365
  let policyPool = await hre.ethers.getContractAt("PolicyPool", poolAddress);
366
366
  if (runAs) policyPool = policyPool.connect(runAs);
367
367
  await policyPool.addComponent(contract.address, 2);
@@ -369,21 +369,6 @@ async function deployRiskModule(
369
369
  return contract.address;
370
370
  }
371
371
 
372
- async function deployFlightDelayRM(opts, hre) {
373
- opts.extraArgs = [opts.linkToken, [opts.oracle, opts.delayTime, _W(opts.oracleFee), opts.dataJobId, opts.sleepJobId]];
374
- return deployRiskModule(opts, hre);
375
- }
376
-
377
- async function deployPriceRM(opts, hre) {
378
- opts.extraConstructorArgs = [opts.assetOracle, opts.referenceOracle, _W(opts.slotSize)];
379
- opts.extraArgs = [opts.oracleTolerance];
380
- const rm = await deployRiskModule(opts, hre);
381
- if (opts.minDuration != 3600) {
382
- // TODO: we will need ORACLE_ADMIN_ROLE
383
- await rm.setMinDuration(opts.minDuration);
384
- }
385
- }
386
-
387
372
  async function deploySignedQuoteRM(opts, hre) {
388
373
  opts.extraConstructorArgs = [opts.creationIsOpen];
389
374
  return deployRiskModule(opts, hre);
@@ -679,32 +664,6 @@ function add_task() {
679
664
  .addParam("wallet", "RM address", types.address)
680
665
  .setAction(deploySignedQuoteRM);
681
666
 
682
- task("deploy:priceRiskModule", "Deploys and injects a Price RiskModule")
683
- .addOptionalParam("verify", "Verify contract in Etherscan", false, types.boolean)
684
- .addOptionalParam("saveAddr", "Save created contract address", "RM", types.str)
685
- .addOptionalParam("addComponent", "Adds the new component to the pool", true, types.boolean)
686
- .addParam("poolAddress", "PolicyPool Address", types.address)
687
- .addParam("paAddress", "PremiumsAccount Address", types.address)
688
- .addOptionalParam("rmClass", "RiskModule contract", "PriceRiskModule", types.str)
689
- .addOptionalParam("rmName", "Name of the RM", "Price Risk Module", types.str)
690
- .addOptionalParam("collRatio", "Collateralization ratio", 1.0, types.float)
691
- .addOptionalParam("jrCollRatio", "Junior Collateralization ratio", 0.0, types.float)
692
- .addOptionalParam("ensuroPpFee", "Ensuro Pure Premium Fee", 0.02, types.float)
693
- .addOptionalParam("ensuroCocFee", "Ensuro Coc Fee", 0.1, types.float)
694
- .addOptionalParam("roc", "Interest rate paid to Senior LPs for solvency capital", 0.05, types.float)
695
- .addOptionalParam("jrRoc", "Interest rate paid to Junior LPs for solvency capital", 0.0, types.float)
696
- .addOptionalParam("maxPayoutPerPolicy", "Max Payout Per policy", 10000, types.float)
697
- .addOptionalParam("exposureLimit", "Exposure (sum of payouts) limit for the RM", 1e6, types.float)
698
- .addOptionalParam("maxDuration", "Maximum policy duration in hours", 24 * 365, types.int)
699
- .addOptionalParam("moc", "Margin of Conservativism", 1.0, types.float)
700
- .addParam("wallet", "RM address", types.address)
701
- .addParam("assetOracle", "Insured asset oracle address", types.address)
702
- .addOptionalParam("referenceOracle", "Reference currency address", ethers.constants.AddressZero, types.address)
703
- .addOptionalParam("slotSize", "Slot size", 0.01, types.float)
704
- .addOptionalParam("oracleTolerance", "Oracle age tolerance", 1800, types.int)
705
- .addOptionalParam("minDuration", "Minimum time that must elapse before a policy can be triggered", 3600, types.int)
706
- .setAction(deployPriceRM);
707
-
708
667
  task("ens:setAssetManager", "Sets an asset manager to a reserve")
709
668
  .addParam("reserve", "Reserve Address", types.address)
710
669
  .addParam("amAddress", "Address of Asset Manager (reuse one already deployed)", types.address)
@@ -813,5 +772,7 @@ module.exports = {
813
772
  deployWhitelist,
814
773
  WhitelistStatus,
815
774
  txOverrides,
775
+ amountFunction,
776
+ _W,
816
777
  _A,
817
778
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ensuro/core",
3
3
  "description": "Ensuro - Decentralized insurance protocol",
4
- "version": "2.2.0",
4
+ "version": "2.2.1",
5
5
  "files": [
6
6
  "**/*.sol",
7
7
  "/build/contracts/*.json",