@dhedge/backend-flatcoin-core 0.3.44 → 0.3.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contracts/abi/v2/leverage-module.d.ts +35 -0
- package/dist/contracts/abi/v2/leverage-module.js +164 -0
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +3 -1
- package/dist/entity/multichain-config.d.ts +1 -0
- package/dist/entity/multichain-config.js +4 -0
- package/dist/service/blockscan.service.d.ts +1 -2
- package/dist/service/blockscan.service.js +2 -6
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const LeverageModuleV2: ({
|
|
2
|
+
anonymous: boolean;
|
|
3
|
+
inputs: ({
|
|
4
|
+
indexed: boolean;
|
|
5
|
+
internalType: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
components?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
components: {
|
|
11
|
+
internalType: string;
|
|
12
|
+
name: string;
|
|
13
|
+
type: string;
|
|
14
|
+
}[];
|
|
15
|
+
indexed: boolean;
|
|
16
|
+
internalType: string;
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
})[];
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
outputs?: undefined;
|
|
23
|
+
stateMutability?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
inputs: never[];
|
|
26
|
+
name: string;
|
|
27
|
+
outputs: {
|
|
28
|
+
internalType: string;
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}[];
|
|
32
|
+
stateMutability: string;
|
|
33
|
+
type: string;
|
|
34
|
+
anonymous?: undefined;
|
|
35
|
+
})[];
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LeverageModuleV2 = void 0;
|
|
4
|
+
exports.LeverageModuleV2 = [
|
|
5
|
+
{
|
|
6
|
+
anonymous: false,
|
|
7
|
+
inputs: [
|
|
8
|
+
{
|
|
9
|
+
indexed: false,
|
|
10
|
+
internalType: 'uint256',
|
|
11
|
+
name: 'tokenId',
|
|
12
|
+
type: 'uint256',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
indexed: false,
|
|
16
|
+
internalType: 'uint256',
|
|
17
|
+
name: 'closePrice',
|
|
18
|
+
type: 'uint256',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
components: [
|
|
22
|
+
{
|
|
23
|
+
internalType: 'int256',
|
|
24
|
+
name: 'profitLoss',
|
|
25
|
+
type: 'int256',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
internalType: 'int256',
|
|
29
|
+
name: 'accruedFunding',
|
|
30
|
+
type: 'int256',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
internalType: 'int256',
|
|
34
|
+
name: 'marginAfterSettlement',
|
|
35
|
+
type: 'int256',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
indexed: false,
|
|
39
|
+
internalType: 'struct PositionSummary',
|
|
40
|
+
name: 'positionSummary',
|
|
41
|
+
type: 'tuple',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
indexed: false,
|
|
45
|
+
internalType: 'uint256',
|
|
46
|
+
name: 'settledMargin',
|
|
47
|
+
type: 'uint256',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
indexed: false,
|
|
51
|
+
internalType: 'uint256',
|
|
52
|
+
name: 'size',
|
|
53
|
+
type: 'uint256',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
indexed: false,
|
|
57
|
+
internalType: 'uint256',
|
|
58
|
+
name: 'tradeFee',
|
|
59
|
+
type: 'uint256',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
name: 'LeverageClose',
|
|
63
|
+
type: 'event',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
anonymous: false,
|
|
67
|
+
inputs: [
|
|
68
|
+
{
|
|
69
|
+
indexed: false,
|
|
70
|
+
internalType: 'address',
|
|
71
|
+
name: 'account',
|
|
72
|
+
type: 'address',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
indexed: false,
|
|
76
|
+
internalType: 'uint256',
|
|
77
|
+
name: 'tokenId',
|
|
78
|
+
type: 'uint256',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
indexed: false,
|
|
82
|
+
internalType: 'uint256',
|
|
83
|
+
name: 'entryPrice',
|
|
84
|
+
type: 'uint256',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
indexed: false,
|
|
88
|
+
internalType: 'uint256',
|
|
89
|
+
name: 'margin',
|
|
90
|
+
type: 'uint256',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
indexed: false,
|
|
94
|
+
internalType: 'uint256',
|
|
95
|
+
name: 'size',
|
|
96
|
+
type: 'uint256',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
indexed: false,
|
|
100
|
+
internalType: 'uint256',
|
|
101
|
+
name: 'tradeFee',
|
|
102
|
+
type: 'uint256',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
name: 'LeverageOpen',
|
|
106
|
+
type: 'event',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
anonymous: false,
|
|
110
|
+
inputs: [
|
|
111
|
+
{
|
|
112
|
+
indexed: false,
|
|
113
|
+
internalType: 'uint256',
|
|
114
|
+
name: 'tokenId',
|
|
115
|
+
type: 'uint256',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
indexed: false,
|
|
119
|
+
internalType: 'uint256',
|
|
120
|
+
name: 'averagePrice',
|
|
121
|
+
type: 'uint256',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
indexed: false,
|
|
125
|
+
internalType: 'uint256',
|
|
126
|
+
name: 'adjustPrice',
|
|
127
|
+
type: 'uint256',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
indexed: false,
|
|
131
|
+
internalType: 'int256',
|
|
132
|
+
name: 'marginDelta',
|
|
133
|
+
type: 'int256',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
indexed: false,
|
|
137
|
+
internalType: 'int256',
|
|
138
|
+
name: 'sizeDelta',
|
|
139
|
+
type: 'int256',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
indexed: false,
|
|
143
|
+
internalType: 'uint256',
|
|
144
|
+
name: 'tradeFee',
|
|
145
|
+
type: 'uint256',
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
name: 'LeverageAdjust',
|
|
149
|
+
type: 'event',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
inputs: [],
|
|
153
|
+
name: 'tokenIdNext',
|
|
154
|
+
outputs: [
|
|
155
|
+
{
|
|
156
|
+
internalType: 'uint256',
|
|
157
|
+
name: '',
|
|
158
|
+
type: 'uint256',
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
stateMutability: 'view',
|
|
162
|
+
type: 'function',
|
|
163
|
+
},
|
|
164
|
+
];
|
|
@@ -15,4 +15,5 @@ export { OrderExecutionModule } from './abi/v2/order-execution-module';
|
|
|
15
15
|
export { OptionViewer } from './abi/v2/option-viewer';
|
|
16
16
|
export { PerpViewer } from './abi/v2/perp-viewer';
|
|
17
17
|
export { PerpViewerGetPositionsBatched } from './abi/v2/perp-viewer-get-positions-batched';
|
|
18
|
+
export { LeverageModuleV2 } from './abi/v2/leverage-module';
|
|
18
19
|
export * from './helpers';
|
package/dist/contracts/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PerpViewerGetPositionsBatched = exports.PerpViewer = exports.OptionViewer = exports.OrderExecutionModule = exports.OrderAnnouncementModule = exports.CanLiquidateWithPriceFeeds = exports.FlatcoinVault = exports.DelayedOrder = exports.LimitOrder = exports.LiquidateWithoutPriceFeeds = exports.Liquidate = exports.LiquidationModule = exports.LeverageModule = exports.FlatcoinErrors = exports.ViewerGetPositionData = exports.Viewer = exports.StableModule = void 0;
|
|
17
|
+
exports.LeverageModuleV2 = exports.PerpViewerGetPositionsBatched = exports.PerpViewer = exports.OptionViewer = exports.OrderExecutionModule = exports.OrderAnnouncementModule = exports.CanLiquidateWithPriceFeeds = exports.FlatcoinVault = exports.DelayedOrder = exports.LimitOrder = exports.LiquidateWithoutPriceFeeds = exports.Liquidate = exports.LiquidationModule = exports.LeverageModule = exports.FlatcoinErrors = exports.ViewerGetPositionData = exports.Viewer = exports.StableModule = void 0;
|
|
18
18
|
var stable_module_1 = require("./abi/stable-module");
|
|
19
19
|
Object.defineProperty(exports, "StableModule", { enumerable: true, get: function () { return stable_module_1.StableModule; } });
|
|
20
20
|
var viewer_1 = require("./abi/viewer");
|
|
@@ -49,4 +49,6 @@ var perp_viewer_1 = require("./abi/v2/perp-viewer");
|
|
|
49
49
|
Object.defineProperty(exports, "PerpViewer", { enumerable: true, get: function () { return perp_viewer_1.PerpViewer; } });
|
|
50
50
|
var perp_viewer_get_positions_batched_1 = require("./abi/v2/perp-viewer-get-positions-batched");
|
|
51
51
|
Object.defineProperty(exports, "PerpViewerGetPositionsBatched", { enumerable: true, get: function () { return perp_viewer_get_positions_batched_1.PerpViewerGetPositionsBatched; } });
|
|
52
|
+
var leverage_module_2 = require("./abi/v2/leverage-module");
|
|
53
|
+
Object.defineProperty(exports, "LeverageModuleV2", { enumerable: true, get: function () { return leverage_module_2.LeverageModuleV2; } });
|
|
52
54
|
__exportStar(require("./helpers"), exports);
|
|
@@ -42,6 +42,10 @@ __decorate([
|
|
|
42
42
|
(0, typeorm_1.Column)({ name: 'blockchain_provider_https_url_fallback', nullable: false }),
|
|
43
43
|
__metadata("design:type", String)
|
|
44
44
|
], MultichainConfig.prototype, "blockchainProviderHttpsUrlFallback", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ name: 'wss_url', nullable: false }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], MultichainConfig.prototype, "wssUrl", void 0);
|
|
45
49
|
__decorate([
|
|
46
50
|
(0, typeorm_1.Column)({ name: 'viewer_contract', nullable: false }),
|
|
47
51
|
__metadata("design:type", String)
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Logger } from '@nestjs/common';
|
|
2
2
|
import { TokenTransfer } from '../dto';
|
|
3
|
-
import { Market } from '../constants';
|
|
4
3
|
export declare class BlockscanService {
|
|
5
4
|
private readonly logger;
|
|
6
5
|
private readonly baseBlockscanUri;
|
|
7
6
|
private readonly optimismBlockscanUri;
|
|
8
7
|
constructor(logger: Logger);
|
|
9
|
-
getTokenTransfers(contractAddress: string, startBlock: number, endBlock: number, blockChainCode: string
|
|
8
|
+
getTokenTransfers(contractAddress: string, startBlock: number, endBlock: number, blockChainCode: string): Promise<TokenTransfer[]>;
|
|
10
9
|
private getUri;
|
|
11
10
|
}
|
|
@@ -28,7 +28,7 @@ let BlockscanService = class BlockscanService {
|
|
|
28
28
|
this.optimismBlockscanUri = process.env.OPTIMISM_BLOCKSCAN_URI;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
async getTokenTransfers(contractAddress, startBlock, endBlock, blockChainCode
|
|
31
|
+
async getTokenTransfers(contractAddress, startBlock, endBlock, blockChainCode) {
|
|
32
32
|
try {
|
|
33
33
|
const response = await axios_1.default.get(`${this.getUri(blockChainCode)}&module=account&action=tokentx&contractaddress=${contractAddress}&startblock=${startBlock}&endblock=${endBlock}&page=1&offset=10000&sort=asc`);
|
|
34
34
|
const result = response.data.result.map((r) => {
|
|
@@ -38,11 +38,7 @@ let BlockscanService = class BlockscanService {
|
|
|
38
38
|
tokenTransfer.from = r.from;
|
|
39
39
|
tokenTransfer.txHash = r.hash;
|
|
40
40
|
tokenTransfer.contractAddress = r.contractAddress;
|
|
41
|
-
|
|
42
|
-
tokenTransfer.value = ethers_1.BigNumber.from(r.value).mul(ethers_1.BigNumber.from('10000000000'));
|
|
43
|
-
}
|
|
44
|
-
else
|
|
45
|
-
tokenTransfer.value = ethers_1.BigNumber.from(r.value);
|
|
41
|
+
tokenTransfer.value = ethers_1.BigNumber.from(r.value);
|
|
46
42
|
return tokenTransfer;
|
|
47
43
|
});
|
|
48
44
|
this.logger.log(`fetched ${result.length} unit direct transfers`);
|