@instadapp/interop-x 0.0.0-dev.e916c22 → 0.0.0-dev.ea4acf6
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 +9 -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/api/index.js +7 -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 +30 -0
- package/dist/src/gnosis/actions/aaveV2/source.js +26 -1
- package/dist/src/gnosis/actions/aaveV2/target.js +18 -4
- 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/{ProcessSubmitSubmitEvents.js → ProcessSubmitEvents.js} +108 -14
- package/dist/src/tasks/InteropX/ProcessValidateEvents.js +30 -10
- package/dist/src/tasks/InteropX/SyncLogExecuteEvents.js +3 -2
- package/dist/src/tasks/InteropX/SyncLogSubmitEvents.js +3 -2
- package/dist/src/tasks/InteropX/SyncLogValidateEvents.js +3 -2
- package/dist/src/tasks/index.js +3 -4
- 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/async.js +18 -0
- package/dist/src/utils/dsa.js +36 -0
- package/dist/src/utils/formatting.js +67 -0
- package/dist/src/utils/gnosis.js +87 -0
- package/dist/src/utils/http.js +10 -0
- package/dist/src/utils/index.js +22 -220
- package/dist/src/utils/interop.js +16 -0
- package/dist/src/utils/tokens.js +22 -0
- package/dist/src/utils/validate.js +111 -0
- package/dist/src/utils/web3.js +93 -0
- package/package.json +9 -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/api/index.ts +8 -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 +26 -0
- package/src/gnosis/actions/aaveV2/source.ts +56 -3
- package/src/gnosis/actions/aaveV2/target.ts +30 -11
- 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/{ProcessSubmitSubmitEvents.ts → ProcessSubmitEvents.ts} +135 -20
- package/src/tasks/InteropX/ProcessValidateEvents.ts +42 -19
- package/src/tasks/InteropX/SyncLogExecuteEvents.ts +5 -6
- package/src/tasks/InteropX/SyncLogSubmitEvents.ts +6 -7
- package/src/tasks/InteropX/SyncLogValidateEvents.ts +6 -7
- package/src/tasks/index.ts +3 -4
- 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/async.ts +22 -0
- package/src/utils/dsa.ts +56 -0
- package/src/utils/formatting.ts +68 -0
- package/src/utils/gnosis.ts +166 -0
- package/src/utils/http.ts +6 -0
- package/src/utils/index.ts +9 -365
- package/src/utils/interop.ts +28 -0
- package/src/utils/tokens.ts +21 -0
- package/src/utils/validate.ts +179 -0
- package/src/utils/web3.ts +132 -0
@@ -5,11 +5,12 @@ 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
|
-
LiquidityError,
|
13
14
|
Signature,
|
14
15
|
} from "@/utils";
|
15
16
|
import { addresses, blockConfirmations } from "@/constants";
|
@@ -22,9 +23,11 @@ import { buildGnosisAction } from "@/gnosis";
|
|
22
23
|
import { peerPool, protocol } from "@/net";
|
23
24
|
import { LogDescription } from "ethers/lib/utils";
|
24
25
|
import wait from "waait";
|
26
|
+
import { LiquidityError } from "@/errors";
|
27
|
+
import { JsonRpcRetryProvider } from "@/providers";
|
25
28
|
|
26
|
-
class ProcessValidateEvents extends BaseTask {
|
27
|
-
sourceProvider:
|
29
|
+
export default class ProcessValidateEvents extends BaseTask {
|
30
|
+
sourceProvider: JsonRpcRetryProvider;
|
28
31
|
chainId: ChainId;
|
29
32
|
leadNodeOnly: boolean = true;
|
30
33
|
blockConfirmationsCount: number = 12;
|
@@ -75,7 +78,7 @@ 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 @@ 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 @@ class ProcessValidateEvents extends BaseTask {
|
|
155
154
|
|
156
155
|
console.log(ownerPeerIds);
|
157
156
|
|
157
|
+
const message = generateGnosisSignatureMessage({
|
158
|
+
to: addresses[targetChainId].multisend,
|
159
|
+
data,
|
160
|
+
chainId: targetChainId as 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 @@ 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: targetChainId as 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,12 +288,10 @@ 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
|
|
270
295
|
await super.start();
|
271
296
|
}
|
272
|
-
}
|
273
|
-
|
274
|
-
export default ProcessValidateEvents;
|
297
|
+
}
|
@@ -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
|
-
class SyncLogExecuteEvents extends BaseTask {
|
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
|
|
@@ -132,7 +133,7 @@ class SyncLogExecuteEvents extends BaseTask {
|
|
132
133
|
|
133
134
|
await transaction.save();
|
134
135
|
|
135
|
-
this.logger.info(`New InteropX
|
136
|
+
this.logger.info(`New InteropX transaction: ${transactionHash} `);
|
136
137
|
} catch (error) {
|
137
138
|
this.logger.error(error);
|
138
139
|
}
|
@@ -145,7 +146,7 @@ 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
|
|
@@ -158,5 +159,3 @@ class SyncLogExecuteEvents extends BaseTask {
|
|
158
159
|
await super.start();
|
159
160
|
}
|
160
161
|
}
|
161
|
-
|
162
|
-
export default SyncLogExecuteEvents;
|
@@ -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
|
-
class SyncLogSubmitEvents extends BaseTask {
|
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
|
|
@@ -109,7 +110,7 @@ class SyncLogSubmitEvents extends BaseTask {
|
|
109
110
|
},
|
110
111
|
});
|
111
112
|
|
112
|
-
this.logger.info(`New InteropX
|
113
|
+
this.logger.info(`New InteropX transaction: ${transactionHash} `);
|
113
114
|
} catch (error) {
|
114
115
|
this.logger.error(error);
|
115
116
|
}
|
@@ -122,7 +123,7 @@ 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
|
|
@@ -134,6 +135,4 @@ class SyncLogSubmitEvents extends BaseTask {
|
|
134
135
|
|
135
136
|
await super.start();
|
136
137
|
}
|
137
|
-
}
|
138
|
-
|
139
|
-
export default SyncLogSubmitEvents;
|
138
|
+
}
|
@@ -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
|
-
class SyncLogValidateEvents extends BaseTask {
|
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
|
|
@@ -122,7 +123,7 @@ class SyncLogValidateEvents extends BaseTask {
|
|
122
123
|
}
|
123
124
|
await transaction.save();
|
124
125
|
|
125
|
-
this.logger.info(`New InteropX
|
126
|
+
this.logger.info(`New InteropX transaction: ${transactionHash} `);
|
126
127
|
} catch (error) {
|
127
128
|
this.logger.error(error);
|
128
129
|
}
|
@@ -135,7 +136,7 @@ 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
|
|
@@ -147,6 +148,4 @@ class SyncLogValidateEvents extends BaseTask {
|
|
147
148
|
|
148
149
|
await super.start();
|
149
150
|
}
|
150
|
-
}
|
151
|
-
|
152
|
-
export default SyncLogValidateEvents;
|
151
|
+
}
|
package/src/tasks/index.ts
CHANGED
@@ -6,7 +6,7 @@ import SyncTransactionStatusTask from "./Transactions/SyncTransactionStatusTask"
|
|
6
6
|
import AutoUpdateTask from "./AutoUpdateTask";
|
7
7
|
|
8
8
|
import SyncLogSubmitEvents from "./InteropX/SyncLogSubmitEvents";
|
9
|
-
import
|
9
|
+
import ProcessSubmitEvents from "./InteropX/ProcessSubmitEvents";
|
10
10
|
import SyncLogValidateEvents from "./InteropX/SyncLogValidateEvents";
|
11
11
|
import ProcessValidateEvents from "./InteropX/ProcessValidateEvents";
|
12
12
|
import SyncLogExecuteEvents from "./InteropX/SyncLogExecuteEvents";
|
@@ -14,15 +14,14 @@ import SyncLogExecuteEvents from "./InteropX/SyncLogExecuteEvents";
|
|
14
14
|
export class Tasks {
|
15
15
|
|
16
16
|
tasks: BaseTask[] = [
|
17
|
-
// new SyncTransactionStatusTask(),
|
18
17
|
new AutoUpdateTask(),
|
19
18
|
|
20
19
|
// InteropX
|
21
20
|
new SyncLogSubmitEvents({ chainId: 137 }),
|
22
21
|
new SyncLogSubmitEvents({ chainId: 43114 }),
|
23
22
|
|
24
|
-
new
|
25
|
-
new
|
23
|
+
new ProcessSubmitEvents({ chainId: 137 }),
|
24
|
+
new ProcessSubmitEvents({ chainId: 43114 }),
|
26
25
|
|
27
26
|
new SyncLogValidateEvents({ chainId: 137 }),
|
28
27
|
new SyncLogValidateEvents({ chainId: 43114 }),
|