@instadapp/interop-x 0.0.0-dev.50c72b9 → 0.0.0-dev.55e8bb4
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 +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 -0
- package/dist/src/abi/instList.json +232 -0
- package/dist/src/constants/addresses.js +5 -1
- package/dist/src/constants/blockConfirmations.js +8 -0
- package/dist/src/constants/index.js +1 -0
- package/dist/src/db/models/transaction.js +15 -11
- package/dist/src/gnosis/actions/aaveV2/index.js +11 -0
- package/dist/src/gnosis/actions/aaveV2/source.js +73 -0
- package/dist/src/gnosis/actions/aaveV2/target.js +85 -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 +179 -0
- package/dist/src/tasks/InteropX/ProcessValidateEvents.js +183 -0
- package/dist/src/tasks/InteropX/SyncLogSubmitEvents.js +8 -5
- package/dist/src/tasks/InteropX/SyncLogValidateEvents.js +105 -0
- package/dist/src/tasks/Transactions/SyncTransactionStatusTask.js +4 -3
- package/dist/src/tasks/index.js +11 -0
- package/dist/src/typechain/InstList.js +2 -0
- package/dist/src/typechain/factories/InstList__factory.js +249 -0
- package/dist/src/typechain/factories/index.js +3 -1
- package/dist/src/typechain/index.js +3 -1
- package/dist/src/utils/index.js +58 -30
- 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 +8 -4
- package/src/abi/instList.json +232 -0
- package/src/constants/addresses.ts +6 -2
- package/src/constants/blockConfirmations.ts +5 -0
- package/src/constants/index.ts +1 -0
- package/src/db/models/transaction.ts +117 -84
- package/src/gnosis/actions/aaveV2/index.ts +9 -0
- package/src/gnosis/actions/aaveV2/source.ts +118 -0
- package/src/gnosis/actions/aaveV2/target.ts +140 -0
- package/src/gnosis/actions/index.ts +2 -2
- package/src/net/protocol/dial/SignatureDialProtocol.ts +3 -2
- package/src/tasks/InteropX/ProcessSubmitSubmitEvents.ts +269 -0
- package/src/tasks/InteropX/ProcessValidateEvents.ts +274 -0
- package/src/tasks/InteropX/SyncLogSubmitEvents.ts +119 -116
- package/src/tasks/InteropX/SyncLogValidateEvents.ts +152 -0
- package/src/tasks/Transactions/SyncTransactionStatusTask.ts +4 -3
- package/src/tasks/index.ts +14 -1
- package/src/typechain/InstList.ts +402 -0
- package/src/typechain/factories/InstList__factory.ts +253 -0
- package/src/typechain/factories/index.ts +1 -0
- package/src/typechain/index.ts +2 -0
- package/src/utils/index.ts +169 -93
- package/dist/src/gnosis/actions/withdraw/index.js +0 -114
- package/src/gnosis/actions/withdraw/index.ts +0 -155
package/dist/src/tasks/index.js
CHANGED
@@ -5,8 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.Tasks = void 0;
|
7
7
|
const waait_1 = __importDefault(require("waait"));
|
8
|
+
const SyncTransactionStatusTask_1 = __importDefault(require("./Transactions/SyncTransactionStatusTask"));
|
8
9
|
const AutoUpdateTask_1 = __importDefault(require("./AutoUpdateTask"));
|
9
10
|
const SyncLogSubmitEvents_1 = __importDefault(require("./InteropX/SyncLogSubmitEvents"));
|
11
|
+
const ProcessSubmitSubmitEvents_1 = __importDefault(require("./InteropX/ProcessSubmitSubmitEvents"));
|
12
|
+
const SyncLogValidateEvents_1 = __importDefault(require("./InteropX/SyncLogValidateEvents"));
|
13
|
+
const ProcessValidateEvents_1 = __importDefault(require("./InteropX/ProcessValidateEvents"));
|
10
14
|
class Tasks {
|
11
15
|
constructor() {
|
12
16
|
this.tasks = [
|
@@ -15,6 +19,13 @@ class Tasks {
|
|
15
19
|
// InteropX
|
16
20
|
new SyncLogSubmitEvents_1.default({ chainId: 137 }),
|
17
21
|
new SyncLogSubmitEvents_1.default({ chainId: 43114 }),
|
22
|
+
new ProcessSubmitSubmitEvents_1.default({ chainId: 137 }),
|
23
|
+
new ProcessSubmitSubmitEvents_1.default({ chainId: 43114 }),
|
24
|
+
new SyncLogValidateEvents_1.default({ chainId: 137 }),
|
25
|
+
new SyncLogValidateEvents_1.default({ chainId: 43114 }),
|
26
|
+
new ProcessValidateEvents_1.default({ chainId: 137 }),
|
27
|
+
new ProcessValidateEvents_1.default({ chainId: 43114 }),
|
28
|
+
new SyncTransactionStatusTask_1.default(),
|
18
29
|
];
|
19
30
|
}
|
20
31
|
async start() {
|
@@ -0,0 +1,249 @@
|
|
1
|
+
"use strict";
|
2
|
+
/* Autogenerated file. Do not edit manually. */
|
3
|
+
/* tslint:disable */
|
4
|
+
/* eslint-disable */
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.InstList__factory = void 0;
|
7
|
+
const ethers_1 = require("ethers");
|
8
|
+
const _abi = [
|
9
|
+
{
|
10
|
+
inputs: [
|
11
|
+
{
|
12
|
+
internalType: "address",
|
13
|
+
name: "_instaIndex",
|
14
|
+
type: "address",
|
15
|
+
},
|
16
|
+
],
|
17
|
+
stateMutability: "nonpayable",
|
18
|
+
type: "constructor",
|
19
|
+
},
|
20
|
+
{
|
21
|
+
inputs: [
|
22
|
+
{
|
23
|
+
internalType: "uint64",
|
24
|
+
name: "",
|
25
|
+
type: "uint64",
|
26
|
+
},
|
27
|
+
],
|
28
|
+
name: "accountAddr",
|
29
|
+
outputs: [
|
30
|
+
{
|
31
|
+
internalType: "address",
|
32
|
+
name: "",
|
33
|
+
type: "address",
|
34
|
+
},
|
35
|
+
],
|
36
|
+
stateMutability: "view",
|
37
|
+
type: "function",
|
38
|
+
},
|
39
|
+
{
|
40
|
+
inputs: [
|
41
|
+
{
|
42
|
+
internalType: "address",
|
43
|
+
name: "",
|
44
|
+
type: "address",
|
45
|
+
},
|
46
|
+
],
|
47
|
+
name: "accountID",
|
48
|
+
outputs: [
|
49
|
+
{
|
50
|
+
internalType: "uint64",
|
51
|
+
name: "",
|
52
|
+
type: "uint64",
|
53
|
+
},
|
54
|
+
],
|
55
|
+
stateMutability: "view",
|
56
|
+
type: "function",
|
57
|
+
},
|
58
|
+
{
|
59
|
+
inputs: [
|
60
|
+
{
|
61
|
+
internalType: "uint64",
|
62
|
+
name: "",
|
63
|
+
type: "uint64",
|
64
|
+
},
|
65
|
+
],
|
66
|
+
name: "accountLink",
|
67
|
+
outputs: [
|
68
|
+
{
|
69
|
+
internalType: "address",
|
70
|
+
name: "first",
|
71
|
+
type: "address",
|
72
|
+
},
|
73
|
+
{
|
74
|
+
internalType: "address",
|
75
|
+
name: "last",
|
76
|
+
type: "address",
|
77
|
+
},
|
78
|
+
{
|
79
|
+
internalType: "uint64",
|
80
|
+
name: "count",
|
81
|
+
type: "uint64",
|
82
|
+
},
|
83
|
+
],
|
84
|
+
stateMutability: "view",
|
85
|
+
type: "function",
|
86
|
+
},
|
87
|
+
{
|
88
|
+
inputs: [
|
89
|
+
{
|
90
|
+
internalType: "uint64",
|
91
|
+
name: "",
|
92
|
+
type: "uint64",
|
93
|
+
},
|
94
|
+
{
|
95
|
+
internalType: "address",
|
96
|
+
name: "",
|
97
|
+
type: "address",
|
98
|
+
},
|
99
|
+
],
|
100
|
+
name: "accountList",
|
101
|
+
outputs: [
|
102
|
+
{
|
103
|
+
internalType: "address",
|
104
|
+
name: "prev",
|
105
|
+
type: "address",
|
106
|
+
},
|
107
|
+
{
|
108
|
+
internalType: "address",
|
109
|
+
name: "next",
|
110
|
+
type: "address",
|
111
|
+
},
|
112
|
+
],
|
113
|
+
stateMutability: "view",
|
114
|
+
type: "function",
|
115
|
+
},
|
116
|
+
{
|
117
|
+
inputs: [],
|
118
|
+
name: "accounts",
|
119
|
+
outputs: [
|
120
|
+
{
|
121
|
+
internalType: "uint64",
|
122
|
+
name: "",
|
123
|
+
type: "uint64",
|
124
|
+
},
|
125
|
+
],
|
126
|
+
stateMutability: "view",
|
127
|
+
type: "function",
|
128
|
+
},
|
129
|
+
{
|
130
|
+
inputs: [
|
131
|
+
{
|
132
|
+
internalType: "address",
|
133
|
+
name: "_owner",
|
134
|
+
type: "address",
|
135
|
+
},
|
136
|
+
],
|
137
|
+
name: "addAuth",
|
138
|
+
outputs: [],
|
139
|
+
stateMutability: "nonpayable",
|
140
|
+
type: "function",
|
141
|
+
},
|
142
|
+
{
|
143
|
+
inputs: [
|
144
|
+
{
|
145
|
+
internalType: "address",
|
146
|
+
name: "_account",
|
147
|
+
type: "address",
|
148
|
+
},
|
149
|
+
],
|
150
|
+
name: "init",
|
151
|
+
outputs: [],
|
152
|
+
stateMutability: "nonpayable",
|
153
|
+
type: "function",
|
154
|
+
},
|
155
|
+
{
|
156
|
+
inputs: [],
|
157
|
+
name: "instaIndex",
|
158
|
+
outputs: [
|
159
|
+
{
|
160
|
+
internalType: "address",
|
161
|
+
name: "",
|
162
|
+
type: "address",
|
163
|
+
},
|
164
|
+
],
|
165
|
+
stateMutability: "view",
|
166
|
+
type: "function",
|
167
|
+
},
|
168
|
+
{
|
169
|
+
inputs: [
|
170
|
+
{
|
171
|
+
internalType: "address",
|
172
|
+
name: "_owner",
|
173
|
+
type: "address",
|
174
|
+
},
|
175
|
+
],
|
176
|
+
name: "removeAuth",
|
177
|
+
outputs: [],
|
178
|
+
stateMutability: "nonpayable",
|
179
|
+
type: "function",
|
180
|
+
},
|
181
|
+
{
|
182
|
+
inputs: [
|
183
|
+
{
|
184
|
+
internalType: "address",
|
185
|
+
name: "",
|
186
|
+
type: "address",
|
187
|
+
},
|
188
|
+
],
|
189
|
+
name: "userLink",
|
190
|
+
outputs: [
|
191
|
+
{
|
192
|
+
internalType: "uint64",
|
193
|
+
name: "first",
|
194
|
+
type: "uint64",
|
195
|
+
},
|
196
|
+
{
|
197
|
+
internalType: "uint64",
|
198
|
+
name: "last",
|
199
|
+
type: "uint64",
|
200
|
+
},
|
201
|
+
{
|
202
|
+
internalType: "uint64",
|
203
|
+
name: "count",
|
204
|
+
type: "uint64",
|
205
|
+
},
|
206
|
+
],
|
207
|
+
stateMutability: "view",
|
208
|
+
type: "function",
|
209
|
+
},
|
210
|
+
{
|
211
|
+
inputs: [
|
212
|
+
{
|
213
|
+
internalType: "address",
|
214
|
+
name: "",
|
215
|
+
type: "address",
|
216
|
+
},
|
217
|
+
{
|
218
|
+
internalType: "uint64",
|
219
|
+
name: "",
|
220
|
+
type: "uint64",
|
221
|
+
},
|
222
|
+
],
|
223
|
+
name: "userList",
|
224
|
+
outputs: [
|
225
|
+
{
|
226
|
+
internalType: "uint64",
|
227
|
+
name: "prev",
|
228
|
+
type: "uint64",
|
229
|
+
},
|
230
|
+
{
|
231
|
+
internalType: "uint64",
|
232
|
+
name: "next",
|
233
|
+
type: "uint64",
|
234
|
+
},
|
235
|
+
],
|
236
|
+
stateMutability: "view",
|
237
|
+
type: "function",
|
238
|
+
},
|
239
|
+
];
|
240
|
+
class InstList__factory {
|
241
|
+
static createInterface() {
|
242
|
+
return new ethers_1.utils.Interface(_abi);
|
243
|
+
}
|
244
|
+
static connect(address, signerOrProvider) {
|
245
|
+
return new ethers_1.Contract(address, _abi, signerOrProvider);
|
246
|
+
}
|
247
|
+
}
|
248
|
+
exports.InstList__factory = InstList__factory;
|
249
|
+
InstList__factory.abi = _abi;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.InteropX__factory = exports.GnosisSafe__factory = exports.Erc20__factory = void 0;
|
3
|
+
exports.InteropX__factory = exports.InstList__factory = exports.GnosisSafe__factory = exports.Erc20__factory = void 0;
|
4
4
|
/* Autogenerated file. Do not edit manually. */
|
5
5
|
/* tslint:disable */
|
6
6
|
/* eslint-disable */
|
@@ -8,5 +8,7 @@ var Erc20__factory_1 = require("./Erc20__factory");
|
|
8
8
|
Object.defineProperty(exports, "Erc20__factory", { enumerable: true, get: function () { return Erc20__factory_1.Erc20__factory; } });
|
9
9
|
var GnosisSafe__factory_1 = require("./GnosisSafe__factory");
|
10
10
|
Object.defineProperty(exports, "GnosisSafe__factory", { enumerable: true, get: function () { return GnosisSafe__factory_1.GnosisSafe__factory; } });
|
11
|
+
var InstList__factory_1 = require("./InstList__factory");
|
12
|
+
Object.defineProperty(exports, "InstList__factory", { enumerable: true, get: function () { return InstList__factory_1.InstList__factory; } });
|
11
13
|
var InteropX__factory_1 = require("./InteropX__factory");
|
12
14
|
Object.defineProperty(exports, "InteropX__factory", { enumerable: true, get: function () { return InteropX__factory_1.InteropX__factory; } });
|
@@ -23,11 +23,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
23
|
return result;
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.InteropX__factory = exports.GnosisSafe__factory = exports.Erc20__factory = exports.factories = void 0;
|
26
|
+
exports.InteropX__factory = exports.InstList__factory = exports.GnosisSafe__factory = exports.Erc20__factory = exports.factories = void 0;
|
27
27
|
exports.factories = __importStar(require("./factories"));
|
28
28
|
var Erc20__factory_1 = require("./factories/Erc20__factory");
|
29
29
|
Object.defineProperty(exports, "Erc20__factory", { enumerable: true, get: function () { return Erc20__factory_1.Erc20__factory; } });
|
30
30
|
var GnosisSafe__factory_1 = require("./factories/GnosisSafe__factory");
|
31
31
|
Object.defineProperty(exports, "GnosisSafe__factory", { enumerable: true, get: function () { return GnosisSafe__factory_1.GnosisSafe__factory; } });
|
32
|
+
var InstList__factory_1 = require("./factories/InstList__factory");
|
33
|
+
Object.defineProperty(exports, "InstList__factory", { enumerable: true, get: function () { return InstList__factory_1.InstList__factory; } });
|
32
34
|
var InteropX__factory_1 = require("./factories/InteropX__factory");
|
33
35
|
Object.defineProperty(exports, "InteropX__factory", { enumerable: true, get: function () { return InteropX__factory_1.InteropX__factory; } });
|
package/dist/src/utils/index.js
CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.LiquidityError = exports.generateGnosisTransaction = exports.getContract = exports.ContractError = exports.generateInteropTransactionHash = exports.asyncCallWithTimeout = exports.buildSignatureBytes = exports.getRpcProviderUrl = exports.signGnosisSafeTx = exports.short = exports.shortenHash = exports.http = void 0;
|
6
|
+
exports.encodeConnectorMethod = exports.LiquidityError = exports.generateGnosisTransaction = exports.getContract = exports.ContractError = exports.generateInteropTransactionHash = exports.asyncCallWithTimeout = exports.buildSignatureBytes = exports.getRpcProviderUrl = exports.signGnosisSafeTx = exports.short = exports.shortenHash = exports.http = void 0;
|
7
7
|
/**
|
8
8
|
* @module util
|
9
9
|
*/
|
@@ -12,6 +12,8 @@ const axios_retry_1 = __importDefault(require("axios-retry"));
|
|
12
12
|
const constants_1 = require("@/constants");
|
13
13
|
const ethers_1 = require("ethers");
|
14
14
|
const async_retry_1 = __importDefault(require("async-retry"));
|
15
|
+
const connectors_1 = require("@/abi/connectors");
|
16
|
+
const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
|
15
17
|
exports.http = axios_1.default.create();
|
16
18
|
(0, axios_retry_1.default)(exports.http, { retries: 3, retryDelay: axios_retry_1.default.exponentialDelay });
|
17
19
|
function shortenHash(hash, length = 4) {
|
@@ -25,10 +27,10 @@ function shortenHash(hash, length = 4) {
|
|
25
27
|
}
|
26
28
|
exports.shortenHash = shortenHash;
|
27
29
|
function short(buffer) {
|
28
|
-
return buffer.toString(
|
30
|
+
return buffer.toString("hex").slice(0, 8) + "...";
|
29
31
|
}
|
30
32
|
exports.short = short;
|
31
|
-
const signGnosisSafeTx = async ({ to, data = null, value =
|
33
|
+
const signGnosisSafeTx = async ({ to, data = null, value = "0", operation = "1", baseGas = "0", gasPrice = "0", gasToken = "0x0000000000000000000000000000000000000000", refundReceiver = "0x0000000000000000000000000000000000000000", safeTxGas = "79668", nonce = "0", chainId = 137, }, { signer }) => {
|
32
34
|
const gnosisSafe = constants_1.addresses[chainId].gnosisSafe;
|
33
35
|
const domain = {
|
34
36
|
verifyingContract: gnosisSafe,
|
@@ -36,16 +38,16 @@ const signGnosisSafeTx = async ({ to, data = null, value = '0', operation = '1',
|
|
36
38
|
};
|
37
39
|
const types = {
|
38
40
|
SafeTx: [
|
39
|
-
{ type:
|
40
|
-
{ type:
|
41
|
-
{ type:
|
42
|
-
{ type:
|
43
|
-
{ type:
|
44
|
-
{ type:
|
45
|
-
{ type:
|
46
|
-
{ type:
|
47
|
-
{ type:
|
48
|
-
{ type:
|
41
|
+
{ type: "address", name: "to" },
|
42
|
+
{ type: "uint256", name: "value" },
|
43
|
+
{ type: "bytes", name: "data" },
|
44
|
+
{ type: "uint8", name: "operation" },
|
45
|
+
{ type: "uint256", name: "safeTxGas" },
|
46
|
+
{ type: "uint256", name: "baseGas" },
|
47
|
+
{ type: "uint256", name: "gasPrice" },
|
48
|
+
{ type: "address", name: "gasToken" },
|
49
|
+
{ type: "address", name: "refundReceiver" },
|
50
|
+
{ type: "uint256", name: "nonce" },
|
49
51
|
],
|
50
52
|
};
|
51
53
|
const message = {
|
@@ -67,11 +69,11 @@ exports.signGnosisSafeTx = signGnosisSafeTx;
|
|
67
69
|
const getRpcProviderUrl = (chainId) => {
|
68
70
|
switch (chainId) {
|
69
71
|
case 1:
|
70
|
-
return
|
72
|
+
return "https://rpc.ankr.com/eth";
|
71
73
|
case 137:
|
72
|
-
return
|
74
|
+
return "https://rpc.ankr.com/polygon";
|
73
75
|
case 43114:
|
74
|
-
return
|
76
|
+
return "https://rpc.ankr.com/avalanche";
|
75
77
|
default:
|
76
78
|
throw new Error(`Unknown chainId: ${chainId}`);
|
77
79
|
}
|
@@ -93,16 +95,16 @@ exports.buildSignatureBytes = buildSignatureBytes;
|
|
93
95
|
const asyncCallWithTimeout = async (asyncPromise, timeout) => {
|
94
96
|
let timeoutHandle;
|
95
97
|
const timeoutPromise = new Promise((_resolve, reject) => {
|
96
|
-
timeoutHandle = setTimeout(() => reject(new Error(
|
98
|
+
timeoutHandle = setTimeout(() => reject(new Error("Async call timeout limit reached")), timeout);
|
97
99
|
});
|
98
|
-
return Promise.race([asyncPromise, timeoutPromise]).then(result => {
|
100
|
+
return Promise.race([asyncPromise, timeoutPromise]).then((result) => {
|
99
101
|
clearTimeout(timeoutHandle);
|
100
102
|
return result;
|
101
103
|
});
|
102
104
|
};
|
103
105
|
exports.asyncCallWithTimeout = asyncCallWithTimeout;
|
104
106
|
const generateInteropTransactionHash = (data) => {
|
105
|
-
return ethers_1.ethers.utils.solidityKeccak256(Array.from(
|
107
|
+
return ethers_1.ethers.utils.solidityKeccak256(Array.from({ length: 7 }, () => "string"), [
|
106
108
|
String(data.actionId),
|
107
109
|
String(data.vnonce),
|
108
110
|
String(data.sourceSender),
|
@@ -117,25 +119,27 @@ class ContractError extends Error {
|
|
117
119
|
}
|
118
120
|
exports.ContractError = ContractError;
|
119
121
|
function getContract(address, contractInterface, signerOrProvider) {
|
120
|
-
if (!ethers_1.ethers.utils.getAddress(address) ||
|
122
|
+
if (!ethers_1.ethers.utils.getAddress(address) ||
|
123
|
+
address === ethers_1.ethers.constants.AddressZero) {
|
121
124
|
throw Error(`Invalid 'address' parameter '${address}'.`);
|
122
125
|
}
|
123
126
|
const contract = new ethers_1.ethers.Contract(address, contractInterface, signerOrProvider);
|
124
127
|
// Make sure the contract properties is writable
|
125
|
-
const desc = Object.getOwnPropertyDescriptor(contract,
|
128
|
+
const desc = Object.getOwnPropertyDescriptor(contract, "functions");
|
126
129
|
if (!desc || desc.writable !== true) {
|
127
130
|
return contract;
|
128
131
|
}
|
129
132
|
return new Proxy(contract, {
|
130
133
|
get(target, prop, receiver) {
|
131
134
|
const value = Reflect.get(target, prop, receiver);
|
132
|
-
if (typeof value ===
|
135
|
+
if (typeof value === "function" &&
|
136
|
+
(contract.functions.hasOwnProperty(prop) ||
|
137
|
+
["queryFilter"].includes(String(prop)))) {
|
133
138
|
let isConstant = false;
|
134
139
|
try {
|
135
140
|
isConstant = contract.interface.getFunction(String(prop)).constant;
|
136
141
|
}
|
137
|
-
catch (error) {
|
138
|
-
}
|
142
|
+
catch (error) { }
|
139
143
|
return async (...args) => {
|
140
144
|
try {
|
141
145
|
return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: isConstant ? 1 : 3 });
|
@@ -149,15 +153,21 @@ function getContract(address, contractInterface, signerOrProvider) {
|
|
149
153
|
}
|
150
154
|
};
|
151
155
|
}
|
152
|
-
if (typeof value ===
|
156
|
+
if (typeof value === "object" &&
|
157
|
+
[
|
158
|
+
"populateTransaction",
|
159
|
+
"estimateGas",
|
160
|
+
"functions",
|
161
|
+
"callStatic",
|
162
|
+
].includes(String(prop))) {
|
153
163
|
const parentProp = String(prop);
|
154
164
|
return new Proxy(value, {
|
155
165
|
get(target, prop, receiver) {
|
156
166
|
const value = Reflect.get(target, prop, receiver);
|
157
|
-
if (typeof value ===
|
167
|
+
if (typeof value === "function") {
|
158
168
|
return async (...args) => {
|
159
169
|
try {
|
160
|
-
return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: parentProp ===
|
170
|
+
return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: parentProp === "callStatic" ? 3 : 1 });
|
161
171
|
}
|
162
172
|
catch (error) {
|
163
173
|
const err = new ContractError(`Error calling "${String(prop)}" using "${parentProp}" on "${address}": ${error.reason || error.message}`);
|
@@ -168,7 +178,7 @@ function getContract(address, contractInterface, signerOrProvider) {
|
|
168
178
|
}
|
169
179
|
};
|
170
180
|
}
|
171
|
-
}
|
181
|
+
},
|
172
182
|
});
|
173
183
|
}
|
174
184
|
return value;
|
@@ -180,7 +190,9 @@ const generateGnosisTransaction = async (transactionData, safeContract) => {
|
|
180
190
|
console.log(transactionData);
|
181
191
|
let isExecuted = await safeContract.dataHashes(await safeContract.getTransactionHash(transactionData.to, transactionData.value, transactionData.data, transactionData.operation, transactionData.safeTxGas, transactionData.baseGas, transactionData.gasPrice, transactionData.gasToken, transactionData.refundReceiver, transactionData.nonce));
|
182
192
|
while (isExecuted == 1) {
|
183
|
-
transactionData.safeTxGas = ethers_1.ethers.BigNumber.from(String(transactionData.safeTxGas))
|
193
|
+
transactionData.safeTxGas = ethers_1.ethers.BigNumber.from(String(transactionData.safeTxGas))
|
194
|
+
.add(1)
|
195
|
+
.toString();
|
184
196
|
isExecuted = await safeContract.dataHashes(await safeContract.getTransactionHash(transactionData.to, transactionData.value, transactionData.data, transactionData.operation, transactionData.safeTxGas, transactionData.baseGas, transactionData.gasPrice, transactionData.gasToken, transactionData.refundReceiver, transactionData.nonce));
|
185
197
|
}
|
186
198
|
return transactionData;
|
@@ -188,8 +200,24 @@ const generateGnosisTransaction = async (transactionData, safeContract) => {
|
|
188
200
|
exports.generateGnosisTransaction = generateGnosisTransaction;
|
189
201
|
class LiquidityError extends Error {
|
190
202
|
constructor(message) {
|
191
|
-
super(message ||
|
203
|
+
super(message || "Not enough liquidity");
|
192
204
|
Object.setPrototypeOf(this, new.target.prototype);
|
193
205
|
}
|
194
206
|
}
|
195
207
|
exports.LiquidityError = LiquidityError;
|
208
|
+
const encodeConnectorMethod = (params) => {
|
209
|
+
const connectorInterface = getInterface(connectors_1.connectors.versions[2][params.connector], params.method);
|
210
|
+
if (!connectorInterface)
|
211
|
+
throw new Error(`ConnectorInterface '${params.method}' not found`);
|
212
|
+
//@ts-ignore
|
213
|
+
return web3_eth_abi_1.default.encodeFunctionCall(connectorInterface, params.args);
|
214
|
+
};
|
215
|
+
exports.encodeConnectorMethod = encodeConnectorMethod;
|
216
|
+
const getInterface = (abiItems, method) => {
|
217
|
+
const abiItem = abiItems.find((abiItem) => abiItem.name === method);
|
218
|
+
if (!abiItem) {
|
219
|
+
console.error(`${method} is an invalid method.`);
|
220
|
+
return;
|
221
|
+
}
|
222
|
+
return abiItem;
|
223
|
+
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@instadapp/interop-x",
|
3
|
-
"version": "0.0.0-dev.
|
3
|
+
"version": "0.0.0-dev.55e8bb4",
|
4
4
|
"license": "MIT",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"engines": {
|
@@ -52,7 +52,9 @@
|
|
52
52
|
"postinstall-postinstall": "^2.1.0",
|
53
53
|
"sequelize": "6.18.0",
|
54
54
|
"sqlite3": "^5.0.8",
|
55
|
-
"waait": "^1.0.5"
|
55
|
+
"waait": "^1.0.5",
|
56
|
+
"web3-eth-abi": "^1.7.3",
|
57
|
+
"web3-utils": "^1.7.3"
|
56
58
|
},
|
57
59
|
"bin": {
|
58
60
|
"interop-x": "bin/interop-x",
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export * as connectorsV1 from './v1'
|
2
|
+
export * as connectorsV2_M1 from './v2'
|
3
|
+
|
4
|
+
import * as connectorsV1 from './v1'
|
5
|
+
import { connectorsV2_M1 } from './v2'
|
6
|
+
|
7
|
+
export type Connector = keyof typeof connectorsV1 | keyof typeof connectorsV2_M1
|
8
|
+
|
9
|
+
export const connectors = {
|
10
|
+
versions: {
|
11
|
+
1: connectorsV1,
|
12
|
+
2: connectorsV2_M1
|
13
|
+
}
|
14
|
+
}
|