@enzymefinance/testutils 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.ts +20 -15
- package/dist/index.js +10 -10
- package/dist/index.mjs +10 -10
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
@@ -538,11 +538,11 @@ declare function convexVotingPositionWithdraw({ comptrollerProxy, externalPositi
|
|
538
538
|
}): Promise<_enzymefinance_ethers.ContractReceipt<_enzymefinance_ethers.SendFunction<[_extension: AddressLike, _actionId: BigNumberish, _callArgs: ethers.BytesLike], void, ComptrollerLib>>>;
|
539
539
|
|
540
540
|
interface ILiquityTroveManager extends Contract<ILiquityTroveManager> {
|
541
|
-
getBorrowingFee: Call<(_LUSDDebt: BigNumberish) =>
|
541
|
+
getBorrowingFee: Call<(_LUSDDebt: BigNumberish) => BigNumber>;
|
542
542
|
}
|
543
543
|
declare const ILiquityTroveManager: _enzymefinance_ethers.ContractFactory<ILiquityTroveManager, never>;
|
544
544
|
interface ILiquityHintHelper extends Contract<ILiquityHintHelper> {
|
545
|
-
getApproxHint: Call<(_cr: BigNumberish, _numTrials: BigNumberish, _inputRandomSeed: BigNumberish) => [hintAddress_: AddressLike, diff_:
|
545
|
+
getApproxHint: Call<(_cr: BigNumberish, _numTrials: BigNumberish, _inputRandomSeed: BigNumberish) => [hintAddress_: AddressLike, diff_: BigNumber, latestRandomSeed_: BigNumber]>;
|
546
546
|
}
|
547
547
|
declare const ILiquityHintHelper: _enzymefinance_ethers.ContractFactory<ILiquityHintHelper, never>;
|
548
548
|
interface ILiquitySortedTroves extends Contract<ILiquitySortedTroves> {
|
@@ -557,31 +557,36 @@ declare function createLiquityDebtPosition({ signer, comptrollerProxy, externalP
|
|
557
557
|
externalPositionProxy: _enzymefinance_protocol.IExternalPositionProxy;
|
558
558
|
receipt: _enzymefinance_ethers.ContractReceipt<_enzymefinance_ethers.SendFunction<[_extension: AddressLike, _actionId: BigNumberish, _callArgs: utils.BytesLike], void, ComptrollerLib>>;
|
559
559
|
}>;
|
560
|
-
declare function liquityCalcHints({ collateralAmount,
|
560
|
+
declare function liquityCalcHints({ collateralAmount, debtAmount, // Total debt, inclusive of fees
|
561
|
+
numTrials, // See note above for recommended value. This helper uses a static value for testing purposes.
|
562
|
+
liquitySortedTroves, liquityHintHelper, inputRandomSeed, }: {
|
561
563
|
collateralAmount: BigNumber;
|
562
|
-
|
564
|
+
debtAmount: BigNumber;
|
563
565
|
numTrials?: BigNumber;
|
564
566
|
liquitySortedTroves: ILiquitySortedTroves;
|
565
567
|
liquityHintHelper: ILiquityHintHelper;
|
566
568
|
inputRandomSeed?: BigNumber;
|
567
|
-
}): Promise<
|
568
|
-
|
569
|
+
}): Promise<{
|
570
|
+
lowerHint: AddressLike;
|
571
|
+
upperHint: AddressLike;
|
572
|
+
}>;
|
573
|
+
declare function liquityDebtPositionAddCollateral({ comptrollerProxy, externalPositionManager, signer, collateralAmount, upperHint, lowerHint, externalPositionProxy, }: {
|
569
574
|
comptrollerProxy: ComptrollerLib;
|
570
575
|
externalPositionManager: ExternalPositionManager;
|
571
576
|
signer: SignerWithAddress;
|
572
577
|
collateralAmount: BigNumberish;
|
573
|
-
lowerHint: AddressLike;
|
574
578
|
upperHint: AddressLike;
|
579
|
+
lowerHint: AddressLike;
|
575
580
|
externalPositionProxy: AddressLike;
|
576
581
|
}): Promise<_enzymefinance_ethers.ContractReceipt<_enzymefinance_ethers.SendFunction<[_extension: AddressLike, _actionId: BigNumberish, _callArgs: utils.BytesLike], void, ComptrollerLib>>>;
|
577
|
-
declare function liquityDebtPositionBorrow({ comptrollerProxy, externalPositionManager, signer, maxFeePercentage, lusdAmount,
|
582
|
+
declare function liquityDebtPositionBorrow({ comptrollerProxy, externalPositionManager, signer, maxFeePercentage, lusdAmount, upperHint, lowerHint, externalPositionProxy, }: {
|
578
583
|
comptrollerProxy: ComptrollerLib;
|
579
584
|
externalPositionManager: ExternalPositionManager;
|
580
585
|
signer: SignerWithAddress;
|
581
586
|
maxFeePercentage: BigNumberish;
|
582
587
|
lusdAmount: BigNumberish;
|
583
|
-
lowerHint: AddressLike;
|
584
588
|
upperHint: AddressLike;
|
589
|
+
lowerHint: AddressLike;
|
585
590
|
externalPositionProxy: AddressLike;
|
586
591
|
}): Promise<_enzymefinance_ethers.ContractReceipt<_enzymefinance_ethers.SendFunction<[_extension: AddressLike, _actionId: BigNumberish, _callArgs: utils.BytesLike], void, ComptrollerLib>>>;
|
587
592
|
declare function liquityDebtPositionCloseTrove({ comptrollerProxy, externalPositionManager, signer, externalPositionProxy, }: {
|
@@ -590,33 +595,33 @@ declare function liquityDebtPositionCloseTrove({ comptrollerProxy, externalPosit
|
|
590
595
|
signer: SignerWithAddress;
|
591
596
|
externalPositionProxy: AddressLike;
|
592
597
|
}): Promise<_enzymefinance_ethers.ContractReceipt<_enzymefinance_ethers.SendFunction<[_extension: AddressLike, _actionId: BigNumberish, _callArgs: utils.BytesLike], void, ComptrollerLib>>>;
|
593
|
-
declare function liquityDebtPositionOpenTrove({ comptrollerProxy, externalPositionManager, signer, maxFeePercentage, collateralAmount, lusdAmount,
|
598
|
+
declare function liquityDebtPositionOpenTrove({ comptrollerProxy, externalPositionManager, signer, maxFeePercentage, collateralAmount, lusdAmount, upperHint, lowerHint, externalPositionProxy, }: {
|
594
599
|
comptrollerProxy: ComptrollerLib;
|
595
600
|
externalPositionManager: ExternalPositionManager;
|
596
601
|
signer: SignerWithAddress;
|
597
602
|
maxFeePercentage: BigNumberish;
|
598
603
|
collateralAmount: BigNumberish;
|
599
604
|
lusdAmount: BigNumberish;
|
600
|
-
lowerHint: AddressLike;
|
601
605
|
upperHint: AddressLike;
|
606
|
+
lowerHint: AddressLike;
|
602
607
|
externalPositionProxy: AddressLike;
|
603
608
|
}): Promise<_enzymefinance_ethers.ContractReceipt<_enzymefinance_ethers.SendFunction<[_extension: AddressLike, _actionId: BigNumberish, _callArgs: utils.BytesLike], void, ComptrollerLib>>>;
|
604
|
-
declare function liquityDebtPositionRemoveCollateral({ comptrollerProxy, externalPositionManager, signer, collateralAmount,
|
609
|
+
declare function liquityDebtPositionRemoveCollateral({ comptrollerProxy, externalPositionManager, signer, collateralAmount, upperHint, lowerHint, externalPositionProxy, }: {
|
605
610
|
comptrollerProxy: ComptrollerLib;
|
606
611
|
externalPositionManager: ExternalPositionManager;
|
607
612
|
signer: SignerWithAddress;
|
608
613
|
collateralAmount: BigNumberish;
|
609
|
-
lowerHint: AddressLike;
|
610
614
|
upperHint: AddressLike;
|
615
|
+
lowerHint: AddressLike;
|
611
616
|
externalPositionProxy: AddressLike;
|
612
617
|
}): Promise<_enzymefinance_ethers.ContractReceipt<_enzymefinance_ethers.SendFunction<[_extension: AddressLike, _actionId: BigNumberish, _callArgs: utils.BytesLike], void, ComptrollerLib>>>;
|
613
|
-
declare function liquityDebtPositionRepay({ comptrollerProxy, externalPositionManager, signer, lusdAmount,
|
618
|
+
declare function liquityDebtPositionRepay({ comptrollerProxy, externalPositionManager, signer, lusdAmount, upperHint, lowerHint, externalPositionProxy, }: {
|
614
619
|
comptrollerProxy: ComptrollerLib;
|
615
620
|
externalPositionManager: ExternalPositionManager;
|
616
621
|
signer: SignerWithAddress;
|
617
622
|
lusdAmount: BigNumberish;
|
618
|
-
lowerHint: AddressLike;
|
619
623
|
upperHint: AddressLike;
|
624
|
+
lowerHint: AddressLike;
|
620
625
|
externalPositionProxy: AddressLike;
|
621
626
|
}): Promise<_enzymefinance_ethers.ContractReceipt<_enzymefinance_ethers.SendFunction<[_extension: AddressLike, _actionId: BigNumberish, _callArgs: utils.BytesLike], void, ComptrollerLib>>>;
|
622
627
|
|
package/dist/index.js
CHANGED
@@ -938,24 +938,24 @@ async function createLiquityDebtPosition({
|
|
938
938
|
}
|
939
939
|
async function liquityCalcHints({
|
940
940
|
collateralAmount,
|
941
|
-
|
942
|
-
numTrials = _ethers3.BigNumber.from("
|
941
|
+
debtAmount,
|
942
|
+
numTrials = _ethers3.BigNumber.from("100"),
|
943
943
|
liquitySortedTroves,
|
944
944
|
liquityHintHelper,
|
945
945
|
inputRandomSeed = _ethers3.BigNumber.from("4")
|
946
946
|
}) {
|
947
|
-
const nicr = collateralAmount.mul(_ethers3.utils.parseEther("100")).div(
|
947
|
+
const nicr = collateralAmount.mul(_ethers3.utils.parseEther("100")).div(debtAmount);
|
948
948
|
const approxHint = await liquityHintHelper.getApproxHint.args(nicr, numTrials, inputRandomSeed).call();
|
949
|
-
const
|
950
|
-
return
|
949
|
+
const [upperHint, lowerHint] = await liquitySortedTroves.findInsertPosition.args(nicr, approxHint[0], approxHint[0]).call();
|
950
|
+
return { lowerHint, upperHint };
|
951
951
|
}
|
952
952
|
async function liquityDebtPositionAddCollateral({
|
953
953
|
comptrollerProxy,
|
954
954
|
externalPositionManager,
|
955
955
|
signer,
|
956
956
|
collateralAmount,
|
957
|
-
lowerHint,
|
958
957
|
upperHint,
|
958
|
+
lowerHint,
|
959
959
|
externalPositionProxy
|
960
960
|
}) {
|
961
961
|
const actionArgs = _protocol.liquityDebtPositionAddCollateralArgs.call(void 0, {
|
@@ -978,8 +978,8 @@ async function liquityDebtPositionBorrow({
|
|
978
978
|
signer,
|
979
979
|
maxFeePercentage,
|
980
980
|
lusdAmount,
|
981
|
-
lowerHint,
|
982
981
|
upperHint,
|
982
|
+
lowerHint,
|
983
983
|
externalPositionProxy
|
984
984
|
}) {
|
985
985
|
const actionArgs = _protocol.liquityDebtPositionBorrowArgs.call(void 0, {
|
@@ -1020,8 +1020,8 @@ async function liquityDebtPositionOpenTrove({
|
|
1020
1020
|
maxFeePercentage,
|
1021
1021
|
collateralAmount,
|
1022
1022
|
lusdAmount,
|
1023
|
-
lowerHint,
|
1024
1023
|
upperHint,
|
1024
|
+
lowerHint,
|
1025
1025
|
externalPositionProxy
|
1026
1026
|
}) {
|
1027
1027
|
const actionArgs = _protocol.liquityDebtPositionOpenTroveArgs.call(void 0, {
|
@@ -1045,8 +1045,8 @@ async function liquityDebtPositionRemoveCollateral({
|
|
1045
1045
|
externalPositionManager,
|
1046
1046
|
signer,
|
1047
1047
|
collateralAmount,
|
1048
|
-
lowerHint,
|
1049
1048
|
upperHint,
|
1049
|
+
lowerHint,
|
1050
1050
|
externalPositionProxy
|
1051
1051
|
}) {
|
1052
1052
|
const actionArgs = _protocol.liquityDebtPositionRemoveCollateralArgs.call(void 0, {
|
@@ -1068,8 +1068,8 @@ async function liquityDebtPositionRepay({
|
|
1068
1068
|
externalPositionManager,
|
1069
1069
|
signer,
|
1070
1070
|
lusdAmount,
|
1071
|
-
lowerHint,
|
1072
1071
|
upperHint,
|
1072
|
+
lowerHint,
|
1073
1073
|
externalPositionProxy
|
1074
1074
|
}) {
|
1075
1075
|
const actionArgs = _protocol.liquityDebtPositionRepayBorrowArgs.call(void 0, {
|
package/dist/index.mjs
CHANGED
@@ -938,24 +938,24 @@ async function createLiquityDebtPosition({
|
|
938
938
|
}
|
939
939
|
async function liquityCalcHints({
|
940
940
|
collateralAmount,
|
941
|
-
|
942
|
-
numTrials = BigNumber4.from("
|
941
|
+
debtAmount,
|
942
|
+
numTrials = BigNumber4.from("100"),
|
943
943
|
liquitySortedTroves,
|
944
944
|
liquityHintHelper,
|
945
945
|
inputRandomSeed = BigNumber4.from("4")
|
946
946
|
}) {
|
947
|
-
const nicr = collateralAmount.mul(utils4.parseEther("100")).div(
|
947
|
+
const nicr = collateralAmount.mul(utils4.parseEther("100")).div(debtAmount);
|
948
948
|
const approxHint = await liquityHintHelper.getApproxHint.args(nicr, numTrials, inputRandomSeed).call();
|
949
|
-
const
|
950
|
-
return
|
949
|
+
const [upperHint, lowerHint] = await liquitySortedTroves.findInsertPosition.args(nicr, approxHint[0], approxHint[0]).call();
|
950
|
+
return { lowerHint, upperHint };
|
951
951
|
}
|
952
952
|
async function liquityDebtPositionAddCollateral({
|
953
953
|
comptrollerProxy,
|
954
954
|
externalPositionManager,
|
955
955
|
signer,
|
956
956
|
collateralAmount,
|
957
|
-
lowerHint,
|
958
957
|
upperHint,
|
958
|
+
lowerHint,
|
959
959
|
externalPositionProxy
|
960
960
|
}) {
|
961
961
|
const actionArgs = liquityDebtPositionAddCollateralArgs({
|
@@ -978,8 +978,8 @@ async function liquityDebtPositionBorrow({
|
|
978
978
|
signer,
|
979
979
|
maxFeePercentage,
|
980
980
|
lusdAmount,
|
981
|
-
lowerHint,
|
982
981
|
upperHint,
|
982
|
+
lowerHint,
|
983
983
|
externalPositionProxy
|
984
984
|
}) {
|
985
985
|
const actionArgs = liquityDebtPositionBorrowArgs({
|
@@ -1020,8 +1020,8 @@ async function liquityDebtPositionOpenTrove({
|
|
1020
1020
|
maxFeePercentage,
|
1021
1021
|
collateralAmount,
|
1022
1022
|
lusdAmount,
|
1023
|
-
lowerHint,
|
1024
1023
|
upperHint,
|
1024
|
+
lowerHint,
|
1025
1025
|
externalPositionProxy
|
1026
1026
|
}) {
|
1027
1027
|
const actionArgs = liquityDebtPositionOpenTroveArgs({
|
@@ -1045,8 +1045,8 @@ async function liquityDebtPositionRemoveCollateral({
|
|
1045
1045
|
externalPositionManager,
|
1046
1046
|
signer,
|
1047
1047
|
collateralAmount,
|
1048
|
-
lowerHint,
|
1049
1048
|
upperHint,
|
1049
|
+
lowerHint,
|
1050
1050
|
externalPositionProxy
|
1051
1051
|
}) {
|
1052
1052
|
const actionArgs = liquityDebtPositionRemoveCollateralArgs({
|
@@ -1068,8 +1068,8 @@ async function liquityDebtPositionRepay({
|
|
1068
1068
|
externalPositionManager,
|
1069
1069
|
signer,
|
1070
1070
|
lusdAmount,
|
1071
|
-
lowerHint,
|
1072
1071
|
upperHint,
|
1072
|
+
lowerHint,
|
1073
1073
|
externalPositionProxy
|
1074
1074
|
}) {
|
1075
1075
|
const actionArgs = liquityDebtPositionRepayBorrowArgs({
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@enzymefinance/testutils",
|
3
|
-
"version": "4.0.
|
3
|
+
"version": "4.0.2",
|
4
4
|
"description": "Technology Regulated and Operated Investment Funds",
|
5
5
|
"author": "Enzyme Council DAO <council@enzyme.finance>",
|
6
6
|
"license": "GPL-3.0",
|
@@ -45,9 +45,9 @@
|
|
45
45
|
"typecheck": "tsc --noEmit"
|
46
46
|
},
|
47
47
|
"dependencies": {
|
48
|
-
"@enzymefinance/ethers": "^4.0.
|
49
|
-
"@enzymefinance/hardhat": "^4.0.
|
50
|
-
"@enzymefinance/protocol": "^4.0.
|
48
|
+
"@enzymefinance/ethers": "^4.0.2",
|
49
|
+
"@enzymefinance/hardhat": "^4.0.2",
|
50
|
+
"@enzymefinance/protocol": "^4.0.2",
|
51
51
|
"ethers": "^5.6.2",
|
52
52
|
"merkletreejs": "^0.2.31"
|
53
53
|
},
|