@indigo-labs/indigo-sdk 0.2.13 → 0.2.15
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/dist/index.js +14 -15
- package/dist/index.mjs +14 -15
- package/package.json +1 -1
- package/src/contracts/cdp/transactions.ts +13 -15
- package/src/contracts/price-oracle/helpers.ts +4 -1
package/dist/index.js
CHANGED
|
@@ -862,7 +862,7 @@ function computeInterestLovelacesFor100PercentCR(collateral, mintedAmt, price) {
|
|
|
862
862
|
// src/contracts/price-oracle/helpers.ts
|
|
863
863
|
var import_lucid10 = require("@lucid-evolution/lucid");
|
|
864
864
|
function oracleExpirationAwareValidity(currentSlot, biasTime, oracleExpiration, network) {
|
|
865
|
-
const validateFrom = (0, import_lucid10.slotToUnixTime)(network, currentSlot - 1);
|
|
865
|
+
const validateFrom = (0, import_lucid10.slotToUnixTime)(network, currentSlot - 1) - Math.min(120 * ONE_SECOND, biasTime);
|
|
866
866
|
const defaultValidateTo = validateFrom + biasTime;
|
|
867
867
|
const cappedValidateTo = (0, import_lucid10.slotToUnixTime)(
|
|
868
868
|
network,
|
|
@@ -2101,20 +2101,19 @@ async function redeemCdp(attemptedRedemptionIAssetAmt, cdpOref, iassetOref, pric
|
|
|
2101
2101
|
mkLovelacesOf(-interestAdaAmt)
|
|
2102
2102
|
)
|
|
2103
2103
|
);
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
lucid,
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
);
|
|
2104
|
+
const collectorFee = processingFee + partialRedemptionFee + interestCollectorAdaAmt;
|
|
2105
|
+
if (collectorFee > 0) {
|
|
2106
|
+
await collectorFeeTx(collectorFee, lucid, sysParams, tx, collectorOref);
|
|
2107
|
+
}
|
|
2108
|
+
if (interestTreasuryAdaAmt > 0) {
|
|
2109
|
+
await treasuryFeeTx(
|
|
2110
|
+
interestTreasuryAdaAmt,
|
|
2111
|
+
lucid,
|
|
2112
|
+
sysParams,
|
|
2113
|
+
tx,
|
|
2114
|
+
treasuryOref
|
|
2115
|
+
);
|
|
2116
|
+
}
|
|
2118
2117
|
return tx;
|
|
2119
2118
|
}
|
|
2120
2119
|
async function freezeCdp(cdpOref, iassetOref, priceOracleOref, interestOracleOref, sysParams, lucid, currentSlot) {
|
package/dist/index.mjs
CHANGED
|
@@ -628,7 +628,7 @@ import {
|
|
|
628
628
|
unixTimeToSlot
|
|
629
629
|
} from "@lucid-evolution/lucid";
|
|
630
630
|
function oracleExpirationAwareValidity(currentSlot, biasTime, oracleExpiration, network) {
|
|
631
|
-
const validateFrom = slotToUnixTime(network, currentSlot - 1);
|
|
631
|
+
const validateFrom = slotToUnixTime(network, currentSlot - 1) - Math.min(120 * ONE_SECOND, biasTime);
|
|
632
632
|
const defaultValidateTo = validateFrom + biasTime;
|
|
633
633
|
const cappedValidateTo = slotToUnixTime(
|
|
634
634
|
network,
|
|
@@ -1872,20 +1872,19 @@ async function redeemCdp(attemptedRedemptionIAssetAmt, cdpOref, iassetOref, pric
|
|
|
1872
1872
|
mkLovelacesOf(-interestAdaAmt)
|
|
1873
1873
|
)
|
|
1874
1874
|
);
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
lucid,
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
);
|
|
1875
|
+
const collectorFee = processingFee + partialRedemptionFee + interestCollectorAdaAmt;
|
|
1876
|
+
if (collectorFee > 0) {
|
|
1877
|
+
await collectorFeeTx(collectorFee, lucid, sysParams, tx, collectorOref);
|
|
1878
|
+
}
|
|
1879
|
+
if (interestTreasuryAdaAmt > 0) {
|
|
1880
|
+
await treasuryFeeTx(
|
|
1881
|
+
interestTreasuryAdaAmt,
|
|
1882
|
+
lucid,
|
|
1883
|
+
sysParams,
|
|
1884
|
+
tx,
|
|
1885
|
+
treasuryOref
|
|
1886
|
+
);
|
|
1887
|
+
}
|
|
1889
1888
|
return tx;
|
|
1890
1889
|
}
|
|
1891
1890
|
async function freezeCdp(cdpOref, iassetOref, priceOracleOref, interestOracleOref, sysParams, lucid, currentSlot) {
|
package/package.json
CHANGED
|
@@ -895,22 +895,20 @@ export async function redeemCdp(
|
|
|
895
895
|
),
|
|
896
896
|
);
|
|
897
897
|
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
tx,
|
|
903
|
-
collectorOref,
|
|
904
|
-
);
|
|
905
|
-
|
|
906
|
-
await treasuryFeeTx(
|
|
907
|
-
interestTreasuryAdaAmt,
|
|
908
|
-
lucid,
|
|
909
|
-
sysParams,
|
|
910
|
-
tx,
|
|
911
|
-
treasuryOref,
|
|
912
|
-
);
|
|
898
|
+
const collectorFee = processingFee + partialRedemptionFee + interestCollectorAdaAmt;
|
|
899
|
+
if (collectorFee > 0) {
|
|
900
|
+
await collectorFeeTx(collectorFee, lucid, sysParams, tx, collectorOref);
|
|
901
|
+
}
|
|
913
902
|
|
|
903
|
+
if (interestTreasuryAdaAmt > 0) {
|
|
904
|
+
await treasuryFeeTx(
|
|
905
|
+
interestTreasuryAdaAmt,
|
|
906
|
+
lucid,
|
|
907
|
+
sysParams,
|
|
908
|
+
tx,
|
|
909
|
+
treasuryOref,
|
|
910
|
+
);
|
|
911
|
+
}
|
|
914
912
|
return tx;
|
|
915
913
|
}
|
|
916
914
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
slotToUnixTime,
|
|
4
4
|
unixTimeToSlot,
|
|
5
5
|
} from '@lucid-evolution/lucid';
|
|
6
|
+
import { ONE_SECOND } from '../../utils/time-helpers';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Calculates the validity range based on the oracle expiration,
|
|
@@ -17,7 +18,9 @@ export function oracleExpirationAwareValidity(
|
|
|
17
18
|
validFrom: number;
|
|
18
19
|
validTo: number;
|
|
19
20
|
} {
|
|
20
|
-
const validateFrom =
|
|
21
|
+
const validateFrom =
|
|
22
|
+
slotToUnixTime(network, currentSlot - 1) -
|
|
23
|
+
Math.min(120 * ONE_SECOND, biasTime);
|
|
21
24
|
const defaultValidateTo = validateFrom + biasTime;
|
|
22
25
|
/// Take the oracle expiration time - 1 slot which is the last acceptable non-expired valid_to time
|
|
23
26
|
/// for the current oracle.
|