@gearbox-protocol/sdk 3.0.0-next.62 → 3.0.0-next.63
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.
|
@@ -188,16 +188,6 @@ class CreditManagerData {
|
|
|
188
188
|
callData: types_1.ICreditFacadeV2Extended__factory.createInterface().encodeFunctionData("revertIfReceivedLessThan", [assets]),
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
|
-
// encodeRevertIfReceivedLessThanV3(assets: Array<Asset>): MultiCall {
|
|
192
|
-
// return {
|
|
193
|
-
// target: this.creditFacade,
|
|
194
|
-
// callData:
|
|
195
|
-
// ICreditFacadeV3Multicall__factory.createInterface().encodeFunctionData(
|
|
196
|
-
// "revertIfReceivedLessThan",
|
|
197
|
-
// [assets.map(a => ({ token: a.token, amount: a.balance }))],
|
|
198
|
-
// ),
|
|
199
|
-
// };
|
|
200
|
-
// }
|
|
201
191
|
encodeUpdateQuotaV3(token, quotaChange, minQuota) {
|
|
202
192
|
return {
|
|
203
193
|
target: this.creditFacade,
|
|
@@ -56,6 +56,21 @@ class CreditFacadeParser extends abstractParser_1.AbstractParser {
|
|
|
56
56
|
const [tokenAddress, amount, deadline, v, r, s] = this.decodeFunctionData(functionFragment, calldata);
|
|
57
57
|
return `${functionName}(token: ${this.tokenSymbol(tokenAddress)}, amount: ${this.formatBN(amount, this.tokenSymbol(tokenAddress))}, ${[deadline, v, r, s].join(", ")})`;
|
|
58
58
|
}
|
|
59
|
+
case "compareBalances": {
|
|
60
|
+
return `${functionName}()`;
|
|
61
|
+
}
|
|
62
|
+
case "setFullCheckParams": {
|
|
63
|
+
const [collateralHints, minHealthFactor] = this.decodeFunctionData(functionFragment, calldata);
|
|
64
|
+
return `${functionName}(token: ${collateralHints
|
|
65
|
+
.map((a) => this.formatAmount(a))
|
|
66
|
+
.join(", ")}, minHealthFactor: ${minHealthFactor})`;
|
|
67
|
+
}
|
|
68
|
+
case "storeExpectedBalances": {
|
|
69
|
+
const [balanceDeltas] = this.decodeFunctionData(functionFragment, calldata);
|
|
70
|
+
return `${functionName}(balanceDeltas: ${balanceDeltas
|
|
71
|
+
.map((b) => `${this.tokenSymbol(b.token)}: ${this.formatBN(b.amount, this.tokenSymbol(b.token))}`)
|
|
72
|
+
.join(", ")})`;
|
|
73
|
+
}
|
|
59
74
|
default:
|
|
60
75
|
return `${functionName}: Unknown operation ${functionFragment.name} with calldata ${calldata}`;
|
|
61
76
|
}
|
|
@@ -10,9 +10,9 @@ describe("CreditFacadeParser test", () => {
|
|
|
10
10
|
const ifc = types_1.ICreditFacadeV2Extended__factory.createInterface();
|
|
11
11
|
let parsed = parser.parse(ifc.encodeFunctionData("addCollateral", [
|
|
12
12
|
sdk_gov_1.tokenDataByNetwork.Mainnet.WBTC,
|
|
13
|
-
(sdk_gov_1.
|
|
13
|
+
(10n ** (0, sdk_gov_1.toBigInt)(sdk_gov_1.decimals.WBTC) * 444n) / 10n,
|
|
14
14
|
]));
|
|
15
|
-
(0, chai_1.expect)(parsed).to.be.eq("CreditFacade[DAI].addCollateral(token: WBTC, amount: 44.40 [
|
|
15
|
+
(0, chai_1.expect)(parsed).to.be.eq("CreditFacade[DAI].addCollateral(token: WBTC, amount: 44.40 [4440000000])", "Incorrect parse addCollateral");
|
|
16
16
|
parsed = parser.parse(ifc.encodeFunctionData("increaseDebt", [(sdk_gov_1.WAD * 414n) / 10n]));
|
|
17
17
|
(0, chai_1.expect)(parsed).to.be.eq("CreditFacade[DAI].increaseDebt(amount: 41.40 [41400000000000000000])", "Incorrect parse increaseDebt");
|
|
18
18
|
parsed = parser.parse(ifc.encodeFunctionData("decreaseDebt", [(sdk_gov_1.WAD * 334n) / 10n]));
|