@instadapp/interop-x 0.0.0-dev.f39d622 → 0.0.0-dev.f45bd03
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/package.json +4 -2
- package/dist/src/abi/aaveV3Resolver.json +628 -0
- package/dist/src/abi/index.js +2 -0
- package/dist/src/constants/addresses.js +4 -2
- package/dist/src/db/models/transaction.js +1 -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 +1 -1
- package/dist/src/providers/index.js +17 -0
- package/dist/src/providers/retry-provider.js +45 -0
- package/dist/src/tasks/InteropX/ProcessSubmitEvents.js +38 -10
- 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/AaveV3Resolver.js +2 -0
- package/dist/src/typechain/factories/AaveV3Resolver__factory.js +887 -0
- package/dist/src/typechain/factories/index.js +3 -1
- package/dist/src/typechain/index.js +3 -1
- package/dist/src/utils/gnosis.js +42 -17
- package/dist/src/utils/validate.js +10 -14
- package/package.json +4 -2
- package/src/abi/aaveV3Resolver.json +628 -0
- package/src/abi/index.ts +2 -0
- package/src/constants/addresses.ts +6 -3
- package/src/db/models/transaction.ts +1 -1
- 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/providers/index.ts +1 -0
- package/src/providers/retry-provider.ts +51 -0
- package/src/tasks/InteropX/ProcessSubmitEvents.ts +52 -13
- package/src/tasks/InteropX/ProcessValidateEvents.ts +39 -13
- 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/AaveV3Resolver.ts +935 -0
- package/src/typechain/factories/AaveV3Resolver__factory.ts +894 -0
- package/src/typechain/factories/index.ts +1 -0
- package/src/typechain/index.ts +2 -0
- package/src/utils/gnosis.ts +75 -32
- package/src/utils/validate.ts +17 -19
@@ -5,8 +5,11 @@ import abi from "@/abi";
|
|
5
5
|
import { Transaction } from "@/db";
|
6
6
|
import {
|
7
7
|
buildSignatureBytes,
|
8
|
+
generateGnosisSignatureMessage,
|
8
9
|
generateGnosisTransaction,
|
9
10
|
getContract,
|
11
|
+
getGnosisOwnerPeerIds,
|
12
|
+
getGnosisSignatureAddress,
|
10
13
|
getRpcProviderUrl,
|
11
14
|
Signature,
|
12
15
|
} from "@/utils";
|
@@ -21,9 +24,10 @@ import { peerPool, protocol } from "@/net";
|
|
21
24
|
import { LogDescription } from "ethers/lib/utils";
|
22
25
|
import wait from "waait";
|
23
26
|
import { LiquidityError } from "@/errors";
|
27
|
+
import { JsonRpcRetryProvider } from "@/providers";
|
24
28
|
|
25
29
|
export default class ProcessValidateEvents extends BaseTask {
|
26
|
-
sourceProvider:
|
30
|
+
sourceProvider: JsonRpcRetryProvider;
|
27
31
|
chainId: ChainId;
|
28
32
|
leadNodeOnly: boolean = true;
|
29
33
|
blockConfirmationsCount: number = 12;
|
@@ -74,7 +78,7 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
74
78
|
|
75
79
|
const { sourceChainId, targetChainId } = transaction.validateEvent
|
76
80
|
|
77
|
-
const targetProvider = new
|
81
|
+
const targetProvider = new JsonRpcRetryProvider(
|
78
82
|
getRpcProviderUrl(targetChainId as ChainId)
|
79
83
|
);
|
80
84
|
|
@@ -140,13 +144,9 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
140
144
|
targetGnosisContract
|
141
145
|
);
|
142
146
|
|
143
|
-
const
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
const ownerPeerIds = peerPool.activePeers
|
148
|
-
.filter((peer) => owners.includes(peer.publicAddress.toLowerCase()))
|
149
|
-
.map((peer) => peer.id);
|
147
|
+
const ownerPeerIds = await getGnosisOwnerPeerIds({
|
148
|
+
gnosisContract: targetGnosisContract,
|
149
|
+
});
|
150
150
|
|
151
151
|
console.log(
|
152
152
|
`Collecting signatures for execution ${transaction.transactionHash}`
|
@@ -154,6 +154,14 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
154
154
|
|
155
155
|
console.log(ownerPeerIds);
|
156
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
|
+
|
157
165
|
const signatures = await protocol.requestSignatures(
|
158
166
|
{
|
159
167
|
type: "target",
|
@@ -165,9 +173,27 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
165
173
|
ownerPeerIds
|
166
174
|
);
|
167
175
|
|
168
|
-
const validSignatures = signatures
|
169
|
-
(
|
170
|
-
|
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[];
|
171
197
|
|
172
198
|
console.log({
|
173
199
|
signatures,
|
@@ -262,7 +288,7 @@ export default class ProcessValidateEvents extends BaseTask {
|
|
262
288
|
async start(): Promise<void> {
|
263
289
|
this.blockConfirmationsCount = blockConfirmations[this.chainId] + 1;
|
264
290
|
|
265
|
-
this.sourceProvider = new
|
291
|
+
this.sourceProvider = new JsonRpcRetryProvider(
|
266
292
|
getRpcProviderUrl(this.chainId)
|
267
293
|
);
|
268
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
|
|