tso-data-models
Advanced tools
Comparing version 1.0.113 to 1.0.114
@@ -6,3 +6,2 @@ export * from './models/data-point/DataPoint'; | ||
export * from './models/data-point/PriceEstimator'; | ||
export * from './models/epoch/PriceHash'; | ||
export * from './models/epoch/AssetSubmission'; | ||
@@ -9,0 +8,0 @@ export * from './models/f-asset/FAsset'; |
@@ -18,3 +18,2 @@ "use strict"; | ||
__exportStar(require("./models/data-point/PriceEstimator"), exports); | ||
__exportStar(require("./models/epoch/PriceHash"), exports); | ||
__exportStar(require("./models/epoch/AssetSubmission"), exports); | ||
@@ -21,0 +20,0 @@ __exportStar(require("./models/f-asset/FAsset"), exports); |
@@ -9,3 +9,4 @@ export declare class AssetSubmission { | ||
saveObject(): Record<string, any>; | ||
getSubmitPriceHash(tsoAddress: string): string; | ||
} | ||
//# sourceMappingURL=AssetSubmission.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AssetSubmission = void 0; | ||
var ethers_1 = require("ethers"); | ||
var class_transformer_1 = require("class-transformer"); | ||
@@ -11,2 +12,3 @@ var AssetSubmission = /** @class */ (function () { | ||
this.price = price; | ||
this.random = Math.floor(Math.random() * 100000); | ||
} | ||
@@ -16,2 +18,5 @@ AssetSubmission.prototype.saveObject = function () { | ||
}; | ||
AssetSubmission.prototype.getSubmitPriceHash = function (tsoAddress) { | ||
return ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.defaultAbiCoder.encode(["uint256", "uint256", "address"], [this.price, this.random, tsoAddress])); | ||
}; | ||
return AssetSubmission; | ||
@@ -18,0 +23,0 @@ }()); |
import { ethers } from "ethers"; | ||
import { OpenEpoch } from "./OpenEpoch"; | ||
import { PriceHash } from "./PriceHash"; | ||
import { AssetSubmission } from "../.."; | ||
export declare class EpochSubmission { | ||
epochNumber: number; | ||
providerAddress: string; | ||
listOfHashes: PriceHash[]; | ||
listOfHashes: any[]; | ||
targetSubmitTime?: number; | ||
@@ -19,5 +19,5 @@ actualSubmitTime?: number; | ||
isTargetSubmitTime(): boolean; | ||
preparePriceHashesForSubmission(listOfFTSOs: [], listOfSymbols: string): void; | ||
preparePriceHashesForSubmission(listOfFTSOs: [], listOfPrices: AssetSubmission, providerAddress: string): void; | ||
submitTransaction(signer: ethers.Signer): Promise<any>; | ||
} | ||
//# sourceMappingURL=EpochSubmission.d.ts.map |
@@ -40,3 +40,2 @@ "use strict"; | ||
exports.EpochSubmission = void 0; | ||
var PriceHash_1 = require("./PriceHash"); | ||
var EpochSubmission = /** @class */ (function () { | ||
@@ -58,10 +57,8 @@ function EpochSubmission(submitterAddress, epochData, submitDelay) { | ||
}; | ||
EpochSubmission.prototype.preparePriceHashesForSubmission = function (listOfFTSOs, listOfSymbols) { | ||
EpochSubmission.prototype.preparePriceHashesForSubmission = function (listOfFTSOs, listOfPrices, providerAddress) { | ||
this.listOfHashes = []; | ||
for (var i = 0; i < listOfFTSOs.length; i++) { | ||
var ftso = listOfFTSOs[i]; | ||
// Confirm Whitelisted | ||
// Get Price From Price Algorithm | ||
// Convert to Hashes | ||
var hash = new PriceHash_1.PriceHash(1.0000, "XRP", 1); | ||
var sub = listOfPrices[i]; | ||
var hash = sub.getSubmitPriceHash(providerAddress); | ||
this.listOfHashes.push(hash); | ||
@@ -68,0 +65,0 @@ } |
{ | ||
"name": "tso-data-models", | ||
"version": "1.0.113", | ||
"version": "1.0.114", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -6,3 +6,2 @@ export * from './models/data-point/DataPoint'; | ||
export * from './models/data-point/PriceEstimator'; | ||
export * from './models/epoch/PriceHash'; | ||
export * from './models/epoch/AssetSubmission'; | ||
@@ -9,0 +8,0 @@ export * from './models/f-asset/FAsset'; |
import { BigNumber, ethers } from "ethers"; | ||
import { OpenEpoch } from "./OpenEpoch"; | ||
import { PRICE_SUBMITTER_ABI } from '../../constants/abis' | ||
import { PriceHash } from "./PriceHash"; | ||
import { PRICE_SUBMITTER_ABI } from '../../constants/abis'; | ||
import { FTSO_REGISTRY_ADDRESS } from "../.."; | ||
@@ -20,2 +19,3 @@ import { classToPlain } from "class-transformer"; | ||
this.price = price; | ||
this.random = Math.floor(Math.random() * 100000); | ||
} | ||
@@ -26,2 +26,6 @@ | ||
} | ||
getSubmitPriceHash(tsoAddress: string) { | ||
return ethers.utils.keccak256(ethers.utils.defaultAbiCoder.encode(["uint256", "uint256", "address"], [this.price, this.random, tsoAddress])); | ||
} | ||
} |
import { BigNumber } from "ethers"; | ||
import { PriceHash } from './PriceHash'; | ||
import { classToPlain } from "class-transformer"; | ||
@@ -4,0 +3,0 @@ |
import { BigNumber, ethers } from "ethers"; | ||
import { OpenEpoch } from "./OpenEpoch"; | ||
import { PRICE_SUBMITTER_ABI } from '../../constants/abis' | ||
import { PriceHash } from "./PriceHash"; | ||
import { FTSO_REGISTRY_ADDRESS } from "../.."; | ||
import { AssetSubmission, FTSO_REGISTRY_ADDRESS } from "../.."; | ||
@@ -10,3 +9,3 @@ export class EpochSubmission { | ||
providerAddress: string; | ||
listOfHashes: PriceHash[] = []; | ||
listOfHashes: any[] = []; | ||
targetSubmitTime?: number; | ||
@@ -38,3 +37,3 @@ actualSubmitTime?: number; | ||
preparePriceHashesForSubmission(listOfFTSOs: [], listOfSymbols: string) { | ||
preparePriceHashesForSubmission(listOfFTSOs: [], listOfPrices: AssetSubmission, providerAddress: string) { | ||
this.listOfHashes = []; | ||
@@ -44,6 +43,4 @@ | ||
const ftso = listOfFTSOs[i]; | ||
// Confirm Whitelisted | ||
// Get Price From Price Algorithm | ||
// Convert to Hashes | ||
const hash = new PriceHash(1.0000, "XRP", 1); | ||
const sub: AssetSubmission = listOfPrices[i]; | ||
const hash = sub.getSubmitPriceHash(providerAddress); | ||
this.listOfHashes.push(hash); | ||
@@ -50,0 +47,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143924
121
2124