@instadapp/interop-x 0.0.0-dev.bfeca30 → 0.0.0-dev.c279cb8
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/ci.yml +19 -0
- package/dist/package.json +4 -2
- package/dist/src/abi/connectors/index.js +36 -0
- package/dist/src/abi/connectors/v1/aave.js +148 -0
- package/dist/src/abi/connectors/v1/aave_claim.js +4 -0
- package/dist/src/abi/connectors/v1/aave_migrate.js +109 -0
- package/dist/src/abi/connectors/v1/aave_polygon_migrate.js +110 -0
- package/dist/src/abi/connectors/v1/aave_stake.js +4 -0
- package/dist/src/abi/connectors/v1/aave_v1_import.js +54 -0
- package/dist/src/abi/connectors/v1/aave_v2.js +230 -0
- package/dist/src/abi/connectors/v1/aave_v2_import.js +59 -0
- package/dist/src/abi/connectors/v1/authority.js +100 -0
- package/dist/src/abi/connectors/v1/basic.js +136 -0
- package/dist/src/abi/connectors/v1/chi.js +36 -0
- package/dist/src/abi/connectors/v1/comp.js +4 -0
- package/dist/src/abi/connectors/v1/compound.js +4 -0
- package/dist/src/abi/connectors/v1/compoundImport.js +69 -0
- package/dist/src/abi/connectors/v1/compoundImport_v2.js +4 -0
- package/dist/src/abi/connectors/v1/compound_old.js +448 -0
- package/dist/src/abi/connectors/v1/curve.js +140 -0
- package/dist/src/abi/connectors/v1/curve_claim.js +63 -0
- package/dist/src/abi/connectors/v1/curve_gauge.js +158 -0
- package/dist/src/abi/connectors/v1/curve_sbtc.js +140 -0
- package/dist/src/abi/connectors/v1/curve_susd.js +140 -0
- package/dist/src/abi/connectors/v1/curve_three.js +79 -0
- package/dist/src/abi/connectors/v1/curve_y.js +140 -0
- package/dist/src/abi/connectors/v1/dsa_migrate_v1_to_v2.js +4 -0
- package/dist/src/abi/connectors/v1/dydx.js +148 -0
- package/dist/src/abi/connectors/v1/dydx_flash.js +52 -0
- package/dist/src/abi/connectors/v1/fee.js +50 -0
- package/dist/src/abi/connectors/v1/gelato.js +1138 -0
- package/dist/src/abi/connectors/v1/index.js +58 -0
- package/dist/src/abi/connectors/v1/instapool.js +439 -0
- package/dist/src/abi/connectors/v1/instapool_v2.js +126 -0
- package/dist/src/abi/connectors/v1/kyber.js +117 -0
- package/dist/src/abi/connectors/v1/maker.js +480 -0
- package/dist/src/abi/connectors/v1/maker_old.js +300 -0
- package/dist/src/abi/connectors/v1/math.js +43 -0
- package/dist/src/abi/connectors/v1/migrate.js +46 -0
- package/dist/src/abi/connectors/v1/oasis.js +198 -0
- package/dist/src/abi/connectors/v1/oneInch.js +160 -0
- package/dist/src/abi/connectors/v1/polygon_bridge.js +4 -0
- package/dist/src/abi/connectors/v1/refinance.js +4 -0
- package/dist/src/abi/connectors/v1/staking.js +220 -0
- package/dist/src/abi/connectors/v1/swerve.js +179 -0
- package/dist/src/abi/connectors/v1/uniswap.js +297 -0
- package/dist/src/abi/connectors/v2/1INCH-A.js +4 -0
- package/dist/src/abi/connectors/v2/1INCH-B.js +4 -0
- package/dist/src/abi/connectors/v2/AAVE-CLAIM-A.js +4 -0
- package/dist/src/abi/connectors/v2/AAVE-CLAIM-B.js +166 -0
- package/dist/src/abi/connectors/v2/AAVE-STAKE-A.js +4 -0
- package/dist/src/abi/connectors/v2/AAVE-V1-A.js +130 -0
- package/dist/src/abi/connectors/v2/AAVE-V1-IMPORT-A.js +4 -0
- package/dist/src/abi/connectors/v2/AAVE-V2-A.js +230 -0
- package/dist/src/abi/connectors/v2/AAVE-V2-IMPORT-A.js +4 -0
- package/dist/src/abi/connectors/v2/AAVE-V2-IMPORT-B.js +225 -0
- package/dist/src/abi/connectors/v2/AUTHORITY-A.js +100 -0
- package/dist/src/abi/connectors/v2/B-COMPOUND-A.js +4 -0
- package/dist/src/abi/connectors/v2/B-LIQUITY-A.js +4 -0
- package/dist/src/abi/connectors/v2/B-MAKERDAO-A.js +4 -0
- package/dist/src/abi/connectors/v2/BASIC-A.js +136 -0
- package/dist/src/abi/connectors/v2/BASIC-B.js +4 -0
- package/dist/src/abi/connectors/v2/BASIC-C.js +4 -0
- package/dist/src/abi/connectors/v2/COMP-A.js +4 -0
- package/dist/src/abi/connectors/v2/COMPOUND-A.js +4 -0
- package/dist/src/abi/connectors/v2/COMPOUND-IMPORT-A.js +4 -0
- package/dist/src/abi/connectors/v2/COMPOUND-IMPORT-B.js +195 -0
- package/dist/src/abi/connectors/v2/G-UNISWAP-A.js +4 -0
- package/dist/src/abi/connectors/v2/GELATO-AAVE-A.js +4 -0
- package/dist/src/abi/connectors/v2/INST-A.js +4 -0
- package/dist/src/abi/connectors/v2/INST-LM-A.js +4 -0
- package/dist/src/abi/connectors/v2/INST-STAKING-A.js +4 -0
- package/dist/src/abi/connectors/v2/INST-STAKING-B.js +4 -0
- package/dist/src/abi/connectors/v2/INSTAPOOL-A.js +4 -0
- package/dist/src/abi/connectors/v2/LIQUITY-A.js +4 -0
- package/dist/src/abi/connectors/v2/MAKERDAO-A.js +4 -0
- package/dist/src/abi/connectors/v2/MAKERDAO-CLAIM-A.js +136 -0
- package/dist/src/abi/connectors/v2/PARASWAP-A.js +4 -0
- package/dist/src/abi/connectors/v2/POLYGON-BRIDGE-A.js +4 -0
- package/dist/src/abi/connectors/v2/REFINANCE-A.js +4 -0
- package/dist/src/abi/connectors/v2/REFLEXER-A.js +4 -0
- package/dist/src/abi/connectors/v2/STAKE-ERC20-A.js +4 -0
- package/dist/src/abi/connectors/v2/UNISWAP-A.js +297 -0
- package/dist/src/abi/connectors/v2/UNISWAP-V2-A.js +4 -0
- package/dist/src/abi/connectors/v2/UNISWAP-V3-A.js +4 -0
- package/dist/src/abi/connectors/v2/UNISWAP-V3-STAKE-A.js +4 -0
- package/dist/src/abi/connectors/v2/WETH-A.js +4 -0
- package/dist/src/abi/connectors/v2/YEARN-VAULT-A.js +4 -0
- package/dist/src/abi/connectors/v2/index.js +89 -0
- package/dist/src/abi/index.js +4 -2
- package/dist/src/abi/interopX.json +1436 -0
- package/dist/src/api/index.js +1 -1
- package/dist/src/constants/addresses.js +4 -7
- package/dist/src/constants/blockConfirmations.js +8 -0
- package/dist/src/constants/index.js +1 -0
- package/dist/src/constants/tokens.js +44 -51
- package/dist/src/db/models/transaction.js +11 -9
- package/dist/src/gnosis/actions/aaveV2/index.js +11 -0
- package/dist/src/gnosis/actions/aaveV2/source.js +75 -0
- package/dist/src/gnosis/actions/aaveV2/target.js +8 -0
- package/dist/src/gnosis/actions/index.js +2 -2
- package/dist/src/index.js +1 -1
- package/dist/src/net/protocol/dial/SignatureDialProtocol.js +2 -2
- package/dist/src/tasks/InteropX/ProcessSubmitSubmitEvents.js +180 -0
- package/dist/src/tasks/{InteropXContract/SyncBridgeRequestEvents.js → InteropX/SyncLogSubmitEvents.js} +23 -15
- package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +6 -3
- package/dist/src/tasks/index.js +9 -13
- 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 +68 -31
- package/package.json +4 -2
- package/src/abi/connectors/index.ts +14 -0
- package/src/abi/connectors/v1/aave.ts +147 -0
- package/src/abi/connectors/v1/aave_claim.ts +3 -0
- package/src/abi/connectors/v1/aave_migrate.ts +108 -0
- package/src/abi/connectors/v1/aave_polygon_migrate.ts +109 -0
- package/src/abi/connectors/v1/aave_stake.ts +3 -0
- package/src/abi/connectors/v1/aave_v1_import.ts +53 -0
- package/src/abi/connectors/v1/aave_v2.ts +229 -0
- package/src/abi/connectors/v1/aave_v2_import.ts +58 -0
- package/src/abi/connectors/v1/authority.ts +99 -0
- package/src/abi/connectors/v1/basic.ts +135 -0
- package/src/abi/connectors/v1/chi.ts +35 -0
- package/src/abi/connectors/v1/comp.ts +3 -0
- package/src/abi/connectors/v1/compound.ts +3 -0
- package/src/abi/connectors/v1/compoundImport.ts +68 -0
- package/src/abi/connectors/v1/compoundImport_v2.ts +3 -0
- package/src/abi/connectors/v1/compound_old.ts +447 -0
- package/src/abi/connectors/v1/curve.ts +139 -0
- package/src/abi/connectors/v1/curve_claim.ts +62 -0
- package/src/abi/connectors/v1/curve_gauge.ts +157 -0
- package/src/abi/connectors/v1/curve_sbtc.ts +139 -0
- package/src/abi/connectors/v1/curve_susd.ts +139 -0
- package/src/abi/connectors/v1/curve_three.ts +78 -0
- package/src/abi/connectors/v1/curve_y.ts +139 -0
- package/src/abi/connectors/v1/dsa_migrate_v1_to_v2.ts +3 -0
- package/src/abi/connectors/v1/dydx.ts +147 -0
- package/src/abi/connectors/v1/dydx_flash.ts +51 -0
- package/src/abi/connectors/v1/fee.ts +49 -0
- package/src/abi/connectors/v1/gelato.ts +1137 -0
- package/src/abi/connectors/v1/index.ts +42 -0
- package/src/abi/connectors/v1/instapool.ts +438 -0
- package/src/abi/connectors/v1/instapool_v2.ts +125 -0
- package/src/abi/connectors/v1/kyber.ts +116 -0
- package/src/abi/connectors/v1/maker.ts +479 -0
- package/src/abi/connectors/v1/maker_old.ts +299 -0
- package/src/abi/connectors/v1/math.ts +42 -0
- package/src/abi/connectors/v1/migrate.ts +45 -0
- package/src/abi/connectors/v1/oasis.ts +197 -0
- package/src/abi/connectors/v1/oneInch.ts +159 -0
- package/src/abi/connectors/v1/polygon_bridge.ts +3 -0
- package/src/abi/connectors/v1/refinance.ts +3 -0
- package/src/abi/connectors/v1/staking.ts +219 -0
- package/src/abi/connectors/v1/swerve.ts +178 -0
- package/src/abi/connectors/v1/uniswap.ts +297 -0
- package/src/abi/connectors/v2/1INCH-A.ts +3 -0
- package/src/abi/connectors/v2/1INCH-B.ts +3 -0
- package/src/abi/connectors/v2/AAVE-CLAIM-A.ts +3 -0
- package/src/abi/connectors/v2/AAVE-CLAIM-B.ts +165 -0
- package/src/abi/connectors/v2/AAVE-STAKE-A.ts +3 -0
- package/src/abi/connectors/v2/AAVE-V1-A.ts +130 -0
- package/src/abi/connectors/v2/AAVE-V1-IMPORT-A.ts +3 -0
- package/src/abi/connectors/v2/AAVE-V2-A.ts +229 -0
- package/src/abi/connectors/v2/AAVE-V2-IMPORT-A.ts +3 -0
- package/src/abi/connectors/v2/AAVE-V2-IMPORT-B.ts +224 -0
- package/src/abi/connectors/v2/AUTHORITY-A.ts +99 -0
- package/src/abi/connectors/v2/B-COMPOUND-A.ts +3 -0
- package/src/abi/connectors/v2/B-LIQUITY-A.ts +3 -0
- package/src/abi/connectors/v2/B-MAKERDAO-A.ts +3 -0
- package/src/abi/connectors/v2/BASIC-A.ts +135 -0
- package/src/abi/connectors/v2/BASIC-B.ts +3 -0
- package/src/abi/connectors/v2/BASIC-C.ts +3 -0
- package/src/abi/connectors/v2/COMP-A.ts +3 -0
- package/src/abi/connectors/v2/COMPOUND-A.ts +3 -0
- package/src/abi/connectors/v2/COMPOUND-IMPORT-A.ts +3 -0
- package/src/abi/connectors/v2/COMPOUND-IMPORT-B.ts +194 -0
- package/src/abi/connectors/v2/G-UNISWAP-A.ts +3 -0
- package/src/abi/connectors/v2/GELATO-AAVE-A.ts +3 -0
- package/src/abi/connectors/v2/INST-A.ts +3 -0
- package/src/abi/connectors/v2/INST-LM-A.ts +3 -0
- package/src/abi/connectors/v2/INST-STAKING-A.ts +3 -0
- package/src/abi/connectors/v2/INST-STAKING-B.ts +3 -0
- package/src/abi/connectors/v2/INSTAPOOL-A.ts +3 -0
- package/src/abi/connectors/v2/LIQUITY-A.ts +3 -0
- package/src/abi/connectors/v2/MAKERDAO-A.ts +3 -0
- package/src/abi/connectors/v2/MAKERDAO-CLAIM-A.ts +135 -0
- package/src/abi/connectors/v2/PARASWAP-A.ts +3 -0
- package/src/abi/connectors/v2/POLYGON-BRIDGE-A.ts +3 -0
- package/src/abi/connectors/v2/REFINANCE-A.ts +3 -0
- package/src/abi/connectors/v2/REFLEXER-A.ts +3 -0
- package/src/abi/connectors/v2/STAKE-ERC20-A.ts +3 -0
- package/src/abi/connectors/v2/UNISWAP-A.ts +297 -0
- package/src/abi/connectors/v2/UNISWAP-V2-A.ts +3 -0
- package/src/abi/connectors/v2/UNISWAP-V3-A.ts +3 -0
- package/src/abi/connectors/v2/UNISWAP-V3-STAKE-A.ts +3 -0
- package/src/abi/connectors/v2/WETH-A.ts +3 -0
- package/src/abi/connectors/v2/YEARN-VAULT-A.ts +3 -0
- package/src/abi/connectors/v2/index.ts +87 -0
- package/src/abi/index.ts +7 -5
- package/src/abi/interopX.json +1436 -0
- package/src/api/index.ts +1 -1
- package/src/constants/addresses.ts +5 -8
- package/src/constants/blockConfirmations.ts +5 -0
- package/src/constants/index.ts +1 -0
- package/src/constants/tokens.ts +44 -51
- package/src/db/models/transaction.ts +28 -37
- package/src/gnosis/actions/aaveV2/index.ts +9 -0
- package/src/gnosis/actions/aaveV2/source.ts +120 -0
- package/src/gnosis/actions/aaveV2/target.ts +13 -0
- package/src/gnosis/actions/index.ts +2 -2
- package/src/net/protocol/dial/SignatureDialProtocol.ts +3 -2
- package/src/tasks/InteropX/ProcessSubmitSubmitEvents.ts +270 -0
- package/src/tasks/InteropX/SyncLogSubmitEvents.ts +138 -0
- package/src/tasks/Transactions/SyncTransactionStatusTask.ts +6 -3
- package/src/tasks/index.ts +8 -15
- 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 +185 -88
- package/dist/src/abi/interopXContract.json +0 -454
- package/dist/src/gnosis/actions/withdraw/index.js +0 -55
- package/dist/src/tasks/InteropXContract/ProcessBridgeRequestEvents.js +0 -152
- package/dist/src/tasks/InteropXContract/SyncBridgeCommittedEvents.js +0 -92
- package/dist/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.js +0 -90
- package/dist/src/typechain/factories/InteropXContract__factory.js +0 -635
- package/src/abi/interopXContract.json +0 -454
- package/src/gnosis/actions/withdraw/index.ts +0 -77
- package/src/tasks/InteropXContract/ProcessBridgeRequestEvents.ts +0 -216
- package/src/tasks/InteropXContract/SyncBridgeCommittedEvents.ts +0 -124
- package/src/tasks/InteropXContract/SyncBridgeRequestEvents.ts +0 -115
- package/src/tasks/InteropXContract/SyncBridgeRequestSentEvents.ts +0 -121
- package/src/typechain/InteropXContract.ts +0 -680
- package/src/typechain/factories/InteropXContract__factory.ts +0 -642
@@ -1,454 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{
|
3
|
-
"anonymous": false,
|
4
|
-
"inputs": [
|
5
|
-
{
|
6
|
-
"indexed": false,
|
7
|
-
"internalType": "string",
|
8
|
-
"name": "actionId",
|
9
|
-
"type": "string"
|
10
|
-
},
|
11
|
-
{
|
12
|
-
"indexed": true,
|
13
|
-
"internalType": "address",
|
14
|
-
"name": "bridger",
|
15
|
-
"type": "address"
|
16
|
-
},
|
17
|
-
{
|
18
|
-
"components": [
|
19
|
-
{
|
20
|
-
"components": [
|
21
|
-
{
|
22
|
-
"internalType": "address",
|
23
|
-
"name": "sourceToken",
|
24
|
-
"type": "address"
|
25
|
-
},
|
26
|
-
{
|
27
|
-
"internalType": "address",
|
28
|
-
"name": "targetToken",
|
29
|
-
"type": "address"
|
30
|
-
},
|
31
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
32
|
-
],
|
33
|
-
"internalType": "struct InteropXContractBeta.TokenInfo[]",
|
34
|
-
"name": "supply",
|
35
|
-
"type": "tuple[]"
|
36
|
-
},
|
37
|
-
{
|
38
|
-
"components": [
|
39
|
-
{
|
40
|
-
"internalType": "address",
|
41
|
-
"name": "sourceToken",
|
42
|
-
"type": "address"
|
43
|
-
},
|
44
|
-
{
|
45
|
-
"internalType": "address",
|
46
|
-
"name": "targetToken",
|
47
|
-
"type": "address"
|
48
|
-
},
|
49
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
50
|
-
],
|
51
|
-
"internalType": "struct InteropXContractBeta.TokenInfo[]",
|
52
|
-
"name": "withdraw",
|
53
|
-
"type": "tuple[]"
|
54
|
-
}
|
55
|
-
],
|
56
|
-
"indexed": false,
|
57
|
-
"internalType": "struct InteropXContractBeta.Position",
|
58
|
-
"name": "position",
|
59
|
-
"type": "tuple"
|
60
|
-
},
|
61
|
-
{
|
62
|
-
"indexed": true,
|
63
|
-
"internalType": "uint32",
|
64
|
-
"name": "sourceChainId",
|
65
|
-
"type": "uint32"
|
66
|
-
},
|
67
|
-
{
|
68
|
-
"indexed": false,
|
69
|
-
"internalType": "uint32",
|
70
|
-
"name": "targetChainId",
|
71
|
-
"type": "uint32"
|
72
|
-
},
|
73
|
-
{
|
74
|
-
"indexed": true,
|
75
|
-
"internalType": "bytes32",
|
76
|
-
"name": "requestTransactionHash",
|
77
|
-
"type": "bytes32"
|
78
|
-
},
|
79
|
-
{
|
80
|
-
"indexed": false,
|
81
|
-
"internalType": "bytes",
|
82
|
-
"name": "metadata",
|
83
|
-
"type": "bytes"
|
84
|
-
}
|
85
|
-
],
|
86
|
-
"name": "LogBridgeCommitted",
|
87
|
-
"type": "event"
|
88
|
-
},
|
89
|
-
{
|
90
|
-
"anonymous": false,
|
91
|
-
"inputs": [
|
92
|
-
{
|
93
|
-
"indexed": false,
|
94
|
-
"internalType": "string",
|
95
|
-
"name": "actionId",
|
96
|
-
"type": "string"
|
97
|
-
},
|
98
|
-
{
|
99
|
-
"indexed": true,
|
100
|
-
"internalType": "address",
|
101
|
-
"name": "bridger",
|
102
|
-
"type": "address"
|
103
|
-
},
|
104
|
-
{
|
105
|
-
"components": [
|
106
|
-
{
|
107
|
-
"components": [
|
108
|
-
{
|
109
|
-
"internalType": "address",
|
110
|
-
"name": "sourceToken",
|
111
|
-
"type": "address"
|
112
|
-
},
|
113
|
-
{
|
114
|
-
"internalType": "address",
|
115
|
-
"name": "targetToken",
|
116
|
-
"type": "address"
|
117
|
-
},
|
118
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
119
|
-
],
|
120
|
-
"internalType": "struct InteropXContractBeta.TokenInfo[]",
|
121
|
-
"name": "supply",
|
122
|
-
"type": "tuple[]"
|
123
|
-
},
|
124
|
-
{
|
125
|
-
"components": [
|
126
|
-
{
|
127
|
-
"internalType": "address",
|
128
|
-
"name": "sourceToken",
|
129
|
-
"type": "address"
|
130
|
-
},
|
131
|
-
{
|
132
|
-
"internalType": "address",
|
133
|
-
"name": "targetToken",
|
134
|
-
"type": "address"
|
135
|
-
},
|
136
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
137
|
-
],
|
138
|
-
"internalType": "struct InteropXContractBeta.TokenInfo[]",
|
139
|
-
"name": "withdraw",
|
140
|
-
"type": "tuple[]"
|
141
|
-
}
|
142
|
-
],
|
143
|
-
"indexed": false,
|
144
|
-
"internalType": "struct InteropXContractBeta.Position",
|
145
|
-
"name": "position",
|
146
|
-
"type": "tuple"
|
147
|
-
},
|
148
|
-
{
|
149
|
-
"indexed": false,
|
150
|
-
"internalType": "uint256",
|
151
|
-
"name": "sourceChainId",
|
152
|
-
"type": "uint256"
|
153
|
-
},
|
154
|
-
{
|
155
|
-
"indexed": true,
|
156
|
-
"internalType": "uint256",
|
157
|
-
"name": "targetChainId",
|
158
|
-
"type": "uint256"
|
159
|
-
},
|
160
|
-
{
|
161
|
-
"indexed": true,
|
162
|
-
"internalType": "bytes32",
|
163
|
-
"name": "requestTransactionHash",
|
164
|
-
"type": "bytes32"
|
165
|
-
},
|
166
|
-
{
|
167
|
-
"indexed": false,
|
168
|
-
"internalType": "bytes32",
|
169
|
-
"name": "targetCommittedTransactionHash",
|
170
|
-
"type": "bytes32"
|
171
|
-
},
|
172
|
-
{
|
173
|
-
"indexed": false,
|
174
|
-
"internalType": "bytes",
|
175
|
-
"name": "metadata",
|
176
|
-
"type": "bytes"
|
177
|
-
}
|
178
|
-
],
|
179
|
-
"name": "LogBridgeCompleted",
|
180
|
-
"type": "event"
|
181
|
-
},
|
182
|
-
{
|
183
|
-
"anonymous": false,
|
184
|
-
"inputs": [
|
185
|
-
{
|
186
|
-
"indexed": false,
|
187
|
-
"internalType": "string",
|
188
|
-
"name": "actionId",
|
189
|
-
"type": "string"
|
190
|
-
},
|
191
|
-
{
|
192
|
-
"indexed": true,
|
193
|
-
"internalType": "address",
|
194
|
-
"name": "bridger",
|
195
|
-
"type": "address"
|
196
|
-
},
|
197
|
-
{
|
198
|
-
"components": [
|
199
|
-
{
|
200
|
-
"components": [
|
201
|
-
{
|
202
|
-
"internalType": "address",
|
203
|
-
"name": "sourceToken",
|
204
|
-
"type": "address"
|
205
|
-
},
|
206
|
-
{
|
207
|
-
"internalType": "address",
|
208
|
-
"name": "targetToken",
|
209
|
-
"type": "address"
|
210
|
-
},
|
211
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
212
|
-
],
|
213
|
-
"internalType": "struct InteropXContractBeta.TokenInfo[]",
|
214
|
-
"name": "supply",
|
215
|
-
"type": "tuple[]"
|
216
|
-
},
|
217
|
-
{
|
218
|
-
"components": [
|
219
|
-
{
|
220
|
-
"internalType": "address",
|
221
|
-
"name": "sourceToken",
|
222
|
-
"type": "address"
|
223
|
-
},
|
224
|
-
{
|
225
|
-
"internalType": "address",
|
226
|
-
"name": "targetToken",
|
227
|
-
"type": "address"
|
228
|
-
},
|
229
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
230
|
-
],
|
231
|
-
"internalType": "struct InteropXContractBeta.TokenInfo[]",
|
232
|
-
"name": "withdraw",
|
233
|
-
"type": "tuple[]"
|
234
|
-
}
|
235
|
-
],
|
236
|
-
"indexed": false,
|
237
|
-
"internalType": "struct InteropXContractBeta.Position",
|
238
|
-
"name": "position",
|
239
|
-
"type": "tuple"
|
240
|
-
},
|
241
|
-
{
|
242
|
-
"indexed": false,
|
243
|
-
"internalType": "uint256",
|
244
|
-
"name": "sourceChainId",
|
245
|
-
"type": "uint256"
|
246
|
-
},
|
247
|
-
{
|
248
|
-
"indexed": true,
|
249
|
-
"internalType": "uint256",
|
250
|
-
"name": "targetChainId",
|
251
|
-
"type": "uint256"
|
252
|
-
},
|
253
|
-
{
|
254
|
-
"indexed": false,
|
255
|
-
"internalType": "bytes",
|
256
|
-
"name": "metadata",
|
257
|
-
"type": "bytes"
|
258
|
-
}
|
259
|
-
],
|
260
|
-
"name": "LogBridgeRequest",
|
261
|
-
"type": "event"
|
262
|
-
},
|
263
|
-
{
|
264
|
-
"anonymous": false,
|
265
|
-
"inputs": [
|
266
|
-
{
|
267
|
-
"indexed": false,
|
268
|
-
"internalType": "string",
|
269
|
-
"name": "actionId",
|
270
|
-
"type": "string"
|
271
|
-
},
|
272
|
-
{
|
273
|
-
"indexed": true,
|
274
|
-
"internalType": "address",
|
275
|
-
"name": "bridger",
|
276
|
-
"type": "address"
|
277
|
-
},
|
278
|
-
{
|
279
|
-
"components": [
|
280
|
-
{
|
281
|
-
"components": [
|
282
|
-
{
|
283
|
-
"internalType": "address",
|
284
|
-
"name": "sourceToken",
|
285
|
-
"type": "address"
|
286
|
-
},
|
287
|
-
{
|
288
|
-
"internalType": "address",
|
289
|
-
"name": "targetToken",
|
290
|
-
"type": "address"
|
291
|
-
},
|
292
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
293
|
-
],
|
294
|
-
"internalType": "struct InteropXContractBeta.TokenInfo[]",
|
295
|
-
"name": "supply",
|
296
|
-
"type": "tuple[]"
|
297
|
-
},
|
298
|
-
{
|
299
|
-
"components": [
|
300
|
-
{
|
301
|
-
"internalType": "address",
|
302
|
-
"name": "sourceToken",
|
303
|
-
"type": "address"
|
304
|
-
},
|
305
|
-
{
|
306
|
-
"internalType": "address",
|
307
|
-
"name": "targetToken",
|
308
|
-
"type": "address"
|
309
|
-
},
|
310
|
-
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
|
311
|
-
],
|
312
|
-
"internalType": "struct InteropXContractBeta.TokenInfo[]",
|
313
|
-
"name": "withdraw",
|
314
|
-
"type": "tuple[]"
|
315
|
-
}
|
316
|
-
],
|
317
|
-
"indexed": false,
|
318
|
-
"internalType": "struct InteropXContractBeta.Position",
|
319
|
-
"name": "position",
|
320
|
-
"type": "tuple"
|
321
|
-
},
|
322
|
-
{
|
323
|
-
"indexed": false,
|
324
|
-
"internalType": "uint32",
|
325
|
-
"name": "sourceChainId",
|
326
|
-
"type": "uint32"
|
327
|
-
},
|
328
|
-
{
|
329
|
-
"indexed": true,
|
330
|
-
"internalType": "uint32",
|
331
|
-
"name": "targetChainId",
|
332
|
-
"type": "uint32"
|
333
|
-
},
|
334
|
-
{
|
335
|
-
"indexed": true,
|
336
|
-
"internalType": "bytes32",
|
337
|
-
"name": "requestTransactionHash",
|
338
|
-
"type": "bytes32"
|
339
|
-
},
|
340
|
-
{
|
341
|
-
"indexed": false,
|
342
|
-
"internalType": "bytes",
|
343
|
-
"name": "metadata",
|
344
|
-
"type": "bytes"
|
345
|
-
}
|
346
|
-
],
|
347
|
-
"name": "LogBridgeRequestSent",
|
348
|
-
"type": "event"
|
349
|
-
},
|
350
|
-
{
|
351
|
-
"inputs": [
|
352
|
-
{ "internalType": "string", "name": "actionId", "type": "string" },
|
353
|
-
{ "internalType": "address", "name": "to_", "type": "address" },
|
354
|
-
{ "internalType": "address", "name": "sourceToken_", "type": "address" },
|
355
|
-
{ "internalType": "address", "name": "targetToken_", "type": "address" },
|
356
|
-
{ "internalType": "uint256", "name": "amount_", "type": "uint256" },
|
357
|
-
{ "internalType": "uint32", "name": "sourceChainId_", "type": "uint32" },
|
358
|
-
{
|
359
|
-
"internalType": "bytes32",
|
360
|
-
"name": "transactionHash_",
|
361
|
-
"type": "bytes32"
|
362
|
-
},
|
363
|
-
{ "internalType": "bytes", "name": "metadata_", "type": "bytes" }
|
364
|
-
],
|
365
|
-
"name": "completeBridge",
|
366
|
-
"outputs": [],
|
367
|
-
"stateMutability": "nonpayable",
|
368
|
-
"type": "function"
|
369
|
-
},
|
370
|
-
{
|
371
|
-
"inputs": [
|
372
|
-
{ "internalType": "address", "name": "user", "type": "address" },
|
373
|
-
{ "internalType": "address[]", "name": "tokens", "type": "address[]" }
|
374
|
-
],
|
375
|
-
"name": "getBridgeAmounts",
|
376
|
-
"outputs": [
|
377
|
-
{
|
378
|
-
"components": [
|
379
|
-
{ "internalType": "uint256", "name": "deposit", "type": "uint256" },
|
380
|
-
{ "internalType": "uint256", "name": "withdraw", "type": "uint256" }
|
381
|
-
],
|
382
|
-
"internalType": "struct InteropXContractBeta.UserData[]",
|
383
|
-
"name": "userData",
|
384
|
-
"type": "tuple[]"
|
385
|
-
}
|
386
|
-
],
|
387
|
-
"stateMutability": "view",
|
388
|
-
"type": "function"
|
389
|
-
},
|
390
|
-
{
|
391
|
-
"inputs": [
|
392
|
-
{ "internalType": "string", "name": "actionId", "type": "string" },
|
393
|
-
{ "internalType": "address", "name": "sourceToken_", "type": "address" },
|
394
|
-
{ "internalType": "address", "name": "targetToken_", "type": "address" },
|
395
|
-
{ "internalType": "uint256", "name": "amount_", "type": "uint256" },
|
396
|
-
{ "internalType": "uint32", "name": "targetChainId_", "type": "uint32" },
|
397
|
-
{ "internalType": "bytes", "name": "metadata_", "type": "bytes" }
|
398
|
-
],
|
399
|
-
"name": "requestWithdraw",
|
400
|
-
"outputs": [],
|
401
|
-
"stateMutability": "nonpayable",
|
402
|
-
"type": "function"
|
403
|
-
},
|
404
|
-
{
|
405
|
-
"inputs": [
|
406
|
-
{ "internalType": "address", "name": "token", "type": "address" },
|
407
|
-
{ "internalType": "bool", "name": "toggle", "type": "bool" }
|
408
|
-
],
|
409
|
-
"name": "toggleWhitelist",
|
410
|
-
"outputs": [],
|
411
|
-
"stateMutability": "nonpayable",
|
412
|
-
"type": "function"
|
413
|
-
},
|
414
|
-
{
|
415
|
-
"inputs": [
|
416
|
-
{ "internalType": "address", "name": "", "type": "address" },
|
417
|
-
{ "internalType": "address", "name": "", "type": "address" }
|
418
|
-
],
|
419
|
-
"name": "userMapping",
|
420
|
-
"outputs": [
|
421
|
-
{ "internalType": "uint256", "name": "deposit", "type": "uint256" },
|
422
|
-
{ "internalType": "uint256", "name": "withdraw", "type": "uint256" }
|
423
|
-
],
|
424
|
-
"stateMutability": "view",
|
425
|
-
"type": "function"
|
426
|
-
},
|
427
|
-
{
|
428
|
-
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
|
429
|
-
"name": "whitelistedTokens",
|
430
|
-
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
|
431
|
-
"stateMutability": "view",
|
432
|
-
"type": "function"
|
433
|
-
},
|
434
|
-
{
|
435
|
-
"inputs": [
|
436
|
-
{ "internalType": "string", "name": "actionId", "type": "string" },
|
437
|
-
{ "internalType": "address", "name": "user_", "type": "address" },
|
438
|
-
{ "internalType": "address", "name": "sourceToken_", "type": "address" },
|
439
|
-
{ "internalType": "address", "name": "targetToken_", "type": "address" },
|
440
|
-
{ "internalType": "uint256", "name": "amount_", "type": "uint256" },
|
441
|
-
{ "internalType": "uint32", "name": "chainId_", "type": "uint32" },
|
442
|
-
{
|
443
|
-
"internalType": "bytes32",
|
444
|
-
"name": "transactionHash_",
|
445
|
-
"type": "bytes32"
|
446
|
-
},
|
447
|
-
{ "internalType": "bytes", "name": "metadata_", "type": "bytes" }
|
448
|
-
],
|
449
|
-
"name": "withdrawRequested",
|
450
|
-
"outputs": [],
|
451
|
-
"stateMutability": "nonpayable",
|
452
|
-
"type": "function"
|
453
|
-
}
|
454
|
-
]
|
@@ -1,77 +0,0 @@
|
|
1
|
-
import abi from "@/abi";
|
2
|
-
import config from "@/config";
|
3
|
-
import { addresses, tokens } from "@/constants";
|
4
|
-
import { Transaction } from "@/db";
|
5
|
-
import { InteropXContract } from "@/typechain";
|
6
|
-
import { ChainId } from "@/types";
|
7
|
-
import { getContract, getRpcProviderUrl } from "@/utils";
|
8
|
-
import { ethers } from "ethers";
|
9
|
-
import { MetaTransaction, OperationType } from "ethers-multisend";
|
10
|
-
|
11
|
-
export default async function (transaction: Transaction, type: 'source' | 'target') {
|
12
|
-
const transactions: MetaTransaction[] = [];
|
13
|
-
const logs: any[] = [];
|
14
|
-
|
15
|
-
if (transaction.actionId !== 'withdraw') {
|
16
|
-
throw new Error(`Invalid action: ${transaction.actionId}`)
|
17
|
-
}
|
18
|
-
|
19
|
-
if (type !== 'source') {
|
20
|
-
throw new Error(`[WIP] Type not supported: ${type}`)
|
21
|
-
}
|
22
|
-
|
23
|
-
if (transaction.sourceStatus === 'pending') {
|
24
|
-
throw Error('Source transaction already processesing')
|
25
|
-
}
|
26
|
-
|
27
|
-
if (transaction.sourceStatus === 'pending') {
|
28
|
-
throw Error('Source transaction already processed')
|
29
|
-
}
|
30
|
-
|
31
|
-
if (!transaction.requestEvent) {
|
32
|
-
throw Error('Something went wrong, source transaction has no request event')
|
33
|
-
}
|
34
|
-
|
35
|
-
const { actionId, bridger, position, sourceChainId, targetChainId, metadata} = transaction.requestEvent;
|
36
|
-
|
37
|
-
const sourceChainProvider = new ethers.providers.JsonRpcProvider(getRpcProviderUrl(targetChainId as ChainId));
|
38
|
-
const sourceWallet = new ethers.Wallet(config.privateKey, sourceChainProvider);
|
39
|
-
const contractAddress = addresses[sourceChainId].interopXContract;
|
40
|
-
const contract = getContract<InteropXContract>(contractAddress, abi.interopXContract, sourceWallet);
|
41
|
-
|
42
|
-
const sourceToken = tokens[sourceChainId].find(t => t.address.toLowerCase() === position.withdraw[0].sourceToken.toLowerCase());
|
43
|
-
|
44
|
-
if (!sourceToken) {
|
45
|
-
throw Error('Source token not found')
|
46
|
-
}
|
47
|
-
|
48
|
-
const targetToken = tokens[targetChainId].find(t => t.address.toLowerCase() === position.withdraw[0].targetToken.toLowerCase());
|
49
|
-
|
50
|
-
if (!targetToken) {
|
51
|
-
throw Error('Target token not found')
|
52
|
-
}
|
53
|
-
|
54
|
-
if (!sourceToken.aliases.some(alias => targetToken.aliases.includes(alias))) {
|
55
|
-
throw Error('Source and target token must be the same')
|
56
|
-
}
|
57
|
-
|
58
|
-
const { data } = await contract.populateTransaction.withdrawRequested(
|
59
|
-
actionId,
|
60
|
-
bridger,
|
61
|
-
position.withdraw[0].sourceToken,
|
62
|
-
position.withdraw[0].targetToken,
|
63
|
-
position.withdraw[0].amount,
|
64
|
-
targetChainId,
|
65
|
-
transaction.requestTransactionHash,
|
66
|
-
metadata,
|
67
|
-
);
|
68
|
-
|
69
|
-
transactions.push({
|
70
|
-
to: contractAddress,
|
71
|
-
data: data!,
|
72
|
-
value: '0',
|
73
|
-
operation: OperationType.Call,
|
74
|
-
});
|
75
|
-
|
76
|
-
return { transactions, logs }
|
77
|
-
}
|