Created
May 13, 2020 15:31
-
-
Save KardanovIR/c52f4d72a7440cd239f91b07c56789d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Callable(i) | |
func getResult(id: String) = { | |
if (keyIsDefined(id) == false) then throwIdError(id) else { | |
let responsesCount = getResponsesCount(id) | |
let minResponsesCount = getMinResponsesCount(id) | |
if (responsesCount < minResponsesCount) then throw("Minimum oracles count not reached yet") else { | |
let result = calculateResult(id) | |
let ratingsDiff = getOracleRatingsDiff(id, result) | |
let resultKey = keyResult(id) | |
let resultDataEntry = StringEntry(resultKey, result) | |
let dataToWrite = cons(resultDataEntry, ratingsDiff) | |
dataToWrite | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment