@instadapp/interop-x 0.0.0-dev.326bdca → 0.0.0-dev.376f394
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/.github/workflows/ci.yml +19 -0
- package/dist/package.json +12 -11
- package/dist/src/abi/index.js +2 -2
- package/dist/src/abi/interopX.json +1436 -0
- package/dist/src/api/index.js +1 -1
- package/dist/src/constants/addresses.js +2 -7
- package/dist/src/constants/tokens.js +62 -39
- package/dist/src/db/models/transaction.js +12 -12
- package/dist/src/gnosis/actions/withdraw/index.js +106 -33
- package/dist/src/gnosis/index.js +4 -4
- package/dist/src/index.js +1 -1
- package/dist/src/net/protocol/dial/SignatureDialProtocol.js +6 -2
- package/dist/src/tasks/{InteropXContract/SyncBridgeRequestEvents.js → InteropX/SyncLogSubmitEvents.js} +21 -15
- package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +5 -2
- package/dist/src/tasks/index.js +7 -8
- package/dist/src/typechain/{InteropXContract.js → InteropX.js} +0 -0
- package/dist/src/typechain/factories/InteropX__factory.js +1928 -0
- package/dist/src/typechain/factories/index.js +3 -3
- package/dist/src/typechain/index.js +3 -3
- package/dist/src/utils/index.js +36 -9
- package/package.json +12 -11
- package/src/abi/index.ts +2 -2
- package/src/abi/interopX.json +1436 -0
- package/src/api/index.ts +1 -1
- package/src/constants/addresses.ts +3 -8
- package/src/constants/tokens.ts +63 -40
- package/src/db/models/transaction.ts +31 -29
- package/src/gnosis/actions/withdraw/index.ts +141 -42
- package/src/gnosis/index.ts +5 -5
- package/src/net/protocol/dial/SignatureDialProtocol.ts +6 -2
- package/src/tasks/{InteropXContract/SyncBridgeRequestEvents.ts → InteropX/SyncLogSubmitEvents.ts} +40 -20
- package/src/tasks/Transactions/SyncTransactionStatusTask.ts +5 -2
- package/src/tasks/index.ts +7 -9
- package/src/typechain/InteropX.ts +1216 -0
- package/src/typechain/factories/InteropX__factory.ts +1932 -0
- package/src/typechain/factories/index.ts +1 -1
- package/src/typechain/index.ts +2 -2
- package/src/utils/index.ts +88 -39
- package/dist/src/abi/interopXContract.json +0 -391
- package/dist/src/tasks/InteropXContract/ProcessBridgeRequestEvents.js +0 -146
- package/dist/src/typechain/factories/InteropXContract__factory.js +0 -526
- package/src/abi/interopXContract.json +0 -391
- package/src/tasks/InteropXContract/ProcessBridgeRequestEvents.ts +0 -208
- package/src/typechain/InteropXContract.ts +0 -524
- package/src/typechain/factories/InteropXContract__factory.ts +0 -533
package/src/tasks/{InteropXContract/SyncBridgeRequestEvents.ts → InteropX/SyncLogSubmitEvents.ts}
RENAMED
@@ -7,17 +7,17 @@ import { generateInteropTransactionHash, getContract, getRpcProviderUrl } from "
|
|
7
7
|
import { addresses } from "@/constants";
|
8
8
|
import { ChainId } from "@/types";
|
9
9
|
import config from "@/config";
|
10
|
-
import {
|
10
|
+
import { InteropX } from "@/typechain";
|
11
11
|
|
12
|
-
class
|
12
|
+
class SyncLogSubmitEvents extends BaseTask {
|
13
13
|
contractAddress: string;
|
14
14
|
provider: ethers.providers.JsonRpcProvider;
|
15
|
-
contract:
|
15
|
+
contract: InteropX;
|
16
16
|
chainId: ChainId;
|
17
17
|
|
18
18
|
constructor({ chainId }: { chainId: ChainId }) {
|
19
19
|
super({
|
20
|
-
logger: new Logger("
|
20
|
+
logger: new Logger("InteropX::SyncLogSubmitEvents"),
|
21
21
|
})
|
22
22
|
this.chainId = chainId;
|
23
23
|
}
|
@@ -26,7 +26,7 @@ class SyncBridgeRequestEvents extends BaseTask {
|
|
26
26
|
const currentBlock = await this.provider.getBlockNumber();
|
27
27
|
|
28
28
|
const events = await this.contract.queryFilter(
|
29
|
-
this.contract.filters.
|
29
|
+
this.contract.filters.LogSubmit(),
|
30
30
|
currentBlock - 2000,
|
31
31
|
currentBlock,
|
32
32
|
);
|
@@ -40,14 +40,28 @@ class SyncBridgeRequestEvents extends BaseTask {
|
|
40
40
|
continue;
|
41
41
|
}
|
42
42
|
|
43
|
-
const {
|
43
|
+
const {
|
44
|
+
position,
|
45
|
+
actionId,
|
46
|
+
actionIdHashHash,
|
47
|
+
sourceSender,
|
48
|
+
sourceDsaId,
|
49
|
+
targetDsaId,
|
50
|
+
sourceChainId,
|
51
|
+
targetChainId,
|
52
|
+
vnonce,
|
53
|
+
metadata,
|
54
|
+
|
55
|
+
} = event.args;
|
44
56
|
|
45
57
|
const uniqueIdentifier = {
|
46
|
-
|
47
|
-
|
48
|
-
|
58
|
+
actionId,
|
59
|
+
vnonce: vnonce.toString(),
|
60
|
+
sourceSender: sourceSender.toString(),
|
49
61
|
sourceChainId: sourceChainId.toNumber(),
|
50
62
|
targetChainId: targetChainId.toNumber(),
|
63
|
+
sourceDsaId: sourceDsaId.toString(),
|
64
|
+
targetDsaId: targetDsaId.toString(),
|
51
65
|
}
|
52
66
|
|
53
67
|
let transactionHash = generateInteropTransactionHash(uniqueIdentifier);
|
@@ -55,17 +69,20 @@ class SyncBridgeRequestEvents extends BaseTask {
|
|
55
69
|
const transaction = await Transaction.findOne({ where: { transactionHash } });
|
56
70
|
|
57
71
|
if (transaction) {
|
58
|
-
|
72
|
+
continue;
|
59
73
|
}
|
60
74
|
|
61
75
|
await Transaction.create({
|
62
76
|
transactionHash,
|
63
77
|
...uniqueIdentifier,
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
78
|
+
submitChainId: this.chainId,
|
79
|
+
submitTransactionHash: event.transactionHash,
|
80
|
+
submitBlockNumber: event.blockNumber,
|
81
|
+
submitCreatedAt: new Date(),
|
82
|
+
submitEvent: {
|
83
|
+
actionId,
|
84
|
+
actionIdHashHash,
|
85
|
+
vnonce: vnonce.toString(),
|
69
86
|
position: {
|
70
87
|
withdraw: position.withdraw.map((v) => ({
|
71
88
|
sourceToken: v.sourceToken,
|
@@ -80,12 +97,15 @@ class SyncBridgeRequestEvents extends BaseTask {
|
|
80
97
|
},
|
81
98
|
sourceChainId: sourceChainId.toNumber(),
|
82
99
|
targetChainId: targetChainId.toNumber(),
|
100
|
+
sourceSender,
|
101
|
+
sourceDsaId: sourceDsaId.toString(),
|
102
|
+
targetDsaId: targetDsaId.toString(),
|
83
103
|
metadata,
|
84
104
|
}
|
85
105
|
})
|
86
106
|
|
87
107
|
this.logger.info(
|
88
|
-
`New
|
108
|
+
`New InteropX tranaction: ${transactionHash} `
|
89
109
|
);
|
90
110
|
} catch (error) {
|
91
111
|
this.logger.error(error);
|
@@ -97,15 +117,15 @@ class SyncBridgeRequestEvents extends BaseTask {
|
|
97
117
|
}
|
98
118
|
|
99
119
|
async start(): Promise<void> {
|
100
|
-
this.contractAddress = addresses[this.chainId].
|
120
|
+
this.contractAddress = addresses[this.chainId].interopX;
|
101
121
|
|
102
122
|
this.provider = new ethers.providers.JsonRpcProvider(
|
103
123
|
getRpcProviderUrl(this.chainId)
|
104
124
|
);
|
105
125
|
|
106
|
-
this.contract = getContract<
|
126
|
+
this.contract = getContract<InteropX>(
|
107
127
|
this.contractAddress,
|
108
|
-
abi.
|
128
|
+
abi.interopX,
|
109
129
|
new ethers.Wallet(config.privateKey!, this.provider)
|
110
130
|
);
|
111
131
|
|
@@ -113,4 +133,4 @@ class SyncBridgeRequestEvents extends BaseTask {
|
|
113
133
|
}
|
114
134
|
}
|
115
135
|
|
116
|
-
export default
|
136
|
+
export default SyncLogSubmitEvents;
|
@@ -20,14 +20,17 @@ class SyncTransactionStatusTask extends BaseTask {
|
|
20
20
|
const leadNode = peerPool.getLeadPeer();
|
21
21
|
|
22
22
|
if (!leadNode) {
|
23
|
+
console.log("No lead node found");
|
23
24
|
return;
|
24
25
|
}
|
25
26
|
|
26
27
|
const transaction = await Transaction.findOne({
|
27
28
|
where: {
|
28
|
-
|
29
|
+
sourceStatus: {
|
30
|
+
[Op.notIn] : ['success', 'failed'],
|
31
|
+
},
|
29
32
|
sourceCreatedAt: {
|
30
|
-
[Op.gte]: new Date(Date.now() -
|
33
|
+
[Op.gte]: new Date(Date.now() - 15 * 60 * 1000),
|
31
34
|
},
|
32
35
|
}
|
33
36
|
})
|
package/src/tasks/index.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import { BaseTask } from "./BaseTask";
|
2
|
+
import wait from "waait";
|
3
|
+
|
2
4
|
import SyncTransactionStatusTask from "./Transactions/SyncTransactionStatusTask";
|
3
5
|
|
4
6
|
import AutoUpdateTask from "./AutoUpdateTask";
|
5
7
|
|
6
|
-
import
|
7
|
-
import ProccessBridgeRequestEvents from "./InteropXContract/ProcessBridgeRequestEvents";
|
8
|
-
import wait from "waait";
|
8
|
+
import SyncLogSubmitEvents from "./InteropX/SyncLogSubmitEvents";
|
9
9
|
|
10
10
|
export class Tasks {
|
11
11
|
|
@@ -13,13 +13,11 @@ export class Tasks {
|
|
13
13
|
// new SyncTransactionStatusTask(),
|
14
14
|
new AutoUpdateTask(),
|
15
15
|
|
16
|
-
//
|
17
|
-
|
18
|
-
new
|
19
|
-
new SyncBridgeRequestEvents({ chainId: 43114 }),
|
16
|
+
// InteropX
|
17
|
+
new SyncLogSubmitEvents({ chainId: 137 }),
|
18
|
+
new SyncLogSubmitEvents({ chainId: 43114 }),
|
20
19
|
|
21
|
-
new
|
22
|
-
new ProccessBridgeRequestEvents({ chainId: 43114 }),
|
20
|
+
new SyncTransactionStatusTask(),
|
23
21
|
];
|
24
22
|
|
25
23
|
async start() {
|