@instadapp/interop-x 0.0.0-dev.ef7acff → 0.0.0-dev.f45bd03
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/package.json +8 -2
- package/dist/src/abi/aaveV2Resolver.json +832 -0
- package/dist/src/abi/aaveV3Resolver.json +628 -0
- package/dist/src/abi/balanceResolver.json +211 -0
- package/dist/src/abi/index.js +6 -0
- package/dist/src/constants/addresses.js +6 -0
- package/dist/src/constants/capPerChain.js +8 -0
- package/dist/src/constants/index.js +2 -0
- package/dist/src/constants/tokens.js +44 -44
- package/dist/src/constants/wrappedNativeToken.js +8 -0
- package/dist/src/crons/index.js +3 -0
- package/dist/src/crons/prices.js +16 -0
- package/dist/src/db/models/transaction.js +1 -1
- package/dist/src/errors/index.js +14 -1
- package/dist/src/gnosis/actions/aaveV2/source.js +26 -1
- package/dist/src/gnosis/actions/aaveV2/target.js +16 -1
- package/dist/src/gnosis/actions/aaveV3/index.js +11 -0
- package/dist/src/gnosis/actions/aaveV3/source.js +74 -0
- package/dist/src/gnosis/actions/aaveV3/target.js +87 -0
- package/dist/src/gnosis/actions/index.js +2 -0
- package/dist/src/index.js +2 -1
- package/dist/src/providers/index.js +17 -0
- package/dist/src/providers/retry-provider.js +45 -0
- package/dist/src/services/Prices.js +74 -0
- package/dist/src/services/index.js +8 -0
- package/dist/src/tasks/InteropX/ProcessSubmitEvents.js +92 -12
- package/dist/src/tasks/InteropX/ProcessValidateEvents.js +28 -9
- package/dist/src/tasks/InteropX/SyncLogExecuteEvents.js +2 -1
- package/dist/src/tasks/InteropX/SyncLogSubmitEvents.js +2 -1
- package/dist/src/tasks/InteropX/SyncLogValidateEvents.js +2 -1
- package/dist/src/typechain/AaveV2Resolver.js +2 -0
- package/dist/src/typechain/AaveV3Resolver.js +2 -0
- package/dist/src/typechain/BalanceResolver.js +2 -0
- package/dist/src/typechain/factories/AaveV2Resolver__factory.js +1191 -0
- package/dist/src/typechain/factories/AaveV3Resolver__factory.js +887 -0
- package/dist/src/typechain/factories/BalanceResolver__factory.js +228 -0
- package/dist/src/typechain/factories/index.js +7 -1
- package/dist/src/typechain/index.js +7 -1
- package/dist/src/utils/formatting.js +51 -1
- package/dist/src/utils/gnosis.js +42 -17
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/tokens.js +22 -0
- package/dist/src/utils/validate.js +85 -1
- package/dist/src/utils/web3.js +2 -1
- package/package.json +8 -2
- package/src/abi/aaveV2Resolver.json +832 -0
- package/src/abi/aaveV3Resolver.json +628 -0
- package/src/abi/balanceResolver.json +211 -0
- package/src/abi/index.ts +6 -0
- package/src/constants/addresses.ts +18 -1
- package/src/constants/capPerChain.ts +5 -0
- package/src/constants/index.ts +2 -0
- package/src/constants/tokens.ts +44 -44
- package/src/constants/wrappedNativeToken.ts +5 -0
- package/src/crons/index.ts +1 -0
- package/src/crons/prices.ts +12 -0
- package/src/db/models/transaction.ts +1 -1
- package/src/errors/index.ts +13 -0
- package/src/gnosis/actions/aaveV2/source.ts +58 -2
- package/src/gnosis/actions/aaveV2/target.ts +29 -2
- package/src/gnosis/actions/aaveV3/index.ts +9 -0
- package/src/gnosis/actions/aaveV3/source.ts +119 -0
- package/src/gnosis/actions/aaveV3/target.ts +142 -0
- package/src/gnosis/actions/index.ts +2 -0
- package/src/index.ts +1 -0
- package/src/providers/index.ts +1 -0
- package/src/providers/retry-provider.ts +51 -0
- package/src/services/Prices.ts +89 -0
- package/src/services/index.ts +1 -0
- package/src/tasks/InteropX/ProcessSubmitEvents.ts +120 -17
- package/src/tasks/InteropX/ProcessValidateEvents.ts +39 -14
- package/src/tasks/InteropX/SyncLogExecuteEvents.ts +3 -2
- package/src/tasks/InteropX/SyncLogSubmitEvents.ts +3 -2
- package/src/tasks/InteropX/SyncLogValidateEvents.ts +3 -2
- package/src/typechain/AaveV2Resolver.ts +1017 -0
- package/src/typechain/AaveV3Resolver.ts +935 -0
- package/src/typechain/BalanceResolver.ts +266 -0
- package/src/typechain/factories/AaveV2Resolver__factory.ts +1198 -0
- package/src/typechain/factories/AaveV3Resolver__factory.ts +894 -0
- package/src/typechain/factories/BalanceResolver__factory.ts +235 -0
- package/src/typechain/factories/index.ts +3 -0
- package/src/typechain/index.ts +6 -0
- package/src/utils/formatting.ts +53 -0
- package/src/utils/gnosis.ts +75 -32
- package/src/utils/index.ts +1 -0
- package/src/utils/tokens.ts +21 -0
- package/src/utils/validate.ts +149 -2
- package/src/utils/web3.ts +3 -2
@@ -5,9 +5,11 @@ import abi from "@/abi";
|
|
5
5
|
import { Transaction } from "@/db";
|
6
6
|
import {
|
7
7
|
buildSignatureBytes,
|
8
|
+
generateGnosisSignatureMessage,
|
8
9
|
generateGnosisTransaction,
|
9
|
-
generateInteropTransactionHash,
|
10
10
|
getContract,
|
11
|
+
getGnosisOwnerPeerIds,
|
12
|
+
getGnosisSignatureAddress,
|
11
13
|
getRpcProviderUrl,
|
12
14
|
Signature,
|
13
15
|
} from "@/utils";
|
@@ -22,9 +24,10 @@ import { peerPool, protocol } from "@/net";
|
|
22
24
|
import { LogDescription } from "ethers/lib/utils";
|
23
25
|
import wait from "waait";
|
24
26
|
import { LiquidityError } from "@/errors";
|
27
|
+
import { JsonRpcRetryProvider } from "@/providers";
|
25
28
|
|
26
29
|
export default class ProcessValidateEvents extends BaseTask {
|
27
|
-
sourceProvider:
|
30
|
+
sourceProvider: JsonRpcRetryProvider;
|
28
31
|
chainId: ChainId;
|
29
32
|
leadNodeOnly: boolean = true;
|
30
33
|
blockConfirmationsCount: number = 12;
|
@@ -75,7 +78,7 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
75
78
|
|
76
79
|
const { sourceChainId, targetChainId } = transaction.validateEvent
|
77
80
|
|
78
|
-
const targetProvider = new
|
81
|
+
const targetProvider = new JsonRpcRetryProvider(
|
79
82
|
getRpcProviderUrl(targetChainId as ChainId)
|
80
83
|
);
|
81
84
|
|
@@ -141,13 +144,9 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
141
144
|
targetGnosisContract
|
142
145
|
);
|
143
146
|
|
144
|
-
const
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
const ownerPeerIds = peerPool.activePeers
|
149
|
-
.filter((peer) => owners.includes(peer.publicAddress.toLowerCase()))
|
150
|
-
.map((peer) => peer.id);
|
147
|
+
const ownerPeerIds = await getGnosisOwnerPeerIds({
|
148
|
+
gnosisContract: targetGnosisContract,
|
149
|
+
});
|
151
150
|
|
152
151
|
console.log(
|
153
152
|
`Collecting signatures for execution ${transaction.transactionHash}`
|
@@ -155,6 +154,14 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
155
154
|
|
156
155
|
console.log(ownerPeerIds);
|
157
156
|
|
157
|
+
const message = generateGnosisSignatureMessage({
|
158
|
+
to: addresses[data.chainId].multisend,
|
159
|
+
data,
|
160
|
+
chainId: this.chainId,
|
161
|
+
safeTxGas: gnosisTx.safeTxGas,
|
162
|
+
nonce: gnosisTx.safeNonce,
|
163
|
+
});
|
164
|
+
|
158
165
|
const signatures = await protocol.requestSignatures(
|
159
166
|
{
|
160
167
|
type: "target",
|
@@ -166,9 +173,27 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
166
173
|
ownerPeerIds
|
167
174
|
);
|
168
175
|
|
169
|
-
const validSignatures = signatures
|
170
|
-
(
|
171
|
-
|
176
|
+
const validSignatures = signatures
|
177
|
+
.filter(
|
178
|
+
(s) => !!s.data && s.data !== "0x"
|
179
|
+
)
|
180
|
+
.filter((s) => {
|
181
|
+
|
182
|
+
try {
|
183
|
+
|
184
|
+
const address = getGnosisSignatureAddress({
|
185
|
+
message,
|
186
|
+
signature: s.data!,
|
187
|
+
chainId: this.chainId,
|
188
|
+
})
|
189
|
+
|
190
|
+
return address?.toLowerCase() === s.signer.toLowerCase();
|
191
|
+
|
192
|
+
} catch (error) {
|
193
|
+
return false
|
194
|
+
}
|
195
|
+
|
196
|
+
}) as Signature[];
|
172
197
|
|
173
198
|
console.log({
|
174
199
|
signatures,
|
@@ -263,7 +288,7 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
263
288
|
async start(): Promise<void> {
|
264
289
|
this.blockConfirmationsCount = blockConfirmations[this.chainId] + 1;
|
265
290
|
|
266
|
-
this.sourceProvider = new
|
291
|
+
this.sourceProvider = new JsonRpcRetryProvider(
|
267
292
|
getRpcProviderUrl(this.chainId)
|
268
293
|
);
|
269
294
|
|
@@ -13,10 +13,11 @@ import { ChainId } from "@/types";
|
|
13
13
|
import config from "@/config";
|
14
14
|
import { InteropX } from "@/typechain";
|
15
15
|
import { Op } from "sequelize";
|
16
|
+
import { JsonRpcRetryProvider } from "@/providers";
|
16
17
|
|
17
18
|
export default class SyncLogExecuteEvents extends BaseTask {
|
18
19
|
contractAddress: string;
|
19
|
-
provider:
|
20
|
+
provider: JsonRpcRetryProvider;
|
20
21
|
contract: InteropX;
|
21
22
|
targetChainId: ChainId;
|
22
23
|
|
@@ -145,7 +146,7 @@ export default class SyncLogExecuteEvents extends BaseTask {
|
|
145
146
|
async start(): Promise<void> {
|
146
147
|
this.contractAddress = addresses[this.targetChainId].interopX;
|
147
148
|
|
148
|
-
this.provider = new
|
149
|
+
this.provider = new JsonRpcRetryProvider(
|
149
150
|
getRpcProviderUrl(this.targetChainId)
|
150
151
|
);
|
151
152
|
|
@@ -12,10 +12,11 @@ import { addresses } from "@/constants";
|
|
12
12
|
import { ChainId } from "@/types";
|
13
13
|
import config from "@/config";
|
14
14
|
import { InteropX } from "@/typechain";
|
15
|
+
import { JsonRpcRetryProvider } from "@/providers";
|
15
16
|
|
16
17
|
export default class SyncLogSubmitEvents extends BaseTask {
|
17
18
|
contractAddress: string;
|
18
|
-
provider:
|
19
|
+
provider: JsonRpcRetryProvider;
|
19
20
|
contract: InteropX;
|
20
21
|
chainId: ChainId;
|
21
22
|
|
@@ -122,7 +123,7 @@ export default class SyncLogSubmitEvents extends BaseTask {
|
|
122
123
|
async start(): Promise<void> {
|
123
124
|
this.contractAddress = addresses[this.chainId].interopX;
|
124
125
|
|
125
|
-
this.provider = new
|
126
|
+
this.provider = new JsonRpcRetryProvider(
|
126
127
|
getRpcProviderUrl(this.chainId)
|
127
128
|
);
|
128
129
|
|
@@ -13,10 +13,11 @@ import { ChainId } from "@/types";
|
|
13
13
|
import config from "@/config";
|
14
14
|
import { InteropX } from "@/typechain";
|
15
15
|
import { Op } from "sequelize";
|
16
|
+
import { JsonRpcRetryProvider } from "@/providers";
|
16
17
|
|
17
18
|
export default class SyncLogValidateEvents extends BaseTask {
|
18
19
|
contractAddress: string;
|
19
|
-
provider:
|
20
|
+
provider: JsonRpcRetryProvider;
|
20
21
|
contract: InteropX;
|
21
22
|
chainId: ChainId;
|
22
23
|
|
@@ -135,7 +136,7 @@ export default class SyncLogValidateEvents extends BaseTask {
|
|
135
136
|
async start(): Promise<void> {
|
136
137
|
this.contractAddress = addresses[this.chainId].interopX;
|
137
138
|
|
138
|
-
this.provider = new
|
139
|
+
this.provider = new JsonRpcRetryProvider(
|
139
140
|
getRpcProviderUrl(this.chainId)
|
140
141
|
);
|
141
142
|
|