impermax-sdk 2.1.252 → 2.1.253
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.
|
@@ -9,26 +9,6 @@ class OnchainInteractionsBorrowableV2 extends onchainInteractionsBorrowable_1.de
|
|
|
9
9
|
super(...arguments);
|
|
10
10
|
this.getLendingPool = () => this.lendingPool;
|
|
11
11
|
this.getPoolToken = () => this.poolToken;
|
|
12
|
-
/*
|
|
13
|
-
public async borrow(amount: BigNumber, permits: Permits, onTransactionHash: Function) {
|
|
14
|
-
const {router, ptAddress, account} = await this.getSendData(permits);
|
|
15
|
-
// TODO temporary fix
|
|
16
|
-
if (await this.isWETH()) {
|
|
17
|
-
return this.send(router.methods.borrowETH(ptAddress, amount, account, '100000000000000000', '0x'), onTransactionHash);
|
|
18
|
-
} else {
|
|
19
|
-
return this.send(router.methods.borrow(ptAddress, amount, account, '100000000000000000', '0x'), onTransactionHash);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public async repay(amount: BigNumber, onTransactionHash: Function) {
|
|
24
|
-
const {router, ptAddress, account} = await this.getSendData([]);
|
|
25
|
-
if (await this.isWETH()) {
|
|
26
|
-
return this.send(router.methods.repayETH(ptAddress, account, DEADLINE), onTransactionHash, amount);
|
|
27
|
-
} else {
|
|
28
|
-
return this.send(router.methods.repay(ptAddress, amount, account, DEADLINE), onTransactionHash);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
*/
|
|
32
12
|
}
|
|
33
13
|
}
|
|
34
14
|
exports.default = OnchainInteractionsBorrowableV2;
|
|
@@ -26,19 +26,6 @@ class OnchainInteractionsCollateralV2 extends onchainInteractionsPoolToken_1.def
|
|
|
26
26
|
getAccountPoolToken() {
|
|
27
27
|
return this.lendingPool.getAccountLendingPool().getCollateral();
|
|
28
28
|
}
|
|
29
|
-
/*public async getPermitData(
|
|
30
|
-
approvalType: ApprovalType,
|
|
31
|
-
amount: BigNumber,
|
|
32
|
-
deadlineArg: BigNumber | null,
|
|
33
|
-
callBack: (permitData: PermitData | null) => void
|
|
34
|
-
) {
|
|
35
|
-
this._getPermitData(approvalType, amount, deadlineArg, callBack);
|
|
36
|
-
}*/
|
|
37
|
-
/*protected async mint(amount: BigNumber, permit: Permits, onTransactionHash: Function) {
|
|
38
|
-
// TODO temporary fix
|
|
39
|
-
const {router, ptAddress, account} = await this.getSendData(permit);
|
|
40
|
-
return this.send(router.methods.mintCollateral(ptAddress, amount, account, '100000000000000000', '0x'), onTransactionHash);
|
|
41
|
-
};*/
|
|
42
29
|
/**
|
|
43
30
|
* Utilities
|
|
44
31
|
*/
|
|
@@ -109,15 +96,15 @@ class OnchainInteractionsCollateralV2 extends onchainInteractionsPoolToken_1.def
|
|
|
109
96
|
}
|
|
110
97
|
else {
|
|
111
98
|
approveA += amountAUser;
|
|
112
|
-
borrowApproveA += actualBorrowADelta;
|
|
113
99
|
}
|
|
114
100
|
if (isEthB) {
|
|
115
101
|
ethValue += amountBUser;
|
|
116
102
|
}
|
|
117
103
|
else {
|
|
118
104
|
approveB += amountBUser;
|
|
119
|
-
borrowApproveB += actualBorrowBDelta;
|
|
120
105
|
}
|
|
106
|
+
borrowApproveA += actualBorrowADelta;
|
|
107
|
+
borrowApproveB += actualBorrowBDelta;
|
|
121
108
|
actions.push(await actionsGetter.methods.getBorrowAndMintUniV2Action(0, await borrowableA.toBigNumber(amountAUser), await borrowableB.toBigNumber(amountBUser), await borrowableA.toBigNumber(depositADelta), await borrowableB.toBigNumber(depositBDelta), await borrowableA.toBigNumber(depositADelta * MIN_AMOUNT), await borrowableB.toBigNumber(depositBDelta * MIN_AMOUNT)).call());
|
|
122
109
|
depositADelta = 0;
|
|
123
110
|
depositBDelta = 0;
|
|
@@ -147,16 +134,14 @@ class OnchainInteractionsCollateralV2 extends onchainInteractionsPoolToken_1.def
|
|
|
147
134
|
actions.push(await actionsGetter.methods.getBorrowAction(0, await borrowableA.toBigNumber(borrowADelta), isEthA ? router._address : this.getAccountAddress()).call());
|
|
148
135
|
if (isEthA)
|
|
149
136
|
doWithdrawEth = true;
|
|
150
|
-
|
|
151
|
-
borrowApproveA += borrowADelta;
|
|
137
|
+
borrowApproveA += borrowADelta;
|
|
152
138
|
borrowADelta = 0;
|
|
153
139
|
}
|
|
154
140
|
if (borrowBDelta > 0) {
|
|
155
141
|
actions.push(await actionsGetter.methods.getBorrowAction(1, await borrowableB.toBigNumber(borrowBDelta), isEthB ? router._address : this.getAccountAddress()).call());
|
|
156
142
|
if (isEthB)
|
|
157
143
|
doWithdrawEth = true;
|
|
158
|
-
|
|
159
|
-
borrowApproveB += borrowBDelta;
|
|
144
|
+
borrowApproveB += borrowBDelta;
|
|
160
145
|
borrowBDelta = 0;
|
|
161
146
|
}
|
|
162
147
|
// Redeem
|