@instadapp/interop-x 0.0.0-dev.ee3d74b → 0.0.0-dev.ef38dfb

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.
Files changed (55) hide show
  1. package/dist/package.json +3 -1
  2. package/dist/src/abi/index.js +2 -0
  3. package/dist/src/abi/instList.json +232 -0
  4. package/dist/src/api/index.js +7 -0
  5. package/dist/src/constants/addresses.js +4 -2
  6. package/dist/src/db/models/transaction.js +15 -7
  7. package/dist/src/errors/index.js +10 -0
  8. package/dist/src/gnosis/actions/aaveV2/source.js +15 -4
  9. package/dist/src/gnosis/actions/aaveV2/target.js +78 -0
  10. package/dist/src/index.js +1 -1
  11. package/dist/src/tasks/InteropX/ProcessSubmitSubmitEvents.js +15 -3
  12. package/dist/src/tasks/InteropX/ProcessValidateEvents.js +184 -0
  13. package/dist/src/tasks/InteropX/SyncLogExecuteEvents.js +112 -0
  14. package/dist/src/tasks/InteropX/SyncLogSubmitEvents.js +1 -0
  15. package/dist/src/tasks/InteropX/SyncLogValidateEvents.js +105 -0
  16. package/dist/src/tasks/index.js +10 -1
  17. package/dist/src/typechain/InstList.js +2 -0
  18. package/dist/src/typechain/factories/InstList__factory.js +249 -0
  19. package/dist/src/typechain/factories/index.js +3 -1
  20. package/dist/src/typechain/index.js +3 -1
  21. package/dist/src/utils/async.js +18 -0
  22. package/dist/src/utils/dsa.js +24 -0
  23. package/dist/src/utils/formatting.js +17 -0
  24. package/dist/src/utils/gnosis.js +62 -0
  25. package/dist/src/utils/http.js +10 -0
  26. package/dist/src/utils/index.js +20 -219
  27. package/dist/src/utils/interop.js +16 -0
  28. package/dist/src/utils/web3.js +92 -0
  29. package/package.json +3 -1
  30. package/src/abi/index.ts +2 -0
  31. package/src/abi/instList.json +232 -0
  32. package/src/api/index.ts +8 -0
  33. package/src/constants/addresses.ts +5 -3
  34. package/src/db/models/transaction.ts +134 -80
  35. package/src/errors/index.ts +6 -0
  36. package/src/gnosis/actions/aaveV2/source.ts +19 -5
  37. package/src/gnosis/actions/aaveV2/target.ts +130 -2
  38. package/src/tasks/InteropX/ProcessSubmitSubmitEvents.ts +20 -3
  39. package/src/tasks/InteropX/ProcessValidateEvents.ts +274 -0
  40. package/src/tasks/InteropX/SyncLogExecuteEvents.ts +162 -0
  41. package/src/tasks/InteropX/SyncLogSubmitEvents.ts +1 -0
  42. package/src/tasks/InteropX/SyncLogValidateEvents.ts +152 -0
  43. package/src/tasks/index.ts +13 -1
  44. package/src/typechain/InstList.ts +402 -0
  45. package/src/typechain/factories/InstList__factory.ts +253 -0
  46. package/src/typechain/factories/index.ts +1 -0
  47. package/src/typechain/index.ts +2 -0
  48. package/src/utils/async.ts +22 -0
  49. package/src/utils/dsa.ts +30 -0
  50. package/src/utils/formatting.ts +15 -0
  51. package/src/utils/gnosis.ts +123 -0
  52. package/src/utils/http.ts +6 -0
  53. package/src/utils/index.ts +7 -365
  54. package/src/utils/interop.ts +28 -0
  55. package/src/utils/web3.ts +131 -0
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getContract = exports.ContractError = exports.getRpcProviderUrl = void 0;
7
+ const async_retry_1 = __importDefault(require("async-retry"));
8
+ const ethers_1 = require("ethers");
9
+ const getRpcProviderUrl = (chainId) => {
10
+ switch (chainId) {
11
+ case 1:
12
+ return "https://rpc.ankr.com/eth";
13
+ case 137:
14
+ return "https://rpc.ankr.com/polygon";
15
+ case 43114:
16
+ return "https://rpc.ankr.com/avalanche";
17
+ default:
18
+ throw new Error(`Unknown chainId: ${chainId}`);
19
+ }
20
+ };
21
+ exports.getRpcProviderUrl = getRpcProviderUrl;
22
+ class ContractError extends Error {
23
+ }
24
+ exports.ContractError = ContractError;
25
+ function getContract(address, contractInterface, signerOrProvider) {
26
+ if (!ethers_1.ethers.utils.getAddress(address) ||
27
+ address === ethers_1.ethers.constants.AddressZero) {
28
+ throw Error(`Invalid 'address' parameter '${address}'.`);
29
+ }
30
+ const contract = new ethers_1.ethers.Contract(address, contractInterface, signerOrProvider);
31
+ // Make sure the contract properties is writable
32
+ const desc = Object.getOwnPropertyDescriptor(contract, "functions");
33
+ if (!desc || desc.writable !== true) {
34
+ return contract;
35
+ }
36
+ return new Proxy(contract, {
37
+ get(target, prop, receiver) {
38
+ const value = Reflect.get(target, prop, receiver);
39
+ if (typeof value === "function" &&
40
+ (contract.functions.hasOwnProperty(prop) ||
41
+ ["queryFilter"].includes(String(prop)))) {
42
+ let isConstant = false;
43
+ try {
44
+ isConstant = contract.interface.getFunction(String(prop)).constant;
45
+ }
46
+ catch (error) { }
47
+ return async (...args) => {
48
+ try {
49
+ return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: isConstant ? 1 : 3 });
50
+ }
51
+ catch (error) {
52
+ const err = new ContractError(`Error calling "${String(prop)}" on "${address}": ${error.reason || error.message}`);
53
+ err.method = String(prop);
54
+ err.address = address;
55
+ err.args = [...args];
56
+ throw err;
57
+ }
58
+ };
59
+ }
60
+ if (typeof value === "object" &&
61
+ [
62
+ "populateTransaction",
63
+ "estimateGas",
64
+ "functions",
65
+ "callStatic",
66
+ ].includes(String(prop))) {
67
+ const parentProp = String(prop);
68
+ return new Proxy(value, {
69
+ get(target, prop, receiver) {
70
+ const value = Reflect.get(target, prop, receiver);
71
+ if (typeof value === "function") {
72
+ return async (...args) => {
73
+ try {
74
+ return await (0, async_retry_1.default)(async () => await value.bind(contract)(...args), { retries: parentProp === "callStatic" ? 3 : 1 });
75
+ }
76
+ catch (error) {
77
+ const err = new ContractError(`Error calling "${String(prop)}" using "${parentProp}" on "${address}": ${error.reason || error.message}`);
78
+ err.method = String(prop);
79
+ err.address = address;
80
+ err.args = [...args];
81
+ throw err;
82
+ }
83
+ };
84
+ }
85
+ },
86
+ });
87
+ }
88
+ return value;
89
+ },
90
+ });
91
+ }
92
+ exports.getContract = getContract;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instadapp/interop-x",
3
- "version": "0.0.0-dev.ee3d74b",
3
+ "version": "0.0.0-dev.ef38dfb",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -53,6 +53,7 @@
53
53
  "sequelize": "6.18.0",
54
54
  "sqlite3": "^5.0.8",
55
55
  "waait": "^1.0.5",
56
+ "web3-eth-abi": "^1.7.3",
56
57
  "web3-utils": "^1.7.3"
57
58
  },
58
59
  "bin": {
@@ -61,6 +62,7 @@
61
62
  },
62
63
  "devDependencies": {
63
64
  "@typechain/ethers-v5": "^10.0.0",
65
+ "@types/async-retry": "^1.4.4",
64
66
  "@types/bn.js": "^5.1.0",
65
67
  "@types/fs-extra": "^9.0.13",
66
68
  "@types/node": "^17.0.33",
package/src/abi/index.ts CHANGED
@@ -2,10 +2,12 @@ import gnosisSafe from "./gnosisSafe.json";
2
2
  import erc20 from "./erc20.json";
3
3
  import interopX from "./interopX.json";
4
4
  import { connectors } from "./connectors";
5
+ import instList from "./instList.json";
5
6
 
6
7
  export default {
7
8
  gnosisSafe,
8
9
  erc20,
9
10
  interopX,
10
11
  connectors,
12
+ instList,
11
13
  };
@@ -0,0 +1,232 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "address",
6
+ "name": "_instaIndex",
7
+ "type": "address"
8
+ }
9
+ ],
10
+ "stateMutability": "nonpayable",
11
+ "type": "constructor"
12
+ },
13
+ {
14
+ "inputs": [
15
+ {
16
+ "internalType": "uint64",
17
+ "name": "",
18
+ "type": "uint64"
19
+ }
20
+ ],
21
+ "name": "accountAddr",
22
+ "outputs": [
23
+ {
24
+ "internalType": "address",
25
+ "name": "",
26
+ "type": "address"
27
+ }
28
+ ],
29
+ "stateMutability": "view",
30
+ "type": "function"
31
+ },
32
+ {
33
+ "inputs": [
34
+ {
35
+ "internalType": "address",
36
+ "name": "",
37
+ "type": "address"
38
+ }
39
+ ],
40
+ "name": "accountID",
41
+ "outputs": [
42
+ {
43
+ "internalType": "uint64",
44
+ "name": "",
45
+ "type": "uint64"
46
+ }
47
+ ],
48
+ "stateMutability": "view",
49
+ "type": "function"
50
+ },
51
+ {
52
+ "inputs": [
53
+ {
54
+ "internalType": "uint64",
55
+ "name": "",
56
+ "type": "uint64"
57
+ }
58
+ ],
59
+ "name": "accountLink",
60
+ "outputs": [
61
+ {
62
+ "internalType": "address",
63
+ "name": "first",
64
+ "type": "address"
65
+ },
66
+ {
67
+ "internalType": "address",
68
+ "name": "last",
69
+ "type": "address"
70
+ },
71
+ {
72
+ "internalType": "uint64",
73
+ "name": "count",
74
+ "type": "uint64"
75
+ }
76
+ ],
77
+ "stateMutability": "view",
78
+ "type": "function"
79
+ },
80
+ {
81
+ "inputs": [
82
+ {
83
+ "internalType": "uint64",
84
+ "name": "",
85
+ "type": "uint64"
86
+ },
87
+ {
88
+ "internalType": "address",
89
+ "name": "",
90
+ "type": "address"
91
+ }
92
+ ],
93
+ "name": "accountList",
94
+ "outputs": [
95
+ {
96
+ "internalType": "address",
97
+ "name": "prev",
98
+ "type": "address"
99
+ },
100
+ {
101
+ "internalType": "address",
102
+ "name": "next",
103
+ "type": "address"
104
+ }
105
+ ],
106
+ "stateMutability": "view",
107
+ "type": "function"
108
+ },
109
+ {
110
+ "inputs": [],
111
+ "name": "accounts",
112
+ "outputs": [
113
+ {
114
+ "internalType": "uint64",
115
+ "name": "",
116
+ "type": "uint64"
117
+ }
118
+ ],
119
+ "stateMutability": "view",
120
+ "type": "function"
121
+ },
122
+ {
123
+ "inputs": [
124
+ {
125
+ "internalType": "address",
126
+ "name": "_owner",
127
+ "type": "address"
128
+ }
129
+ ],
130
+ "name": "addAuth",
131
+ "outputs": [],
132
+ "stateMutability": "nonpayable",
133
+ "type": "function"
134
+ },
135
+ {
136
+ "inputs": [
137
+ {
138
+ "internalType": "address",
139
+ "name": "_account",
140
+ "type": "address"
141
+ }
142
+ ],
143
+ "name": "init",
144
+ "outputs": [],
145
+ "stateMutability": "nonpayable",
146
+ "type": "function"
147
+ },
148
+ {
149
+ "inputs": [],
150
+ "name": "instaIndex",
151
+ "outputs": [
152
+ {
153
+ "internalType": "address",
154
+ "name": "",
155
+ "type": "address"
156
+ }
157
+ ],
158
+ "stateMutability": "view",
159
+ "type": "function"
160
+ },
161
+ {
162
+ "inputs": [
163
+ {
164
+ "internalType": "address",
165
+ "name": "_owner",
166
+ "type": "address"
167
+ }
168
+ ],
169
+ "name": "removeAuth",
170
+ "outputs": [],
171
+ "stateMutability": "nonpayable",
172
+ "type": "function"
173
+ },
174
+ {
175
+ "inputs": [
176
+ {
177
+ "internalType": "address",
178
+ "name": "",
179
+ "type": "address"
180
+ }
181
+ ],
182
+ "name": "userLink",
183
+ "outputs": [
184
+ {
185
+ "internalType": "uint64",
186
+ "name": "first",
187
+ "type": "uint64"
188
+ },
189
+ {
190
+ "internalType": "uint64",
191
+ "name": "last",
192
+ "type": "uint64"
193
+ },
194
+ {
195
+ "internalType": "uint64",
196
+ "name": "count",
197
+ "type": "uint64"
198
+ }
199
+ ],
200
+ "stateMutability": "view",
201
+ "type": "function"
202
+ },
203
+ {
204
+ "inputs": [
205
+ {
206
+ "internalType": "address",
207
+ "name": "",
208
+ "type": "address"
209
+ },
210
+ {
211
+ "internalType": "uint64",
212
+ "name": "",
213
+ "type": "uint64"
214
+ }
215
+ ],
216
+ "name": "userList",
217
+ "outputs": [
218
+ {
219
+ "internalType": "uint64",
220
+ "name": "prev",
221
+ "type": "uint64"
222
+ },
223
+ {
224
+ "internalType": "uint64",
225
+ "name": "next",
226
+ "type": "uint64"
227
+ }
228
+ ],
229
+ "stateMutability": "view",
230
+ "type": "function"
231
+ }
232
+ ]
package/src/api/index.ts CHANGED
@@ -26,6 +26,14 @@ export const startApiServer = async () => {
26
26
  })
27
27
  })
28
28
 
29
+ server.get('/transactions/:transaction', async (req) => {
30
+ return await Transaction.findOne({
31
+ where: {
32
+ transactionHash: (req.params as any).transaction
33
+ }
34
+ })
35
+ })
36
+
29
37
  await server.listen(PORT, HOST)
30
38
 
31
39
  logger.log(`RPC Server listening at http://${HOST}:${PORT}`)
@@ -4,11 +4,13 @@ export const addresses = {
4
4
  multisend: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761',
5
5
  interopX: '0xDB6083df37C5F224a3dF84A4B5f9fB60b6c8670a',
6
6
  dsaAddress: '0x9Fbd453a8e7a158510fBae5D9935958507cf4b19',
7
+ instList: "0x839c2D3aDe63DF5b0b8F3E57D5e145057Ab41556",
7
8
  },
8
9
  43114: {
9
10
  gnosisSafe: '0x31d7a5194Fe60AC209Cf1Ce2d539C9A60662Ed6b',
10
11
  multisend: '0x998739BFdAAdde7C933B942a68053933098f9EDa',
11
- interopX: '0xd61f55C6d9deD35B9d13243b816c4BcC1d78592b',
12
- dsaAddress: '0xFcB7d826E32081c4799de2f83b47b49df600dc8c',
12
+ interopX: '0xA82A87096709E3D8648c9d9a22f31133bC4B6d32',
13
+ dsaAddress: '0x995e67a652d2be45a8bff438b3dfac66dfff1c46',
14
+ instList: "0x9926955e0Dd681Dc303370C52f4Ad0a4dd061687",
13
15
  }
14
- } as Record<number, { gnosisSafe: string, multisend: string, interopX: string, dsaAddress: string }>
16
+ } as Record<number, { gnosisSafe: string, multisend: string, interopX: string, dsaAddress: string, instList: string }>
@@ -1,74 +1,116 @@
1
- import { sequelize } from '@/db/sequelize'
2
- import { CreationOptional, InferAttributes, InferCreationAttributes, Model, DataTypes } from 'sequelize';
1
+ import { sequelize } from "@/db/sequelize";
2
+ import {
3
+ CreationOptional,
4
+ InferAttributes,
5
+ InferCreationAttributes,
6
+ Model,
7
+ DataTypes,
8
+ } from "sequelize";
3
9
 
4
10
  export interface IPositionTokenInfo {
5
- amount: string;
6
- sourceToken: string;
7
- targetToken: string;
11
+ amount: string;
12
+ sourceToken: string;
13
+ targetToken: string;
8
14
  }
9
15
 
10
16
  export interface IPosition {
11
- supply: IPositionTokenInfo[];
12
- withdraw: IPositionTokenInfo[];
17
+ supply: IPositionTokenInfo[];
18
+ withdraw: IPositionTokenInfo[];
13
19
  }
14
20
 
15
- export class Transaction extends Model<InferAttributes<Transaction>, InferCreationAttributes<Transaction>> {
16
- declare id: CreationOptional<number>;
17
-
18
- declare transactionHash: string;
19
- declare vnonce: string;
20
- declare actionId: string;
21
- declare sourceSender: string;
22
-
23
- declare submitChainId: number;
24
- declare submitTransactionHash: string;
25
- declare submitBlockNumber: number;
26
- declare submitCreatedAt: Date;
27
-
28
- declare sourceChainId: number;
29
- declare sourceDsaId: string;
30
- declare sourceTransactionHash: CreationOptional<string>;
31
- declare sourceBlockNumber: CreationOptional<number>;
32
- declare sourceStatus: CreationOptional<string>;
33
- declare sourceErrors: CreationOptional<string[]>;
34
- declare sourceLogs: CreationOptional<any[]>;
35
- declare sourceCreatedAt: CreationOptional<Date>;
36
- declare sourceDelayUntil: CreationOptional<Date>;
37
-
38
- declare targetChainId: number;
39
- declare targetDsaId: string;
40
- declare targetTransactionHash: CreationOptional<string>;
41
- declare targetBlockNumber: CreationOptional<number>;
42
- declare targetStatus: CreationOptional<string>;
43
- declare targetErrors: CreationOptional<string[]>;
44
- declare targetLogs: CreationOptional<any[]>;
45
- declare targetCreatedAt: CreationOptional<Date>;
46
- declare targetDelayUntil: CreationOptional<Date>;
47
-
48
- declare submitEvent: {
49
- position: IPosition;
50
- actionId: string;
51
- actionIdHashHash: string;
52
- sourceSender: string;
53
- sourceDsaId: string;
54
- targetDsaId: string;
55
- sourceChainId: number;
56
- targetChainId: number;
57
- vnonce: string;
58
- metadata: string;
59
- };
60
-
61
- declare status: CreationOptional<string>;
62
-
63
- declare createdAt: CreationOptional<Date>;
64
- declare updatedAt: CreationOptional<Date>;
21
+ export class Transaction extends Model<
22
+ InferAttributes<Transaction>,
23
+ InferCreationAttributes<Transaction>
24
+ > {
25
+ declare id: CreationOptional<number>;
26
+
27
+ declare transactionHash: string;
28
+ declare vnonce: string;
29
+ declare actionId: string;
30
+ declare sourceSender: string;
31
+
32
+ declare submitChainId: number;
33
+ declare submitTransactionHash: string;
34
+ declare submitBlockNumber: number;
35
+ declare submitCreatedAt: Date;
36
+
37
+ declare sourceChainId: number;
38
+ declare sourceDsaId: string;
39
+ declare sourceTransactionHash: CreationOptional<string>;
40
+ declare sourceBlockNumber: CreationOptional<number>;
41
+ declare sourceStatus: CreationOptional<string>;
42
+ declare sourceErrors: CreationOptional<string[]>;
43
+ declare sourceLogs: CreationOptional<any[]>;
44
+ declare sourceCreatedAt: CreationOptional<Date>;
45
+ declare sourceDelayUntil: CreationOptional<Date>;
46
+
47
+ declare targetChainId: number;
48
+ declare targetDsaId: string;
49
+ declare targetTransactionHash: CreationOptional<string>;
50
+ declare targetBlockNumber: CreationOptional<number>;
51
+ declare targetStatus: CreationOptional<string>;
52
+ declare targetErrors: CreationOptional<string[]>;
53
+ declare targetLogs: CreationOptional<any[]>;
54
+ declare targetCreatedAt: CreationOptional<Date>;
55
+ declare targetDelayUntil: CreationOptional<Date>;
56
+
57
+ declare submitEvent: {
58
+ position: IPosition;
59
+ actionId: string;
60
+ actionIdHashHash: string;
61
+ actionIdHash: string;
62
+ sourceSender: string;
63
+ sourceDsaId: string;
64
+ targetDsaId: string;
65
+ sourceChainId: number;
66
+ targetChainId: number;
67
+ vnonce: string;
68
+ metadata: string;
69
+ };
70
+
71
+ declare validateEvent: CreationOptional<{
72
+ sourceSpells: Array<{ connector: string; data: string }>;
73
+ position: IPosition;
74
+ actionId: string;
75
+ actionIdHashHash: string;
76
+ actionIdHash: string;
77
+ sourceSender: string;
78
+ sourceDsaId: string;
79
+ targetDsaId: string;
80
+ sourceChainId: number;
81
+ targetChainId: number;
82
+ vnonce: string;
83
+ metadata: string;
84
+ }>;
85
+
86
+ declare executeEvent: CreationOptional<{
87
+ sourceSpells: Array<{ connector: string; data: string }>;
88
+ targetSpells: Array<{ connector: string; data: string }>;
89
+ position: IPosition;
90
+ actionId: string;
91
+ actionIdHashHash: string;
92
+ actionIdHash: string;
93
+ sourceSender: string;
94
+ sourceDsaId: string;
95
+ targetDsaId: string;
96
+ sourceChainId: number;
97
+ targetChainId: number;
98
+ vnonce: string;
99
+ metadata: string;
100
+ }>;
101
+
102
+ declare status: CreationOptional<string>;
103
+
104
+ declare createdAt: CreationOptional<Date>;
105
+ declare updatedAt: CreationOptional<Date>;
65
106
  }
66
107
 
67
- Transaction.init({
108
+ Transaction.init(
109
+ {
68
110
  id: {
69
- type: DataTypes.INTEGER,
70
- autoIncrement: true,
71
- primaryKey: true
111
+ type: DataTypes.INTEGER,
112
+ autoIncrement: true,
113
+ primaryKey: true,
72
114
  },
73
115
 
74
116
  transactionHash: DataTypes.STRING,
@@ -86,20 +128,20 @@ Transaction.init({
86
128
  sourceTransactionHash: DataTypes.STRING,
87
129
  sourceBlockNumber: DataTypes.NUMBER,
88
130
  sourceStatus: {
89
- type: DataTypes.STRING,
90
- defaultValue: 'pending'
131
+ type: DataTypes.STRING,
132
+ defaultValue: "pending",
91
133
  },
92
134
  sourceErrors: {
93
- type: DataTypes.JSON,
94
- // defaultValue: [],
135
+ type: DataTypes.JSON,
136
+ // defaultValue: [],
95
137
  },
96
138
  sourceLogs: {
97
- type: DataTypes.JSON,
98
- // defaultValue: [],
139
+ type: DataTypes.JSON,
140
+ // defaultValue: [],
99
141
  },
100
142
  sourceCreatedAt: {
101
- type: DataTypes.DATE,
102
- defaultValue: Date.now()
143
+ type: DataTypes.DATE,
144
+ defaultValue: Date.now(),
103
145
  },
104
146
  sourceDelayUntil: DataTypes.STRING,
105
147
 
@@ -108,29 +150,41 @@ Transaction.init({
108
150
  targetTransactionHash: DataTypes.STRING,
109
151
  targetBlockNumber: DataTypes.NUMBER,
110
152
  targetStatus: {
111
- type: DataTypes.STRING,
112
- defaultValue: 'pending'
153
+ type: DataTypes.STRING,
154
+ defaultValue: "pending",
113
155
  },
114
156
  targetErrors: {
115
- type: DataTypes.JSON,
116
- // defaultValue: [],
157
+ type: DataTypes.JSON,
158
+ // defaultValue: [],
117
159
  },
118
160
  targetLogs: {
119
- type: DataTypes.JSON,
120
- // defaultValue: [],
161
+ type: DataTypes.JSON,
162
+ // defaultValue: [],
121
163
  },
122
164
  targetCreatedAt: DataTypes.DATE,
123
165
  targetDelayUntil: DataTypes.DATE,
124
166
 
125
167
  submitEvent: {
126
- type: DataTypes.JSON,
127
- allowNull: false
168
+ type: DataTypes.JSON,
169
+ allowNull: false,
170
+ },
171
+
172
+ validateEvent: {
173
+ type: DataTypes.JSON,
174
+ allowNull: true,
175
+ },
176
+
177
+ executeEvent: {
178
+ type: DataTypes.JSON,
179
+ allowNull: true,
128
180
  },
129
181
 
130
182
  status: {
131
- type: DataTypes.STRING,
132
- defaultValue: 'pending'
183
+ type: DataTypes.STRING,
184
+ defaultValue: "pending",
133
185
  },
134
186
  createdAt: DataTypes.DATE,
135
187
  updatedAt: DataTypes.DATE,
136
- }, { sequelize, tableName: 'transactions' });
188
+ },
189
+ { sequelize, tableName: "transactions" }
190
+ );
@@ -0,0 +1,6 @@
1
+ export class LiquidityError extends Error {
2
+ constructor(message?: string) {
3
+ super(message || "Not enough liquidity");
4
+ Object.setPrototypeOf(this, new.target.prototype);
5
+ }
6
+ }