@wharfkit/resources 1.2.2-rc2 → 1.2.2
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/lib/wharfkit-resources.d.ts +3 -4
- package/lib/wharfkit-resources.js +10 -12
- package/lib/wharfkit-resources.js.map +1 -1
- package/lib/wharfkit-resources.m.js +10 -12
- package/lib/wharfkit-resources.m.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/powerup/abstract.ts +6 -8
- package/src/powerup/cpu.ts +2 -4
- package/src/powerup/net.ts +2 -4
- package/lib/eosio-resources.d.ts +0 -191
- package/lib/eosio-resources.js +0 -552
- package/lib/eosio-resources.js.map +0 -1
- package/lib/eosio-resources.m.js +0 -532
- package/lib/eosio-resources.m.js.map +0 -1
package/lib/eosio-resources.js
DELETED
|
@@ -1,552 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @greymass/eosio-resources v0.9.0
|
|
3
|
-
* https://github.com/greymass/eosio-resources
|
|
4
|
-
*
|
|
5
|
-
* @license
|
|
6
|
-
* Copyright (c) 2021 Greymass Inc. All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* Redistribution and use in source and binary forms, with or without modification,
|
|
9
|
-
* are permitted provided that the following conditions are met:
|
|
10
|
-
*
|
|
11
|
-
* 1. Redistribution of source code must retain the above copyright notice, this
|
|
12
|
-
* list of conditions and the following disclaimer.
|
|
13
|
-
*
|
|
14
|
-
* 2. Redistribution in binary form must reproduce the above copyright notice,
|
|
15
|
-
* this list of conditions and the following disclaimer in the documentation
|
|
16
|
-
* and/or other materials provided with the distribution.
|
|
17
|
-
*
|
|
18
|
-
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
19
|
-
* may be used to endorse or promote products derived from this software without
|
|
20
|
-
* specific prior written permission.
|
|
21
|
-
*
|
|
22
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
23
|
-
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
24
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
25
|
-
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
26
|
-
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
27
|
-
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
28
|
-
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
29
|
-
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
30
|
-
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
31
|
-
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
-
*
|
|
33
|
-
* YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT DESIGNED, LICENSED OR INTENDED FOR USE
|
|
34
|
-
* IN THE DESIGN, CONSTRUCTION, OPERATION OR MAINTENANCE OF ANY MILITARY FACILITY.
|
|
35
|
-
*/
|
|
36
|
-
'use strict';
|
|
37
|
-
|
|
38
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
39
|
-
|
|
40
|
-
var tslib = require('tslib');
|
|
41
|
-
var eosio = require('@greymass/eosio');
|
|
42
|
-
var BN = require('bn.js');
|
|
43
|
-
|
|
44
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
45
|
-
|
|
46
|
-
var BN__default = /*#__PURE__*/_interopDefaultLegacy(BN);
|
|
47
|
-
|
|
48
|
-
class PowerUpStateResource extends eosio.Struct {
|
|
49
|
-
constructor() {
|
|
50
|
-
super(...arguments);
|
|
51
|
-
this.default_block_cpu_limit = eosio.UInt64.from(200000);
|
|
52
|
-
this.default_block_net_limit = eosio.UInt64.from(1048576000);
|
|
53
|
-
}
|
|
54
|
-
// Get the current number of allocated units (shift from REX -> PowerUp)
|
|
55
|
-
get allocated() {
|
|
56
|
-
return 1 - Number(this.weight_ratio) / Number(this.target_weight_ratio) / 100;
|
|
57
|
-
}
|
|
58
|
-
// Get the current percentage of reserved units
|
|
59
|
-
get reserved() {
|
|
60
|
-
return Number(this.utilization) / Number(this.weight);
|
|
61
|
-
}
|
|
62
|
-
// Get the symbol definition for the token
|
|
63
|
-
get symbol() {
|
|
64
|
-
return this.min_price.symbol;
|
|
65
|
-
}
|
|
66
|
-
// Common casting for typed values to numbers
|
|
67
|
-
cast() {
|
|
68
|
-
return {
|
|
69
|
-
adjusted_utilization: Number(this.adjusted_utilization),
|
|
70
|
-
decay_secs: Number(this.decay_secs.value),
|
|
71
|
-
exponent: Number(this.exponent),
|
|
72
|
-
utilization: Number(this.utilization),
|
|
73
|
-
utilization_timestamp: Number(this.utilization_timestamp.value),
|
|
74
|
-
weight: Number(this.weight),
|
|
75
|
-
weight_ratio: Number(this.weight_ratio),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
// Mimic: https://github.com/EOSIO/eosio.contracts/blob/d7bc0a5cc8c0c2edd4dc61b0126517d0cb46fd94/contracts/eosio.system/src/powerup.cpp#L358
|
|
79
|
-
utilization_increase(sample, frac) {
|
|
80
|
-
const { weight } = this;
|
|
81
|
-
const frac128 = eosio.UInt128.from(frac);
|
|
82
|
-
const utilization_increase = new BN__default['default'](weight.value.mul(new BN__default['default'](frac128.value))) / Math.pow(10, 15);
|
|
83
|
-
return Math.ceil(utilization_increase);
|
|
84
|
-
}
|
|
85
|
-
// Mimic: https://github.com/EOSIO/eosio.contracts/blob/d7bc0a5cc8c0c2edd4dc61b0126517d0cb46fd94/contracts/eosio.system/src/powerup.cpp#L284-L298
|
|
86
|
-
price_function(utilization) {
|
|
87
|
-
const { exponent, weight } = this.cast();
|
|
88
|
-
const max_price = this.max_price.value;
|
|
89
|
-
const min_price = this.min_price.value;
|
|
90
|
-
let price = min_price;
|
|
91
|
-
const new_exponent = exponent - 1.0;
|
|
92
|
-
if (new_exponent <= 0.0) {
|
|
93
|
-
return max_price;
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
price += (max_price - min_price) * Math.pow(utilization / weight, new_exponent);
|
|
97
|
-
}
|
|
98
|
-
return price;
|
|
99
|
-
}
|
|
100
|
-
// Mimic: https://github.com/EOSIO/eosio.contracts/blob/d7bc0a5cc8c0c2edd4dc61b0126517d0cb46fd94/contracts/eosio.system/src/powerup.cpp#L274-L280
|
|
101
|
-
price_integral_delta(start_utilization, end_utilization) {
|
|
102
|
-
const { exponent, weight } = this.cast();
|
|
103
|
-
const max_price = this.max_price.value;
|
|
104
|
-
const min_price = this.min_price.value;
|
|
105
|
-
const coefficient = (max_price - min_price) / exponent;
|
|
106
|
-
const start_u = start_utilization / weight;
|
|
107
|
-
const end_u = end_utilization / weight;
|
|
108
|
-
const delta = min_price * end_u -
|
|
109
|
-
min_price * start_u +
|
|
110
|
-
coefficient * Math.pow(end_u, exponent) -
|
|
111
|
-
coefficient * Math.pow(start_u, exponent);
|
|
112
|
-
return delta;
|
|
113
|
-
}
|
|
114
|
-
// Mimic: https://github.com/EOSIO/eosio.contracts/blob/d7bc0a5cc8c0c2edd4dc61b0126517d0cb46fd94/contracts/eosio.system/src/powerup.cpp#L262-L315
|
|
115
|
-
fee(utilization_increase, adjusted_utilization) {
|
|
116
|
-
const { utilization, weight } = this.cast();
|
|
117
|
-
let start_utilization = utilization;
|
|
118
|
-
const end_utilization = start_utilization + utilization_increase;
|
|
119
|
-
let fee = 0;
|
|
120
|
-
if (start_utilization < adjusted_utilization) {
|
|
121
|
-
fee +=
|
|
122
|
-
(this.price_function(adjusted_utilization) *
|
|
123
|
-
Math.min(utilization_increase, adjusted_utilization - start_utilization)) /
|
|
124
|
-
weight;
|
|
125
|
-
start_utilization = adjusted_utilization;
|
|
126
|
-
}
|
|
127
|
-
if (start_utilization < end_utilization) {
|
|
128
|
-
fee += this.price_integral_delta(start_utilization, end_utilization);
|
|
129
|
-
}
|
|
130
|
-
return fee;
|
|
131
|
-
}
|
|
132
|
-
// Mimic: https://github.com/EOSIO/eosio.contracts/blob/d7bc0a5cc8c0c2edd4dc61b0126517d0cb46fd94/contracts/eosio.system/src/powerup.cpp#L105-L117
|
|
133
|
-
determine_adjusted_utilization(options) {
|
|
134
|
-
// Casting EOSIO types to usable formats for JS calculations
|
|
135
|
-
const { decay_secs, utilization, utilization_timestamp } = this.cast();
|
|
136
|
-
let { adjusted_utilization } = this.cast();
|
|
137
|
-
// If utilization is less than adjusted, calculate real time value
|
|
138
|
-
if (utilization < adjusted_utilization) {
|
|
139
|
-
// Create now & adjust JS timestamp to match EOSIO timestamp values
|
|
140
|
-
const ts = options && options.timestamp ? options.timestamp : new Date();
|
|
141
|
-
const now = eosio.TimePointSec.from(ts).toMilliseconds() / 1000;
|
|
142
|
-
const diff = adjusted_utilization - utilization;
|
|
143
|
-
let delta = diff * Math.exp(-(now - utilization_timestamp) / decay_secs);
|
|
144
|
-
delta = Math.min(Math.max(delta, 0), diff); // Clamp the delta
|
|
145
|
-
adjusted_utilization = utilization + delta;
|
|
146
|
-
}
|
|
147
|
-
return adjusted_utilization;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
tslib.__decorate([
|
|
151
|
-
eosio.Struct.field('uint8')
|
|
152
|
-
], PowerUpStateResource.prototype, "version", void 0);
|
|
153
|
-
tslib.__decorate([
|
|
154
|
-
eosio.Struct.field('int64')
|
|
155
|
-
], PowerUpStateResource.prototype, "weight", void 0);
|
|
156
|
-
tslib.__decorate([
|
|
157
|
-
eosio.Struct.field('int64')
|
|
158
|
-
], PowerUpStateResource.prototype, "weight_ratio", void 0);
|
|
159
|
-
tslib.__decorate([
|
|
160
|
-
eosio.Struct.field('int64')
|
|
161
|
-
], PowerUpStateResource.prototype, "assumed_stake_weight", void 0);
|
|
162
|
-
tslib.__decorate([
|
|
163
|
-
eosio.Struct.field('int64')
|
|
164
|
-
], PowerUpStateResource.prototype, "initial_weight_ratio", void 0);
|
|
165
|
-
tslib.__decorate([
|
|
166
|
-
eosio.Struct.field('int64')
|
|
167
|
-
], PowerUpStateResource.prototype, "target_weight_ratio", void 0);
|
|
168
|
-
tslib.__decorate([
|
|
169
|
-
eosio.Struct.field('time_point_sec')
|
|
170
|
-
], PowerUpStateResource.prototype, "initial_timestamp", void 0);
|
|
171
|
-
tslib.__decorate([
|
|
172
|
-
eosio.Struct.field('time_point_sec')
|
|
173
|
-
], PowerUpStateResource.prototype, "target_timestamp", void 0);
|
|
174
|
-
tslib.__decorate([
|
|
175
|
-
eosio.Struct.field('float64')
|
|
176
|
-
], PowerUpStateResource.prototype, "exponent", void 0);
|
|
177
|
-
tslib.__decorate([
|
|
178
|
-
eosio.Struct.field('uint32')
|
|
179
|
-
], PowerUpStateResource.prototype, "decay_secs", void 0);
|
|
180
|
-
tslib.__decorate([
|
|
181
|
-
eosio.Struct.field('asset')
|
|
182
|
-
], PowerUpStateResource.prototype, "min_price", void 0);
|
|
183
|
-
tslib.__decorate([
|
|
184
|
-
eosio.Struct.field('asset')
|
|
185
|
-
], PowerUpStateResource.prototype, "max_price", void 0);
|
|
186
|
-
tslib.__decorate([
|
|
187
|
-
eosio.Struct.field('int64')
|
|
188
|
-
], PowerUpStateResource.prototype, "utilization", void 0);
|
|
189
|
-
tslib.__decorate([
|
|
190
|
-
eosio.Struct.field('int64')
|
|
191
|
-
], PowerUpStateResource.prototype, "adjusted_utilization", void 0);
|
|
192
|
-
tslib.__decorate([
|
|
193
|
-
eosio.Struct.field('time_point_sec')
|
|
194
|
-
], PowerUpStateResource.prototype, "utilization_timestamp", void 0);
|
|
195
|
-
|
|
196
|
-
let PowerUpStateResourceCPU = class PowerUpStateResourceCPU extends PowerUpStateResource {
|
|
197
|
-
constructor() {
|
|
198
|
-
super(...arguments);
|
|
199
|
-
// Return smallest units per day, μs (microseconds)
|
|
200
|
-
this.per_day = (options) => this.us_per_day(options);
|
|
201
|
-
// Default frac generation by smallest unit type
|
|
202
|
-
this.frac = (usage, us) => this.frac_by_us(usage, us);
|
|
203
|
-
// Frac generation by ms (milliseconds)
|
|
204
|
-
this.frac_by_ms = (usage, ms) => this.frac_by_us(usage, ms * 1000);
|
|
205
|
-
// Price generation by smallest units, μs (microseconds)
|
|
206
|
-
this.price_per = (usage, us = 1000, options) => this.price_per_us(usage, us, options);
|
|
207
|
-
// Price generation by ms (milliseconds)
|
|
208
|
-
this.price_per_ms = (usage, ms = 1, options) => this.price_per_us(usage, ms * 1000, options);
|
|
209
|
-
}
|
|
210
|
-
// Return ms (milliseconds) per day
|
|
211
|
-
ms_per_day(options) {
|
|
212
|
-
return this.us_per_day(options) / 1000;
|
|
213
|
-
}
|
|
214
|
-
// Return μs (microseconds) per day
|
|
215
|
-
us_per_day(options) {
|
|
216
|
-
const limit = options && options.virtual_block_cpu_limit
|
|
217
|
-
? options.virtual_block_cpu_limit
|
|
218
|
-
: this.default_block_cpu_limit;
|
|
219
|
-
return Number(limit) * 2 * 60 * 60 * 24;
|
|
220
|
-
}
|
|
221
|
-
// Convert weight to μs (microseconds)
|
|
222
|
-
weight_to_us(sample, weight) {
|
|
223
|
-
return Math.ceil((weight * Number(sample)) / BNPrecision);
|
|
224
|
-
}
|
|
225
|
-
// Convert μs (microseconds) to weight
|
|
226
|
-
us_to_weight(sample, us) {
|
|
227
|
-
return Math.floor((us / Number(sample)) * BNPrecision);
|
|
228
|
-
}
|
|
229
|
-
// Frac generation by μs (microseconds)
|
|
230
|
-
frac_by_us(usage, us) {
|
|
231
|
-
const { weight } = this.cast();
|
|
232
|
-
const frac = this.us_to_weight(usage.cpu, us) / weight;
|
|
233
|
-
return Math.floor(frac * Math.pow(10, 15));
|
|
234
|
-
}
|
|
235
|
-
// Price generation by μs (microseconds)
|
|
236
|
-
price_per_us(usage, us = 1000, options) {
|
|
237
|
-
// Determine the utilization increase by this action
|
|
238
|
-
const frac = eosio.UInt128.from(this.frac(usage, us));
|
|
239
|
-
const utilization_increase = this.utilization_increase(usage.cpu, frac);
|
|
240
|
-
// Determine the adjusted utilization if needed
|
|
241
|
-
const adjusted_utilization = this.determine_adjusted_utilization(options);
|
|
242
|
-
// Derive the fee from the increase and utilization
|
|
243
|
-
const fee = this.fee(utilization_increase, adjusted_utilization);
|
|
244
|
-
// Force the fee up to the next highest value of precision
|
|
245
|
-
const precision = Math.pow(10, 4);
|
|
246
|
-
const value = Math.ceil(fee * precision) / precision;
|
|
247
|
-
// Return the modified fee
|
|
248
|
-
return value;
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
PowerUpStateResourceCPU = tslib.__decorate([
|
|
252
|
-
eosio.Struct.type('powerupstateresourcecpu')
|
|
253
|
-
], PowerUpStateResourceCPU);
|
|
254
|
-
|
|
255
|
-
let PowerUpStateResourceNET = class PowerUpStateResourceNET extends PowerUpStateResource {
|
|
256
|
-
constructor() {
|
|
257
|
-
super(...arguments);
|
|
258
|
-
// Return smallest units per day, bytes
|
|
259
|
-
this.per_day = (options) => this.bytes_per_day(options);
|
|
260
|
-
// Default frac generation by smallest unit type
|
|
261
|
-
this.frac = (usage, bytes) => this.frac_by_bytes(usage, bytes);
|
|
262
|
-
// Frac generation by kb
|
|
263
|
-
this.frac_by_kb = (usage, kilobytes) => this.frac_by_bytes(usage, kilobytes * 1000);
|
|
264
|
-
// Price generation by smallest units, bytes
|
|
265
|
-
this.price_per = (usage, bytes = 1000, options) => this.price_per_byte(usage, bytes, options);
|
|
266
|
-
// Price generation by kb
|
|
267
|
-
this.price_per_kb = (usage, kilobytes = 1, options) => this.price_per_byte(usage, kilobytes * 1000, options);
|
|
268
|
-
}
|
|
269
|
-
// Return kb per day
|
|
270
|
-
kb_per_day(options) {
|
|
271
|
-
return this.bytes_per_day(options) / 1000;
|
|
272
|
-
}
|
|
273
|
-
// Return bytes per day
|
|
274
|
-
bytes_per_day(options) {
|
|
275
|
-
const limit = options && options.virtual_block_net_limit
|
|
276
|
-
? options.virtual_block_net_limit
|
|
277
|
-
: this.default_block_net_limit;
|
|
278
|
-
return Number(limit) * 2 * 60 * 60 * 24;
|
|
279
|
-
}
|
|
280
|
-
// Convert weight to bytes
|
|
281
|
-
weight_to_bytes(sample, weight) {
|
|
282
|
-
return Math.ceil((weight * Number(sample)) / BNPrecision);
|
|
283
|
-
}
|
|
284
|
-
// Convert bytes to weight
|
|
285
|
-
bytes_to_weight(sample, bytes) {
|
|
286
|
-
return Math.floor((bytes / Number(sample)) * BNPrecision);
|
|
287
|
-
}
|
|
288
|
-
// Frac generation by bytes
|
|
289
|
-
frac_by_bytes(usage, bytes) {
|
|
290
|
-
const { weight } = this.cast();
|
|
291
|
-
const frac = this.bytes_to_weight(usage.net, bytes) / weight;
|
|
292
|
-
return Math.floor(frac * Math.pow(10, 15));
|
|
293
|
-
}
|
|
294
|
-
// Price generation by bytes
|
|
295
|
-
price_per_byte(usage, bytes = 1000, options) {
|
|
296
|
-
// Determine the utilization increase by this action
|
|
297
|
-
const frac = eosio.UInt128.from(this.frac(usage, bytes));
|
|
298
|
-
const utilization_increase = this.utilization_increase(usage.net, frac);
|
|
299
|
-
// Determine the adjusted utilization if needed
|
|
300
|
-
const adjusted_utilization = this.determine_adjusted_utilization(options);
|
|
301
|
-
// Derive the fee from the increase and utilization
|
|
302
|
-
const fee = this.fee(utilization_increase, adjusted_utilization);
|
|
303
|
-
// Force the fee up to the next highest value of precision
|
|
304
|
-
const precision = Math.pow(10, 4);
|
|
305
|
-
const value = Math.ceil(fee * precision) / precision;
|
|
306
|
-
// Return the modified fee
|
|
307
|
-
return value;
|
|
308
|
-
}
|
|
309
|
-
};
|
|
310
|
-
PowerUpStateResourceNET = tslib.__decorate([
|
|
311
|
-
eosio.Struct.type('powerupstateresourcenet')
|
|
312
|
-
], PowerUpStateResourceNET);
|
|
313
|
-
|
|
314
|
-
exports.PowerUpState = class PowerUpState extends eosio.Struct {
|
|
315
|
-
};
|
|
316
|
-
tslib.__decorate([
|
|
317
|
-
eosio.Struct.field('uint8')
|
|
318
|
-
], exports.PowerUpState.prototype, "version", void 0);
|
|
319
|
-
tslib.__decorate([
|
|
320
|
-
eosio.Struct.field(PowerUpStateResourceNET)
|
|
321
|
-
], exports.PowerUpState.prototype, "net", void 0);
|
|
322
|
-
tslib.__decorate([
|
|
323
|
-
eosio.Struct.field(PowerUpStateResourceCPU)
|
|
324
|
-
], exports.PowerUpState.prototype, "cpu", void 0);
|
|
325
|
-
tslib.__decorate([
|
|
326
|
-
eosio.Struct.field('uint32')
|
|
327
|
-
], exports.PowerUpState.prototype, "powerup_days", void 0);
|
|
328
|
-
tslib.__decorate([
|
|
329
|
-
eosio.Struct.field('asset')
|
|
330
|
-
], exports.PowerUpState.prototype, "min_powerup_fee", void 0);
|
|
331
|
-
exports.PowerUpState = tslib.__decorate([
|
|
332
|
-
eosio.Struct.type('powerupstate')
|
|
333
|
-
], exports.PowerUpState);
|
|
334
|
-
class PowerUpAPI {
|
|
335
|
-
constructor(parent) {
|
|
336
|
-
this.parent = parent;
|
|
337
|
-
}
|
|
338
|
-
get_state() {
|
|
339
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
340
|
-
const response = yield this.parent.api.v1.chain.get_table_rows({
|
|
341
|
-
code: 'eosio',
|
|
342
|
-
scope: '',
|
|
343
|
-
table: 'powup.state',
|
|
344
|
-
type: exports.PowerUpState,
|
|
345
|
-
});
|
|
346
|
-
return response.rows[0];
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
exports.Connector = class Connector extends eosio.Struct {
|
|
352
|
-
};
|
|
353
|
-
tslib.__decorate([
|
|
354
|
-
eosio.Struct.field('asset')
|
|
355
|
-
], exports.Connector.prototype, "balance", void 0);
|
|
356
|
-
tslib.__decorate([
|
|
357
|
-
eosio.Struct.field('float64')
|
|
358
|
-
], exports.Connector.prototype, "weight", void 0);
|
|
359
|
-
exports.Connector = tslib.__decorate([
|
|
360
|
-
eosio.Struct.type('connector')
|
|
361
|
-
], exports.Connector);
|
|
362
|
-
exports.ExchangeState = class ExchangeState extends eosio.Struct {
|
|
363
|
-
};
|
|
364
|
-
tslib.__decorate([
|
|
365
|
-
eosio.Struct.field('asset')
|
|
366
|
-
], exports.ExchangeState.prototype, "supply", void 0);
|
|
367
|
-
tslib.__decorate([
|
|
368
|
-
eosio.Struct.field(exports.Connector)
|
|
369
|
-
], exports.ExchangeState.prototype, "base", void 0);
|
|
370
|
-
tslib.__decorate([
|
|
371
|
-
eosio.Struct.field(exports.Connector)
|
|
372
|
-
], exports.ExchangeState.prototype, "quote", void 0);
|
|
373
|
-
exports.ExchangeState = tslib.__decorate([
|
|
374
|
-
eosio.Struct.type('exchange_state')
|
|
375
|
-
], exports.ExchangeState);
|
|
376
|
-
exports.RAMState = class RAMState extends exports.ExchangeState {
|
|
377
|
-
price_per(bytes) {
|
|
378
|
-
const base = this.base.balance.units.toNumber();
|
|
379
|
-
const quote = this.quote.balance.value;
|
|
380
|
-
return this.get_input(base, quote, bytes);
|
|
381
|
-
}
|
|
382
|
-
price_per_kb(kilobytes) {
|
|
383
|
-
return this.price_per(kilobytes * 1000);
|
|
384
|
-
}
|
|
385
|
-
// Derived from https://github.com/EOSIO/eosio.contracts/blob/f6578c45c83ec60826e6a1eeb9ee71de85abe976/contracts/eosio.system/src/exchange_state.cpp#L96
|
|
386
|
-
get_input(base, quote, value) {
|
|
387
|
-
const result = (quote * value) / (base - value);
|
|
388
|
-
if (result < 0) {
|
|
389
|
-
return 0;
|
|
390
|
-
}
|
|
391
|
-
return result;
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
exports.RAMState = tslib.__decorate([
|
|
395
|
-
eosio.Struct.type('ramstate')
|
|
396
|
-
], exports.RAMState);
|
|
397
|
-
class RAMAPI {
|
|
398
|
-
constructor(parent) {
|
|
399
|
-
this.parent = parent;
|
|
400
|
-
}
|
|
401
|
-
get_state() {
|
|
402
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
403
|
-
const response = yield this.parent.api.v1.chain.get_table_rows({
|
|
404
|
-
code: 'eosio',
|
|
405
|
-
scope: 'eosio',
|
|
406
|
-
table: 'rammarket',
|
|
407
|
-
type: exports.RAMState,
|
|
408
|
-
});
|
|
409
|
-
return response.rows[0];
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
exports.REXState = class REXState extends eosio.Struct {
|
|
415
|
-
get reserved() {
|
|
416
|
-
return Number(this.total_lent.units) / Number(this.total_lendable.units);
|
|
417
|
-
}
|
|
418
|
-
get symbol() {
|
|
419
|
-
return this.total_lent.symbol;
|
|
420
|
-
}
|
|
421
|
-
get precision() {
|
|
422
|
-
return this.total_lent.symbol.precision;
|
|
423
|
-
}
|
|
424
|
-
get value() {
|
|
425
|
-
return ((Number(this.total_lent.units) + Number(this.total_unlent.units)) /
|
|
426
|
-
Number(this.total_rex.units));
|
|
427
|
-
}
|
|
428
|
-
exchange(amount) {
|
|
429
|
-
return eosio.Asset.from((amount.value * this.total_lendable.value) / this.total_rex.value, this.symbol);
|
|
430
|
-
}
|
|
431
|
-
price_per(sample, unit = 1000) {
|
|
432
|
-
// Sample token units
|
|
433
|
-
const tokens = eosio.Asset.fromUnits(10000, this.symbol);
|
|
434
|
-
// Spending 1 EOS (10000 units) on REX gives this many tokens
|
|
435
|
-
const bancor = Number(tokens.units) / (this.total_rent.value / this.total_unlent.value);
|
|
436
|
-
// The ratio of the number of tokens received vs the sampled values
|
|
437
|
-
const unitPrice = bancor * (Number(sample.cpu) / BNPrecision);
|
|
438
|
-
// The token units spent per unit
|
|
439
|
-
const perunit = Number(tokens.units) / unitPrice;
|
|
440
|
-
// Multiply the per unit cost by the units requested
|
|
441
|
-
const cost = perunit * unit;
|
|
442
|
-
// Converting to an Asset
|
|
443
|
-
return cost / Math.pow(10, this.precision);
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
tslib.__decorate([
|
|
447
|
-
eosio.Struct.field('uint8')
|
|
448
|
-
], exports.REXState.prototype, "version", void 0);
|
|
449
|
-
tslib.__decorate([
|
|
450
|
-
eosio.Struct.field('asset')
|
|
451
|
-
], exports.REXState.prototype, "total_lent", void 0);
|
|
452
|
-
tslib.__decorate([
|
|
453
|
-
eosio.Struct.field('asset')
|
|
454
|
-
], exports.REXState.prototype, "total_unlent", void 0);
|
|
455
|
-
tslib.__decorate([
|
|
456
|
-
eosio.Struct.field('asset')
|
|
457
|
-
], exports.REXState.prototype, "total_rent", void 0);
|
|
458
|
-
tslib.__decorate([
|
|
459
|
-
eosio.Struct.field('asset')
|
|
460
|
-
], exports.REXState.prototype, "total_lendable", void 0);
|
|
461
|
-
tslib.__decorate([
|
|
462
|
-
eosio.Struct.field('asset')
|
|
463
|
-
], exports.REXState.prototype, "total_rex", void 0);
|
|
464
|
-
tslib.__decorate([
|
|
465
|
-
eosio.Struct.field('asset')
|
|
466
|
-
], exports.REXState.prototype, "namebid_proceeds", void 0);
|
|
467
|
-
tslib.__decorate([
|
|
468
|
-
eosio.Struct.field('uint64')
|
|
469
|
-
], exports.REXState.prototype, "loan_num", void 0);
|
|
470
|
-
exports.REXState = tslib.__decorate([
|
|
471
|
-
eosio.Struct.type('rexstate')
|
|
472
|
-
], exports.REXState);
|
|
473
|
-
class REXAPI {
|
|
474
|
-
constructor(parent) {
|
|
475
|
-
this.parent = parent;
|
|
476
|
-
}
|
|
477
|
-
get_state() {
|
|
478
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
479
|
-
const response = yield this.parent.api.v1.chain.get_table_rows({
|
|
480
|
-
code: 'eosio',
|
|
481
|
-
scope: 'eosio',
|
|
482
|
-
table: 'rexpool',
|
|
483
|
-
type: exports.REXState,
|
|
484
|
-
});
|
|
485
|
-
return response.rows[0];
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
const BNPrecision = new BN__default['default'](1000 * 1000);
|
|
491
|
-
class Resources {
|
|
492
|
-
constructor(options) {
|
|
493
|
-
// the account to use when sampling usage
|
|
494
|
-
this.sampleAccount = 'b1';
|
|
495
|
-
// token precision/symbol
|
|
496
|
-
this.symbol = '4,EOS';
|
|
497
|
-
this.v1 = {
|
|
498
|
-
powerup: new PowerUpAPI(this),
|
|
499
|
-
ram: new RAMAPI(this),
|
|
500
|
-
rex: new REXAPI(this),
|
|
501
|
-
};
|
|
502
|
-
// Allow overriding of the sample account name
|
|
503
|
-
if (options.sampleAccount) {
|
|
504
|
-
this.sampleAccount = options.sampleAccount;
|
|
505
|
-
}
|
|
506
|
-
// Allow overriding of the system token symbol
|
|
507
|
-
if (options.symbol) {
|
|
508
|
-
this.symbol = options.symbol;
|
|
509
|
-
}
|
|
510
|
-
// Allow variations on how to specify the API configuration
|
|
511
|
-
if (options.api) {
|
|
512
|
-
this.api = options.api;
|
|
513
|
-
}
|
|
514
|
-
else if (options.url) {
|
|
515
|
-
this.api = new eosio.APIClient({ provider: new eosio.FetchProvider(options.url, options) });
|
|
516
|
-
}
|
|
517
|
-
else {
|
|
518
|
-
throw new Error('Missing url or api client');
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
getSampledUsage() {
|
|
522
|
-
return tslib.__awaiter(this, void 0, void 0, function* () {
|
|
523
|
-
const account = yield this.api.v1.chain.get_account(this.sampleAccount);
|
|
524
|
-
const us = eosio.UInt128.from(account.cpu_limit.max.value.mul(BNPrecision));
|
|
525
|
-
const byte = eosio.UInt128.from(account.net_limit.max.value.mul(BNPrecision));
|
|
526
|
-
const cpu_weight = eosio.UInt128.from(account.cpu_weight.value);
|
|
527
|
-
const net_weight = eosio.UInt128.from(account.net_weight.value);
|
|
528
|
-
return {
|
|
529
|
-
account,
|
|
530
|
-
cpu: divCeil(us.value, cpu_weight.value),
|
|
531
|
-
net: divCeil(byte.value, net_weight.value),
|
|
532
|
-
};
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
Resources.__className = 'Resources';
|
|
537
|
-
function divCeil(num, den) {
|
|
538
|
-
let v = num.div(den);
|
|
539
|
-
const zero = new BN__default['default'](0);
|
|
540
|
-
const one = new BN__default['default'](1);
|
|
541
|
-
if (num.mod(den).gt(zero)) {
|
|
542
|
-
v = v.sub(one);
|
|
543
|
-
}
|
|
544
|
-
return eosio.UInt128.from(v);
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
exports.BNPrecision = BNPrecision;
|
|
548
|
-
exports.PowerUpAPI = PowerUpAPI;
|
|
549
|
-
exports.RAMAPI = RAMAPI;
|
|
550
|
-
exports.REXAPI = REXAPI;
|
|
551
|
-
exports.Resources = Resources;
|
|
552
|
-
//# sourceMappingURL=eosio-resources.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eosio-resources.js","sources":["../src/powerup/abstract.ts","../src/powerup/cpu.ts","../src/powerup/net.ts","../src/powerup.ts","../src/ram.ts","../src/rex.ts","../src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":["Struct","UInt64","UInt128","BN","TimePointSec","__decorate","PowerUpState","Connector","ExchangeState","RAMState","REXState","Asset","APIClient","FetchProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAesB,oBAAqB,SAAQA,YAAM;IAAzD;;QAiBa,4BAAuB,GAAWC,YAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACrD,4BAAuB,GAAWA,YAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;KA8GrE;;IAzGG,IAAW,SAAS;QAChB,OAAO,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,GAAG,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