@indigo-labs/indigo-sdk 0.2.20 → 0.2.22
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
CHANGED
|
@@ -1489,7 +1489,6 @@ function serialiseTreasuryRedeemer(redeemer) {
|
|
|
1489
1489
|
|
|
1490
1490
|
// src/contracts/treasury/transactions.ts
|
|
1491
1491
|
async function treasuryFeeTx(fee, lucid, sysParams, tx, treasuryOref) {
|
|
1492
|
-
console.debug("treasuryFeeTx", fee);
|
|
1493
1492
|
const treasuryUtxo = matchSingle(
|
|
1494
1493
|
await lucid.utxosByOutRef([treasuryOref]),
|
|
1495
1494
|
(_) => new Error("Expected a single treasury UTXO")
|
|
@@ -2018,19 +2017,10 @@ async function redeemCdp(attemptedRedemptionIAssetAmt, cdpOref, iassetOref, pric
|
|
|
2018
2017
|
interest.lastSettled,
|
|
2019
2018
|
interestOracleDatum
|
|
2020
2019
|
);
|
|
2021
|
-
|
|
2020
|
+
return ocdMul(
|
|
2022
2021
|
{ getOnChainInt: interestPaymentIAssetAmt },
|
|
2023
2022
|
priceOracleDatum.price
|
|
2024
2023
|
).getOnChainInt;
|
|
2025
|
-
console.log("currentTime", currentTime);
|
|
2026
|
-
console.log("interest.unitaryInterestSnapshot", interest.unitaryInterestSnapshot);
|
|
2027
|
-
console.log("cdpDatum.mintedAmt", cdpDatum.mintedAmt);
|
|
2028
|
-
console.log("interest.lastSettled", interest.lastSettled);
|
|
2029
|
-
console.log("interestOracleDatum", interestOracleDatum);
|
|
2030
|
-
console.log("interestPaymentIAssetAmt", interestPaymentIAssetAmt);
|
|
2031
|
-
console.log("priceOracleDatum.price", priceOracleDatum.price);
|
|
2032
|
-
console.log("adaAmt", adaAmt);
|
|
2033
|
-
return adaAmt;
|
|
2034
2024
|
}).exhaustive();
|
|
2035
2025
|
const interestCollectorAdaAmt = calculateFeeFromPercentage(
|
|
2036
2026
|
iassetDatum.interestCollectorPortionPercentage,
|
|
@@ -2111,22 +2101,20 @@ async function redeemCdp(attemptedRedemptionIAssetAmt, cdpOref, iassetOref, pric
|
|
|
2111
2101
|
mkLovelacesOf(-interestAdaAmt)
|
|
2112
2102
|
)
|
|
2113
2103
|
);
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
);
|
|
2129
|
-
}
|
|
2104
|
+
await collectorFeeTx(
|
|
2105
|
+
processingFee + partialRedemptionFee + interestCollectorAdaAmt,
|
|
2106
|
+
lucid,
|
|
2107
|
+
sysParams,
|
|
2108
|
+
tx,
|
|
2109
|
+
collectorOref
|
|
2110
|
+
);
|
|
2111
|
+
await treasuryFeeTx(
|
|
2112
|
+
interestTreasuryAdaAmt,
|
|
2113
|
+
lucid,
|
|
2114
|
+
sysParams,
|
|
2115
|
+
tx,
|
|
2116
|
+
treasuryOref
|
|
2117
|
+
);
|
|
2130
2118
|
return tx;
|
|
2131
2119
|
}
|
|
2132
2120
|
async function freezeCdp(cdpOref, iassetOref, priceOracleOref, interestOracleOref, sysParams, lucid, currentSlot) {
|
|
@@ -3575,7 +3563,7 @@ async function vote(voteOption, pollShardOref, stakingPositionOref, sysParams, l
|
|
|
3575
3563
|
stakingPosUtxo.assets,
|
|
3576
3564
|
fromSystemParamsAsset(sysParams.govParams.indyAsset)
|
|
3577
3565
|
);
|
|
3578
|
-
const validityFrom = Number(currentTime) - ONE_SECOND;
|
|
3566
|
+
const validityFrom = Number(currentTime) - Math.min(120 * ONE_SECOND, Number(sysParams.govParams.gBiasTime));
|
|
3579
3567
|
if (stakingPosDatum.lockedAmount.has(pollShardDatum.pollId)) {
|
|
3580
3568
|
throw new Error("Already voted for that proposal.");
|
|
3581
3569
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1260,7 +1260,6 @@ function serialiseTreasuryRedeemer(redeemer) {
|
|
|
1260
1260
|
|
|
1261
1261
|
// src/contracts/treasury/transactions.ts
|
|
1262
1262
|
async function treasuryFeeTx(fee, lucid, sysParams, tx, treasuryOref) {
|
|
1263
|
-
console.debug("treasuryFeeTx", fee);
|
|
1264
1263
|
const treasuryUtxo = matchSingle(
|
|
1265
1264
|
await lucid.utxosByOutRef([treasuryOref]),
|
|
1266
1265
|
(_) => new Error("Expected a single treasury UTXO")
|
|
@@ -1789,19 +1788,10 @@ async function redeemCdp(attemptedRedemptionIAssetAmt, cdpOref, iassetOref, pric
|
|
|
1789
1788
|
interest.lastSettled,
|
|
1790
1789
|
interestOracleDatum
|
|
1791
1790
|
);
|
|
1792
|
-
|
|
1791
|
+
return ocdMul(
|
|
1793
1792
|
{ getOnChainInt: interestPaymentIAssetAmt },
|
|
1794
1793
|
priceOracleDatum.price
|
|
1795
1794
|
).getOnChainInt;
|
|
1796
|
-
console.log("currentTime", currentTime);
|
|
1797
|
-
console.log("interest.unitaryInterestSnapshot", interest.unitaryInterestSnapshot);
|
|
1798
|
-
console.log("cdpDatum.mintedAmt", cdpDatum.mintedAmt);
|
|
1799
|
-
console.log("interest.lastSettled", interest.lastSettled);
|
|
1800
|
-
console.log("interestOracleDatum", interestOracleDatum);
|
|
1801
|
-
console.log("interestPaymentIAssetAmt", interestPaymentIAssetAmt);
|
|
1802
|
-
console.log("priceOracleDatum.price", priceOracleDatum.price);
|
|
1803
|
-
console.log("adaAmt", adaAmt);
|
|
1804
|
-
return adaAmt;
|
|
1805
1795
|
}).exhaustive();
|
|
1806
1796
|
const interestCollectorAdaAmt = calculateFeeFromPercentage(
|
|
1807
1797
|
iassetDatum.interestCollectorPortionPercentage,
|
|
@@ -1882,22 +1872,20 @@ async function redeemCdp(attemptedRedemptionIAssetAmt, cdpOref, iassetOref, pric
|
|
|
1882
1872
|
mkLovelacesOf(-interestAdaAmt)
|
|
1883
1873
|
)
|
|
1884
1874
|
);
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
);
|
|
1900
|
-
}
|
|
1875
|
+
await collectorFeeTx(
|
|
1876
|
+
processingFee + partialRedemptionFee + interestCollectorAdaAmt,
|
|
1877
|
+
lucid,
|
|
1878
|
+
sysParams,
|
|
1879
|
+
tx,
|
|
1880
|
+
collectorOref
|
|
1881
|
+
);
|
|
1882
|
+
await treasuryFeeTx(
|
|
1883
|
+
interestTreasuryAdaAmt,
|
|
1884
|
+
lucid,
|
|
1885
|
+
sysParams,
|
|
1886
|
+
tx,
|
|
1887
|
+
treasuryOref
|
|
1888
|
+
);
|
|
1901
1889
|
return tx;
|
|
1902
1890
|
}
|
|
1903
1891
|
async function freezeCdp(cdpOref, iassetOref, priceOracleOref, interestOracleOref, sysParams, lucid, currentSlot) {
|
|
@@ -3369,7 +3357,7 @@ async function vote(voteOption, pollShardOref, stakingPositionOref, sysParams, l
|
|
|
3369
3357
|
stakingPosUtxo.assets,
|
|
3370
3358
|
fromSystemParamsAsset(sysParams.govParams.indyAsset)
|
|
3371
3359
|
);
|
|
3372
|
-
const validityFrom = Number(currentTime) - ONE_SECOND;
|
|
3360
|
+
const validityFrom = Number(currentTime) - Math.min(120 * ONE_SECOND, Number(sysParams.govParams.gBiasTime));
|
|
3373
3361
|
if (stakingPosDatum.lockedAmount.has(pollShardDatum.pollId)) {
|
|
3374
3362
|
throw new Error("Already voted for that proposal.");
|
|
3375
3363
|
}
|
package/package.json
CHANGED
|
@@ -782,20 +782,10 @@ export async function redeemCdp(
|
|
|
782
782
|
interestOracleDatum,
|
|
783
783
|
);
|
|
784
784
|
|
|
785
|
-
|
|
785
|
+
return ocdMul(
|
|
786
786
|
{ getOnChainInt: interestPaymentIAssetAmt },
|
|
787
787
|
priceOracleDatum.price,
|
|
788
788
|
).getOnChainInt;
|
|
789
|
-
|
|
790
|
-
console.log('currentTime', currentTime);
|
|
791
|
-
console.log('interest.unitaryInterestSnapshot', interest.unitaryInterestSnapshot);
|
|
792
|
-
console.log('cdpDatum.mintedAmt', cdpDatum.mintedAmt);
|
|
793
|
-
console.log('interest.lastSettled', interest.lastSettled);
|
|
794
|
-
console.log('interestOracleDatum', interestOracleDatum);
|
|
795
|
-
console.log('interestPaymentIAssetAmt', interestPaymentIAssetAmt);
|
|
796
|
-
console.log('priceOracleDatum.price', priceOracleDatum.price);
|
|
797
|
-
console.log('adaAmt', adaAmt);
|
|
798
|
-
return adaAmt;
|
|
799
789
|
})
|
|
800
790
|
.exhaustive();
|
|
801
791
|
|
|
@@ -905,23 +895,22 @@ export async function redeemCdp(
|
|
|
905
895
|
),
|
|
906
896
|
);
|
|
907
897
|
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
898
|
+
await collectorFeeTx(
|
|
899
|
+
processingFee + partialRedemptionFee + interestCollectorAdaAmt,
|
|
900
|
+
lucid,
|
|
901
|
+
sysParams,
|
|
902
|
+
tx,
|
|
903
|
+
collectorOref,
|
|
904
|
+
);
|
|
905
|
+
|
|
906
|
+
await treasuryFeeTx(
|
|
907
|
+
interestTreasuryAdaAmt,
|
|
908
|
+
lucid,
|
|
909
|
+
sysParams,
|
|
910
|
+
tx,
|
|
911
|
+
treasuryOref,
|
|
912
|
+
);
|
|
912
913
|
|
|
913
|
-
console.debug('interestAdaAmt', interestAdaAmt);
|
|
914
|
-
console.debug('interestCollectorAdaAmt', interestCollectorAdaAmt);
|
|
915
|
-
console.debug('interestTreasuryAdaAmt', interestTreasuryAdaAmt);
|
|
916
|
-
if (interestTreasuryAdaAmt > 0) {
|
|
917
|
-
await treasuryFeeTx(
|
|
918
|
-
interestTreasuryAdaAmt,
|
|
919
|
-
lucid,
|
|
920
|
-
sysParams,
|
|
921
|
-
tx,
|
|
922
|
-
treasuryOref,
|
|
923
|
-
);
|
|
924
|
-
}
|
|
925
914
|
return tx;
|
|
926
915
|
}
|
|
927
916
|
|
|
@@ -446,7 +446,7 @@ export async function vote(
|
|
|
446
446
|
fromSystemParamsAsset(sysParams.govParams.indyAsset),
|
|
447
447
|
);
|
|
448
448
|
|
|
449
|
-
const validityFrom = Number(currentTime) - ONE_SECOND;
|
|
449
|
+
const validityFrom = Number(currentTime) - Math.min(120 * ONE_SECOND, Number(sysParams.govParams.gBiasTime));
|
|
450
450
|
|
|
451
451
|
if (stakingPosDatum.lockedAmount.has(pollShardDatum.pollId)) {
|
|
452
452
|
throw new Error('Already voted for that proposal.');
|
|
@@ -20,7 +20,6 @@ export async function treasuryFeeTx(
|
|
|
20
20
|
tx: TxBuilder,
|
|
21
21
|
treasuryOref: OutRef,
|
|
22
22
|
): Promise<void> {
|
|
23
|
-
console.debug('treasuryFeeTx', fee);
|
|
24
23
|
const treasuryUtxo = matchSingle(
|
|
25
24
|
await lucid.utxosByOutRef([treasuryOref]),
|
|
26
25
|
(_) => new Error('Expected a single treasury UTXO'),
|